blob: 3f13ca145cb5dcb4b205102db0069a5c48c644cf (
plain) (
tree)
|
|
<!-- ##### SECTION Title ##### -->
EphyCommandManager
<!-- ##### SECTION Short_Description ##### -->
Performs commands, such as cut/copy/paste
<!-- ##### SECTION Long_Description ##### -->
<para>
An #EphyCommandManager is an interface to an #EphyEmbed which is used to perform
commands, such as cut/copy/paste. To perform any command, use
ephy_command_manager_do_command(). To test the availability of a command, use
ephy_command_manager_can_do_command(). The availability of commands depends on
the selection and actions previously performed in the #EphyEmbed. For instance,
%cmd_copy is only available if text has been selected; %cmd_undo is only
available if the user has a text input focused and has typed or erased some of
its text.
</para>
<para>
<example>
<title>Copying selected text in an #EphyEmbed</title>
<programlisting>#<![CDATA[include <ephy-embed.h>]]>
#<![CDATA[include <ephy-command-manager.h>
static void
copy_selected_text (EphyEmbed *embed)
{
EphyCommandManager *manager;
manager = EPHY_COMMAND_MANAGER (embed);
g_return_if_fail (EPHY_IS_COMMAND_MANAGER (manager));
if (!ephy_command_manager_can_do_command (manager, "cmd_copy")) return;
ephy_command_manager_do_command (manager, "cmd_copy");
}]]>
</programlisting>
</example>
</para>
<para>
The #EphyCommandManager interface can perform any command which is defined in
Mozilla. However, for purposes of abstraction, only a certain subset of commands
should be used:
</para>
<variablelist><title>Available Commands</title>
<varlistentry><term>cmd_copy</term>
<listitem><para>Copies selected text</para></listitem>
</varlistentry>
<varlistentry><term>cmd_cut</term>
<listitem><para>Cuts selected text.</para></listitem>
</varlistentry>
<varlistentry><term>cmd_paste</term>
<listitem><para>Pastes text from the clipboard (for example, into a text entry)
</para></listitem>
</varlistentry>
<varlistentry><term>cmd_undo</term>
<listitem><para>Undoes the last action (for example, typing text into a text
entry</para></listitem>
</varlistentry>
<varlistentry><term>cmd_redo</term>
<listitem><para>Redoes previously %undo<!-- -->ne actions (for example, in a
text entry)</para></listitem>
</varlistentry>
</variablelist>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### STRUCT EphyCommandManager ##### -->
<para>
</para>
<!-- ##### SIGNAL EphyCommandManager::command-changed ##### -->
<para>
</para>
@ephycommandmanager: the object which received the signal.
@arg1:
<!-- ##### STRUCT EphyCommandManagerIface ##### -->
<para>
</para>
@base_iface:
@do_command:
@can_do_command:
@command_changed:
<!-- ##### FUNCTION ephy_command_manager_do_command ##### -->
<para>
</para>
@manager:
@command:
<!-- ##### FUNCTION ephy_command_manager_can_do_command ##### -->
<para>
</para>
@manager:
@command:
@Returns:
|