aboutsummaryrefslogtreecommitdiffstats
path: root/doc/reference/tmpl/ephy-command-manager.sgml
blob: 060d41615051caa10159f62af1d6c035689aefcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!-- ##### 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>

<!-- ##### STRUCT EphyCommandManager ##### -->
<para>

</para>


<!-- ##### 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: 


<!-- ##### SIGNAL EphyCommandManager::command-changed ##### -->
<para>

</para>

@ephycommandmanager: the object which received the signal.
@arg1: