summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkbuttonbox.xml
blob: cd075d65d1ab544eb1c20a7551255cc42d3fa080 (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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?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-gtkbuttonbox">
  <refnamediv>
    <refname>gtk.ButtonBox</refname>
    <refpurpose>the base class for widgets that contain multiple
buttons</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.ButtonBox</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkbox">gtk.Box</link></classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkbuttonbox--get-layout">get_layout</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkbuttonbox--set-layout">set_layout</link></methodname>
	<methodparam><parameter
		       role="keyword">layout_style</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkbuttonbox--get-child-secondary">get_child_secondary</link></methodname>
	<methodparam><parameter
		       role="keyword">child</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkbuttonbox--set-child-secondary">set_child_secondary</link></methodname>
	<methodparam><parameter
		       role="keyword">child</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">is_secondary</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkcontainer">gtk.Container</link>
        +-- <link linkend="class-gtkbox">gtk.Box</link>
          +-- <link linkend="class-gtkbuttonbox">gtk.ButtonBox</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkbuttonbox"><classname>gtk.ButtonBox</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>

  <refsect1 id="properties-gtkbuttonbox">
    <title>gtk.ButtonBox Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkcontainer">gtk.Container Properties</link></para>
    <para><link linkend="properties-gtkbox">gtk.Box Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"layout-style"</entry>
	      <entry>Read/Write</entry>
	<entry>the style used to layout the buttons in the box. The layout
styles are: <literal>gtk.BUTTONBOX_SPREAD</literal>,
<literal>gtk.BUTTONBOX_EDGE</literal>,
<literal>gtk.BUTTONBOX_START</literal> and
<literal>gtk.BUTTONBOX_END</literal>.</entry>
	  </row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="style-properties-gtkbuttonbox">
    <title>gtk.ButtonBox Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"child-internal-pad-x"</entry>
	      <entry>Read</entry>
	      <entry>The amount of padding that increases a child's size on
	      the top and bottom</entry>
	    </row>

	    <row valign="top">
	      <entry>"child-internal-pad-y"</entry>
	      <entry>Read</entry>
	      <entry>The amount of padding that increases a child's size on
	      the top and bottom</entry>
	    </row>

	    <row valign="top">
	      <entry>"child-min-height"</entry>
	      <entry>Read</entry>
	      <entry>The minimum height of buttons inside the box.</entry>
	    </row>

	    <row valign="top">
	      <entry>"child-min-width"</entry>
	      <entry>Read</entry>
	      <entry>The minimum width of buttons inside the box.</entry>
	    </row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="child-properties-gtkbuttonbox">
    <title>gtk.ButtonBox Child Properties</title>

    <para><link linkend="child-properties-gtkbox">gtk.Box Child Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"secondary"</entry>
	      <entry>Read/Write</entry>
	<entry>If <literal>True</literal>, the child appears in a secondary
group of children, suitable for, e.g., help buttons.</entry>
	  </row>

	  </tbody>
	</tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkbuttonbox">
    <title>gtk.ButtonBox Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcontainer">gtk.Container Signal Prototypes</link></para>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A button box is used to provide a consistent layout of buttons
throughout an application. The <link
linkend="class-gtkbuttonbox"><classname>gtk.ButtonBox</classname></link> is
subclassed by the <link
linkend="class-gtkhbuttonbox"><classname>gtk.HButtonBox</classname></link>
and <link
linkend="class-gtkvbuttonbox"><classname>gtk.VButtonBox</classname></link>
classes to provide horizontal and vertical button layouts respectively. The
same effect could be achieved by using a <link
linkend="class-gtkvbuttonbox"><classname>gtk.Box</classname></link> but less
conveniently.</para>

    <para>A buttonbox provides one default layout and a default spacing
value that are persistent across all widgets. The layout/spacing can then be
altered by the programmer, or if desired, by the user to alter the 'feel' of
a program to a small degree.</para>

    <para>The <link
linkend="method-gtkbox--get-spacing"><methodname>gtk.Box.get_spacing</methodname>()</link> 
method and the <link
linkend="method-gtkbox--set-spacing"><methodname>gtk.Box.set_spacing</methodname>()</link> 
methods retrieve and change the default number of pixels between buttons.
The <link
linkend="method-gtkbuttonbox--get-layout"><methodname>get_layout</methodname>()</link> 
and <link
linkend="method-gtkbuttonbox--set-layout"><methodname>set_layout</methodname>()</link> 
methods retrieve and alter the style used to spread the buttons in a button
box across the container. The layout styles are:
<literal>gtk.BUTTONBOX_SPREAD</literal>,
<literal>gtk.BUTTONBOX_EDGE</literal>,
<literal>gtk.BUTTONBOX_START</literal> and
<literal>gtk.BUTTONBOX_END</literal>.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkbuttonbox--get-layout">
      <title>gtk.ButtonBox.get_layout</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_layout</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the layout style used by the
buttonbox</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_layout</methodname>() method returns the
current value of the "layout-style" property. The possible values are:
<literal>gtk.BUTTONBOX_SPREAD</literal>,
<literal>gtk.BUTTONBOX_EDGE</literal>,
<literal>gtk.BUTTONBOX_START</literal> and
<literal>gtk.BUTTONBOX_END</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkbuttonbox--set-layout">
      <title>gtk.ButtonBox.set_layout</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_layout</methodname>
	  <methodparam><parameter
			 role="keyword">layout_style</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">layout_style</parameter>&nbsp;:</term>
	  <listitem><simpara>the new layout style</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_layout</methodname>() method sets the
"layout-style" property to the value in <parameter>layout_style</parameter>.
The possible values are: <literal>gtk.BUTTONBOX_SPREAD</literal>,
<literal>gtk.BUTTONBOX_EDGE</literal>,
<literal>gtk.BUTTONBOX_START</literal> and
<literal>gtk.BUTTONBOX_END</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkbuttonbox--get-child-secondary">
      <title>gtk.ButtonBox.get_child_secondary</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_child_secondary</methodname>
	  <methodparam><parameter
			 role="keyword">child</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">child</parameter>&nbsp;:</term>
	  <listitem><simpara>a child button of the
buttonbox</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal>, the
<parameter>child</parameter> appears in a secondary group of the button
box.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_child_secondary</methodname>() method
returns <literal>True</literal> if <parameter>child</parameter> should
appear in a secondary group of children. See the <link
linkend="method-gtkbuttonbox--set-child-secondary"><methodname>set_child_secondary</methodname>()</link>
method for more information.</para>

    </refsect2>

    <refsect2 id="method-gtkbuttonbox--set-child-secondary">
      <title>gtk.ButtonBox.set_child_secondary</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_child_secondary</methodname>
	  <methodparam><parameter
			 role="keyword">child</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">is_secondary</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">child</parameter>&nbsp;:</term>
	  <listitem><simpara>a child button of the
buttonbox</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">is_secondary</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal>, the
<parameter>child</parameter> appears in a secondary group of the button
box.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_child_secondary</methodname>() method sets
whether <parameter>child</parameter> should appear in a secondary group of
children. The typical use of a secondary child is the help button in a
dialog that is displayed away from the main group of buttons e.g. right
aligned.</para>

      <para>The secondary group appears after the other children if the
style is <literal>gtk.BUTTONBOX_START</literal>,
<literal>gtk.BUTTONBOX_SPREAD</literal> or
<literal>gtk.BUTTONBOX_EDGE</literal>, and before the the other children if
the style is <literal>gtk.BUTTONBOX_END</literal>. For horizontal button
boxes, the definition of before/after depends on direction of the widget
(see <link
linkend="method-gtkwidget--set-direction"><function>gtk.Widget.set_direction()</function></link>). 
If the style is <literal>gtk.BUTTONBOX_START</literal> or
<literal>gtk.BUTTONBOX_END</literal>, then the secondary children are
aligned at the other end of the button box from the main children. For the
other styles, they appear immediately next to the main children.</para>

    </refsect2>

  </refsect1>

</refentry>