summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkrcstyle.xml
blob: 2222f2dda64b624245132b23f8b10a5b00d12041 (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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
<?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-gtkrcstyle">
  <refnamediv>
    <refname>gtk.RcStyle</refname>
    <refpurpose>an object holding resource styles</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

<classsynopsis language="python">
  <ooclass><classname>gtk.RcStyle</classname></ooclass>
  <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
<methodsynopsis language="python">
    <methodname><link linkend="method-gtkrcstyle--copy">copy</link></methodname>
    <methodparam></methodparam>
      </methodsynopsis>
</classsynopsis>

<programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-add-default-file">gtk.rc_add_default_file</link></methodname>
    <methodparam><parameter role="keyword">filename</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-set-default-files">gtk.rc_set_default_files</link></methodname>
    <methodparam><parameter role="keyword">filenames</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-get-default-files">gtk.rc_get_default_files</link></methodname>
    <methodparam></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-get-style-by-paths">gtk.rc_get_style_by_paths</link></methodname>
    <methodparam><parameter role="keyword">settings</parameter></methodparam>
    <methodparam><parameter role="keyword">widget_path</parameter></methodparam>
    <methodparam><parameter role="keyword">class_path</parameter></methodparam>
    <methodparam><parameter role="keyword">type</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-reparse-all-for-settings">gtk.rc_reparse_all_for_settings</link></methodname>
    <methodparam><parameter role="keyword">settings</parameter></methodparam>
    <methodparam><parameter role="keyword">force_load</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-reset-styles">gtk.rc_reset_styles</link></methodname>
    <methodparam><parameter role="keyword">settings</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-parse">gtk.rc_parse</link></methodname>
    <methodparam><parameter role="keyword">filename</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-parse-string">gtk.rc_parse_string</link></methodname>
    <methodparam><parameter role="keyword">rc_string</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-reparse-all">gtk.rc_reparse_all</link></methodname>
    <methodparam></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-find-module-in-path">gtk.rc_find_module_in_path</link></methodname>
    <methodparam><parameter role="keyword">module_file</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-get-theme-dir">gtk.rc_get_theme_dir</link></methodname>
    <methodparam></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-get-module-dir">gtk.rc_get_module_dir</link></methodname>
    <methodparam></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-get-im-module-path">gtk.rc_get_im_module_path</link></methodname>
    <methodparam></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--rc-get-im-module-file">gtk.rc_get_im_module_file</link></methodname>
    <methodparam></methodparam>
  </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkrcstyle">gtk.RcStyle</link>
</synopsis>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkrcstyle">
    <title>gtk.RcStyle Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para><literal>PyGTK</literal> via <literal>GTK+</literal> provides
resource file mechanism for configuring various aspects of the operation of
a program at runtime.</para>

    <title>Default files</title>

    <para>An application can cause <literal>GTK+</literal> to parse a
specific RC file by calling the <link
linkend="function-gtk--rc-parse"><function>gtk.rc_parse</function>()</link>
function. In addition to this, certain files will be read at the end of
<literal>GTK+</literal> initialization. Unless modified, the files looked
for will be <filename>&lt;SYSCONFDIR&gt;/gtk-2.0/gtkrc</filename> and
.gtkrc-2.0 in the users home directory. (&lt;SYSCONFDIR&gt; defaults to
<filename>/usr/local/etc</filename>.) The set of these default files can be
retrieved with the <link
linkend="function-gtk--rc-get-default-files"><function>gtk.rc_get_default_files</function>()</link> 
function and modified with the <link
linkend="function-gtk--rc-add-default-file"><function>gtk.rc_add_default_file</function>()</link> 
and <link
linkend="function-gtk--rc-set-default-files"><function>gtk.rc_set_default_files</function>()</link> 
functions. Additionally, the <envar>GTK_RC_FILES</envar> environment
variable can be set to a list of files in order to overwrite the set of
default files at runtime.</para>

    <para>For each RC file, in addition to the file itself,
<literal>GTK+</literal> will look for a locale-specific file that will be
parsed after the main file. For instance, if <envar>LANG</envar> is set to
<literal>ja_JP.ujis</literal>, when loading the default file
<filename>~/.gtkrc</filename> then <literal>GTK+</literal> looks for
<filename>~/.gtkrc.ja_JP</filename> and <filename>~/.gtkrc.ja</filename>,
and parses the first of those that exists.</para>

<title>Pathnames and patterns</title>

<para>A resource file defines a number of styles and key bindings and
attaches them to particular widgets. The attachment is done by the widget,
widget_class, and class declarations. As an example of such a
statement:</para>

    <programlisting>
  widget "mywindow.*.GtkEntry" style "my-entry-class"
</programlisting>

<para>attaches the style "my-entry-class" to all widgets whose widget class
matches the pattern "mywindow.*.GtkEntry". The patterns here are given in
the standard shell glob syntax. The "?" wildcard matches any character,
while "*" matches zero or more of any character. The three types of matching
are against the widget path, the class path and the class hierarchy. Both
the widget and the class paths consists of a "." separated list of all the
parents of the widget and the widget itself from outermost to innermost. The
difference is that in the widget path, the name assigned by the <link
linkend="method-gtkwidget--set-name"><methodname>set_name</methodname>()</link> 
method is used if present, otherwise the class name of the widget, while for
the widget path, the class name is always used. So, if you have a <link
linkend="class-gtkentry"><classname>gtk.Entry</classname></link> named
"myentry", inside of a of a window named "mywindow", then the widget path
is: "mwindow.GtkHBox.myentry" while the class path is:
"GtkWindow.GtkHBox.GtkEntry".</para>

<para>Matching against class is a little different. The pattern match is
done against all class names in the widgets class hierarchy (not the layout
hierarchy) in sequence, so the pattern:</para>

    <programlisting>
  class "GtkButton" style "my-style"
</programlisting>

    <para>will match not just <link
linkend="class-gtkbutton"><classname>gtk.Button</classname></link> widgets,
but also <link
linkend="class-gtktogglebutton"><classname>gtk.ToggleButton</classname></link> 
and <link
linkend="class-gtkcheckbutton"><classname>gtk.CheckButton</classname></link>
widgets, since those classes derive from <link
linkend="class-gtkbutton"><classname>gtk.Button</classname></link>.</para>

    <title>Toplevel declarations</title>

<para>An RC file is a text file which is composed of a sequence of
declarations. '#' characters delimit comments and the portion of a line
after a '#' is ignored when parsing an RC file. The possible toplevel
declarations are:</para>

      <variablelist>
      <varlistentry>
	<term>binding&nbsp;<parameter>name</parameter>&nbsp;{&nbsp;...&nbsp;}</term>
	<listitem>
	  <simpara>Declares a binding set.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>class&nbsp;<parameter>pattern</parameter>&nbsp;[&nbsp;style&nbsp;|&nbsp;binding&nbsp;[&nbsp;:&nbsp;priority&nbsp;]]&nbsp;<parameter>name</parameter></term>
	<listitem>
	  <simpara>Specifies a style or binding set for a particular branch
of the inheritance hierarchy.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>include&nbsp;<parameter>filename</parameter></term>
	<listitem>
	  <simpara>Parses another file at this point. If
<parameter>filename</parameter> is not an absolute filename, it is searched
in the directories of the currently open RC files. <literal>GTK+</literal>
also tries to load a locale-specific variant of the included file.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>module_path&nbsp;<parameter>path</parameter></term>
	<listitem>
	  <simpara>Sets a path (a list of directories separated by colons)
that will be searched for theme engines referenced in RC files.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>pixmap_path&nbsp;<parameter>path</parameter></term>
	<listitem>
	  <simpara>Sets a path (a list of directories separated by colons)
that will be searched for pixmaps referenced in RC files.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>style&nbsp;<parameter>name</parameter>&nbsp;[&nbsp;=&nbsp;<parameter>parent</parameter>&nbsp;]&nbsp;{&nbsp;...&nbsp;}</term>
	<listitem>
	  <simpara>Declares a style.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>widget&nbsp;<parameter>pattern</parameter>&nbsp;[&nbsp;style&nbsp;|&nbsp;binding&nbsp;[&nbsp;:&nbsp;priority&nbsp;]]&nbsp;<parameter>name</parameter></term>
	<listitem>
	  <simpara>Specifies a style or binding set for a particular group
of widgets by matching on the widget pathname.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>widget_class&nbsp;<parameter>pattern</parameter>&nbsp;[&nbsp;style&nbsp;|&nbsp;binding&nbsp;[&nbsp;:&nbsp;priority&nbsp;]]&nbsp;<parameter>name</parameter></term>
	<listitem>
	  <simpara>Specifies a style or binding set for a particular group
of widgets by matching on the class pathname.</simpara>
	</listitem>
      </varlistentry>
      </variablelist>

    <title>Styles</title>

    <para>A RC style is specified by a style declaration in a RC file, and
then bound to widgets with a <literal>widget</literal>,
<literal>widget_class</literal>, or <literal>class</literal> declaration.
All styles applying to a particular widget are composited together with
widget declarations overriding <literal>widget_class</literal> declarations
which, in turn, override <literal>class</literal> declarations. Within each
type of declaration, later declarations override earlier ones. Within a
style declaration, the possible elements are:</para>
  
      <variablelist role="old">
      <varlistentry>
	<term>bg[<parameter>state</parameter>]&nbsp;=&nbsp;<parameter>color</parameter></term>
	<listitem>
	  <simpara>Sets the color used for the background of most
widgets.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>fg[<parameter>state</parameter>]&nbsp;=&nbsp;<parameter>color</parameter></term>
	<listitem>
	  <simpara>Sets the color used for the foreground of most
widgets.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>base[<parameter>state</parameter>]&nbsp;=&nbsp;<parameter>color</parameter></term>
	<listitem>
	  <simpara>Sets the color used for the background of widgets
displaying editable text. This color is used for the background of, among
others, <link
linkend="class-gtktextview"><classname>gtk.TextView</classname></link> and
<link
linkend="class-gtkentry"><classname>gtk.Entry</classname></link>.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>text[<parameter>state</parameter>]&nbsp;=&nbsp;<parameter>color</parameter></term>
	<listitem>
	  <simpara>Sets the color used for foreground of widgets using
<parameter>base</parameter> for the background color.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>bg_pixmap[<parameter>state</parameter>]&nbsp;=&nbsp;<parameter>pixmap</parameter></term>
	<listitem>
	  <simpara> Sets a background pixmap to be used in place of the
<literal>bg</literal> color (or for <link
linkend="class-gtktextview"><classname>gtk.TextView</classname></link>, in
place of the <literal>base</literal> color). The special value
"&lt;parent&gt;" may be used to indicate that the widget should use the same
background pixmap as its parent. The special value "&lt;none&gt;" may be
used to indicate no background pixmap.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>font&nbsp;=&nbsp;<parameter>font</parameter></term>
	<listitem>
	  <simpara>Sets the font for a widget. font must be a XLFD font
description, e.g.
"-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*".</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>fontset&nbsp;=&nbsp;<parameter>font</parameter></term>
	<listitem>
	  <simpara>Sets the fontset for a widget. Overrides any font
declarations. font must be a comma-separated list of XLFD font descriptions,
e.g. "-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-240,
-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-120,
-GB-Fixed-Medium-R-Normal--26-180-100-100-C-240,
-Adobe-Courier-Bold-R-Normal--25-180-100-100-M-150".</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>font_name&nbsp;=&nbsp;<parameter>font</parameter></term>
	<listitem>
	  <simpara>Sets the font for a widget. Overrides any
<literal>font</literal> or <literal>fontset</literal> declarations.
<parameter>font</parameter> must be a Pango font name, e.g. "Sans Italic
10".</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>stock["<parameter>stock-id</parameter>"]&nbsp;=&nbsp;{&nbsp;<parameter>icon&nbsp;source&nbsp;specifications</parameter>&nbsp;}</term>
	<listitem>
	  <simpara>Defines the icon for a stock item.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>engine&nbsp;"<parameter>engine</parameter>"&nbsp;{&nbsp;<parameter>engine-specific&nbsp;settings</parameter>&nbsp;}</term>
	<listitem>
	  <simpara>Defines the engine to be used when drawing with this
style.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter>class</parameter>::<parameter>property</parameter>&nbsp;=&nbsp;<parameter>value</parameter></term>
	<listitem>
	  <simpara>Sets a <link
linkend="widget-style-properties">style property</link> for a widget
class.</simpara>
	</listitem>
      </varlistentry>
      </variablelist>

    <para>The colors and background pixmaps are specified as a function of
the state of the widget. The states are:</para>

      <variablelist>
      <varlistentry>
	<term><literal>NORMAL</literal></term>
	<listitem>
	  <simpara>A color used for a widget in its normal state.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><literal>ACTIVE</literal></term>
	<listitem>
	  <simpara>A variant of the <literal>NORMAL</literal> color used
when the widget is in the <literal>gtk.STATE_ACTIVE</literal> state, and
also for the trough of a <link
linkend="class-gtkscrollbar"><classname>gtk.Scrollbar</classname></link>,
tabs of a <link
linkend="class-gtknotebook"><classname>gtk.Notebook</classname></link> other
than the current tab and similar areas. Frequently, this should be a darker
variant of the <literal>NORMAL</literal> color.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><literal>PRELIGHT</literal></term>
	<listitem>
	  <simpara>A color used for widgets in the
<literal>gtk.STATE_PRELIGHT</literal> state. This state is the used for
<link linkend="class-gtkbutton"><classname>gtk.Button</classname></link> and
<link linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link>
widgets that have the mouse cursor over them, and for their
children.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><literal>SELECTED</literal></term>
	<listitem>
	  <simpara>A color used to highlight data selected by the user. for
instance, the selected items in a list widget, and the selection in an
editable widget.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><literal>INSENSITIVE</literal></term>
	<listitem>
	  <simpara>A color used for the background of widgets that have been
set insensitive with the <link
linkend="method-gtkwidget--set-sensitive"><methodname>set_sensitive</methodname>()</link> 
method.</simpara>
	</listitem>
      </varlistentry>
      </variablelist>

    <para>Colors can be specified as a string containing a color name (from
the X color database <filename>/usr/lib/X11/rgb.txt</filename>), in one of
the hexadecimal forms <literal>#rrrrggggbbbb</literal>,
<literal>#rrrgggbbb</literal>, <literal>#rrggbb</literal>, or
<literal>#rgb</literal>, where <literal>r</literal>, <literal>g</literal>
and <literal>b</literal> are hex digits, or they can be specified as a
triplet <literal>{ r, g, b}</literal>, where <literal>r</literal>,
<literal>g</literal> and <literal>b</literal> are either integers in the
range 0-65635 or floats in the range 0.0-1.0.</para>

<para>In a stock definition, icon sources are specified as a 4-tuple of
image filename, text direction, widget state, and size, in that order. Each
icon source specifies an image filename to use with a given direction,
state, and size. The * character can be used as a wildcard, and if
direction-state-size are omitted they default to *. So for example, the
following specifies different icons to use for left-to-right and
right-to-left languages:</para>

    <programlisting>
  stock["my-stock-item"] = 
  {
    { "itemltr.png", LTR, *, * },
    { "itemrtl.png", RTL, *, * }
  }
</programlisting>

    <para>This could be abbreviated as follows:</para>

    <programlisting>
  stock["my-stock-item"] = 
  {
    { "itemltr.png", LTR },
    { "itemrtl.png", RTL }
  }
</programlisting>

    <para>You can specify custom icons for specific sizes, as
follows:</para>

    <programlisting>
  stock["my-stock-item"] = 
  {
    { "itemmenusize.png", *, *, "gtk-menu" },
    { "itemtoolbarsize.png", *, *, "gtk-large-toolbar" }
    { "itemgeneric.png" } /* implicit *, *, * as a fallback */
  }
</programlisting>

    <para>The sizes that come with <literal>GTK+</literal> itself are
"gtk-menu", "gtk-small-toolbar", "gtk-large-toolbar", "gtk-button",
"gtk-dialog". Applications can define other sizes. It's also possible to use
custom icons for a given state, for example:</para>

    <programlisting>
  stock["my-stock-item"] = 
  {
    { "itemprelight.png", *, PRELIGHT },
    { "iteminsensitive.png", *, INSENSITIVE }, 
    { "itemgeneric.png" } /* implicit *, *, * as a fallback */
  }
</programlisting>

    <para>When selecting an icon source to use, <literal>GTK+</literal> will
consider text direction most important, state second, and size third. It
will select the best match based on those criteria. If an attribute matches
exactly (e.g. you specified <literal>PRELIGHT</literal> or specified the
size), <literal>GTK+</literal> won't modify the image; if the attribute
matches with a wildcard, <literal>GTK+</literal> will scale or modify the
image to match the state and size the user requested.</para>

    <title>Key bindings</title>

<para>Key bindings allow the user to specify actions to be taken on
particular key presses. The form of a binding set declaration is:</para>

    <programlisting>
  binding name {
    bind key { 
      signalname (param, ...)
      ...
    }
    ...
  }
</programlisting>

    <para><parameter>key</parameter> is a string consisting of a series of
modifiers followed by the name of a key. The modifiers can be:</para>

    <itemizedlist>
      <listitem>
	<simpara>&lt;alt&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;control&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;mod1&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;mod2&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;mod3&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;mod4&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;mod5&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;release&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;shft&gt;</simpara>
      </listitem>
      <listitem>
	<simpara>&lt;shift&gt;</simpara>
      </listitem>
   </itemizedlist>

    <para>&lt;shft&gt; is an alias for &lt;shift&gt; and &lt;alt&gt; is an
alias for &lt;mod1&gt;.</para>

    <para>The action that is bound to the key is a sequence of signal names
(strings) followed by parameters for each signal. The signals must be action
signals. Each parameter can be a float, integer, string, or unquoted string
representing an enumeration value. The types of the parameters specified
must match the types of the parameters of the signal. Binding sets are
connected to widgets in the same manner as styles, with one addition. A
priority can be specified for each pattern, and within each type of pattern,
binding sets override other binding sets first by priority, and only then by
order of specification. (Later overrides earlier). The priorities that can
be specified are (highest to lowest):</para>

    <itemizedlist>
      <listitem>
	<simpara>highest</simpara>
      </listitem>
      <listitem>
	<simpara>rc</simpara>
      </listitem>
      <listitem>
	<simpara>theme</simpara>
      </listitem>
      <listitem>
	<simpara>application</simpara>
      </listitem>
      <listitem>
	<simpara>gtk</simpara>
      </listitem>
      <listitem>
	<simpara>lowest</simpara>
      </listitem>
   </itemizedlist>

    <para><literal>rc</literal> is the default for bindings read from an RC
file, <literal>theme</literal> is the default for bindings read from theme
RC files, <literal>application</literal> should be used for bindings an
application sets up, and <literal>gtk</literal> is used for bindings that
<literal>GTK+</literal> creates internally.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

  <refsect2 id="method-gtkrcstyle--copy">
      <title>gtk.RcStyle.copy</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-gtkrcstyle"><classname>gtk.RcStyle</classname></link> that is
a copy of the rcstyle</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The copy() method returns a new <link
linkend="class-gtkrcstyle"><classname>gtk.RcStyle</classname></link> that is
a copy of the RC style. This method will correctly copy an RC style that is
a member of a class derived from <link
linkend="class-gtkrcstyle"><classname>gtk.RcStyle</classname></link>.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-gtk--rc-add-default-file">
      <title>gtk.rc_add_default_file</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_add_default_file</methodname>
	  <methodparam><parameter
			 role="keyword">filename</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">filename</parameter>&nbsp;:</term>
	  <listitem><simpara>the name of a file containing resource
data</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_add_default_file</function>() function adds
the file specified by <parameter>filename</parameter> to the list of files
to be parsed for resource data.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-set-default-files">
      <title>gtk.rc_set_default_files</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_set_default_files</methodname>
	  <methodparam><parameter
			 role="keyword">filenames</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">filenames</parameter>&nbsp;:</term>
	  <listitem><simpara>a list of filenames</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_set_default_files</function>() function
sets the list of files (specified by <parameter>filenames</parameter>) that
will be parsed for resource information.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-get-default-files">
      <title>gtk.rc_get_default_files</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_get_default_files</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the current list of resource
files</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_get_default_files</function>() function
returns a list of filenames (as set by the <link
linkend="function-gtk--rc-set-default-files"><function>gtk.rc_set_default_files</function>()</link> 
function) that will be parsed for resource data.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-get-style-by-paths">
      <title>gtk.rc_get_style_by_paths</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_get_style_by_paths</methodname>
	  <methodparam><parameter
			 role="keyword">settings</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">widget_path</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">class_path</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">type</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">settings</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtksettings"><classname>gtk.Settings</classname></link>
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">widget_path</parameter>&nbsp;:</term>
	  <listitem><simpara>the widget path to use when looking up the
style</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">class_path</parameter>&nbsp;:</term>
	  <listitem><simpara>the class path to use when looking up the
style</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">type</parameter>&nbsp;:</term>
	  <listitem><simpara>a type that will be used along with parent
types of this type when matching against class styles, or
<literal>gobject.TYPE_NONE</literal></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkstyle"><classname>gtk.Style</classname></link> created by
matching with the supplied paths, or <literal>None</literal> if nothing
matching was specified and the default style should be
used.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_get_style_by_paths</function>() function
returns a <link
linkend="class-gtkstyle"><classname>gtk.Style</classname></link> created
from styles defined in a RC file by providing the raw components used in
matching. This function may be useful when creating pseudo-widgets that
should be themed like widgets but don't actually have corresponding
<literal>PyGTK</literal> widgets. An example of this would be items inside a
<literal>GNOME</literal> canvas widget.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-reparse-all-for-settings">
      <title>gtk.rc_reparse_all_for_settings</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_reparse_all_for_settings</methodname>
	  <methodparam><parameter
			 role="keyword">settings</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">force_load</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">settings</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtksettings"><classname>gtk.Settings</classname></link>
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">force_load</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal> reparse the RC files
even if they haven't changed</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> if the files were
reparsed</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_reparse_all_for_settings</function>()
function reparses the files associated with the <link
linkend="class-gtksettings"><classname>gtk.Settings</classname></link>
object specified by <parameter>settings</parameter> if any of the files have
changed and <parameter>force_load</parameter> is <literal>False</literal>
and . If <parameter>force_load</parameter> is <literal>True</literal> the
files are always reparsed.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-reset-styles">
      <title>gtk.rc_reset_styles</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_reset_styles</methodname>
    <methodparam><parameter role="keyword">settings</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">settings</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtksettings"><classname>gtk.Settings</classname></link>
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkstyle"><classname>gtk.Style</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <function>gtk.rc_reset_styles</function>() function returns
a <link
linkend="class-gtkstyle"><classname>gtk.Style</classname></link>. This
function computes the styles for all widgets that use the <link
linkend="class-gtksettings"><classname>gtk.Settings</classname></link>
object specified by <parameter>settings</parameter>. (There is one <link
linkend="class-gtksettings"><classname>gtk.Settings</classname></link>
object per <link
linkend="class-gdkscreen"><classname>gtk.gdk.Screen</classname></link>, see
the <link
linkend="function-gtk--settings-get-for-screen"><function>gtk.settings_get_for_screen</function>()</link>
function). It is useful when some global parameter has changed that affects
the appearance of all widgets, because when a widget gets a new style, it
will both redraw and recompute any cached information about its
appearance. As an example, it is used when the default font size set by the
operating system changes. Note that this function doesn't affect widgets
that have a style set explicitly on them with the <link
linkend="method-gtkwidget--set-style"><methodname>gtk.Widget.set_style</methodname>()</link>
method.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-parse">
      <title>gtk.rc_parse</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_parse</methodname>
	  <methodparam><parameter
			 role="keyword">filename</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">filename</parameter>&nbsp;:</term>
	  <listitem><simpara>the name of a file to parse for resource
data</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_parse</function>() function parses the file
specified by <parameter>filename</parameter> for resource data.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-parse-string">
      <title>gtk.rc_parse_string</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_parse_string</methodname>
	  <methodparam><parameter
			 role="keyword">rc_string</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">rc_string</parameter>&nbsp;:</term>
	  <listitem><simpara>a string to parse for resource
data</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_parse_string</function>() function parses
the string specified by <parameter>rc_string</parameter> for resource
data.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-reparse-all">
      <title>gtk.rc_reparse_all</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_reparse_all</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> if the files were
reparsed.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_reparse_all</function>() function discards
all style data and reparses all the RC files for resource data if any of
them have changed.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-find-module-in-path">
      <title>gtk.rc_find_module_in_path</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_find_module_in_path</methodname>
	  <methodparam><parameter
			 role="keyword">module_file</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">module_file</parameter>&nbsp;:</term>
	  <listitem><simpara>the name of a theme engine</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the filename of the theme engine or
<literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_find_module_in_path</function>() function
searches for a theme engine named by <parameter>module_file</parameter>.
This function is not useful for applications and should not be used.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-get-theme-dir">
      <title>gtk.rc_get_theme_dir</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_get_theme_dir</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the name of the themes
directory</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_get_theme_dir</function>() function returns
the name of the directory where themes should be installed.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-get-module-dir">
      <title>gtk.rc_get_module_dir</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_get_module_dir</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the theme engines directory
name</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_get_module_dir</function>() function
returns the name of the directory where <literal>PyGTK</literal> searches
for theme engines.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-get-im-module-path">
      <title>gtk.rc_get_im_module_path</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_get_im_module_path</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the IM modules path</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_get_im_module_path</function>() function
returns the path where <literal>PyGTK</literal> searches for IM
modules.</para>

    </refsect2>

    <refsect2 id="function-gtk--rc-get-im-module-file">
      <title>gtk.rc_get_im_module_file</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.rc_get_im_module_file</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the name of the IM modules
file</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.rc_get_im_module_file</function>() function
returns the name of the <literal>PyGTK</literal> IM modules file.</para>

    </refsect2>

  </refsect1>

</refentry>