summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-atkaction.xml
blob: 3e89ce186dab5bdda4bbff6300e5e80888e418fb (plain)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-atkaction">

  <refnamediv>
    <refname>atk.Action</refname>
      <refpurpose>the ATK interface provided by UI components that the user
      can activate/interact with, </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>atk.Action</classname></ooclass>
      <ooclass><classname>gobject.GInterface</classname></ooclass>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--do-action">do_action</link></methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--get-n-actions">get_n_actions</link></methodname>
        <methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--get-description">get_description</link></methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--get-name">get_name</link></methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--get-keybinding">get_keybinding</link></methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--set-description">set_description</link></methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
        <methodparam><parameter role="keyword">desc</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
        <methodname><link linkend="method-atkaction--get-localized-name">get_localized_name</link></methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis>
</classsynopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para><link
    linkend="class-atkaction"><classname>atk.Action</classname></link>
    should be implemented by instances of <link
    linkend="class-atkobject"><classname>atk.Object</classname></link>
    classes with which the user can interact directly, i.e. buttons,
    checkboxes, scrollbars, e.g. components which are not "passive"
    providers of UI information.</para>

    <para>Exceptions: when the user interaction is already covered by
    another appropriate interface such as <link
    linkend="class-atkeditabletext"><classname>atk.EditableText</classname></link>
    (insert/delete test, etc.) or <link
    linkend="class-atkvalue"><classname>atk.Value</classname></link> (set
    value) then these actions should not be exposed by <link
    linkend="class-atkaction"><classname>atk.Action</classname></link> as
    well.</para>

    <para>Also note that the <link
    linkend="class-atkaction"><classname>atk.Action</classname></link> API
    is limited in that parameters may not be passed to the object being
    activated; thus the action must be self-contained and specifiable via
    only a single "verb".  Concrete examples include "press", "release",
    "click" for buttons, "drag" (meaning initiate drag) and "drop" for drag
    sources and drop targets, etc.</para>

    <para>Though most UI interactions on components should be invocable via
    keyboard as well as mouse, there will generally be a close mapping
    between "mouse actions" that are possible on a component and the
    AtkActions.  Where mouse and keyboard actions are redundant in effect,
    <link linkend="class-atkaction"><classname>atk.Action</classname></link>
    should expose only one action rather than exposing redundant actions if
    possible.  By convention we have been using "mouse centric" terminology
    for <link
    linkend="class-atkaction"><classname>atk.Action</classname></link>
    names.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-atkaction--do-action">
      <title>atk.Action.do_action</title>

      <programlisting><methodsynopsis language="python">
        <methodname>do_action</methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">i</parameter>&nbsp;:</term>
          <listitem><simpara>the action index corresponding to the action to
          be performed</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara><literal>True</literal> if success,
          <literal>False</literal> otherwise</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Perform the specified action on the object.</para>

    </refsect2>

    <refsect2 id="method-atkaction--get-n-actions">
      <title>atk.Action.get_n_actions</title>

      <programlisting><methodsynopsis language="python">
        <methodname>get_n_actions</methodname>
        <methodparam></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>a the number of actions, or 0 if
          <parameter>action</parameter> does not implement this
          interface.</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Gets the number of accessible actions available on the object.
      If there are more than one, the first one is considered the "default"
      action of the object.</para>

    </refsect2>

    <refsect2 id="method-atkaction--get-description">
      <title>atk.Action.get_description</title>

      <programlisting><methodsynopsis language="python">
        <methodname>get_description</methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">i</parameter>&nbsp;:</term>
          <listitem><simpara>the action index corresponding to the action to be performed</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>a description string, or
          <literal>None</literal> if <parameter>action</parameter> does not
          implement this interface.</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Returns a description of the specified action of the
      object.</para>

    </refsect2>

    <refsect2 id="method-atkaction--get-name">
      <title>atk.Action.get_name</title>

      <programlisting><methodsynopsis language="python">
        <methodname>get_name</methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">i</parameter>&nbsp;:</term>
          <listitem><simpara>the action index corresponding to the action to
          be performed</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>a name string, or <literal>None</literal> if
          <parameter>action</parameter> does not implement this
          interface.</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Returns the name of the specified action of the object.</para>

    </refsect2>

    <refsect2 id="method-atkaction--get-keybinding">
      <title>atk.Action.get_keybinding</title>

      <programlisting><methodsynopsis language="python">
        <methodname>get_keybinding</methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">i</parameter>&nbsp;:</term>
          <listitem><simpara>the action index corresponding to the action to
          be performed</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>a string representing the keybinding, or
          <literal>None</literal> if there is no keybinding for this
          action.</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Returns a keybinding associated with this action, if one
      exists.</para>

    </refsect2>

    <refsect2 id="method-atkaction--set-description">
      <title>atk.Action.set_description</title>

      <programlisting><methodsynopsis language="python">
        <methodname>set_description</methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
        <methodparam><parameter role="keyword">desc</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">i</parameter>&nbsp;:</term>
          <listitem><simpara>the action index corresponding to the action to
          be performed</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><parameter role="keyword">desc</parameter>&nbsp;:</term>
          <listitem><simpara>the description to be assigned to this
          action</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara><literal>True</literal> if the description was
          successfully set;</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Sets a description of the specified action of the object.</para>

    </refsect2>

    <refsect2 id="method-atkaction--get-localized-name">
      <title>atk.Action.get_localized_name</title>

      <programlisting><methodsynopsis language="python">
        <methodname>get_localized_name</methodname>
        <methodparam><parameter role="keyword">i</parameter></methodparam>
      </methodsynopsis></programlisting>

      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">i</parameter>&nbsp;:</term>
          <listitem><simpara>the action index corresponding to the action to
          be performed</simpara></listitem>
        </varlistentry>
        <varlistentry>
          <term><emphasis>Returns</emphasis>&nbsp;:</term>
          <listitem><simpara>a name string, or <literal>None</literal> if
          <parameter>action</parameter> does not implement this
          interface.</simpara></listitem>
        </varlistentry>
      </variablelist>

      <para>Returns the localized name of the specified action of the
      object.</para>

    </refsect2>

  </refsect1>

</refentry>