summaryrefslogtreecommitdiff
path: root/gtk.py
blob: 1a8687a21ce90244d1c055e9290abb77392d2934 (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
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
#
# gtk.py: Wrapper for the gtk module.  This one gives an object oriented
#         feel for the library.  Just type "from gtk import *"
#
# Author: James Henstridge <james@daa.com.au>
#
# TODO
# 1. document some of this (maybe all of it)

# The _obj argument in each constructor is used to create a gtk object
# that coresponds to an already created GTK Object.  It should be possible
# to call any of the gtk object constructors something like this:
# GtkContainer(_obj=gtk_obj) where gtk_obj is an already created GtkObject.
#
# To make the use of this system easier, you can use the _obj2inst function
# to create a gtk object of the correct type from a GtkObject.  This
# is the function the new() command uses.

from GTK import *
import GDK    # make the GDK constants available
import _gtk
import sys, os

# this sets up i18n input stuff
_gtk.gtk_set_locale()

# initialise GTK (only if it can find the display -- this avoids segfaults)
if '--display' in sys.argv or os.environ.has_key('DISPLAY'):
	_gtk.gtk_init()
else:
	print 'No display information -- gtk_init not called'
del sys, os

class GtkObject:
	get_type = _gtk.gtk_object_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def set(self, dict):
		_filtprops(dict)
		_gtk.gtk_object_set(self._o, dict)
	def __getitem__(self, key):
		ret = _gtk.gtk_object_get(self._o, key)
		if type(ret) == _gtk.GtkObjectType:
			return _obj2inst(ret)
		else:
			return ret
	def __setitem__(self, key, v):
		if hasattr(v, '_o') and type(v._o) == _gtk.GtkObjectType:
			v = v._o
		elif hasattr(v, '_ag') and type(v._ag)==_gtk.GtkAccelGroupType:
			v = v._ag
		elif hasattr(v, '_im'):
			v = v._im
		_gtk.gtk_object_set(self._o, {key: v});
	def __cmp__(self, other):
	        if hasattr(other, '_o'):
			return cmp(self._o, other._o)
		else:
			return cmp(id(self), id(other))
	def __getattr__(self, attr):
		# this function allows setting attributes on an object so that
		# they will always be available with the object.  Due to
		# reference counting problems, we can't always pass the
		# same GtkObject instance to a callback.
		#if attr[0] == '_' or not self.__dict__.has_key('_o'):
		#	raise AttributeError, attr
		#dict = self.get_data('Python-Attributes')
		#if dict and dict.has_key(attr):
		#	return dict[attr]
		raise AttributeError, attr
	#def __setattr__(self, attr, value):
	#	if attr[0] == '_' or self.__dict__.has_key(attr) or \
	#	   not self.__dict__.has_key('_o'):
	#		self.__dict__[attr] = value
	#	dict = self.get_data('Python-Attributes')
	#	if not dict:
	#		dict = {}
	#		self.set_data('Python-Attributes', dict)
	#	dict[attr] = value
	#def __delattr__(self, attr):
	#	if self.__dict__.has_key(attr):
	#		del self.__dict__[attr]
	#		return
	#	if not self.__dict__.has_key('_o'):
	#		raise AttributeError, \
	#		      'delete non-existing instance attribute'
	#	dict = self.get_data('Python-Attributes')
	#	if dict and dict.has_key(attr):
	#		del dict[attr]
	#	else:
	#		raise AttributeError, \
	#		      'delete non-existing instance attribute'
			
	def flags(self, mask=None):
		if mask:
			return _gtk.GTK_OBJECT_FLAGS(self._o) & mask
		else:
			return _gtk.GTK_OBJECT_FLAGS(self._o)
	def set_flags(self, flags):
		_gtk.GTK_OBJECT_SET_FLAGS(self._o, flags)
	def unset_flags(self, flags):
		_gtk.GTK_OBJECT_UNSET_FLAGS(self._o, flags)
	def set_data(self, key, value):
		_gtk.gtk_object_set_data(self._o, key, value)
	def get_data(self, key):
		return _gtk.gtk_object_get_data(self._o, key)
	def remove_data(self, key):
		_gtk.gtk_object_remove_data(self._o, key)
	class __cnv:
		def __init__(self, func):
			self.func = func
		def __call__(self, *args):
			a = list(args)
			for i in range(len(args)):
				if type(args[i]) == _gtk.GtkObjectType:
					a[i] = _obj2inst(args[i])
				elif type(args[i]) == _gtk.GtkAccelGroupType:
					a[i] = GtkAccelGroup(_obj=args[i])
			a = tuple(a)
			ret = apply(self.func, a)
			if hasattr(ret, '_o'): ret = ret._o
			elif hasattr(ret, '_ag'): ret = ret._ag
			elif hasattr(ret, '_im'): ret = ret._im
			return ret
	def connect(self, name, f, *extra):
		callback = self.__cnv(f)
		return _gtk.gtk_signal_connect(self._o, name,
						   callback.__call__, extra)
	signal_connect = connect
	def connect_after(self, name, f, *extra):
		callback = self.__cnv(f)
		return _gtk.gtk_signal_connect_after(self._o, name,
						     callback.__call__, extra)
	signal_connect_after = connect_after
	def disconnect(self, id):
		_gtk.gtk_signal_disconnect(self._o, id)
	def signal_handler_block(self, id):
		_gtk.gtk_signal_handler_block(self._o, id)
	def signal_handler_unblock(self, id):
		_gtk.gtk_signal_handler_unblock(self._o, id)
	def signal_handlers_destroy(self):
		_gtk.gtk_signal_handlers_destroy(self._o)
	def emit(self, signal, *args):
		params = []
		for i in args:
			if hasattr(i, '_o'): params.append(i._o)
			elif hasattr(i, '_ag'): params.append(i._ag)
			elif hasattr(i, '_im'): params.append(i._im)
			else: params.append(i)
		return _gtk.gtk_signal_emitv_by_name(self._o,signal,params)
	def emit_stop_by_name(self, sig):
		_gtk.gtk_signal_emit_stop_by_name(self._o, sig)
	def destroy(self, _obj=None):
		_gtk.gtk_object_destroy(self._o)

class GtkData(GtkObject):
	get_type = _gtk.gtk_data_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return

class GtkAdjustment(GtkData):
	get_type = _gtk.gtk_adjustment_get_type
	def __init__(self, value=0, lower=0, upper=0, step_incr=0, page_incr=0,
			page_size=0, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_adjustment_new(value, lower, upper,
					  step_incr, page_incr, page_size)
	def __getattr__(self, attr):
		attrs = {
		'lower': _gtk.gtk_adjustment_get_lower,
		'upper': _gtk.gtk_adjustment_get_upper,
		'value': _gtk.gtk_adjustment_get_value,
		'step_increment': _gtk.gtk_adjustment_get_step_increment,
		'page_increment': _gtk.gtk_adjustment_get_page_increment,
		'page_size': _gtk.gtk_adjustment_get_page_size
		}
		if attrs.has_key(attr):
			return attrs[attr](self._o)
		return GtkData.__getattr__(self, attr)
	def set_value(self, value):
		_gtk.gtk_adjustment_set_value(self._o, value)
	def clamp_page(self, lower, upper):
		_gtk.gtk_adjustment_clamp_page(self._o, lower, upper)
	def changed(self, obj=None):
		_gtk.gtk_adjustment_changed(self._o)
	def value_changed(self, obj=None):
		_gtk.gtk_adjustment_value_changed(self._o)

class GtkTooltips(GtkData):
	get_type = _gtk.gtk_tooltips_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_tooltips_new()
	def enable(self):
		_gtk.gtk_tooltips_enable(self._o)
	def disable(self, obj=None):
		_gtk.gtk_tooltips_disable(self._o)
	def set_delay(self, delay):
		_gtk.gtk_tooltips_set_delay(self._o, delay)
	def set_tip(self, w, tip, tip_private=None):
		_gtk.gtk_tooltips_set_tip(self._o, w._o, tip, tip_private)
	def set_tips(self, w, tip):
		print "GtkTooltip.set_tips deprecated -- use set_tip instead"
		self.set_tip(w, tip, tip)
	def set_colors(self, back, fore):
		_gtk.gtk_tooltips_set_colors(self._o, back, fore)
	def force_window(self):
		_gtk.gtk_tooltips_force_window(self._o)

class GtkItemFactory(GtkObject):
	get_type = _gtk.gtk_item_factory_get_type
	def __init__(self, type=-1, path='', accel_group=None, _obj=None):
		if _obj: self._o = _obj; return
		if type == -1: type = _gtk.gtk_menu_bar_get_type()
		if hasattr(type, 'get_type'): type = type.get_type()
		self._o = _gtk.gtk_item_factory_new(type,path,accel_group._ag)
	parse_rc = _gtk.gtk_item_factory_parse_rc
	parse_rc_string = _gtk.gtk_item_factory_parse_rc_string
	def get_widget(self, path):
		ret = _gtk.gtk_item_factory_get_widget(self._o, path)
		if ret:
			return _obj2inst(ret)
		else:
			return ret
	def get_widget_by_action(self, action):
		ret = _gtk.gtk_item_factory_get_widget_by_action(self._o,
								 action)
		if ret:
			return _obj2inst(ret)
		else:
			return ret
	class __wrap_cb:
		def __init__(self, cb):
			self.cb = cb
		def __call__(self, action, widget):
			self.cb(action, _obj2inst(widget))
	def create_items(self, items):
		def map_func((path,accel,cb,action,type), wrap=self.__wrap_cb):
			if cb:
				return (path,accel,wrap(cb).__call__,action,
					type)
			else:
				return (path,accel,None,action,type)
		items = map(map_func, items)
		_gtk.gtk_item_factory_create_items(self._o, items)
	def delete_item(self, path):
		_gtk.gtk_item_factory_delete_item(self._o, path)
	def popup(self, x, y, button, time):
		_gtk.gtk_item_factory_popup(self._o, x, y, button, time)
	def add_foreign(self, accel_widget, full_path, accel_group, keyval,
			modifiers):
		_gtk.gtk_item_factory_add_foreign(accel_widget._o, full_path,
						  accel_group._ag, keyval,
						  modifiers)

class GtkWidget(GtkObject):
	get_type = _gtk.gtk_widget_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	# extra parameter is so that these funcs can be used as signal funcs
	def accelerators_locked(self):
		return _gtk.gtk_widget_accelerators_locked(self._o)
	def activate(self, obj=None):
		return _gtk.gtk_widget_activate(self._o)
	def add_accelerator(self, signal, group, key, mods, flags):
		_gtk.gtk_widget_add_accelerator(self._o, signal, group._ag,
						key, mods, flags)
	def destroy(self, obj=None):
		_gtk.gtk_widget_destroy(self._o)
	def drag_get_data(self, context, target, time):
		_gtk.gtk_drag_get_data(self._o, context, target, time)
	def drag_finish(self, context, success, delete, time):
		_gtk.gtk_drag_finish(context, success, delete, time)
	def drag_highlight(self):
		_gtk.gtk_drag_highlight(self._o)
	def drag_unhighlight(self):
		_gtk.gtk_drag_unhighlight(self._o)
	# targets is a list of 3-tuples of form
	# (string target, int flags ,int info)
	def drag_dest_set(self, flags, targets, actions):
		_gtk.gtk_drag_dest_set(self._o, flags, targets, actions)
	def drag_dest_set_proxy(self, proxy_window, protocol, use_coordinates):
		_gtk.gtk_drag_dest_set_proxy(self._o, proxy_window, protocol,
					     use_coordinates)
	def drag_dest_unset(self):
		_gtk.gtk_drag_dest_unset(self._o)
	# targets as for drag_dest_set
	def drag_source_set(self, button_mask, targets, actions):
		_gtk.gtk_drag_source_set(self._o, button_mask, targets,actions)
	def drag_source_set_icon(self, colormap, pixmap, mask):
		_gtk.gtk_drag_source_set_icon(self._o, colormap, pixmap, mask)
	# targets as for drag_dest_set
	def drag_begin(self, targets, actions, button, event):
		return _gtk.gtk_drag_begine(self._o, targets, actions, button,
					    event)
	def drag_set_icon_widget(self, context, widget, hot_x, hot_y):
		_gtk.gtk_drag_set_icon_widget(context, widget._o, hot_x, hot_y)
	def drag_set_icon_pixmap(self, context, colormap, pixmap, mask,
				 hot_x, hot_y):
		_gtk.gtk_drag_set_icon_pixmap(context, colormap, pixmap, mask,
					      hot_x, hot_y)
	def drag_set_icon_default(self, context):
		_gtk.gtk_drag_set_icon_default(context)
	def drag_set_default_icon(self, colormap, pixmap, mask, hot_x, hot_y):
		_gtk.gtk_drag_set_default_icon(colormap, pixmap, mask,
					       hot_x, hot_y)
	def drag_get_source_widget(self, context):
		return _obj2inst(_gtk.gtk_drag_get_source_widget(context))
	def drag_status(self, context, action, time):
		_gtk.gdk_drag_status(context, action, time)
	def draw(self, rect):
		_gtk.gtk_widget_draw(self._o, rect)
	def draw_default(self, obj=None):
		_gtk.gtk_widget_draw_default(self._o)
	def draw_focus(self, obj=None):
		_gtk.gtk_widget_draw_focus(self._o)
	def ensure_style(self):
		_gtk.gtk_widget_ensure_style(self._o)
	def event(self, event):
		_gtk.gtk_widget_event(self._o, event)
	def lock_accelerators(self):
		_gtk.gtk_widget_lock_accelerators(self._o)
	def get_allocation(self):
		return _gtk.gtk_widget_get_allocation(self._o)
	def get_ancestor(self, type):
		return _obj2inst(_gtk.gtk_widget_get_ancestor(self._o, type))
	def get_child_requisition(self):
		return _gtk.gtk_widget_get_child_requisition(self._o)
	def get_colormap(self):
		return _gtk.gtk_widget_get_colormap(self._o)
	def get_composite_name(self):
		return _gtk.gtk_widget_get_composite_name(self._o)
	def get_events(self):
		return _gtk.gtk_widget_get_events(self._o)
	def get_extension_events(self):
		return _gtk.gtk_widget_get_extension_events(self._o)
	def get_name(self):
		return _gtk.gtk_widget_get_name(self._o)
	def get_parent_window(self):
		return _gtk.gtk_widget_get_parent_window(self._o)
	def get_pointer(self):
		return _gtk.gtk_widget_get_pointer(self._o)
	def get_style(self):
		return _gtk.gtk_widget_get_style(self._o)
	def get_toplevel(self):
		return _obj2inst(_gtk.gtk_widget_get_toplevel(self._o))
	def get_window(self):
		return _gtk.gtk_widget_get_window(self._o)
	def grab_focus(self, obj=None):
		_gtk.gtk_widget_grab_focus(self._o)
	def grab_default(self, obj=None):
		_gtk.gtk_widget_grab_default(self._o)
	def hide(self, obj=None):
		_gtk.gtk_widget_hide(self._o)
	def hide_all(self, obj=None):
		_gtk.gtk_widget_hide_all(self._o)
	def hide_on_delete(self, obj=None):
		return _gtk.gtk_widget_hide_on_delete(self._o)
	def intersect(self, rect):
		return _gtk.gtk_widget_intersect(self._o, rect)
	def is_ancestor(self, a):
		return _gtk.gtk_widget_is_ancestor(self._o, a._o)
	def map(self, obj=None):
		_gtk.gtk_widget_map(self._o)
	def popup(self, x, y):
		_gtk.gtk_widget_popup(self._o, x, y)
	def queue_draw(self, obj=None):
		_gtk.gtk_widget_queue_draw(self._o)
	def queue_resize(self, obj=None):
		_gtk.gtk_widget_queue_resize(self._o)
	def realize(self, obj=None):
		_gtk.gtk_widget_realize(self._o)
	def remove_accelerator(self, group, key, mods):
		_gtk.gtk_widget_remove_accelerator(self._o, group._ag,
						   key, mods)
	def remove_accelerators(self, signal, visible_only):
		_gtk.gtk_widget_remove_accelerators(self._o, signal,
						    visible_only)
	def reparent(self, new_parent):
		_gtk.gtk_widget_reparent(self._o, new_parent._o)
	def reset_rc_styles(self):
		_gtk.gtk_widget_reset_rc_styles(self._o)
	def restore_default_style(self):
		_gtk.gtk_widget_restore_default_style(self._o)
	def selection_owner_set(self, selection, time):
		return _gtk.gtk_selection_owner_set(self._o, selection, time)
	def selection_add_target(self, selection, target, info):
		_gtk.gtk_selection_add_target(self._o, selection, target, info)
	def selection_convert(self, selection, target, time):
		return _gtk.gtk_selection_convert(self._o, selection,
						  target, time)
	def selection_remove_all(self):
		_gtk.gtk_selection_remove_all(self._o)
	def set_events(self, events):
		_gtk.gtk_widget_set_events(self._o, events)
	def add_events(self, events):
		_gtk.gtk_widget_add_events(self._o, events)
	def set_app_paintable(self, app_paintable):
		_gtk.gtk_widget_set_app_paintable(self._o, app_paintable)
	def set_composite_name(self, name):
		_gtk.gtk_widget_set_composite_name(self._o, name)
	def set_extension_events(self, exevents):
		_gtk.gtk_widget_set_extension_events(self._o, exevents)
	def set_name(self, name):
		_gtk.gtk_widget_set_name(self._o, name)
	def set_parent(self, parent):
		_gtk.gtk_widget_set_parent(self._o, parent._o)
	def set_parent_window(self, parent):
		_gtk.gtk_widget_set_parent_window(self._o, parent)
	def set_scroll_adjustments(self, hadj, vadj):
		_gtk.gtk_widget_set_scroll_adjustments(self._o,hadj._o,vadj._o)
	def set_sensitive(self, s):
		_gtk.gtk_widget_set_sensitive(self._o, s)
	def set_state(self, s):
		_gtk.gtk_widget_set_state(self._o, s)
	def set_style(self, style):
		_gtk.gtk_widget_set_style(self._o, style)
	def set_rc_style(self):
		_gtk.gtk_widget_set_rc_style(self._o)
	def set_uposition(self, x, y):
		_gtk.gtk_widget_set_uposition(self._o, x, y)
	def set_usize(self, w, h):
		_gtk.gtk_widget_set_usize(self._o, w, h)
	def shape_combine_mask(self, mask, ofs_x, ofs_y):
		if hasattr(mask, '_o'):
			tmp, mask = mask.get()
	        _gtk.gtk_widget_shape_combine_mask(self._o, mask, ofs_x, ofs_y)
	def show(self, obj=None):
		_gtk.gtk_widget_show(self._o)
	def show_all(self, obj=None):
		_gtk.gtk_widget_show_all(self._o)
	def show_now(self, obj=None):
	        _gtk.gtk_widget_show_now(self._o)
	def size_allocate(self, a):
		_gtk.gtk_widget_size_allocate(self._o, a)
	def size_request(self):
		return _gtk.gtk_widget_size_request(self._o)
	def unlock_accelerators(self):
		_gtk.gtk_widget_unlock_accelerators(self._o)
	def unmap(self, obj=None):
		_gtk.gtk_widget_unmap(self._o)
	def unparent(self):
		_gtk.gtk_widget_unparent(self._o)
	def unrealize(self, obj=None):
		_gtk.gtk_widget_unrealize(self._o)

class GtkCalendar(GtkWidget):
	get_type = _gtk.gtk_calendar_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_calendar_new()
	def select_month(self, month, year):
		return _gtk.gtk_calendar_select_month(self._o, month, year)
	def select_day(self, day):
		_gtk.gtk_calendar_select_day(self._o, day)
	def mark_day(self, day):
		return _gtk.gtk_calendar_mark_day(self._o, day)
	def unmark_day(self, day):
		return _gtk.gtk_calendar_unmark_day(self._o, day)
	def clear_marks(self):
		_gtk.gtk_calendar_clear_marks(self._o)
	def display_options(self, flags):
		_gtk.gtk_calendar_display_options(self._o, flags)
	def get_date(self):
		return _gtk.gtk_calendar_get_date(self._o)
	def freeze(self):
		_gtk.gtk_calendar_freeze(self._o)
	def thaw(self):
		_gtk.gtk_calendar_thaw(self._o)
	
class GtkContainer(GtkWidget):
	get_type = _gtk.gtk_container_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def add(self, child, **args):
		if args == {}:
			_gtk.gtk_container_add(self._o, child._o)
		else:
			_gtk.gtk_container_add(self._o, child._o, args)
	def border_width(self, bw):
		print "border_width deprecated -- use set_border_width"
		self.set_border_width(bw)
	def set_border_width(self, bw):
		_gtk.gtk_container_set_border_width(self._o, bw)
	def check_resize(self):
		_gtk.gtk_container_check_resize(self._o)
	def child_composite_name(self, child):
		return _gtk.gtk_container_child_composite_name(self._o,
							       child._o)
	def child_set(self, child, **args):
		_gtk.gtk_container_child_set(self._o, child._o, args)
	def child_get(self, child, arg):
		return _gtk.gtk_container_child_get(self._o, child._o, arg)
	def children(self):
		l =  _gtk.gtk_container_children(self._o)
		return map(_obj2inst, l)
	def child_type(self):
		return _gtk.gtk_container_child_type(self._o)
	def focus(self, d):
		_gtk.gtk_container_focus(self._o, d)
	def foreach(self, f):
		for child in self.children():
			f(child)
	def register_toplevel(self):
		_gtk.gtk_container_register_toplevel(self._o)
	def remove(self, child):
		_gtk.gtk_container_remove(self._o, child._o)
	def resize_children(self):
		_gtk.gtk_container_resize_children(self._o)
	def set_focus_child(self, child):
		if child: child = child._o
		_gtk.gtk_container_set_focus_child(self._o, child)
	def set_focus_vadjustment(self, adj):
		_gtk.gtk_container_set_focus_vadjustment(self._o, adj._o)
	def set_focus_hadjustment(self, adj):
		_gtk.gtk_container_set_focus_hadjustment(self._o, adj._o)
	def set_resize_mode(self, mode):
		_gtk.gtk_container_set_resize_mode(self._o, mode)
	def unregister_toplevel(self):
		_gtk.gtk_container_unregister_toplevel(self._o)

class GtkBin(GtkContainer):
	get_type = _gtk.gtk_bin_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return

class GtkAlignment(GtkBin):
	get_type = _gtk.gtk_alignment_get_type
	def __init__(self, xa=0, ya=0, xs=0, ys=0, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_alignment_new(xa, ya, xs, ys)
	def set(self, xa, ya, xs, ys):
		_gtk.gtk_alignment_set(self._o, xa, ya, xs, ys)

class GtkButton(GtkBin):
	get_type = _gtk.gtk_button_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_button_new()
		else:
			self._o = _gtk.gtk_button_new_with_label(label)
	def pressed(self, obj=None):
		_gtk.gtk_button_pressed(self._o)
	def released(self, obj=None):
		_gtk.gtk_button_released(self._o)
	def clicked(self, obj=None):
		_gtk.gtk_button_clicked(self._o)
	def enter(self, obj=None):
		_gtk.gtk_button_enter(self._o)
	def leave(self, obj=None):
		_gtk.gtk_button_leave(self._o)
	def set_relief(self, style):
		_gtk.gtk_button_set_relief(self._o, style)
	def get_relief(self):
		return _gtk.gtk_button_get_relief(self._o)

class GtkOptionMenu(GtkButton):
	get_type = _gtk.gtk_option_menu_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_option_menu_new()
	def get_menu(self):
		return _obj2inst(_gtk.gtk_option_menu_get_menu(self._o))
	def set_menu(self, menu):
		_gtk.gtk_option_menu_set_menu(self._o, menu._o)
	def remove_menu(self):
		_gtk.gtk_option_menu_remove_menu(self._o)
	def set_history(self, index):
		_gtk.gtk_option_menu_set_history(self._o, index)

class GtkToggleButton(GtkButton):
	get_type = _gtk.gtk_toggle_button_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_toggle_button_new()
		else:
			self._o = _gtk.gtk_toggle_button_new_with_label(label)
	def __getattr__(self, attr):
	    attrs = {
		    'active': _gtk.gtk_toggle_button_get_active,
		    'draw_indicator':_gtk.gtk_toggle_button_get_draw_indicator,
	    }
	    if attrs.has_key(attr):
		    return attrs[attr](self._o)
	    return GtkButton.__getattr__(self, attr)
	def set_mode(self, di):
		_gtk.gtk_toggle_button_set_mode(self._o, di)
	def set_active(self, active):
		_gtk.gtk_toggle_button_set_active(self._o, active)
	def get_active(self):
		return _gtk.gtk_toggle_button_get_active(self._o)
	def toggled(self, obj):
		_gtk.gtk_toggle_button_toggled(self._o)

class GtkCheckButton(GtkToggleButton):
	get_type = _gtk.gtk_check_button_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_check_button_new()
		else:
			self._o = _gtk.gtk_check_button_new_with_label(label)

class GtkRadioButton(GtkCheckButton):
	get_type = _gtk.gtk_radio_button_get_type
	def __init__(self, group=None, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			if group == None:
				self._o = _gtk.gtk_radio_button_new()
			else:
				self._o = \
					_gtk.gtk_radio_button_new_from_widget(
						group._o)
		else:
			if group == None:
				self._o = _gtk.gtk_radio_button_new_with_label(
					None, label)
			else:
				self._o = _gtk.gtk_radio_button_new_with_label_from_widget(group._o, label)

class GtkFrame(GtkBin):
	get_type = _gtk.gtk_frame_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_frame_new(label)
	def set_label(self, label):
		_gtk.gtk_frame_set_label(self._o, label)
	def set_label_align(self, x, y):
		_gtk.gtk_frame_set_label_align(self._o, x, y)
	def set_shadow_type(self, tp=SHADOW_ETCHED_IN):
		_gtk.gtk_frame_set_shadow_type(self._o, tp)

class GtkAspectFrame(GtkFrame):
	get_type = _gtk.gtk_aspect_frame_get_type
	def __init__(self, xa=0, ya=0, ratio=1, obey_child=1, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_aspect_frame_new(xa, ya, ratio, obey_child)
	def set(self, xa, ya, ratio, obey_child):
		_gtk.gtk_aspect_frame_set(self._o, xa, ya, ratio, obey_child)

class GtkEventBox(GtkBin):
	get_type = _gtk.gtk_event_box_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_event_box_new()

class GtkHandleBox(GtkBin):
	get_type = _gtk.gtk_handle_box_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_handle_box_new()
	def set_shadow_type(self, type):
		_gtk.gtk_handle_box_set_shadow_type(self._o, type)
	def set_handle_position(self, position):
		_gtk.gtk_handle_box_set_handle_position(self._o, position)
	def set_snap_edge(self, edge):
		_gtk.gtk_handle_box_set_snap_edge(self._o, edge)

class GtkItem(GtkBin):
	get_type = _gtk.gtk_item_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def select(self, obj=None):
		_gtk.gtk_item_select(self._o)
	def deselect(self, obj=None):
		_gtk.gtk_item_deselect(self._o)
	def toggle(self, obj=None):
		_gtk.gtk_item_toggle(self._o)

class GtkMenuItem(GtkItem):
	get_type = _gtk.gtk_menu_item_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_menu_item_new()
		else:
			self._o = _gtk.gtk_menu_item_new_with_label(label)
	def set_submenu(self, sub):
		_gtk.gtk_menu_item_set_submenu(self._o, sub._o)
	def set_placement(self, placement):
		_gtk.gtk_menu_item_set_placement(self._o, placement)
	def configure(self, show_toggle, show_sub):
		_gtk.gtk_menu_item_configure(self._o, show_toggle, show_sub)
	def select(self, obj=None):
		_gtk.gtk_menu_item_select(self._o)
	def deselect(self, obj=None):
		_gtk.gtk_menu_item_deselect(self._o)
	def activate(self, obj=None):
		_gtk.gtk_menu_item_activate(self._o)
	def remove_submenu(self):
		_gtk.gtk_menu_item_remove_submenu(self._o)
	def right_justify(self, obj=None):
		_gtk.gtk_menu_item_right_justify(self._o)
		
class GtkCheckMenuItem(GtkMenuItem):
	get_type = _gtk.gtk_check_menu_item_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_check_menu_item_new()
		else:
			self._o =_gtk.gtk_check_menu_item_new_with_label(label)
	def __getattr__(self, attr):
		attrs = {
			'active': _gtk.gtk_check_menu_item_get_active
		}
		if attrs.has_key(attr):
			return attrs[attr](self._o)
		return GtkMenuItem.__getattr__(self, attr)
	def set_show_toggle(self, always):
		_gtk.gtk_check_menu_item_set_show_toggle(self._o, always)
	def set_active(self, active):
		_gtk.gtk_check_menu_item_set_active(self._o, active)
	def toggled(self, obj=None):
		_gtk.gtk_check_menu_item_toggled(self._o)

class GtkRadioMenuItem(GtkCheckMenuItem):
	get_type = _gtk.gtk_radio_menu_item_get_type
	def __init__(self, group=None, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			if group == None:
				self._o = _gtk.gtk_radio_menu_item_new()
			else:
				self._o =_gtk.gtk_radio_menu_item_new(group._o)
		else:
			if group == None:
				self._o=_gtk.gtk_radio_menu_item_new_with_label(
					None, label)
			else:
				self._o=_gtk.gtk_radio_menu_item_new_with_label(
					group._o, label)

class GtkTearoffMenuItem(GtkMenuItem):
	get_type = _gtk.gtk_tearoff_menu_item_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_tearoff_menu_item_new()

class GtkListItem(GtkItem):
	get_type = _gtk.gtk_list_item_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_list_item_new()
		else:
			self._o = _gtk.gtk_list_item_new_with_label(label)
	def select(self, obj=None):
		_gtk.gtk_list_item_select(self._o)
	def deselect(self, obj=None):
		_gtk.gtk_list_item_deselect(self._o)

class GtkTreeItem(GtkItem):
	get_type = _gtk.gtk_tree_item_get_type
	def __init__(self, label=None, _obj=None):
		if _obj: self._o = _obj; return
		if label == None:
			self._o = _gtk.gtk_tree_item_new()
		else:
			self._o = _gtk.gtk_tree_item_new_with_label(label)
	def __getattr__(self, attr):
		attrs = {
			'subtree': _gtk.gtk_tree_item_get_subtree,
			}
		if attrs.has_key(attrs):
			return attrs[attr](self._o)
		return GtkItem.__getattr__(self, attr)
	def set_subtree(self, subtree):
		_gtk.gtk_tree_item_set_subtree(self._o, subtree._o)
	def select(self, obj=None):
		_gtk.gtk_tree_item_select(self._o)
	def deselect(self, obj=None):
		_gtk.gtk_tree_item_deselect(self._o)
	def expand(self, obj=None):
		_gtk.gtk_tree_item_expand(self._o)
	def collapse(self, obj=None):
		_gtk.gtk_tree_item_collapse(self._o)
	def remove_subtree(self):
		_gtk.gtk_tree_item_remove_subtree(self._o)

class GtkViewport(GtkBin):
	get_type = _gtk.gtk_viewport_get_type
	def __init__(self, ha=None, va=None, _obj=None):
		if _obj: self._o = _obj; return
		if ha: ha = ha._o
		if va: va = va._o
		self._o = _gtk.gtk_viewport_new(ha, va)
	def get_hadjustment(self):
		return _obj2inst(_gtk.gtk_viewport_get_hadjustment(self._o))
	def get_vadjustment(self):
		return _obj2inst(_gtk.gtk_viewport_get_vadjustment(self._o))
	def set_hadjustment(self, ha):
		_gtk.gtk_viewport_set_hadjustment(self._o, ha._o)
	def set_vadjustment(self, va):
		_gtk.gtk_viewport_set_vadjustment(self._o, va._o)
	def set_shadow_type(self, tp=SHADOW_ETCHED_IN):
		_gtk.gtk_viewport_set_shadow_type(self._o, tp)

class GtkWindow(GtkBin):
	get_type = _gtk.gtk_window_get_type
	def __init__(self, type=WINDOW_TOPLEVEL, title=None, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_window_new(type)
		if title is not None:
			self.set_title(title)
	def activate_focus(self, obj=None):
		_gtk.gtk_window_activate_focus(self._o)
	def activate_default(self, obj=None):
		_gtk.gtk_window_activate_default(self._o)
	def set_title(self, title):
		_gtk.gtk_window_set_title(self._o, title)
	def set_policy(self, as, ag, autos):
		_gtk.gtk_window_set_policy(self._o, as, ag, autos)
	def add_accel_group(self, group):
		_gtk.gtk_window_add_accel_group(self._o, group._ag)
	def remove_accel_group(self, group):
		_gtk.gtk_window_remove_accel_group(self._o, group._ag)
	def position(self, pos):
		print "position deprecated -- use set_position"
		self.set_position(pos)
	def set_position(self, pos):
		_gtk.gtk_window_set_position(self._o, pos)
	def set_wmclass(self, wmc_name, wmc_class):
		_gtk.gtk_window_set_wmclass(self._o, wmc_name, wmc_class)
	def set_icon(self, pixmap, mask=None):
		if not mask and hasattr(pixmap, '_o'):
			pixmap, mask = pixmap.get()
		_gtk.gtk_window_set_icon(self._o, pixmap, mask)
	def set_icon_name(self, name):
		_gtk.gtk_window_set_icon_name(self._o, name)
	def set_transient_for(self, parent):
		_gtk.gtk_window_set_transient_for(self._o, parent._o)
	def set_geometry_hints(self, geometry_widget=None, **hints):
		# acceptable hints are min_width, min_height, max_width,
		# max_height, base_width, base_height, width_inc, height_inc
		# (with int values) and min_aspect, max_aspect (double values).
		if hasattr(geometry_widget, '_o'):
			geometry_widget = geometry_widget._o
		_gtk.gtk_window_set_geometry_hints(self._o, geometry_widget,
						   hints)
	def set_default_size(self, width, height):
		_gtk.gtk_window_set_default_size(self._o, width, height)
	def set_modal(self, modal):
		_gtk.gtk_window_set_modal(self._o, modal)

class GtkColorSelectionDialog(GtkWindow):
	get_type = _gtk.gtk_color_selection_dialog_get_type
	def __init__(self, name="", _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_color_selection_dialog_new(name)
	def __getattr__(self, attr):
		attrs = {
			'colorsel':_gtk.gtk_color_selection_dialog_get_colorsel,
			'main_vbox':_gtk.gtk_color_selection_dialog_get_main_vbox,
			'ok_button': _gtk.gtk_color_selection_dialog_get_ok_button,
			'reset_button': _gtk.gtk_color_selection_dialog_get_reset_button,
			'cancel_button': _gtk.gtk_color_selection_dialog_get_cancel_button,
			'help_button': _gtk.gtk_color_selection_dialog_get_help_button
		}
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkWindow.__getattr__(self, attr)

class GtkDialog(GtkWindow):
	get_type = _gtk.gtk_dialog_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_dialog_new()
	def __getattr__(self, attr):
		attrs = {
			'vbox': _gtk.gtk_dialog_get_vbox,
			'action_area': _gtk.gtk_dialog_get_action_area
		}
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkWindow.__getattr__(self, attr)

class GtkFileSelection(GtkWindow):
	get_type = _gtk.gtk_file_selection_get_type
	def __init__(self, title='', _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_file_selection_new(title)

	def __getattr__(self, attr):
		attrs = {
		'cancel_button':   _gtk.gtk_file_selection_get_cancel_button,
		'dir_list':        _gtk.gtk_file_selection_get_dir_list,
		'file_list':       _gtk.gtk_file_selection_get_file_list,
		'help_button':     _gtk.gtk_file_selection_get_help_button,
		'main_vbox':       _gtk.gtk_file_selection_get_main_vbox,
		'ok_button':       _gtk.gtk_file_selection_get_ok_button,
		'selection_entry': _gtk.gtk_file_selection_get_selection_entry,
		'selection_text':  _gtk.gtk_file_selection_get_selection_text
		}
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkWindow.__getattr__(self, attr)
	def set_filename(self, filename):
		_gtk.gtk_file_selection_set_filename(self._o, filename)
	def get_filename(self):
		return _gtk.gtk_file_selection_get_filename(self._o)
	def complete(self, pattern):
		_gtk.gtk_file_selection_complete(self._o, pattern)
	def show_fileop_buttons(self):
		_gtk.gtk_file_selection_show_fileop_buttons(self._o)
	def hide_fileop_buttons(self):
		_gtk.gtk_file_selection_hide_fileop_buttons(self._o)

class GtkInputDialog(GtkWindow):
	get_type = _gtk.gtk_input_dialog_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_input_dialog_new()
	def __getattr__(self, attr):
		attrs = {
			'close_button': _gtk.gtk_input_dialog_get_close_button,
			'save_button': _gtk.gtk_input_dialog_get_save_button
		}
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkWindow.__getattr__(self, attr)

class GtkFontSelectionDialog(GtkWindow):
	get_type = _gtk.gtk_font_selection_dialog_get_type
	def __init__(self, title=None, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_font_selection_dialog_new(title)
	def __getattr__(self, attr):
		attrs = {
		"fontsel": _gtk.gtk_font_selection_dialog_get_fontsel,
		"main_vbox": _gtk.gtk_font_selection_dialog_get_main_vbox,
		"action_area": _gtk.gtk_font_selection_dialog_get_action_area,
		"ok_button": _gtk.gtk_font_selection_dialog_get_ok_button,
		"apply_button":_gtk.gtk_font_selection_dialog_get_apply_button,
		"cancel_button":
		        _gtk.gtk_font_selection_dialog_get_cancel_button
		}
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkWindow.__getattr__(self, attr)
	def get_font_name(self):
		return _gtk.gtk_font_selection_dialog_get_font_name(self._o)
	def get_font(self):
		return _gtk.gtk_font_selection_dialog_get_font(self._o)
	def set_font_name(self, name):
		return _gtk.gtk_font_selection_dialog_set_font_name(self._o,
								    name)
	def get_preview_text(self):
		return _gtk.gtk_font_selection_dialog_get_preview_text(self._o)
	def set_preview_text(self, text):
		_gtk.gtk_font_selection_dialog_set_preview_text(self._o, text)

class GtkPlug(GtkWindow):
	get_type = _gtk.gtk_plug_get_type
	def __init__(self, socket_id=-1, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_plug_new(socket_id)

class GtkBox(GtkContainer):
	get_type = _gtk.gtk_box_get_type
	def __init__(self, _obj=None):
		if nonint: return
	def pack_start(self, child, expand=TRUE, fill=TRUE, padding=0):
		_gtk.gtk_box_pack_start(self._o, child._o, expand,fill,padding)
	def pack_end(self, child, expand=TRUE, fill=TRUE, padding=0):
		_gtk.gtk_box_pack_end(self._o, child._o, expand,fill,padding)
	def reorder_child(self, child, pos):
		_gtk.gtk_box_reorder_child(self._o, child._o, pos)
	def set_homogeneous(self, homogeneous):
		_gtk.gtk_box_set_homogeneous(self._o, homogeneous)
	def set_spacing(self, spacing):
		_gtk.gtk_box_set_spacing(self._o, spacing)
	def query_child_packing(self, child):
		return _gtk.gtk_box_query_child_packing(self._o, child._o)
	def set_child_packing(self, child, expand, fill, padding, pack_type):
		_gtk.gtk_box_set_child_packing(self._o, child._o, expand, fill,
					       padding, pack_type)

class GtkHBox(GtkBox):
	get_type = _gtk.gtk_hbox_get_type
	def __init__(self, homogeneous=0, spacing=0, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_hbox_new(homogeneous, spacing)

class GtkCombo(GtkHBox):
	get_type = _gtk.gtk_combo_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_combo_new()
	def disable_activate(self, obj=None):
		_gtk.gtk_combo_disable_activate(self._o)
	def set_use_arrows(self, val):
		_gtk.gtk_combo_set_use_arrows(self._o, val)
	def set_use_arrows_always(self, val):
		_gtk.gtk_combo_set_use_arrows_always(self._o, val)
	def set_case_sensitive(self, val):
		_gtk.gtk_combo_set_case_sensitive(self._o, val)
	def set_item_string(self, item, val):
		_gtk.gtk_combo_set_item_string(self._o, item._o, val)
	def set_value_in_list(self, val, ok_if_empty):
		_gtk.gtk_combo_set_value_in_list(self._o, val, ok_if_empty)
	def set_popdown_strings(self, strings):
		_gtk.gtk_combo_set_popdown_strings(self._o, strings)
	def __getattr__(self, attr):
		attrs = {
			'entry': _gtk.gtk_combo_get_entry,
			'list':  _gtk.gtk_combo_get_list
	        }
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkHBox.__getattr__(self, attr)

class GtkStatusbar(GtkHBox):
	get_type = _gtk.gtk_statusbar_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_statusbar_new()
	def get_context_id(self, desc):
		return _gtk.gtk_statusbar_get_context_id(self._o, desc)
	def pop(self, cid):
		_gtk.gtk_statusbar_pop(self._o, cid)
	def push(self, cid, text):
		return _gtk.gtk_statusbar_push(self._o, cid, text)
	def remove(self, cid, msg_id):
		_gtk.gtk_statusbar_remove(self._o, cid, msg_id)

class GtkVBox(GtkBox):
	get_type = _gtk.gtk_vbox_get_type
	def __init__(self, homogeneous=0, spacing=0, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_vbox_new(homogeneous, spacing)

class GtkColorSelection(GtkVBox):
	get_type = _gtk.gtk_color_selection_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_color_selection_new()
	def set_update_policy(self, p):
		_gtk.gtk_color_selection_set_update_policy(self._o, p)
	def set_opacity(self, use_opacity):
		_gtk.gtk_color_selection_set_opacity(self._o, use_opacity)
	def set_color(self, c):
		_gtk.gtk_color_selection_set_color(self._o, c)
	def get_color(self):
		return _gtk.gtk_color_selection_get_color(self._o)

class GtkGammaCurve(GtkVBox):
	get_type = _gtk.gtk_gamma_curve_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_gamma_curve_new()
	def __getattr__(self, attr):
		if attr == 'gamma':
			return _gtk.gtk_gamma_curve_get_gamma(self._o)
		attrs = {
			'curve': _gtk.gtk_gamma_curve_get_curve,
			'gamma_dialog': _gtk.gtk_gamma_curve_get_gamma_dialog,
			'gamma_text': _gtk.gtk_gamma_curve_get_gamma_text,
			'table': _gtk.gtk_gamma_curve_get_table,
		}
		if attrs.has_key(attr):
			return _obj2inst(attrs[attr](self._o))
		return GtkVBox.__getattr__(self, attr)

class GtkButtonBox(GtkBox):
	get_type = _gtk.gtk_button_box_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def get_child_size_default(self):
		return _gtk.gtk_button_box_get_child_size_default()
	def get_child_ipadding_default(self):
		return _gtk.gtk_button_box_get_child_ipadding_default()
	def set_child_size_default(self, mw, mh):
		_gtk.gtk_button_box_set_child_size_default(mw, mh)
	def set_child_ipadding_default(self, ix, iy):
		_gtk.gtk_button_box_set_child_ipadding_default(ix, iy)
	def get_spacing(self):
		return _gtk.gtk_button_box_get_spacing(self._o)
	def get_layout(self):
		return _gtk.gtk_button_box_get_layout(self._o)
	def get_child_size(self):
		return _gtk.gtk_button_box_get_child_size(self._o)
	def get_child_ipadding(self):
		return _gtk.gtk_button_box_get_child_ipadding(self._o)
	def set_spacing(self, spacing):
		_gtk.gtk_button_box_set_spacing(self._o, spacing)
	def set_layout(self, layout):
		_gtk.gtk_button_box_set_layout(self._o, layout)
	def set_child_size(self, mw, mh):
		_gtk.gtk_button_box_set_child_size(self._o, mw, mh)
	def set_child_ipadding(self, ix, iy):
		_gtk.gtk_button_box_set_child_ipadding(self._o, ix, iy)

class GtkHButtonBox(GtkButtonBox):
	get_type = _gtk.gtk_hbutton_box_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_hbutton_box_new()
	def get_spacing_default(self):
		return _gtk.gtk_hbutton_box_get_spacing_default()
	def get_layout_default(self):
		return _gtk.gtk_hbutton_box_get_layout_default()
	def set_spacing_default(self, spacing):
		_gtk.gtk_hbutton_box_set_spacing_default(spacing)
	def set_layout_default(self, layout):
		_gtk.gtk_hbutton_box_set_layout_default(layout)

class GtkVButtonBox(GtkButtonBox):
	get_type = _gtk.gtk_vbutton_box_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_vbutton_box_new()
	def get_spacing_default(self):
		return _gtk.gtk_vbutton_box_get_spacing_default()
	def get_layout_default(self):
		return _gtk.gtk_vbutton_box_get_layout_default()
	def set_spacing_default(self, spacing):
		_gtk.gtk_vbutton_box_set_spacing_default(spacing)
	def set_layout_default(self, layout):
		_gtk.gtk_vbutton_box_set_layout_default(layout)

class GtkCList(GtkContainer):
	get_type = _gtk.gtk_clist_get_type
	def __init__(self, cols=1, titles=None, _obj=None):
		if _obj: self._o = _obj; return
		if titles == None:
			self._o = _gtk.gtk_clist_new(cols)
		else:
			self._o = _gtk.gtk_clist_new_with_titles(cols, titles)
	def __getattr__(self, attr):
		attrs = {
			'selection':_gtk.gtk_clist_get_selection,
			'focus_row':_gtk.gtk_clist_get_focus_row,
		}
		if attrs.has_key(attr):
			return attrs[attr](self._o)
		return GtkContainer.__getattr__(self, attr)
	def append(self, values):
		return _gtk.gtk_clist_append(self._o, values)
	def clear(self, obj=None):
		_gtk.gtk_clist_clear(self._o)
	def column_title_active(self, col):
		_gtk.gtk_clist_column_title_active(self._o, col)
	def column_title_passive(self, col):
		_gtk.gtk_clist_column_title_passive(self._o, col)
	def column_titles_active(self, obj=None):
		_gtk.gtk_clist_column_titles_active(self._o)
	def column_titles_hide(self, obj=None):
		_gtk.gtk_clist_column_titles_hide(self._o)
	def column_titles_passive(self, obj=None):
		_gtk.gtk_clist_column_titles_passive(self._o)
	def column_titles_show(self, obj=None):
		_gtk.gtk_clist_column_titles_show(self._o)
	def columns_autosize(self):
		return _gtk.gtk_clist_columns_autosize(self._o)
	def find_row_from_data(self, data):
		return _gtk.gtk_clist_find_row_from_data(self._o, data)
	def freeze(self, obj=None):
		_gtk.gtk_clist_freeze(self._o)
	def get_cell_style(self, row, col):
		return _gtk.gtk_clist_get_cell_style(self._o, row, col)
	def get_cell_type(self, r, c):
		return _gtk.gtk_clist_get_cell_type(self._o, r, c)
	def get_column_title(self, col):
		return _gtk.gtk_clist_get_column_title(self._o, col)
	def get_column_widget(self, col):
		return _obj2inst(_gtk.gtk_clist_get_column_widget(self._o,col))
	def get_row_data(self, row):
		return _gtk.gtk_clist_get_row_data(self._o, row)
	def get_row_style(self, row):
		return _gtk.gtk_clist_get_row_style(self._o, row)
	def get_text(self, r, c):
		return _gtk.gtk_clist_get_text(self._o, r, c)
	def get_pixmap(self, r, c):
		return _gtk.gtk_clist_get_pixmap(self._o, r, c)
	def get_pixtext(self, r, c):
		return _gtk.gtk_clist_get_pixtext(self._o, r, c)
	def get_selectable(self, row):
		return _gtk.gtk_clist_get_selectable(self._o, row)
	def get_selection_info(self, x, y):
		return _gtk.gtk_clist_get_selection_info(self._o, x, y)
	def insert(self, row, values):
		return _gtk.gtk_clist_insert(self._o, row, values)
	def moveto(self, row=-1, col=-1, row_align=0.5, col_align=0.5):
		_gtk.gtk_clist_moveto(self._o, row, col, row_align, col_align)
	def optimal_column_width(self, col):
		return _gtk.gtk_clist_optimal_column_width(self._o, col)
	def remove(self, row):
		_gtk.gtk_clist_remove(self._o, row)
	def row_is_visible(self, row):
		return _gtk.gtk_clist_row_is_visible(self._o, row)
	def row_move(self, soure_row, dest_row):
		_gtk.gtk_clist_row_move(self._o, source_row, dest_row)
	def select_all(self):
		_gtk.gtk_clist_select_all(self._o)
	def select_row(self, row, col):
		_gtk.gtk_clist_select_row(self._o, row, col)
	def set_auto_sort(self, auto_sort):
		_gtk.gtk_clist_set_auto_sort(self._o, auto_sort)
	def set_background(self, row, colour):
		_gtk.gtk_clist_set_background(self._o, row, colour)
	def set_cell_style(self, row, col, style):
		_gtk.gtk_clist_set_cell_style(self._o, row, col, style)
	def set_column_auto_resize(self, col, auto):
		_gtk.gtk_clist_set_column_auto_resize(self._o, col, auto)
	def set_column_justification(self, col, just):
		_gtk.gtk_clist_set_column_justification(self._o, col, just)
	def set_column_max_width(self, col, width):
		_gtk.gtk_clist_set_column_max_width(self._o, col, width)
	def set_column_min_width(self, col, width):
		_gtk.gtk_clist_set_column_min_width(self._o, col, width)
	def set_column_resizeable(self, col, resizeable):
		_gtk.gtk_clist_set_column_resizeable(self._o, col, resizeable)
	def set_column_title(self, col, title):
		_gtk.gtk_clist_set_column_title(self._o, col, title)
	def set_column_visibility(self, col, visible):
		_gtk.gtk_clist_set_column_visibility(self._o, col, visible)
	def set_column_widget(self, col, w):
		_gtk.gtk_clist_set_column_widget(self._o, col, w._o)
	def set_column_width(self, col, width):
		_gtk.gtk_clist_set_column_width(self._o, col, width)
	def set_foreground(self, row, colour):
		_gtk.gtk_clist_set_foreground(self._o, row, colour)
	def set_hadjustment(self, adj):
		_gtk.gtk_clist_set_hadjustment(self._o, adj._o)
	def set_vadjustment(self, adj):
		_gtk.gtk_clist_set_vadjustment(self._o, adj._o)
	def get_hadjustment(self):
		return GtkAdjusment(_obj=
				    _gtk.gtk_clist_get_hadjustment(self._o))
	def get_vadjustment(self):
		return GtkAdjusment(_obj=
				    _gtk.gtk_clist_get_vadjustment(self._o))
	def set_reorderable(self, reorderable):
		_gtk.gtk_clist_set_reorderable(self._o, reorderable)
	def set_use_drag_icons(self, use_icons):
		_gtk.gtk_clist_set_use_drag_icons(self._o, use_icons)
	def set_button_actions(self, button, button_actions):
		_gtk.gtk_clist_set_button_actions(self._o, button,
						  button_actions)
	def set_row_data(self, row, data):
		_gtk.gtk_clist_set_row_data(self._o, row, data)
	def set_row_height(self, height):
		_gtk.gtk_clist_set_row_height(self._o, height)
	def set_row_style(self, row, style):
		_gtk.gtk_clist_set_row_style(self._o, row, style)
	def set_shift(self, row, col, v, h):
		_gtk.gtk_clist_set_shift(self._o, row, col, v, h)
	def set_selectable(self, row, selectable):
		_gtk.gtk_clist_set_selectable(self._o, row, selectable)
	def set_selection_mode(self, mode):
		_gtk.gtk_clist_set_selection_mode(self._o, mode)
	def set_shadow_type(self, border):
		_gtk.gtk_clist_set_shadow_type(self._o, border)
	def set_sort_column(self, col):
		_gtk.gtk_clist_set_sort_column(self._o, col)
	def set_sort_type(self, sort_type):
		_gtk.gtk_clist_set_sort_type(self._o, sort_type)
	def set_text(self, r, c, text):
		_gtk.gtk_clist_set_text(self._o, r, c, text)
	def set_pixmap(self, r, c, pixmap, mask=None):
		if not mask and hasattr(pixmap, '_o'):
			pixmap, mask = pixmap.get()
		_gtk.gtk_clist_set_pixmap(self._o, r, c, pixmap, mask)
	def set_pixtext(self, r, c, text, spacing, pixmap, mask=None):
		if not mask and hasattr(pixmap, '_o'):
			pixmap, mask = pixmap.get()
		_gtk.gtk_clist_set_pixtext(self._o, r, c, text, spacing,
					   pixmap, mask)
	def sort(self):
		_gtk.gtk_clist_sort(self._o)
	def swap_rows(self, row1, row2):
		_gtk.gtk_clist_swap_rows(self._o, row1, row2)
	def thaw(self):
		_gtk.gtk_clist_thaw(self._o)
	def undo_selection(self):
		_gtk.gtk_clist_undo_selection(self._o)
	def unselect_all(self):
		_gtk.gtk_clist_unselect_all(self._o)
	def unselect_row(self, row, col):
		_gtk.gtk_clist_unselect_row(self._o, row, col)

class GtkCTree(GtkCList):
	get_type = _gtk.gtk_ctree_get_type
	def __init__(self, cols=1, tree_col=0, titles=None, _obj=None):
		if _obj: self._o = _obj; return
		if titles == None:
			self._o = _gtk.gtk_ctree_new(cols, tree_col)
		else:
			self._o = _gtk.gtk_ctree_new_with_titles(cols,
								 tree_col,
								 titles)
	def __getattr__(self, attr):
		attrs = {
			'selection':_gtk.gtk_ctree_get_selection,
		}
		if attrs.has_key(attr):
			return attrs[attr](self._o)
		return GtkCList.__getattr__(self, attr)
	def base_nodes(self):
		# this returns a list of the base nodes.  Useful for recursion
		return _gtk.gtk_ctree_base_nodes(self._o)
	def insert_node(self, parent, sibling, text, spacing=5,
			pixmap_closed=None, mask_closed=None,
			pixmap_opened=None, mask_opened=None, is_leaf=TRUE,
			expanded=FALSE):
		# parent and sibling can also be None
		return _gtk.gtk_ctree_insert_node(self._o, parent, sibling,
						  text, spacing,
						  pixmap_closed, mask_closed,
						  pixmap_opened, mask_opened,
						  is_leaf, expanded)
	def remove_node(self, node):
		_gtk.gtk_ctree_remove_node(self._o, node)
	def is_viewable(self, node):
		return _gtk.gtk_ctree_is_viewable(self._o, node)
	def last(self, node):
		return _gtk.gtk_ctree_last(self._o, node)
	def node_nth(self, row):
		return _gtk.gtk_ctree_node_nth(self._o, row)
	def find(self, node, child):
		return _gtk.gtk_ctree_find(self._o, node, child)
	def is_ancestor(self, node, child):
		return _gtk.gtk_ctree_is_ancestor(self._o, node, child)
	def find_by_row_data(self, node, data):
		return _gtk.gtk_ctree_find_by_row_data(self._o, node, data)
	def find_all_by_row_data(self, node, data):
		return _gtk.gtk_ctree_find_all_by_row_data(self._o, node, data)
	def is_hot_spot(self, x, y):
		return _gtk.gtk_ctree_is_hot_spot(self._o, x, y)
	def move(self, node, new_parent, new_sibling):
		_gtk.gtk_ctree_move(self._o, node, new_parent, new_sibling)
	def expand(self, node):
		_gtk.gtk_ctree_expand(self._o, node)
	def expand_recursive(self, node):
		_gtk.gtk_ctree_expand_recursive(self._o, node)
	def expand_to_depth(self, node, depth):
		_gtk.gtk_ctree_expand_to_depth(self._o, node, depth)
	def collapse(self, node):
		_gtk.gtk_ctree_collapse(self._o, node)
	def collapse_recursive(self, node):
		_gtk.gtk_ctree_collapse_recursive(self._o, node)
	def collapse_to_depth(self, node, depth):
		_gtk.gtk_ctree_collapse_to_depth(self._o, node, depth)
	def toggle_expansion(self, node):
		_gtk.gtk_ctree_toggle_expansion(self._o, node)
	def toggle_expansion_recursive(self, node):
		_gtk.gtk_ctree_toggle_expansion_recursive(self._o, node)
	def select(self, node):
		_gtk.gtk_ctree_select(self._o, node)
	def select_recursive(self, node):
		_gtk.gtk_ctree_select_recursive(self._o, node)
	def unselect(self, node):
		_gtk.gtk_ctree_unselect(self._o, node)
	def unselect_recursive(self, node):
		_gtk.gtk_ctree_unselect_recursive(self._o, node)
	def real_select_recursive(self, node, state):
		_gtk.gtk_ctree_real_select_recursive(self._o, node, state)
	def node_set_text(self, node, col, text):
		_gtk.gtk_ctree_node_set_text(self._o, node, col, text)
	def node_set_pixmap(self, node, col, pixmap, mask):
		_gtk.gtk_ctree_node_set_pixmap(self._o, node, col, pixmap,mask)
	def node_set_pixtext(self, node, col, text, spacing, pixmap, mask):
		_gtk.gtk_ctree_node_set_pixtext(self._o, node, col, text,
						spacing, pixmap, mask)
	def set_node_info(self, node, text, spacing, pixmap_closed,
			  mask_closed, pixmap_opened, mask_opened, is_leaf,
			  expanded):
		_gtk.gtk_ctree_set_node_info(self._o, node, text, spacing,
					     pixmap_closed, mask_closed,
					     pixmap_opened, mask_opened,
					     is_leaf, expanded)
	def node_set_shift(self, node, col, vert, horiz):
		_gtk.gtk_ctree_node_set_shift(self._o, node, col, vert, horiz)
	def node_set_selectable(self, node, selectable):
		_gtk.gtk_ctree_node_set_selectable(self._o, node, selectable)
	def node_get_cell_type(self, node, col):
		return _gtk.gtk_ctree_node_get_cell_type(self._o, node, col)
	def node_get_text(self, node, col):
		return _gtk.gtk_ctree_node_get_text(self._o, node, col)
	def node_get_pixmap(self, node, col):
		return _gtk.gtk_ctree_node_get_pixmap(self._o, node, col)
	def node_get_pixtext(self, node, col):
		return _gtk.gtk_ctree_node_get_pixtext(self._o, node, col)
	def get_node_info(self, node):
		return _gtk.gtk_ctree_get_node_info(self._o, node)
	def node_set_row_style(self, node, style):
		_gtk.gtk_ctree_node_set_row_style(self._o, node, style)
	def node_get_row_style(self, node):
		return _gtk.gtk_ctree_node_get_row_style(self._o, node)
	def node_set_cell_style(self, node, col, style):
		_gtk.gtk_ctree_node_set_row_style(self._o, node, col, style)
	def node_get_cell_style(self, node, col):
		return _gtk.gtk_ctree_node_get_row_style(self._o, node, col)
	def node_set_foreground(self, node, color):
		_gtk.gtk_ctree_node_set_foreground(self._o, node, color)
	def node_set_background(self, node, color):
		_gtk.gtk_ctree_node_set_background(self._o, node, color)
	def node_set_row_data(self, node, data):
		_gtk.gtk_ctree_node_set_row_data(self._o, node, data)
	def node_get_row_data(self, node):
		return _gtk.gtk_ctree_node_get_row_data(self._o, node)
	def node_moveto(self, node, col, row_align, col_align):
		_gtk.gtk_ctree_node_moveto(self._o, node, col, row_align,
					   col_align)
	def node_is_visible(self, node):
		return _gtk.gtk_ctree_node_is_visible(self._o, node)
	def set_indent(self, indent):
		_gtk.gtk_ctree_set_indent(self._o, indent)
	def set_spacing(self, spacing):
		_gtk.gtk_ctree_set_spacing(self._o, spacing)
	def set_show_stub(self, show_stub):
		_gtk.gtk_ctree_set_show_stub(self._o, show_stub)
	def set_line_style(self, style):
		_gtk.gtk_ctree_set_line_style(self._o, style)
	def set_expander_style(self, style):
		_gtk.gtk_ctree_set_expander_style(self._o, style)
	def sort_node(self, node):
		_gtk.gtk_ctree_sort_node(self._o, node)
	def sort_recursive(self, node):
		_gtk.gtk_ctree_sort_recursive(self._o, node)

class GtkFixed(GtkContainer):
	get_type = _gtk.gtk_fixed_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_fixed_new()
	def put(self, child, x, y):
		_gtk.gtk_fixed_put(self._o, child._o, x, y)
	def move(self, child, x, y):
		_gtk.gtk_fixed_move(self._o, child._o, x, y)

class GtkLayout(GtkContainer):
	get_type = _gtk.gtk_layout_get_type
	def __init__(self, hadj=None, vadj=None, _obj=None):
		if _obj: self._o = _obj; return
		if hadj and vadj:
			self._o = _gtk.gtk_layout_new(hadj._o, vadj._o)
		else:
			self._o = _gtk.gtk_layout_new()
	def put(self, child, x, y):
		_gtk.gtk_layout_put(self._o, child._o, x, y)
	def move(self, child, x, y):
		_gtk.gtk_layout_move(self._o, child._o, x, y)
	def set_size(self, width, height):
		_gtk.gtk_layout_set_size(self._o, width, height)
	def freeze(self):
		_gtk.gtk_layout_freeze(self._o)
	def thaw(self):
		_gtk.gtk_layout_thaw(self._o)
	def get_hadjustment(self):
		return GtkAdjustment(
			_obj=_gtk.gtk_layout_get_hadjustment(self._o))
	def get_vadjustment(self):
		return GtkAdjustment(
			_obj=_gtk.gtk_layout_get_vadjustment(self._o))
	def set_hadjustment(self, adj):
		_gtk.gtk_layout_set_hadjustment(self._o, adj._o)
	def set_vadjustment(self, adj):
		_gtk.gtk_layout_set_vadjustment(self._o, adj._o)

class GtkList(GtkContainer):
	get_type = _gtk.gtk_list_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_list_new()
	def get_selection(self):
		l = _gtk.gtk_list_get_selection(self._o)
		return map(_obj2inst, l)
	def insert_items(self, items, pos):
		items = map(lambda i: i._o, items)
		_gtk.gtk_list_insert_items(self._o, items, pos)
	def append_items(self, items):
		items = map(lambda i: i._o, items)
		_gtk.gtk_list_append_items(self._o, items)
	def prepend_items(self, items):
		items = map(lambda i: i._o, items)
		_gtk.gtk_list_prepend_items(self._o, items)
	def remove_items(self, items):
		items = map(lambda i: i._o, items)
		_gtk.gtk_list_remove_items(self._o, items)
	def clear_items(self, start, end):
		_gtk.gtk_list_clear_items(self._o, start, end)
	def select_item(self, item):
		_gtk.gtk_list_select_item(self._o, item)
	def unselect_item(self, item):
		_gtk.gtk_list_unselect_item(self._o, item)
	def select_child(self, child):
		_gtk.gtk_list_select_child(self._o, child._o)
	def unselect_child(self, child):
		_gtk.gtk_list_unselect_child(self._o, child._o)
	def child_position(self, child):
		return _gtk.gtk_list_child_position(self._o, child._o)
	def set_selection_mode(self, mode):
		_gtk.gtk_list_set_selection_mode(self._o, mode)
	def extend_selection(self, scroll_type, pos, auto):
		_gtk.gtk_list_extend_selection(self._o, scroll_type, pos, auto)
	def start_selection(self):
		_gtk.gtk_list_start_selection(self._o)
	def end_selection(self):
		_gtk.gtk_list_end_selection(self._o)
	def select_all(self):
		_gtk.gtk_list_select_all(self._o)
	def unselect_all(self):
		_gtk.gtk_list_unselect_all(self._o)
	def scroll_horizontal(self, scroll_type, pos):
		_gtk.gtk_list_scroll_horizontal(self._o, scroll_type, pos)
	def scroll_vertical(self, scroll_type, pos):
		_gtk.gtk_list_scroll_vertical(self._o, scroll_type, pos)
	def toggle_add_mode(self):
		_gtk.gtk_list_toggle_add_mode(self._o)
	def toggle_focus_row(self):
		_gtk.gtk_list_toggle_focus_row(self._o)
	def toggle_row(self, item):
		_gtk.gtk_list_toggle_row(self._o, item._o)
	def undo_selection(self):
		_gtk.gtk_list_undo_selection(self._o)
	def end_drag_selection(self):
		_gtk.gtk_list_end_drag_selection(self._o)

class GtkMenuShell(GtkContainer):
	get_type = _gtk.gtk_menu_shell_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def append(self, child):
		_gtk.gtk_menu_shell_append(self._o, child._o)
	def prepend(self, child):
		_gtk.gtk_menu_shell_prepend(self._o, child._o)
	def insert(self, child, pos):
		_gtk.gtk_menu_shell_insert(self._o, child._o, pos)
	def deactivate(self, obj=None):
		_gtk.gtk_menu_shell_deactivate(self._o)
	def select_item(self, item):
		_gtk.gtk_menu_shell_select_item(self._o, item._o)
	def deselect(self):
		_gtk.gtk_menu_shell_deselect(self._o)
	def activate_item(self, item, force_deactivate):
		_gtk.gtk_menu_shell_activate_item(self._o, item._o,
						  force_deactivate)

class GtkMenuBar(GtkMenuShell):
	get_type = _gtk.gtk_menu_bar_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_menu_bar_new()
	def append(self, child):
		_gtk.gtk_menu_bar_append(self._o, child._o)
	def prepend(self, child):
		_gtk.gtk_menu_bar_prepend(self._o, child._o)
	def insert(self, child, pos):
		_gtk.gtk_menu_bar_insert(self._o, child._o, pos)
	def set_shadow_type(self, type):
		_gtk.gtk_menu_bar_set_shadow_type(self._o, type)

class GtkMenu(GtkMenuShell):
	get_type = _gtk.gtk_menu_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_menu_new()
	def append(self, child):
		_gtk.gtk_menu_append(self._o, child._o)
	def prepend(self, child):
		_gtk.gtk_menu_prepend(self._o, child._o)
	def insert(self, child, pos):
		_gtk.gtk_menu_insert(self._o, child._o, pos)
	def popup(self, pms, pmi, func, button, time):
		if pms: pms = pms._o
		if pmi: pmi = pmi._o
		_gtk.gtk_menu_popup(self._o, pms, pmi, func, button, time)
	def reposition(self):
		_gtk.gtk_menu_reposition(self._o)
	def popdown(self, obj=None):
		_gtk.gtk_menu_popdown(self._o)
	def get_active(self):
		return _obj2inst(_gtk.gtk_menu_get_active(self._o))
	def get_attach_widget(self):
		return _obj2inst(_gtk.gtk_menu_get_attach_widget(self._o))
	def detach(self):
		_gtk.gtk_menu_detach(self._o)
	def set_active(self, index):
		_gtk.gtk_menu_set_active(self._o, index)
	def set_accel_group(self, group):
		_gtk.gtk_menu_set_accel_group(self._o, group._ag)
	def get_accel_group(self):
		return GtkAccelGroup(_obj=
				     _gtk.gtk_menu_get_accel_group(self._o))
	def set_tearoff_state(self, torn_off):
		_gtk.gtk_menu_set_tearoff_state(self._o, torn_off)
	def set_title(self, title):
		_gtk.gtk_menu_set_title(self._o, title)
	def reorder_child(self, child, position):
		_gtk.gtk_menu_reorder_child(self._o, child._o, position)

class GtkNotebook(GtkContainer):
	get_type = _gtk.gtk_notebook_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_notebook_new()
	def append_page(self, child, tab):
		_gtk.gtk_notebook_append_page(self._o, child._o, tab._o)
	def append_page_menu(self, child, tab, ml):
		_gtk.gtk_notebook_append_page_menu(self._o, child._o, tab._o,
						   ml._o)
	def prepend_page(self, child, tab):
		_gtk.gtk_notebook_prepend_page(self._o, child._o, tab._o)
	def prepend_page_menu(self, child, tab, ml):
		_gtk.gtk_notebook_prepend_page_menu(self._o, child._o, tab._o,
						    ml._o)
	def insert_page(self, child, tab, pos):
		_gtk.gtk_notebook_insert_page(self._o, child._o, tab._o, pos)
	def insert_page_menu(self, child, tab, ml, pos):
		_gtk.gtk_notebook_insert_page_menu(self._o, child._o, tab._o,
						   ml._o, pos)
	def remove_page(self, pos):
		_gtk.gtk_notebook_remove_page(self._o, pos)
	def current_page(self):
		print "current_page deprecated -- use get_current_page"
		return self.current_page()
	def get_current_page(self):
		return _gtk.gtk_notebook_get_current_page(self._o)
	def get_nth_page(self, page_num):
		return _obj2inst(_gtk.gtk_notebook_get_nth_page(self._o,
								page_num))
	def page_num(self, child):
		return _gtk.gtk_notebook_page_num(self._o, child._o)
	def set_page(self, pos):
		_gtk.gtk_notebook_set_page(self._o, pos)
	def next_page(self, obj=None):
		_gtk.gtk_notebook_next_page(self._o)
	def prev_page(self, obj=None):
		_gtk.gtk_notebook_prev_page(self._o)
	def reorder_child(self, child, pos):
		_gtk.gtk_notebook_reorder_child(self._o, child._o, pos)
	def set_tab_border(self, border):
		_gtk.gtk_notebook_set_tab_border(self._o, border)
	def set_tab_hborder(self, tab_hborder):
		_gtk.gtk_notebook_set_tab_hborder(self._o, tab_hborder)
	def set_tab_vborder(self, tab_vborder):
		_gtk.gtk_notebook_set_tab_hborder(self._o, tab_vborder)
	def get_tab_pos(self):
		return _gtk.gtk_notebook_get_tab_pos(self._o)
	def set_tab_pos(self, pos):
		_gtk.gtk_notebook_set_tab_pos(self._o, pos)
	def set_homogeneous_tabs(self, homog):
		_gtk.gtk_notebook_set_homogeneous_tabs(self._o, homog)
	def set_scrollable(self, scrollable):
		_gtk.gtk_notebook_set_scrollable(self._o, scrollable)
	def set_show_tabs(self, show):
		_gtk.gtk_notebook_set_show_tabs(self._o, show)
	def set_show_border(self, show):
		_gtk.gtk_notebook_set_show_border(self._o, show)
	def popup_enable(self, obj=None):
		_gtk.gtk_notebook_popup_enable(self._o)
	def popup_disable(self, obj=None):
		_gtk.gtk_notebook_popup_disable(self._o)
	def query_tab_label(self, child):
		print "query_tab_label deprecated -- use get_tab_label"
		return self.get_tab_label(child)
	def get_tab_label(self, child):
		return _obj2inst(_gtk.gtk_notebook_get_tab_label(self._o,
								 child._o))
	def set_tab_label(self, child, tab_label):
		_gtk.gtk_notebook_set_tab_label(self._o, child._o,
						tab_label._o)
	def set_tab_label_text(self, child, tab_text):
		_gtk.gtk_notebook_set_tab_label_text(self._o, child._o,
						     tab_text)
	def query_menu_label(self, child):
		print "query_menu_label deprecated -- use get_menu_label"
		return self.get_menu_label(child)
	def get_menu_label(self, child):
		return _obj2inst(_gtk.gtk_notebook_get_menu_label(self._o,
								  child._o))
	def set_menu_label(self, child, menu_label):
		_gtk.gtk_notebook_set_menu_label(self._o, child._o,
						menu_label._o)
	def set_menu_label_text(self, child, menu_text):
		_gtk.gtk_notebook_set_menu_label(self._o, child._o, menu_text)
	def query_tab_label_packing(self, child):
		# returns (expand,fill,pack_type)
		return _gtk.gtk_notebook_query_tab_label_packing(self._o,
								 child._o)
	def set_tab_label_packing(self, child, expand, fill, pack_type):
		_gtk.gtk_notebook_set_tab_label_packing(self._o, child._o,
							expand, fill,
							pack_type)

class GtkFontSelection(GtkNotebook):
	get_type = _gtk.gtk_font_selection_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_font_selection_new()
	def get_font_name(self):
		return _gtk.gtk_font_selection_get_font_name(self._o)
	def get_font(self):
		return _gtk.gtk_font_selection_get_font(self._o)
	def set_font_name(self, name):
		return _gtk.gtk_font_selection_set_font_name(self._o, name)
	def get_preview_text(self):
		return _gtk.gtk_font_selection_get_preview_text(self._o)
	def set_preview_text(self, text):
		_gtk.gtk_font_selection_set_preview_text(self._o, text)

class GtkPacker(GtkContainer):
	get_type = _gtk.gtk_packer_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_packer_new()
	def add_defaults(self, child, side, anchor, options):
		_gtk.gtk_packer_add_defaults(self._o, child._o, side, anchor,
					     options)
	def add(self, child, side=SIDE_TOP, anchor=ANCHOR_CENTER,
		options=0, border_width=0, pad_x=0, pad_y=0,
		 i_pad_x=0, i_pad_y=0):
		_gtk.gtk_packer_add(self._o, child._o, side, anchor, options,
				    border_width, pad_x, pad_y, i_pad_x,
				    i_pad_y)
	def configure(self, child, side, anchor, options, border_width, pad_x,
		      pad_y, i_pad_x, i_pad_y):
		print "configure deprecated -- use set_child_packing"
		self.set_child_packing(child, side, anchor, options,
				       border_width, pad_x, pad_y, i_pad_x,
				       i_pad_y)
	def set_child_packing(self, child, side, anchor, options,
			      border_width, pad_x, pad_y, i_pad_x, i_pad_y):
		_gtk.gtk_packer_set_child_packing(self._o, child._o, side,
						  anchor, options,
						  border_width, pad_x, pad_y,
						  i_pad_x, i_pad_y)
	def reorder_child(self, child, pos):
		_gtk.gtk_packer_reorder_child(self._o, child._o, pos)
	def set_spacing(self, spacing):
		_gtk.gtk_packer_set_spacing(self._o, spacing)
	def set_default_pad(self, pad_x, pad_y):
		_gtk.gtk_packer_set_default_pad(self._o, pad_x, pad_y)
	def set_default_ipad(self, i_pad_x, i_pad_y):
		_gtk.gtk_packer_set_default_ipad(self._o, i_pad_x, i_pad_y)

class GtkPaned(GtkContainer):
	get_type = _gtk.gtk_paned_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def add1(self, child):
		_gtk.gtk_paned_add1(self._o, child._o)
	def add2(self, child):
		_gtk.gtk_paned_add2(self._o, child._o)
	def pack1(self, child, resize=TRUE, shrink=TRUE):
		_gtk.gtk_paned_pack1(self._o, child._o, resize, shrink)
	def pack2(self, child, resize=TRUE, shrink=TRUE):
		_gtk.gtk_paned_pack2(self._o, child._o, resize, shrink)
	def set_position(self, position):
		_gtk.gtk_paned_set_position(self._o, position)
	def handle_size(self, size):
		print "handle_size deprecated -- use set_handle_size"
		self.set_handle_size(size)
	def set_handle_size(self, size):
		_gtk.gtk_paned_set_handle_size(self._o, size)
	def gutter_size(self, size):
		print "gutter_size deprecated -- use set_gutter_size"
		self.set_gutter_size(size)
	def set_gutter_size(self, size):
		_gtk.gtk_paned_set_gutter_size(self._o, size)

class GtkHPaned(GtkPaned):
	get_type = _gtk.gtk_hpaned_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_hpaned_new()

class GtkVPaned(GtkPaned):
	get_type = _gtk.gtk_vpaned_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_vpaned_new()

class GtkScrolledWindow(GtkBin):
	get_type = _gtk.gtk_scrolled_window_get_type
	def __init__(self, hadj=None, vadj=None, _obj=None):
		if _obj: self._o = _obj; return
		if hadj: hadj = hadj._o
		if vadj: vadj = vadj._o
		self._o = _gtk.gtk_scrolled_window_new(hadj, vadj)
	def get_hadjustment(self):
		return _obj2inst(_gtk.gtk_scrolled_window_get_hadjustment(
			self._o))
	def get_vadjustment(self):
		return _obj2inst(_gtk.gtk_scrolled_window_get_vadjustment(
			self._o))
	def set_hadjustment(self, adjustment):
		_gtk.gtk_scrolled_window_set_hadjustment(self._o,adjustment._o)
	def set_vadjustment(self, adjustment):
		_gtk.gtk_scrolled_window_set_vadjustment(self._o,adjustment._o)
	def set_policy(self, hp, vp):
		_gtk.gtk_scrolled_window_set_policy(self._o, hp, vp)
	def set_placement(self, window_place):
		_gtk.gtk_scrolled_window_set_placement(self._o, window_place)
	def add_with_viewport(self, child):
		_gtk.gtk_scrolled_window_add_with_viewport(self._o, child._o)

class GtkSocket(GtkContainer):
	get_type = _gtk.gtk_socket_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_socket_new()
	def steal(self, wid):
		_gtk.gtk_socket_steal(self._o, wid)

class GtkTable(GtkContainer):
	get_type = _gtk.gtk_table_get_type
	def __init__(self, rows=1, cols=1, homogeneous=0, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_table_new(rows, cols, homogeneous)
	def attach(self, child, la, ra, ta, ba, xoptions=EXPAND|FILL,
			yoptions=EXPAND|FILL, xpadding=0, ypadding=0):
		_gtk.gtk_table_attach(self._o, child._o, la,ra,ta,ba,
			xoptions,yoptions, xpadding,ypadding)
	def set_row_spacing(self, row, s):
		_gtk.gtk_table_set_row_spacing(self._o, row, s)
	def set_col_spacing(self, col, s):
		_gtk.gtk_table_set_col_spacing(self._o, col, s)
	def set_row_spacings(self, s):
		_gtk.gtk_table_set_row_spacings(self._o, s)
	def set_col_spacings(self, s):
		_gtk.gtk_table_set_col_spacings(self._o, s)
	def set_homogeneous(self, homogeneous):
	        _gtk.gtk_table_set_homogeneous(self._o, homogeneous)

class GtkTree(GtkContainer):
	get_type = _gtk.gtk_tree_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_tree_new()
	def get_selection(self):
		return map(_obj2inst, _gtk.gtk_tree_get_selection(self._o))
	def append(self, child):
		_gtk.gtk_tree_append(self._o, child._o)
	def prepend(self, child):
		_gtk.gtk_tree_prepend(self._o, child._o)
	def insert(self, child, pos):
		_gtk.gtk_tree_insert(self._o, child._o, pos)
	def remove_item(self, child):
		# fix this when the function starts existing
		#_gtk.gtk_tree_remove_item(self._o, child._o)
		self.remove_items([child])
	def remove_items(self, children):
		children = map(lambda x: x._o, children)
		_gtk.gtk_tree_remove_items(self._o, children)
	def clear_items(self, start, end):
		_gtk.gtk_tree_clear_items(self._o, start, end)
	def select_item(self, item):
		_gtk.gtk_tree_select_item(self._o, item)
	def unselect_item(self, item):
		_gtk.gtk_tree_unselect_item(self._o, item)
	def select_child(self, child):
		_gtk.gtk_tree_select_child(self._o, child._o)
	def unselect_child(self, child):
		_gtk.gtk_tree_unselect_child(self._o, child._o)
	def child_position(self, child):
		return _gtk.gtk_tree_child_position(self._o, child._o)
	def set_selection_mode(self, mode):
		_gtk.gtk_tree_set_selection_mode(self._o, mode)
	def set_view_mode(self, mode):
		_gtk.gtk_tree_set_view_mode(self._o, mode)
	def set_view_lines(self, flag):
		_gtk.gtk_tree_set_view_lines(self._o, flag)

class GtkToolbar(GtkContainer):
	get_type = _gtk.gtk_toolbar_get_type
	def __init__(self, orientation=ORIENTATION_HORIZONTAL,
		     style=TOOLBAR_ICONS, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_toolbar_new(orientation, style)
        def append_item(self, text, tooltip, tp, icon, callback):
		return _obj2inst(_gtk.gtk_toolbar_append_item(
			self._o, text, tooltip, tp, icon._o, callback))
	def append_space(self):
		_gtk.gtk_toolbar_append_space(self._o)
	def append_widget(self, w, tooltip, tp):
		_gtk.gtk_toolbar_append_widget(self._o, w._o, tooltip, tp)
	def insert_item(self, text, tooltip, tp, icon, callback, pos):
		return _obj2inst(_gtk.gtk_toolbar_insert_item(
			self._o, text, tooltip, tp, icon._o, callback, pos))
	def insert_space(self, pos):
		_gtk.gtk_toolbar_insert_space(self._o, pos)
	def insert_widget(self, w, tooltip, tp, pos):
		_gtk.gtk_toolbar_insert_widget(self._o, w._o, tooltip, tp, pos)
	def prepend_item(self, text, tooltip, tp, icon, callback):
		return _obj2inst(_gtk.gtk_toolbar_prepend_item(
			self._o, text, tooltip, tp, icon._o, callback))
	def prepend_space(self):
		_gtk.gtk_toolbar_prepend_space(self._o)
	def prepend_widget(self, w, tooltip, tp):
		_gtk.gtk_toolbar_prepend_widget(self._o, w._o, tooltip, tp)
       	def set_orientation(self, orientation):
		_gtk.gtk_toolbar_set_orientation(self._o, orientation)
	def set_style(self, style):
		_gtk.gtk_toolbar_set_style(self._o, style)
	def set_space_size(self, size):
		_gtk.gtk_toolbar_set_space_size(self._o, size)
	def set_space_style(self, style):
		_gtk.gtk_toolbar_set_space_style(self._o, style)
	def set_tooltips(self, enable):
		_gtk.gtk_toolbar_set_tooltips(self._o, enable)
	def set_button_relief(self, relief):
		_gtk.gtk_toolbar_set_button_relief(self._o, relief)
	def get_button_relief(self):
		return _gtk.gtk_toolbar_get_button_relief(self._o)

class GtkDrawingArea(GtkWidget):
	get_type = _gtk.gtk_drawing_area_get_type
	def __init__(self, _obj=None):
		self.__win = None
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_drawing_area_new()
	def size(self, w, h):
		_gtk.gtk_drawing_area_size(self._o, w, h)
	def __cache_win(self):
		self.realize()
		self.__win = self.get_window()
	def draw_point(self, gc, x, y):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_point(self.__win, gc, x, y)
	def draw_line(self, gc, x1, y1, x2, y2):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_line(self.__win, gc, x1, y1, x2, y2)
	def draw_rectangle(self, gc, fill, x, y, width, height):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_rectangle(self.__win, gc, fill, x, y,
					width, height)
	def draw_arc(self, gc, fill, x, y, width, height, angle1, angle2):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_arc(self.__win, gc, fill, x, y, width, height,
				  angle1, angle2)
	def draw_polygon(self, gc, fill, points):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_polygon(self.__win, gc, fill, points)
	def draw_string(self, font, gc, x, y, string):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_string(self.__win, font, gc, x, y, string)
	def draw_text(self, font, gc, x, y, text):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_text(self.__win, font, gc, x, y, text)
	def draw_pixmap(self, gc, src, xsrc,ysrc, xdest,ydest, width,height):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_pixmap(self.__win, gc, src, xsrc,ysrc,
				     xdest,ydest, width,height)
	def draw_points(self, gc, points):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_points(self.__win, gc, points)
	def draw_segments(self, gc, segs):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_segments(self.__win, gc, segs)
	def draw_lines(self, gc, points):
		if not self.__win: self.__cache_win()
		_gtk.gdk_draw_lines(self.__win, gc, points)

class GtkCurve(GtkDrawingArea):
	get_type = _gtk.gtk_curve_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_curve_new()
	def reset(self):
		_gtk.gtk_curve_reset(self._o)
	def get_vector(self, size=-1):
		return _gtk.gtk_curve_get_vector(self._o, size)
	def set_vector(self, vector):
		_gtk.gtk_curve_set_vector(self._o, vector)
	def set_gamma(self, g):
		_gtk.gtk_curve_set_gamma(self._o, g)
	def set_range(self, minx,maxx, miny,maxy):
		_gtk.gtk_curve_set_range(self._o, minx,maxx, miny,maxy)
	def set_curve_type(self, tp):
		_gtk.gtk_curve_set_curve_type(self._o, tp)

class GtkEditable(GtkWidget):
	get_type = _gtk.gtk_editable_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def select_region(self, start, end):
		_gtk.gtk_editable_select_region(self._o, start, end)
	def insert_text(self, new_text):
		return _gtk.gtk_editable_insert_text(self._o, new_text)
	def delete_text(self, start, end):
		_gtk.gtk_editable_delete_text(self._o, start, end)
	def get_chars(self, start, end):
		return _gtk.gtk_editable_get_chars(self._o, start, end)
	def cut_clipboard(self):
		_gtk.gtk_editable_cut_clipboard(self._o)
	def copy_clipboard(self):
		_gtk.gtk_editable_copy_clipboard(self._o)
	def paste_clipboard(self):
		_gtk.gtk_editable_paste_clipboard(self._o)
	def claim_selection(self, claim, time):
		_gtk.gtk_editable_claim_selection(self._o, claim, time)
	def delete_selection(self):
		_gtk.gtk_editable_delete_selection(self._o)
	def changed(self):
		_gtk.gtk_editable_changed(self._o)
	def set_position(self, pos):
		_gtk.gtk_editable_set_position(self._o, pos)
	def get_position(self):
		return _gtk.gtk_editable_get_position(self._o)
	def set_editable(self, is_editable):
		_gtk.gtk_editable_set_editable(self._o, is_editable)

class GtkEntry(GtkEditable):
	get_type = _gtk.gtk_entry_get_type
	def __init__(self, maxlen=-1, _obj=None):
		if _obj: self._o = _obj; return
		if maxlen == -1:
			self._o = _gtk.gtk_entry_new()
		else:
			self._o = _gtk.gtk_entry_new_with_max_length(maxlen)
	def set_text(self, text):
		_gtk.gtk_entry_set_text(self._o, text)
	def append_text(self, text):
		_gtk.gtk_entry_append_text(self._o, text)
	def prepend_text(self, text):
		_gtk.gtk_entry_prepend_text(self._o, text)
	def set_position(self, pos):
		_gtk.gtk_entry_set_position(self._o, pos)
	def get_text(self):
		return _gtk.gtk_entry_get_text(self._o)
	def select_region(self, start, stop):
		_gtk.gtk_entry_select_region(self._o, start, stop)
	def set_visibility(self, visible):
		_gtk.gtk_entry_set_visibility(self._o, visible)
	def set_editable(self, editable):
		_gtk.gtk_entry_set_editable(self._o, editable)
	def set_max_length(self, max):
		_gtk.gtk_entry_set_max_length(self._o, max)

class GtkSpinButton(GtkEntry):
	get_type = _gtk.gtk_spin_button_get_type
	def __init__(self, adj=None, climb_rate=1, digits=1, _obj=None):
		if _obj: self._o = _obj; return
		if adj:
			adj = adj._o
		self._o = _gtk.gtk_spin_button_new(adj, climb_rate, digits)
	def set_adjustment(self, adj):
		_gtk.gtk_spin_button_set_adjustment(self._o, adj._o)
	def get_adjustment(self):
		return _obj2inst(_gtk.gtk_spin_button_get_adjustment(sel._o))
	def set_digits(self, digits):
		_gtk.gtk_spin_button_set_digits(self._o, digits)
	def get_value_as_float(self):
		return _gtk.gtk_spin_button_get_value_as_float(self._o)
	def get_value_as_int(self):
		return _gtk.gtk_spin_button_get_value_as_int(self._o)
	get_value = get_value_as_float
	def set_value(self, val):
		_gtk.gtk_spin_button_set_value(self._o, val)
	def set_update_policy(self, pol):
		_gtk.gtk_spin_button_set_update_policy(self._o, pol)
	def set_numeric(self, numeric):
		_gtk.gtk_spin_button_set_numeric(self._o, numeric)
	def spin(self, direction, step):
		_gtk.gtk_spin_button_spin(self._o, direction, step)
	def set_wrap(self, wrap):
	        _gtk.gtk_spin_button_set_wrap(self._o, wrap)
	def set_shadow_type(self, shadow_type):
		_gtk.gtk_spin_button_set_shadow_type(self._o, shadow_type)
	def set_snap_to_ticks(self, snap):
		_gtk.gtk_spin_button_set_snap_to_ticks(self._o, snap)
	def update(self):
		_gtk.gtk_spin_button_update(self._o)

class GtkText(GtkEditable):
	get_type = _gtk.gtk_text_get_type
	def __init__(self, hadj=None, vadj=None, _obj=None):
		if _obj: self._o = _obj; return
		if hadj: hadj = hadj._o
		if vadj: vadj = vadj._o
		self._o = _gtk.gtk_text_new(hadj, vadj)
	def set_editable(self, editable):
		_gtk.gtk_text_set_editable(self._o, editable)
	def set_word_wrap(self, word_wrap):
		_gtk.gtk_text_set_word_wrap(self._o, word_wrap)
	def set_line_wrap(self, line_wrap):
		_gtk.gtk_text_set_line_wrap(self._o, line_wrap)
	def set_adjustments(self, hadj, vadj):
		_gtk.gtk_text_set_adjustments(self._o, hadj._o, vadj._o)
	def get_hadjustment(self):
		return _obj2inst(_gtk.gtk_text_get_hadj(self._o))
	def get_vadjustment(self):
		return _obj2inst(_gtk.gtk_text_get_vadj(self._o))
	def set_point(self, point):
		_gtk.gtk_text_set_point(self._o, point)
	def get_point(self):
		return _gtk.gtk_text_get_point(self._o)
	def get_length(self):
		return _gtk.gtk_text_get_length(self._o)
	def freeze(self, obj=None):
		_gtk.gtk_text_freeze(self._o)
	def thaw(self, obj=None):
		_gtk.gtk_text_thaw(self._o)
	def insert(self, font, fg, bg, string):
		_gtk.gtk_text_insert(self._o, font, fg, bg, string,
				     len(string))
	def insert_defaults(self, chars):
		_gtk.gtk_text_insert_defaults(self._o, chars)
	def backward_delete(self, nchars):
		_gtk.gtk_text_backward_delete(self._o, nchars)
	def forward_delete(self, nchars):
		_gtk.gtk_text_forward_delete(self._o, nchars)

class GtkMisc(GtkWidget):
	get_type = _gtk.gtk_misc_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def set_alignment(self, xa, ya):
		_gtk.gtk_misc_set_alignment(self._o, xa, ya)
	def set_padding(self, xp, yp):
		_gtk.gtk_misc_set_padding(self._o, xp, yp)

class GtkArrow(GtkMisc):
	get_type = _gtk.gtk_arrow_get_type
	def __init__(self, at=ARROW_RIGHT, st=SHADOW_OUT, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_arrow_new(at, st)
	def set(self, at, st):
		_gtk.gtk_arrow_set(self._o, at, st)

class GtkPixmap(GtkMisc):
	get_type = _gtk.gtk_pixmap_get_type
	def __init__(self, parent_or_pixmap=None, xpm_or_mask=None, bg=None,
		     _obj=None):
		# This function can be called with two argument models:
		# The old model:
		#  GtkPixmap(parent_win, xpm_file, bg_colour)
		# or the one closer to the C version:
		#  GtkPixmap(pixmap, mask)
		if _obj: self._o = _obj; return
		if type(xpm_or_mask) == type(''):
			pix, mask = create_pixmap_from_xpm(parent_or_pixmap,
							   bg, xpm_or_mask)
			self._o = _gtk.gtk_pixmap_new(pix, mask)
		else:
			self._o = _gtk.gtk_pixmap_new(parent_or_pixmap,
						      xpm_or_mask)
	def get(self):
		return _gtk.gtk_pixmap_get(self._o)
	def set(self, pixmap, mask):
		_gtk.gtk_pixmap_set(self._o, pixmap, mask)
	def set_build_insensitive(self, build):
		_gtk.gtk_pixmap_set_build_insensitive(self._o, build)

class GtkLabel(GtkMisc):
	get_type = _gtk.gtk_label_get_type
	def __init__(self, label="", _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_label_new(label)
	def set(self, str):
		print "GtkLabel.set deprecated -- use set_text"
		self.set_text(str)
	def set_text(self, str):
		_gtk.gtk_label_set_text(self._o, str)
	def set_justify(self, jtype):
		_gtk.gtk_label_set_justify(self._o, jtype)
	def set_line_wrap(self, wrap):
		_gtk.gtk_label_set_line_wrap(self._o, wrap)
	def set_pattern(self, pattern):
		_gtk.gtk_label_set_pattern(self._o, pattern)
	def get(self):
		return _gtk.gtk_label_get(self._o)
	def parse_uline(self, string):
		return _gtk.gtk_label_parse_uline(self._o, string)

class GtkAccelLabel(GtkLabel):
	get_type = _gtk.gtk_accel_label_get_type
	def __init__(self, string=None, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_accel_label_new(string)
	def accelerator_width(self):
		print "accelerator_width deprecated -- use get_accel_width"
		return self.get_accel_width()
	def get_accel_width(self):
		return _gtk.gtk_accel_label_get_accel_width(self._o)
	def set_accel_widget(self, widget):
		_gtk.gtk_accel_label_set_accel_widget(self._o, widget._o)
	def refetch(self):
		_gtk.gtk_accel_label_refetch(self._o)

class GtkTipsQuery(GtkLabel):
	get_type = _gtk.gtk_tips_query_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_tips_query_new()
	def start_query(self, obj=None):
		_gtk.gtk_tips_query_start_query(self._o)
	def stop_query(self, obj=None):
		_gtk.gtk_tips_query_stop_query(self._o)
	def set_caller(self, caller):
		_gtk.gtk_tips_query_set_caller(self._o, caller._o)
	def set_labels(self, inactive, no_tip):
		_gtk.gtk_tips_query_set_labels(self._o, inactive, no_tip)

class GtkPreview(GtkWidget):
	get_type = _gtk.gtk_preview_get_type
	def __init__(self, type=PREVIEW_COLOR, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_preview_new(type)
	def size(self, w, h):
		_gtk.gtk_preview_size(self._o, w, h)
	def put(self, win, gc, srcx, srcy, dstx, dsty, width, height):
		_gtk.gtk_preview_put(self._o, win, gc, srcx, srcy,
				     dstx, dsty, width, height)
	def draw_row(self, data, x, y, w=None):
		_gtk.gtk_preview_draw_row(self._o, data, x, y, w or len(data))
	def set_expand(self, expand):
		_gtk.gtk_preview_set_expand(self._o, expand)
	def set_gamma(self, gamma):
		_gtk.gtk_preview_set_gamma(self._o, gamma)
	def set_color_cube(self, nr, ng, nb, ngrey):
		_gtk.gtk_preview_set_color_cube(self._o, nr,ng,nb, ngrey)
	def set_install_cmap(self, install):
		_gtk.gtk_preview_set_install_cmap(install)
	def set_reserved(self, reserved):
		_gtk.gtk_preview_set_reserved(reserved)
	def set_dither(self, dither):
		_gtk.gtk_preview_set_dither(self._o, dither)

class GtkProgress(GtkWidget):
	get_type = _gtk.gtk_progress_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def set_show_text(self, show_text):
		_gtk.gtk_progress_set_show_text(self._o, show_text)
	def set_text_alignment(self, x_align, y_align):
		_gtk.gtk_progress_set_text_alignment(self._o, x_align,
						     y_align)
	def set_format_string(self, format):
		_gtk.gtk_progress_set_format_string(self._o, format)
	def set_adjustment(self, adj):
		_gtk.gtk_progress_set_adjustment(self._o, adj._o)
	def reconfigure(self, value, min, max):
		print "reconfigure deprecated -- use configure"
		self.configure(value, min, max)
	def configure(self, value, min, max):
		_gtk.gtk_progress_configure(self._o, value, min, max)
	def set_percentage(self, pcnt):
		_gtk.gtk_progress_set_percentage(self._o, pcnt)
	def set_value(self, value):
		_gtk.gtk_progress_set_value(self._o, value)
	def get_value(self):
		return _gtk.gtk_progress_get_value(self._o)
	def set_activity_mode(self, activity_mode):
		_gtk.gtk_progress_set_activity_mode(self._o, activity_mode)
	def get_current_text(self):
		return _gtk.gtk_progress_get_current_text(self._o)
	def get_text_from_value(self, value):
		return _gtk.gtk_progress_get_text_from_value(self._o, value)
	def get_current_percentage(self):
		return _gtk.gtk_progress_get_current_percentage(self._o)
	def get_percentage_from_value(self, value):
		return _gtk.gtk_progress_get_percentage_from_value(self._o,
								   value)

class GtkProgressBar(GtkProgress):
	get_type = _gtk.gtk_progress_bar_get_type
	def __init__(self, adjustment=None, _obj=None):
		if _obj: self._o = _obj; return
		if adjustment:
			self._o = _gtk.gtk_progress_bar_new_with_adjustment(
				adjustment._o)
		else:
			self._o = _gtk.gtk_progress_bar_new()
	def set_bar_style(self, style):
		_gtk.gtk_progress_bar_set_bar_style(self._o, style)
	def set_discrete_blocks(self, blocks):
		_gtk.gtk_progress_bar_set_discrete_blocks(self._o, blocks)
	def set_activity_step(self, step):
		_gtk.gtk_progress_bar_set_activity_step(self._o, step)
	def set_activity_blocks(self, blocks):
		_gtk.gtk_progress_bar_set_activity_blocks(self._o, blocks)
	def set_orientation(self, orient):
		_gtk.gtk_progress_bar_set_orientation(self._o, orient)
	def update(self, pcnt):
		_gtk.gtk_progress_bar_update(self._o, pcnt)

class GtkRange(GtkWidget):
	get_type = _gtk.gtk_range_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def get_adjustment(self):
		return _obj2inst(_gtk.gtk_range_get_adjustment(self._o))
	def set_update_policy(self, pol):
		_gtk.gtk_range_set_update_policy(self._o, pol)
	def set_adjustment(self, adj):
		_gtk.gtk_range_set_adjustment(self._o, adj._o)
	def draw_background(self, obj=None):
		_gtk.gtk_range_draw_background(self._o)
	def clear_background(self, _obj=None):
		_gtk.gtk_range_clear_background(self._o)
	def draw_trough(self, obj=None):
		_gtk.gtk_range_draw_trough(self._o)
	def draw_step_forw(self, obj=None):
		_gtk.gtk_range_draw_step_forw(self._o)
	def draw_step_back(self, obj=None):
		_gtk.gtk_range_draw_step_back(self._o)

class GtkScale(GtkRange):
	get_type = _gtk.gtk_scale_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def set_digits(self, digits):
		_gtk.gtk_scale_set_digits(self._o, digits)
	def set_draw_value(self, draw_value):
		_gtk.gtk_scale_set_draw_value(self._o, draw_value)
	def set_value_pos(self, pos):
		_gtk.gtk_scale_set_value_pos(self._o, pos)
	def value_width(self):
		print "value_width deprecated -- use get_value_width"
		return self.get_value_width()
	def get_value_width(self):
		return _gtk.gtk_scale_get_value_width(self._o)
	def draw_value(self, obj=None):
		_gtk.gtk_scale_draw_value(self._o)

class GtkHScale(GtkScale):
	get_type = _gtk.gtk_hscale_get_type
	def __init__(self, adj=None, _obj=None):
		if _obj: self._o = _obj; return
		if adj: adj = adj._o
		self._o = _gtk.gtk_hscale_new(adj)

class GtkVScale(GtkScale):
	get_type = _gtk.gtk_vscale_get_type
	def __init__(self, adj=None, _obj=None):
		if _obj: self._o = _obj; return
		if adj: adj = adj._o
		self._o = _gtk.gtk_vscale_new(adj)

class GtkScrollbar(GtkRange):
	get_type = _gtk.gtk_scrollbar_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return

class GtkHScrollbar(GtkScrollbar):
	get_type = _gtk.gtk_hscrollbar_get_type
	def __init__(self, adj=None, _obj=None):
		if _obj: self._o = _obj; return
		if adj: adj = adj._o
		self._o = _gtk.gtk_hscrollbar_new(adj)

class GtkVScrollbar(GtkScrollbar):
	get_type = _gtk.gtk_vscrollbar_get_type
	def __init__(self, adj=None, _obj=None):
		if _obj: self._o = _obj; return
		if adj: adj = adj._o
		self._o = _gtk.gtk_vscrollbar_new(adj)

class GtkRuler(GtkWidget):
	get_type = _gtk.gtk_ruler_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
	def set_metric(self, metric):
		_gtk.gtk_ruler_set_metric(self._o, metric)
	def set_range(self, lo, up, pos, max):
		_gtk.gtk_ruler_set_range(self._o, lo, up, pos, max)
	def draw_ticks(self, obj=None):
		_gtk.gtk_ruler_draw_ticks(self._o)
	def draw_pos(self, obj=None):
		_gtk.gtk_ruler_draw_pos(self._o)

class GtkHRuler(GtkRuler):
	get_type = _gtk.gtk_hruler_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_hruler_new()

class GtkVRuler(GtkRuler):
	get_type = _gtk.gtk_vruler_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_vruler_new()

class GtkSeparator(GtkWidget):
	get_type = _gtk.gtk_separator_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return

class GtkHSeparator(GtkSeparator):
	get_type = _gtk.gtk_hseparator_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_hseparator_new()

class GtkVSeparator(GtkSeparator):
	get_type = _gtk.gtk_vseparator_get_type
	def __init__(self, _obj=None):
		if _obj: self._o = _obj; return
		self._o = _gtk.gtk_vseparator_new()


_name2cls = {}
_supported = map(lambda x: eval(x), filter(lambda x: x[:3] == 'Gtk', dir()))
for m in _supported:
	_name2cls[m.__name__] = m
del m

class GtkAccelGroup:
	def __init__(self, _obj=None):
		if _obj: self._ag = _obj; return
		self._ag = _gtk.gtk_accel_group_new()
	def activate(self, key, mods):
		_gtk.gtk_accel_group_activate(self._ag, key, mods)
	def attach(self, obj):
		_gtk.gtk_accel_group_attach(self._ag, obj._o)
	def detach(self, obj):
		_gtk.gtk_accel_group_detach(self._ag, obj._o)
	def lock(self):
		_gtk.gtk_accel_group_lock(self._ag)
	def unlock(self):
		_gtk.gtk_accel_group_unlock(self._ag)
	def lock_entry(self, key, mods):
		_gtk.gtk_accel_group_lock_entry(self._ag, key, mods)
	def unlock_entry(self, key, mods):
		_gtk.gtk_accel_group_unlock_entry(self._ag, key, mods)
	def add(self, key, mods, flags, obj, signal):
		_gtk.gtk_accel_group_add(self._ag, key, mods, flags,
					 obj._o, signal)
	def remove(self, key, mods, obj):
		_gtk.gtk_accel_group_remove(self._ag, key, mods, obj._o)

def _obj2inst(obj):
	objname = _gtk.gtk_type_name(_gtk.GTK_OBJECT_TYPE(obj))
	if _name2cls.has_key(objname):
		return _name2cls[objname](_obj=obj)
	# if I don't know what the object is, guess
	elif _gtk.GTK_CHECK_TYPE(obj, GtkBox.get_type()):
		return GtkBox(_obj=obj)
	elif _gtk.GTK_CHECK_TYPE(obj, GtkBin.get_type()):
		return GtkBin(_obj=obj)
	elif _gtk.GTK_CHECK_TYPE(obj, GtkWindow.get_type()):
		return GtkWindow(_obj=obj)
	elif _gtk.GTK_CHECK_TYPE(obj, GtkContainer.get_type()):
		return GtkContainer(_obj=obj)
	elif _gtk.GTK_CHECK_TYPE(obj, GtkWidget.get_type()):
		return GtkWidget(_obj=obj)
	else:
		return GtkObject(_obj=obj)

def _filtprops(props):
	for k in props.keys():
		v = props[k]
		if hasattr(v, '_o') and type(v._o) == _gtk.GtkObjectType:
			props[k] = v._o

def new(tp, **props):
	if type(tp) == type(GtkObject):
		tp = tp.get_type()
	elif type(tp) == type('forty-two'): 
		tp = _name2cls[tp].get_type()
	elif type(tp) != type(0):
		raise TypeError, "unknow type argument: " + tp
	_filtprops(props)
	return _obj2inst(_gtk.gtk_object_new(tp, props))

# flow control
def mainloop():
	_gtk.gtk_main()
def mainquit(*args):
	_gtk.gtk_main_quit()
def mainiteration(block=TRUE):
	return _gtk.gtk_main_iteration(block)
def events_pending():
	return _gtk.gtk_events_pending()

# idle/quit/timeout handlers
def idle_add(callback):
	return _gtk.gtk_idle_add(callback)
def idle_add_priority(priority, callback):
	return _gtk.gtk_idle_add_priority(priority, callback)
def idle_remove(tag):
	_gtk.gtk_idle_remove(tag)
def quit_add(mainlevel, callback):
        return _gtk.gtk_quit_add(mainlevel, callback)
def quit_add_destroy(mainlevel, object):
	_gtk.gtk_quit_add_destroy(mainlevel, object._o)
def quit_remove(tag):
	_gtk.gtk_quit_remove(tag)
def timeout_add(timeout, callback):
	return _gtk.gtk_timeout_add(timeout, callback)
def timeout_remove(tag):
	_gtk.gtk_timeout_remove(tag)

# input (file handle) handler
def input_add(source, condition, callback):
	if hasattr(source, 'fileno'):
		# handle python file handles
		def wrapper(source, condition, real_s=source,real_cb=callback):
			real_cb(real_s, condition)
		return _gtk.gtk_input_add(source.fileno(), condition, wrapper)
	else:
		return _gtk.gtk_input_add(source, condition, callback)
def input_remove(tag):
	_gtk.gtk_input_remove(tag)

# these functions govern modality
def grab_add(wid):
	_gtk.gtk_grab_add(wid._o)
def grab_remove(wid):
	_gtk.gtk_grab_remove(wid._o)
def grab_get_current():
	return _obj2inst(_gtk.gtk_grab_get_current())

# RC parsing
def rc_parse(fname):
	_gtk.gtk_rc_parse(fname)
def rc_parse_string(string):
	_gtk.gtk_rc_parse_string(string)
def rc_reparse_all():
	_gtk.gtk_rc_repase_all()

# font loading
def load_font(font):
	return _gtk.gdk_font_load(font)
def load_fontset(fontset):
	return _gtk.gdk_fontset_load(fontset)

# cursor loading
def cursor_new(type):
	return _gtk.gdk_cursor_new(type)
def cursor_new_from_pixmap(source, mask, fg, bg, x, y):
	return _gtk.gdk_cursor_new_from_pixmap(source, mask, fg, bg, x, y)

# colour allocation
def colour_alloc(parent, red, green=None, blue=None):
	print "colour_alloc deprecated.  Use GdkColormap.alloc"
	if hasattr(parent, '_o'): cmap = parent.get_window().colormap
	elif hasattr(parent, 'colormap'): cmap = parent.colormap
	else: cmap = parent
	if type(red) == type(''):
		return cmap.alloc(red)
	# red assumed to be an int
	if green == None and blue == None:
		green, blue = divmod(red, 256)
		red, green  = divmod(green, 256)
		red = red % 256

		red   = (red   + 1) * 256 - 1
		green = (green + 1) * 256 - 1
		blue  = (blue  + 1) * 256 - 1
	return cmap.alloc(red, green, blue)
# This one's for the Americans...
color_alloc = colour_alloc

# atoms ...
def atom_intern(name, only_if_exists=FALSE):
	return _gtk.gdk_atom_intern(name, only_if_exists)
def atom_name(atom):
	return _gtk.gdk_atom_name(atom)

# pixmap loading
def create_pixmap_from_xpm(object, bg, xpm):
	if type(object) == _gtk.GdkWindowType:
		return _gtk.gdk_pixmap_create_from_xpm(object, bg, xpm)
	else:
		if hasattr(object, 'get_colormap'):
			cmap = object.get_colormap()
		elif hasattr(object, 'colormap'):
			cmap = object.colormap
		else:
			cmap = object
		return _gtk.gdk_pixmap_colormap_create_from_xpm(None, cmap,
								bg, xpm)
# use XPM data ...
def create_pixmap_from_xpm_d(object, bg, xpm_d):
	if type(object) == _gtk.GdkWindowType:
		return _gtk.gdk_pixmap_create_from_xpm_d(object, bg, xpm_d)
	else:
		if hasattr(object, 'get_colormap'):
			cmap = object.get_colormap()
		elif hasattr(object, 'colormap'):
			cmap = object.colormap
		else:
			cmap = object
		return _gtk.gdk_pixmap_colormap_create_from_xpm_d(None, cmap,
								  bg, xpm_d)
def create_pixmap(window, width, height, depth=-1):
	if (hasattr(window, '_o')):
	        window.realize()
		window = window.get_window()
	return _gtk.gdk_pixmap_new(window, width, height, depth)

def create_bitmap_from_data(window, data, width, height):
	return _gtk.gdk_bitmap_create_from_data(window, data, width, height)

# drawing functions...
def draw_point(drawable, gc, x, y):
	_gtk.gdk_draw_point(drawable, gc, x, y)
def draw_line(drawable, gc, x1, y1, x2, y2):
	_gtk.gdk_draw_line(drawable, gc, x1, y1, x2, y2)
def draw_rectangle(drawable, gc, fill, x, y, width, height):
	_gtk.gdk_draw_rectangle(drawable, gc, fill, x, y,
				width, height)
def draw_arc(drawable, gc, fill, x, y, width, height, angle1, angle2):
	_gtk.gdk_draw_arc(drawable, gc, fill, x, y, width, height, angle1,
			  angle2)
def draw_polygon(drawable, gc, fill, points):
	_gtk.gdk_draw_polygon(drawable, gc, fill, points)
def draw_string(drawable, font, gc, x, y, string):
	_gtk.gdk_draw_string(drawable, font, gc, x, y, string)
def draw_text(drawable, font, gc, x, y, text):
	_gtk.gdk_draw_text(drawable, font, gc, x, y, text)
def draw_pixmap(drawable, gc, src, xsrc,ysrc, xdest,ydest, width,height):
	_gtk.gdk_draw_pixmap(drawable, gc, src, xsrc,ysrc,
			     xdest,ydest, width,height)
def draw_points(drawable, gc, points):
	_gtk.gdk_draw_points(drawable, gc, points)
def draw_segments(drawable, gc, segs):
	_gtk.gdk_draw_segments(drawable, gc, segs)
def draw_lines(drawable, gc, points):
	_gtk.gdk_draw_lines(drawable, gc, points)


# screen size
def screen_width():
	return _gtk.gdk_screen_width()
def screen_height():
	return _gtk.gdk_screen_height()

def screen_width_mm():
	return _gtk.gdk_screen_width_mm()
def screen_height_mm():
	return _gtk.gdk_screen_height_mm()

# thread support -- place calls to these arround gtk code in threads ...
def threads_enter():
	_gtk.gdk_threads_enter()
def threads_leave():
	_gtk.gdk_threads_leave()