Initial import of ephy (rev# 7126) from svn
[ephy-soc.git] / doc / reference / tmpl / ephy-command-manager.sgml
blob3f13ca145cb5dcb4b205102db0069a5c48c644cf
1 <!-- ##### SECTION Title ##### -->
2 EphyCommandManager
4 <!-- ##### SECTION Short_Description ##### -->
5 Performs commands, such as cut/copy/paste
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 An #EphyCommandManager is an interface to an #EphyEmbed which is used to perform
10 commands, such as cut/copy/paste. To perform any command, use
11 ephy_command_manager_do_command(). To test the availability of a command, use
12 ephy_command_manager_can_do_command(). The availability of commands depends on
13 the selection and actions previously performed in the #EphyEmbed. For instance,
14 %cmd_copy is only available if text has been selected; %cmd_undo is only
15 available if the user has a text input focused and has typed or erased some of
16 its text.
17 </para>
18 <para>
19 <example>
20 <title>Copying selected text in an #EphyEmbed</title>
21 <programlisting>#<![CDATA[include <ephy-embed.h>]]>
22 #<![CDATA[include <ephy-command-manager.h>
24 static void
25 copy_selected_text (EphyEmbed *embed)
27 EphyCommandManager *manager;
29 manager = EPHY_COMMAND_MANAGER (embed);
30 g_return_if_fail (EPHY_IS_COMMAND_MANAGER (manager));
32 if (!ephy_command_manager_can_do_command (manager, "cmd_copy")) return;
34 ephy_command_manager_do_command (manager, "cmd_copy");
35 }]]>
36 </programlisting>
37 </example>
38 </para>
39 <para>
40 The #EphyCommandManager interface can perform any command which is defined in
41 Mozilla. However, for purposes of abstraction, only a certain subset of commands
42 should be used:
43 </para>
44 <variablelist><title>Available Commands</title>
45 <varlistentry><term>cmd_copy</term>
46 <listitem><para>Copies selected text</para></listitem>
47 </varlistentry>
48 <varlistentry><term>cmd_cut</term>
49 <listitem><para>Cuts selected text.</para></listitem>
50 </varlistentry>
51 <varlistentry><term>cmd_paste</term>
52 <listitem><para>Pastes text from the clipboard (for example, into a text entry)
53 </para></listitem>
54 </varlistentry>
55 <varlistentry><term>cmd_undo</term>
56 <listitem><para>Undoes the last action (for example, typing text into a text
57 entry</para></listitem>
58 </varlistentry>
59 <varlistentry><term>cmd_redo</term>
60 <listitem><para>Redoes previously %undo<!-- -->ne actions (for example, in a
61 text entry)</para></listitem>
62 </varlistentry>
63 </variablelist>
65 <!-- ##### SECTION See_Also ##### -->
66 <para>
68 </para>
70 <!-- ##### SECTION Stability_Level ##### -->
73 <!-- ##### STRUCT EphyCommandManager ##### -->
74 <para>
76 </para>
79 <!-- ##### SIGNAL EphyCommandManager::command-changed ##### -->
80 <para>
82 </para>
84 @ephycommandmanager: the object which received the signal.
85 @arg1:
87 <!-- ##### STRUCT EphyCommandManagerIface ##### -->
88 <para>
90 </para>
92 @base_iface:
93 @do_command:
94 @can_do_command:
95 @command_changed:
97 <!-- ##### FUNCTION ephy_command_manager_do_command ##### -->
98 <para>
100 </para>
102 @manager:
103 @command:
106 <!-- ##### FUNCTION ephy_command_manager_can_do_command ##### -->
107 <para>
109 </para>
111 @manager:
112 @command:
113 @Returns: