Compare commits
797 Commits
SNAP_19971
...
GTK_1_0_6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fafa639f7b | ||
|
|
0bbd333f29 | ||
|
|
f04ccd3146 | ||
|
|
0a1be824fd | ||
|
|
41e220c75d | ||
|
|
a48ad6be3e | ||
|
|
56ce3d070b | ||
|
|
358d0c4e13 | ||
|
|
be7ac5fc4a | ||
|
|
397a0daaaa | ||
|
|
b840c209fe | ||
|
|
488cb58d8d | ||
|
|
bbaadfc586 | ||
|
|
38c3cf2961 | ||
|
|
7977bf7bc4 | ||
|
|
52a9e5cae8 | ||
|
|
92b28247ed | ||
|
|
ea15a83623 | ||
|
|
0b345bfa9c | ||
|
|
2ca0b3898b | ||
|
|
403212acab | ||
|
|
1a236b3c44 | ||
|
|
2bc0f1c83d | ||
|
|
780f6c48f5 | ||
|
|
0a4017b054 | ||
|
|
39a1087c7c | ||
|
|
7f8bb36f06 | ||
|
|
7e893194cd | ||
|
|
3b4e7ea423 | ||
|
|
7c1e35b4c6 | ||
|
|
559a3b4435 | ||
|
|
d367a71915 | ||
|
|
e43a752e2b | ||
|
|
4ae5397e86 | ||
|
|
fcf1813ac6 | ||
|
|
320c0f5b4a | ||
|
|
4992f18f25 | ||
|
|
7f44192c6f | ||
|
|
15e5518841 | ||
|
|
e8358c9845 | ||
|
|
b975c992ba | ||
|
|
a66b9ecba3 | ||
|
|
fe487d27d3 | ||
|
|
ffefc931cb | ||
|
|
936a9bb82f | ||
|
|
2cf9cfc70e | ||
|
|
8e1f6f269d | ||
|
|
4a666956be | ||
|
|
ed9c2e8b44 | ||
|
|
d5e1327f9e | ||
|
|
f25b333e33 | ||
|
|
510541dd5b | ||
|
|
7c9cc2cf39 | ||
|
|
b252a7fffd | ||
|
|
b26728291a | ||
|
|
b62fc60de7 | ||
|
|
7defce053a | ||
|
|
f322097971 | ||
|
|
8d312b1d4f | ||
|
|
3b0e9baee5 | ||
|
|
0b1b179e45 | ||
|
|
6c6b244015 | ||
|
|
725300f5f2 | ||
|
|
7d56ba7b0c | ||
|
|
832e096207 | ||
|
|
063c490570 | ||
|
|
8d55a9d665 | ||
|
|
6c21fc646d | ||
|
|
0847bed69f | ||
|
|
f3f8304436 | ||
|
|
7e6c3c0df7 | ||
|
|
25f9fd2958 | ||
|
|
b3e0707899 | ||
|
|
aa505f0ff4 | ||
|
|
66dd08d2e8 | ||
|
|
8555c23889 | ||
|
|
98d997b105 | ||
|
|
5cb538d805 | ||
|
|
7d6aff77e5 | ||
|
|
668c7604a9 | ||
|
|
e8cf1d552b | ||
|
|
5266d6322a | ||
|
|
52d2e1b6a1 | ||
|
|
4aa965149c | ||
|
|
ab40e71ec9 | ||
|
|
d8e88af7d0 | ||
|
|
1a7acfef50 | ||
|
|
f8116014c1 | ||
|
|
eedaab9236 | ||
|
|
2117f4ac7e | ||
|
|
6349f7cb2c | ||
|
|
8435d34838 | ||
|
|
0f0ede22ad | ||
|
|
43ef2e2394 | ||
|
|
b94559a288 | ||
|
|
a3cfbc84cf | ||
|
|
4143e106cc | ||
|
|
d0a29b40d6 | ||
|
|
1b7fc490af | ||
|
|
8c66060a8e | ||
|
|
e94d12f926 | ||
|
|
cde57dc1d2 | ||
|
|
42a7da51fc | ||
|
|
2bec3fad18 | ||
|
|
2f6ee99191 | ||
|
|
9a1db40746 | ||
|
|
37bedcc07a | ||
|
|
302aaa2802 | ||
|
|
9829d1ee03 | ||
|
|
aa6097e255 | ||
|
|
1d8aed6816 | ||
|
|
49680fed32 | ||
|
|
4a7d355898 | ||
|
|
0982f71b98 | ||
|
|
7363897409 | ||
|
|
2b210ff47e | ||
|
|
385164d6f9 | ||
|
|
1bafe5a8e7 | ||
|
|
52f719521a | ||
|
|
5c67089e7d | ||
|
|
af36f7765a | ||
|
|
0b0524d397 | ||
|
|
4eaccda110 | ||
|
|
16bcc7bc6d | ||
|
|
26004d36fa | ||
|
|
0b31d8a9c4 | ||
|
|
c2a843d8ed | ||
|
|
ecb8751322 | ||
|
|
d4a428d2e9 | ||
|
|
1d6172102d | ||
|
|
887540e646 | ||
|
|
18dfa1ae90 | ||
|
|
7ec269052d | ||
|
|
a3ee7a9416 | ||
|
|
92006c8e78 | ||
|
|
e6af5d49ae | ||
|
|
0dfc14aa8b | ||
|
|
6114e5b813 | ||
|
|
9c585e9210 | ||
|
|
0e3d507006 | ||
|
|
1cf5800665 | ||
|
|
3a02948170 | ||
|
|
26df647a0f | ||
|
|
ad7dc0e87f | ||
|
|
2a2323d64e | ||
|
|
3a1eebe683 | ||
|
|
520fd17eca | ||
|
|
09d32399ab | ||
|
|
c492bd10e8 | ||
|
|
0d1eb423a1 | ||
|
|
55f36bac3a | ||
|
|
3d19b7ce55 | ||
|
|
2ab408a700 | ||
|
|
1c77b5f926 | ||
|
|
13de9dc34f | ||
|
|
6788abaa48 | ||
|
|
39a05c0b55 | ||
|
|
8051b9d2bc | ||
|
|
30533f0397 | ||
|
|
01c3cd84f5 | ||
|
|
49efbf9b1d | ||
|
|
0f9fe89727 | ||
|
|
d7aa6a88fb | ||
|
|
c4089778fb | ||
|
|
61ca241924 | ||
|
|
79d880ccb7 | ||
|
|
20fee708a3 | ||
|
|
1a099c2ced | ||
|
|
ab7989217a | ||
|
|
6e28c40061 | ||
|
|
9a5ad5d44e | ||
|
|
e19f939b53 | ||
|
|
977b13d37f | ||
|
|
bfd68b4357 | ||
|
|
71824a2cd5 | ||
|
|
e2ae4aec47 | ||
|
|
59d586e2ff | ||
|
|
07a8601adf | ||
|
|
b1446447fc | ||
|
|
308adaa6db | ||
|
|
32cd050cfe | ||
|
|
740b70ea0c | ||
|
|
4268cd7312 | ||
|
|
5d81d2ab28 | ||
|
|
68bc2c51db | ||
|
|
acb95ed9da | ||
|
|
c36ca76bb8 | ||
|
|
30f22e0208 | ||
|
|
4e01061296 | ||
|
|
2be5abf4ed | ||
|
|
f59f2039c0 | ||
|
|
a20f83d9a9 | ||
|
|
4bf5d761bc | ||
|
|
8eb7761e72 | ||
|
|
c05d6f2d12 | ||
|
|
f553b79b70 | ||
|
|
4098ac22ff | ||
|
|
2f5621e566 | ||
|
|
93e1585614 | ||
|
|
5b3cc69b43 | ||
|
|
7033e33822 | ||
|
|
b2c30ad95d | ||
|
|
f2cfc17be8 | ||
|
|
186a0455be | ||
|
|
e0ea1f0c14 | ||
|
|
11f79ebe18 | ||
|
|
c2906f2bea | ||
|
|
a74e338517 | ||
|
|
d38e339ebb | ||
|
|
b47085512c | ||
|
|
cb98231c7d | ||
|
|
36e83663cf | ||
|
|
102b1de4b4 | ||
|
|
d362159181 | ||
|
|
9b7fd1bbe5 | ||
|
|
9457fe86d4 | ||
|
|
13fa9d3819 | ||
|
|
3f5c7acc33 | ||
|
|
7de464ffe8 | ||
|
|
c88afb81f9 | ||
|
|
34e324ca70 | ||
|
|
7bd32a06cf | ||
|
|
ba0b7257a7 | ||
|
|
690e34968a | ||
|
|
923f3f6992 | ||
|
|
f0f650948a | ||
|
|
03a7c4551b | ||
|
|
6b411f4b47 | ||
|
|
b78286eab5 | ||
|
|
dac3ffed60 | ||
|
|
16aa9c1964 | ||
|
|
ac05ab301d | ||
|
|
de26d9af9b | ||
|
|
8cff9d3307 | ||
|
|
995d97b001 | ||
|
|
a7960ed953 | ||
|
|
0328873baf | ||
|
|
babfb28c3c | ||
|
|
8a544b8912 | ||
|
|
75a00da8d1 | ||
|
|
38614a78b6 | ||
|
|
b44ec526b6 | ||
|
|
177354df02 | ||
|
|
2a2fff763d | ||
|
|
3c03a6787d | ||
|
|
f9739e8343 | ||
|
|
85d4cd0f43 | ||
|
|
e648c2d68f | ||
|
|
467e4e73c1 | ||
|
|
b141619b50 | ||
|
|
3f04c019cd | ||
|
|
3872c32d4a | ||
|
|
df0b05ef2b | ||
|
|
70b3b3e6e1 | ||
|
|
a783d668f1 | ||
|
|
a6e2c24b60 | ||
|
|
8a0d67391c | ||
|
|
63955ec2e2 | ||
|
|
077b5109a4 | ||
|
|
444c9529db | ||
|
|
600eaaea09 | ||
|
|
60c008eb99 | ||
|
|
27c086bd95 | ||
|
|
c91f2c0cfa | ||
|
|
3f4411ed52 | ||
|
|
f8170cbd7c | ||
|
|
8ecd7ef5ae | ||
|
|
0ac28d23a4 | ||
|
|
ced74f4435 | ||
|
|
16c6ee03ae | ||
|
|
eac28852ed | ||
|
|
f87ee7e51a | ||
|
|
9ce0cb6037 | ||
|
|
85764dad33 | ||
|
|
9addd8da2c | ||
|
|
bfc969f697 | ||
|
|
e8a447e002 | ||
|
|
8fa6f19aa2 | ||
|
|
85dd78b7d8 | ||
|
|
bc8e40387b | ||
|
|
566a13a6c0 | ||
|
|
9280285954 | ||
|
|
135cdd43a9 | ||
|
|
6e7f4a99e9 | ||
|
|
cfd3a51369 | ||
|
|
ab4fed04fe | ||
|
|
c86bf9bae2 | ||
|
|
b8e7ea1f11 | ||
|
|
54a9eb416d | ||
|
|
f9ad283402 | ||
|
|
8cde2c5c21 | ||
|
|
bc98ea9ce1 | ||
|
|
294cfcdb22 | ||
|
|
3ef2c37a83 | ||
|
|
78290be1c0 | ||
|
|
c31eb969ba | ||
|
|
68fcbef5a1 | ||
|
|
cc4dc8339d | ||
|
|
c57f1e318e | ||
|
|
bd9ddcb231 | ||
|
|
6acde3e1ce | ||
|
|
3832600822 | ||
|
|
fa107ded2a | ||
|
|
8eb77dfea2 | ||
|
|
9c8ed97e83 | ||
|
|
c8e5c809ed | ||
|
|
9b4919dcb8 | ||
|
|
96a7435911 | ||
|
|
7c698ad46c | ||
|
|
9a9070c26d | ||
|
|
aebd3d2df2 | ||
|
|
affaf4f9d2 | ||
|
|
4f3495f955 | ||
|
|
d19d3c5dca | ||
|
|
a8afd462c0 | ||
|
|
093dfedf74 | ||
|
|
48a15b7349 | ||
|
|
59436967d5 | ||
|
|
c5327ecc31 | ||
|
|
617a879dfe | ||
|
|
b7a6cd6750 | ||
|
|
ffc1084029 | ||
|
|
5724801800 | ||
|
|
309d7377e7 | ||
|
|
2ff460a6c8 | ||
|
|
3573f8b5f3 | ||
|
|
e583ab045f | ||
|
|
3d7c2d6634 | ||
|
|
47933b73db | ||
|
|
1432078569 | ||
|
|
6cfdaaa740 | ||
|
|
d94b21a8df | ||
|
|
cfda5f0035 | ||
|
|
5d6fe2d05f | ||
|
|
fb66cb05df | ||
|
|
5d5bbd1a21 | ||
|
|
c45ab2b2d6 | ||
|
|
4a4f0aedf3 | ||
|
|
db51126e3b | ||
|
|
2737494599 | ||
|
|
e9e7e4c86b | ||
|
|
7f17ced74b | ||
|
|
8f8b0f68ff | ||
|
|
f9e5e12bcc | ||
|
|
cb6412978c | ||
|
|
120df3b8b7 | ||
|
|
fabfc17d93 | ||
|
|
4db2561dd5 | ||
|
|
355e74fce4 | ||
|
|
c5e729b4bc | ||
|
|
1f39582f3f | ||
|
|
23a7e9c93e | ||
|
|
0db2549361 | ||
|
|
100775d091 | ||
|
|
8532799aaa | ||
|
|
2f50a3044e | ||
|
|
990bddfe16 | ||
|
|
239a12d0d1 | ||
|
|
2ab3ec6cbd | ||
|
|
d187183161 | ||
|
|
2a8d32a760 | ||
|
|
19a80b7695 | ||
|
|
7b721e200b | ||
|
|
c9f7f2a0f8 | ||
|
|
d894d2dc0c | ||
|
|
2b3f8baf86 | ||
|
|
ab30a02e5f | ||
|
|
85f1364922 | ||
|
|
e60864761c | ||
|
|
829936fd6f | ||
|
|
6eca1a93c0 | ||
|
|
77ff63f7e7 | ||
|
|
5fa1bfcf45 | ||
|
|
76d01a826c | ||
|
|
2395ed0826 | ||
|
|
de1262dcc1 | ||
|
|
124d1e5caa | ||
|
|
640c75216d | ||
|
|
a328473d1b | ||
|
|
1941bf4cbf | ||
|
|
761549b968 | ||
|
|
16f8b9f627 | ||
|
|
2095c552f8 | ||
|
|
3033d6b47a | ||
|
|
2a4c36a73d | ||
|
|
4a35f24c47 | ||
|
|
47f7073e28 | ||
|
|
6c9e2cf195 | ||
|
|
be3ad53c49 | ||
|
|
1ac59c103d | ||
|
|
ba55b3f94b | ||
|
|
793a130520 | ||
|
|
f5c00ed917 | ||
|
|
c6a2248e98 | ||
|
|
12f1b7858e | ||
|
|
3eac46a981 | ||
|
|
3cbeacaf58 | ||
|
|
818ea9d84b | ||
|
|
395ccd366a | ||
|
|
3362281802 | ||
|
|
9eb0ce778a | ||
|
|
5b51a9f7f1 | ||
|
|
558c5f5040 | ||
|
|
1e5d354127 | ||
|
|
68a8537266 | ||
|
|
f6f1ce01c6 | ||
|
|
80fd0a0c00 | ||
|
|
d1f5f06082 | ||
|
|
172d6433a7 | ||
|
|
6ef73ebac0 | ||
|
|
ade3020098 | ||
|
|
af18ab4305 | ||
|
|
3fb589b2ff | ||
|
|
b7056ea129 | ||
|
|
60870d3407 | ||
|
|
afe08d63e3 | ||
|
|
2a9e933d90 | ||
|
|
16da0508af | ||
|
|
f222bd77bb | ||
|
|
2630943eb3 | ||
|
|
9205edae41 | ||
|
|
d491547e86 | ||
|
|
91c1c8dddb | ||
|
|
68a90caf45 | ||
|
|
c4c1c1ea55 | ||
|
|
6d3ef70d1e | ||
|
|
fa26673f49 | ||
|
|
8a19c2a157 | ||
|
|
7ad17f7b08 | ||
|
|
b2e6c9723a | ||
|
|
693fa02b83 | ||
|
|
a36ffb12a5 | ||
|
|
50cc709f77 | ||
|
|
473c1d4d7b | ||
|
|
a597dd9473 | ||
|
|
95efae09a7 | ||
|
|
6c2818881d | ||
|
|
3cdf88be4d | ||
|
|
777159913b | ||
|
|
97bbc97bb2 | ||
|
|
cf01747701 | ||
|
|
82d7ac35ed | ||
|
|
203476915a | ||
|
|
c88ea382d2 | ||
|
|
635d54c091 | ||
|
|
d3607d5465 | ||
|
|
7add75fba5 | ||
|
|
86a97f7835 | ||
|
|
f6f927d227 | ||
|
|
1b656e0dde | ||
|
|
7c99ffb891 | ||
|
|
84335371b1 | ||
|
|
9a0687a673 | ||
|
|
5861dfb9f8 | ||
|
|
06d19fb68d | ||
|
|
e00c0594a3 | ||
|
|
75a8405430 | ||
|
|
800afc55d7 | ||
|
|
a8d6f14c2d | ||
|
|
f97dd05d5a | ||
|
|
782dcc834b | ||
|
|
4c0ca9b968 | ||
|
|
7983856239 | ||
|
|
53a595f448 | ||
|
|
005f39e02e | ||
|
|
75fbe1adae | ||
|
|
6ff27c34f1 | ||
|
|
7cb1030d32 | ||
|
|
22a9a454af | ||
|
|
62dba86c81 | ||
|
|
2fbc8c20c1 | ||
|
|
132f17fa37 | ||
|
|
10474e6a73 | ||
|
|
c87244dd75 | ||
|
|
0ef453b82c | ||
|
|
a4b322cccc | ||
|
|
fc7e845c8f | ||
|
|
3d4cc2f904 | ||
|
|
8923d60dba | ||
|
|
9ad922290c | ||
|
|
7e3692b99f | ||
|
|
83e3008d35 | ||
|
|
1410a8a003 | ||
|
|
825aa9501b | ||
|
|
b5cb66dc35 | ||
|
|
a303493882 | ||
|
|
9f96d18eb1 | ||
|
|
7b399a225c | ||
|
|
d91da80871 | ||
|
|
04c520bad9 | ||
|
|
afcc0ad3b2 | ||
|
|
27575aa216 | ||
|
|
fa10f1361f | ||
|
|
a589338a7f | ||
|
|
623f7d9772 | ||
|
|
3c7f5af2a5 | ||
|
|
c3fc26bb9d | ||
|
|
041983a776 | ||
|
|
888470ee29 | ||
|
|
dd07df15c1 | ||
|
|
39e26262a5 | ||
|
|
c43a50fe36 | ||
|
|
9dee8ee4e4 | ||
|
|
31a238b6b6 | ||
|
|
c305397fca | ||
|
|
f747f3b2cd | ||
|
|
ed848ac41e | ||
|
|
2090cc650c | ||
|
|
13179d42a0 | ||
|
|
6898536a02 | ||
|
|
f98686da85 | ||
|
|
6246db9288 | ||
|
|
38fac1be63 | ||
|
|
7a3af96d84 | ||
|
|
289f6a38fe | ||
|
|
e105a87144 | ||
|
|
c763748dd1 | ||
|
|
75cd57b6cb | ||
|
|
dca018206e | ||
|
|
89107cb751 | ||
|
|
edad08addd | ||
|
|
5b597c65c7 | ||
|
|
d3c3333735 | ||
|
|
9258a7aecb | ||
|
|
f82814760e | ||
|
|
4b86717650 | ||
|
|
8d2bb0f43e | ||
|
|
23a13fd4a5 | ||
|
|
64ca527ecb | ||
|
|
3b0de24a7b | ||
|
|
5842311062 | ||
|
|
b45cd0430c | ||
|
|
a8629917ae | ||
|
|
febe6498f2 | ||
|
|
fc86f630a6 | ||
|
|
b239e3c941 | ||
|
|
6b5e983f3d | ||
|
|
eeaefdf04f | ||
|
|
8822bde131 | ||
|
|
c3154703d0 | ||
|
|
57bae55574 | ||
|
|
58df302b15 | ||
|
|
35ba1ac7ef | ||
|
|
eef38289b2 | ||
|
|
81fe36047e | ||
|
|
b0de5e73f5 | ||
|
|
1522f2ae59 | ||
|
|
a11062b2d9 | ||
|
|
01200282da | ||
|
|
4ef94fd74e | ||
|
|
b38b6f5f0f | ||
|
|
db628b3ca0 | ||
|
|
015c1052ae | ||
|
|
ce4263f901 | ||
|
|
4af33fa24d | ||
|
|
ee7038f9fd | ||
|
|
7922f34318 | ||
|
|
ac492cfab6 | ||
|
|
1ff162c445 | ||
|
|
38bffa52d3 | ||
|
|
db6a8d4a8a | ||
|
|
22388cfc07 | ||
|
|
b5b1534b10 | ||
|
|
89a5c21c07 | ||
|
|
4fb20bdbcc | ||
|
|
7b2f9afe4c | ||
|
|
bad1cb0f37 | ||
|
|
4cb6dec331 | ||
|
|
d43c0de3f4 | ||
|
|
a9f866f4ca | ||
|
|
8f355e26ef | ||
|
|
3cefe524dc | ||
|
|
918f7d484d | ||
|
|
2c4b378455 | ||
|
|
347a06e3d0 | ||
|
|
f734007af4 | ||
|
|
63f6c689ff | ||
|
|
edf9e176db | ||
|
|
33f3f4a2ae | ||
|
|
6f7faf9df2 | ||
|
|
3942cb76af | ||
|
|
6365ebc9ea | ||
|
|
36b2a2ebcd | ||
|
|
3779493d17 | ||
|
|
01f66785cb | ||
|
|
5cb62b4561 | ||
|
|
d64570b781 | ||
|
|
fb48f5a356 | ||
|
|
b2140a2322 | ||
|
|
0b372cfb3a | ||
|
|
2d42cb955e | ||
|
|
10be064561 | ||
|
|
b533c32dd4 | ||
|
|
3dca445763 | ||
|
|
5e517e426c | ||
|
|
325dc92ad4 | ||
|
|
d1da1a45a0 | ||
|
|
06f64ff941 | ||
|
|
4c2931aab5 | ||
|
|
3ae8c300bb | ||
|
|
18ee22d93b | ||
|
|
3b95a7a2b1 | ||
|
|
275d8a2696 | ||
|
|
0dae051ddd | ||
|
|
a7a7e430bf | ||
|
|
839be1dfdb | ||
|
|
53ac2efcad | ||
|
|
73386d5761 | ||
|
|
79f69b1676 | ||
|
|
1a8765e6ce | ||
|
|
0c6a6baa08 | ||
|
|
9dcce18815 | ||
|
|
67e6757069 | ||
|
|
2dd1106130 | ||
|
|
59ff297c24 | ||
|
|
f424cd83a9 | ||
|
|
4628759d3b | ||
|
|
11d37c5067 | ||
|
|
1e34b9ba8d | ||
|
|
1e764e1b41 | ||
|
|
e35fb5486f | ||
|
|
40808fa050 | ||
|
|
3f44ca9487 | ||
|
|
84cf918177 | ||
|
|
443648028c | ||
|
|
2e99581612 | ||
|
|
8d721e5b75 | ||
|
|
8dc9cd53ff | ||
|
|
c44ba4b377 | ||
|
|
a6252a3297 | ||
|
|
582a3f433c | ||
|
|
97f11c694c | ||
|
|
aed02304eb | ||
|
|
8e1fb2cccd | ||
|
|
2d5a6055e8 | ||
|
|
dd77b5db5a | ||
|
|
18681dc653 | ||
|
|
f91efadd4f | ||
|
|
880c62eec1 | ||
|
|
72da1d3e02 | ||
|
|
4da8e492f7 | ||
|
|
139026de73 | ||
|
|
284882b8c7 | ||
|
|
dfc3630c8c | ||
|
|
8bb622a983 | ||
|
|
24cfae7295 | ||
|
|
75b20f2eaf | ||
|
|
839b480391 | ||
|
|
6d33a0791a | ||
|
|
00000538ed | ||
|
|
f873f58d5b | ||
|
|
1d58a2e291 | ||
|
|
84e1ee4bac | ||
|
|
5eee6416f5 | ||
|
|
4ccc005197 | ||
|
|
52d5af4d7e | ||
|
|
82da232b12 | ||
|
|
51a481d9e8 | ||
|
|
d2aa891c8e | ||
|
|
ad5466ca6e | ||
|
|
33a9119c22 | ||
|
|
1f07d39e23 | ||
|
|
49517ca835 | ||
|
|
be68a5dacb | ||
|
|
23db1522f6 | ||
|
|
0e3e5eed78 | ||
|
|
957bd9d9c0 | ||
|
|
65d015d813 | ||
|
|
0eedb30ce8 | ||
|
|
25995faa6c | ||
|
|
621e1dd4c2 | ||
|
|
8eb36ebbd5 | ||
|
|
39f02b638b | ||
|
|
7a2073bf64 | ||
|
|
948a3620cf | ||
|
|
303c8f03a8 | ||
|
|
06dc220d64 | ||
|
|
9dadde735c | ||
|
|
dc4e9e2fe1 | ||
|
|
0e9ff02e85 | ||
|
|
c3a5564894 | ||
|
|
2b65feb5a5 | ||
|
|
af9e316ce6 | ||
|
|
92610dafdb | ||
|
|
26c35927f7 | ||
|
|
f7443e0e85 | ||
|
|
e2f5eb1c3e | ||
|
|
0f6d9f0ffc | ||
|
|
36d360aa98 | ||
|
|
0516fcead1 | ||
|
|
f872397c0c | ||
|
|
aacb5bd1e3 | ||
|
|
fb51b7a6c5 | ||
|
|
b8e57550b7 | ||
|
|
2d8acc12f3 | ||
|
|
a5fa0b03c0 | ||
|
|
d02a42db34 | ||
|
|
4c23b890c4 | ||
|
|
7c21169e72 | ||
|
|
ad1a805810 | ||
|
|
6ceea7e635 | ||
|
|
ed11431bdb | ||
|
|
ee489eafb0 | ||
|
|
104f72cf95 | ||
|
|
7bac5c59eb | ||
|
|
7c726a1e3e | ||
|
|
2b2667e791 | ||
|
|
e3956c289a | ||
|
|
b44565f3e4 | ||
|
|
4da7b2f2ef | ||
|
|
0a81bbf58f | ||
|
|
162795e983 | ||
|
|
81a58c413c | ||
|
|
1b6fb00808 | ||
|
|
32fbb7b821 | ||
|
|
67180c87e1 | ||
|
|
24b21a5d84 | ||
|
|
01eda653ee | ||
|
|
61124945c0 | ||
|
|
e9f322e2f0 | ||
|
|
f7b1fa3aed | ||
|
|
8d0318387f | ||
|
|
1cf3f510d1 | ||
|
|
6824581335 | ||
|
|
fde815eb54 | ||
|
|
05cf0f3203 | ||
|
|
73e9b6b205 | ||
|
|
555aa2baf9 | ||
|
|
26be2f7003 | ||
|
|
d5d01a5af9 | ||
|
|
65e63db01e | ||
|
|
4de2665e8c | ||
|
|
865eab2445 | ||
|
|
f9bfb8462a | ||
|
|
9c5d32799d | ||
|
|
4c530ae5bc | ||
|
|
134466992b | ||
|
|
585dc6d781 | ||
|
|
ad5083714e | ||
|
|
fce69b5a4f | ||
|
|
a97e3501c8 | ||
|
|
d55ed5449d | ||
|
|
4d724c25c7 | ||
|
|
92c316606b | ||
|
|
3103106ba7 | ||
|
|
ebce1f7954 | ||
|
|
da9a8aee9e | ||
|
|
4bb8907c2b | ||
|
|
c3fe09e069 | ||
|
|
19096ebdfd | ||
|
|
d30343b9d9 | ||
|
|
30e8968f3b | ||
|
|
bb698f73f4 | ||
|
|
8a6dea2d55 | ||
|
|
68269a3f2a | ||
|
|
244e4fe4c7 | ||
|
|
2e943b280e | ||
|
|
d6b0c35739 | ||
|
|
ef7a3aa2ff | ||
|
|
79f532177f | ||
|
|
56aae058fc | ||
|
|
37f6b421f2 | ||
|
|
7e4ee8cb4f | ||
|
|
0219b8b6b4 | ||
|
|
4d6f11a6ce | ||
|
|
a51d944e25 | ||
|
|
a7f427d7d9 | ||
|
|
59af5a46f0 | ||
|
|
a8cd23de73 | ||
|
|
bb1aa22b63 | ||
|
|
28de9c69b3 | ||
|
|
ef3f373172 | ||
|
|
4b4c6aff91 | ||
|
|
c3ac6c80a6 | ||
|
|
6653fcf391 | ||
|
|
1ce708c570 | ||
|
|
8fc5d3586a | ||
|
|
a95ad0a897 | ||
|
|
1e4243e40b | ||
|
|
60ec6d4638 | ||
|
|
b50a9f760b | ||
|
|
ebdcd27f15 | ||
|
|
8d073b0232 | ||
|
|
64fd713042 | ||
|
|
fbc9ee9fba | ||
|
|
519a4bc24e | ||
|
|
b04290fe58 | ||
|
|
15f51f0eb6 | ||
|
|
763c529be0 | ||
|
|
dd34bcca5e | ||
|
|
e522ad46ba | ||
|
|
aedb8717f1 | ||
|
|
33b9431580 | ||
|
|
c82e82dafc | ||
|
|
ba1d51293c | ||
|
|
63bf68c991 | ||
|
|
c320a8d858 |
@@ -5,6 +5,9 @@ libtool
|
||||
config.status
|
||||
stamp-h
|
||||
Makefile
|
||||
gtk+.xconfig
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
gtk-config
|
||||
config.cache
|
||||
|
||||
|
||||
28
AUTHORS
28
AUTHORS
@@ -1,3 +1,25 @@
|
||||
Peter Mattis (petm@xcf.berkeley.edu)
|
||||
Spencer Kimball (spencer@xcf.berkeley.edu)
|
||||
Josh MacDonald (jmacd@xcf.berkeley.edu)
|
||||
Original Authors
|
||||
----------------
|
||||
Peter Mattis <petm@xcf.berkeley.edu>
|
||||
Spencer Kimball <spencer@xcf.berkeley.edu>
|
||||
Josh MacDonald <jmacd@xcf.berkeley.edu>
|
||||
|
||||
|
||||
The GTK+ Team (in alphabetical order)
|
||||
-------------------------------------
|
||||
Shawn T. Amundson <amundson@gtk.org>
|
||||
Jerome Bolliet <bolliet@in2p3.fr>
|
||||
Tony Gale <gale@gtk.org>
|
||||
Lars Hamann <lars@gtk.org>
|
||||
Tim Janik <timj@gtk.org>
|
||||
Stefan Jeske <stefan@gtk.org>
|
||||
Elliot Lee <sopwith@gtk.org>
|
||||
Ian Main <imain@gtk.org>
|
||||
Fedrerico Mena <quartic@gtk.org>
|
||||
Paolo Molaro <lupus@lettere.unipd.it>
|
||||
Jay Painter <jpaint@gtk.org>
|
||||
Manish Singh <manish@gtk.org>
|
||||
Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
There are many others who have contributed patches; we thank them,
|
||||
GTK+ is much better because of them.
|
||||
|
||||
9
COPYING
9
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -436,7 +436,7 @@ DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
@@ -463,8 +463,9 @@ convey the exclusion of warranty; and each file should have at least the
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
||||
4816
ChangeLog.pre-2-0
4816
ChangeLog.pre-2-0
File diff suppressed because it is too large
Load Diff
4816
ChangeLog.pre-2-10
4816
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
4816
ChangeLog.pre-2-2
4816
ChangeLog.pre-2-2
File diff suppressed because it is too large
Load Diff
4816
ChangeLog.pre-2-4
4816
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
4816
ChangeLog.pre-2-6
4816
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
4816
ChangeLog.pre-2-8
4816
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
49
HACKING
Normal file
49
HACKING
Normal file
@@ -0,0 +1,49 @@
|
||||
If you want to hack on the Gtk+ project, it will make you life easier
|
||||
to have the following packages installed:
|
||||
|
||||
- GNU autoconf 2.12
|
||||
- GNU automake 1.3
|
||||
(Beta releases are at ftp://ftp.cygnus.com/pub/tromey)
|
||||
- GNU libtool 1.2
|
||||
|
||||
These should be available by ftp from ftp.gnu.org or any of the
|
||||
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
|
||||
|
||||
If you are accessing gtk+ via CVS, then you will need to take several
|
||||
steps to get it to compile. You can do all these steps at once
|
||||
by running:
|
||||
|
||||
cvsroot/gtk+# ./autogen.sh
|
||||
|
||||
Basically this does the following for you:
|
||||
|
||||
cvsroot/gtk+# aclocal; automake; autoconf
|
||||
cvsroot/gtk+/glib# aclocal; automake; autoconf
|
||||
|
||||
The above commands create the "configure" script. Now you
|
||||
can run the configure script in cvsroot/gtk+ to create all
|
||||
the Makefiles. You only need to call "configure" in cvsroot/gtk+
|
||||
as the one in glib will be invoked automatically.
|
||||
|
||||
Before running autogen.sh or configure, make sure you have libtool
|
||||
in your path.
|
||||
|
||||
Note that autogen.sh runs configure for you. If you wish to pass
|
||||
options like --prefix=/usr to configure you can give those options
|
||||
to autogen.sh and they will be passed on to configure.
|
||||
|
||||
If at all possible, please use CVS to get the latest development version of
|
||||
gtk+. You can do the following to get gtk+ from cvs:
|
||||
|
||||
$ export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
|
||||
$ cvs login
|
||||
(there is no password, just hit return)
|
||||
$ cvs -z9 checkout gtk+
|
||||
|
||||
Please submit patches to the gtk-list@redhat.com mailing list (you must
|
||||
subscribe before you post, e-mail gtk-list-request@redhat.com with a
|
||||
subject of "subscribe"). All kinds of contributions are accepted.
|
||||
Patches that you wish to go into the distribution should also be uploaded
|
||||
to ftp://ftp.gimp.org/incoming. Follow the rules there for naming your
|
||||
patches.
|
||||
|
||||
137
INSTALL
137
INSTALL
@@ -0,0 +1,137 @@
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.0.6.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.0.6 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
% make install # install GTK
|
||||
|
||||
The Nitty-Gritty
|
||||
================
|
||||
|
||||
The 'configure' script can be given a number of options to enable
|
||||
and disable various features. For a complete list, type:
|
||||
|
||||
./configure --help
|
||||
|
||||
A few of the more important ones:
|
||||
|
||||
* --prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[ Defaults to /usr/local ]
|
||||
|
||||
* --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[ Defaults to the value given to --prefix ]
|
||||
|
||||
* --with-xinput=[no/gxi/xfree] support XInput [default=no]
|
||||
|
||||
The --with-xinput flag specifies whether to compile with support
|
||||
for the XInput extension (mainly used for graphics tablets), and
|
||||
which form of support to use:
|
||||
|
||||
no : no support
|
||||
gxi : Use generic XInput support
|
||||
xfree : Use special features in the Wacom drivers in XFree86 3.3.1
|
||||
and later.
|
||||
|
||||
For more information, follow the link from http://www.gtk.org
|
||||
|
||||
* --enable-xim support XIM [default=yes]
|
||||
|
||||
Specifying --disable-xim will disable support for entering
|
||||
internationalized text using X Input Methods. This will give some
|
||||
slight savings in speed and memory use and might be necessary
|
||||
with older versions of X.
|
||||
|
||||
* --with-locale=LOCALE locale name you want to use
|
||||
|
||||
The --with-locale options is used to determine if your operating
|
||||
system has support for the locale you will be using. If not, X's
|
||||
built in locale support will be used.
|
||||
|
||||
Because of bugs in autoconf, it is necessary to specify this
|
||||
option even if your LANG environment variable is correctly set.
|
||||
|
||||
This option does not determine which locale GTK will use at
|
||||
runtime. That will be determined from the usual environment
|
||||
variables. If you will be using multiple locales with GTK,
|
||||
specify the one for which your operating system has the worst
|
||||
support for the --with-locale option.
|
||||
|
||||
|
||||
Options can be given to the compiler and linker by setting
|
||||
environment variables before running configure. A few of the more
|
||||
important ones:
|
||||
|
||||
CC : The C compiler to use
|
||||
CPPFLAGS : Flags for the C preprocesser such as -I and -D
|
||||
CFLAGS : C compiler flags
|
||||
|
||||
The most important use of this is to set the
|
||||
optimization/debugging flags. For instance, to compile with no
|
||||
debugging information at all, run configure as:
|
||||
|
||||
CFLAGS=-O2 ./configure # Bourne compatible shells (sh/bash/zsh)
|
||||
|
||||
or,
|
||||
|
||||
setenv CFLAGS -O2 ; ./configure # csh and variants
|
||||
|
||||
|
||||
Installation directories
|
||||
========================
|
||||
|
||||
The location of the installed files is determined by the --prefix
|
||||
and --exec-prefix options given to configure. There are also more
|
||||
detailed flags to control individual directories. However, the
|
||||
use of these flags is not tested.
|
||||
|
||||
One particular detail to note, is that the architecture-dependent
|
||||
include file glibconfig.h is installed in:
|
||||
|
||||
$exec_pref/lib/glib/include/
|
||||
|
||||
if you have a version in $prefix/include, this is out of date
|
||||
and should be deleted.
|
||||
|
||||
A shell script gtk-config is created during the configure
|
||||
process, and installed in the bin/ directory
|
||||
($exec_prefix/bin). This is used to determine the location of GTK
|
||||
when building applications. If you move GTK after installation,
|
||||
it will be necessary to edit this file.
|
||||
|
||||
For complete details, see the file docs/gtk-config.txt
|
||||
|
||||
|
||||
Notes for using XIM support for Japanese input
|
||||
==============================================
|
||||
|
||||
* There is a bug in older versions of kinput2 that will cause GTK
|
||||
to hang when destroying a text entry. The latest versions of
|
||||
kinput is available from:
|
||||
|
||||
ftp://ftp.sra.co.jp/pub/x11/kinput2
|
||||
|
||||
* The locale information file for the ja_JP EUC locale
|
||||
distributed with some recent versions of X11 specifies to use the
|
||||
C library multibyte functions. Unless your C library has support
|
||||
for Japanese locales, this is incorrect, and will cause problems
|
||||
for GTK's internationalization.
|
||||
|
||||
(In particular, this occurs with GNU libc 2.0 and 2.1, in which
|
||||
the multibyte functions always translate to and from UTF-8; but
|
||||
the problem may occur for other C libraries, and other operating
|
||||
systems as well.)
|
||||
|
||||
To fix this, change the line:
|
||||
|
||||
use_stdc_env True
|
||||
|
||||
to
|
||||
|
||||
use_stdc_env False
|
||||
|
||||
in the file /usr/X11R6/lib/X11/locale/ja_JP/XLC_LOCALE.
|
||||
|
||||
|
||||
|
||||
72
Makefile.am
72
Makefile.am
@@ -3,7 +3,77 @@
|
||||
SRC_SUBDIRS = glib gdk gtk
|
||||
SUBDIRS = $(SRC_SUBDIRS) docs
|
||||
|
||||
EXTRA_DIST = gtk+.prj makecopyright TODO
|
||||
bin_SCRIPTS = gtk-config
|
||||
|
||||
EXTRA_DIST = \
|
||||
gtk+.spec \
|
||||
gtk.m4 \
|
||||
makecopyright \
|
||||
TODO \
|
||||
examples/README.1ST \
|
||||
examples/aspectframe/Makefile \
|
||||
examples/aspectframe/aspectframe.c \
|
||||
examples/buttons/Makefile \
|
||||
examples/buttons/buttons.c \
|
||||
examples/buttons/info.xpm \
|
||||
examples/entry/Makefile \
|
||||
examples/entry/entry.c \
|
||||
examples/eventbox/Makefile \
|
||||
examples/eventbox/eventbox.c \
|
||||
examples/filesel/Makefile \
|
||||
examples/filesel/filesel.c \
|
||||
examples/gtkdial/Makefile \
|
||||
examples/gtkdial/dial_test.c \
|
||||
examples/gtkdial/gtkdial.c \
|
||||
examples/gtkdial/gtkdial.h \
|
||||
examples/helloworld/Makefile \
|
||||
examples/helloworld/helloworld.c \
|
||||
examples/helloworld2/Makefile \
|
||||
examples/helloworld2/helloworld2.c \
|
||||
examples/list/Makefile \
|
||||
examples/list/list.c \
|
||||
examples/menu/Makefile \
|
||||
examples/menu/menu.c \
|
||||
examples/menu/menufactory.c \
|
||||
examples/menu/menufactory.h \
|
||||
examples/menu/mfmain.c \
|
||||
examples/menu/mfmain.h \
|
||||
examples/notebook/Makefile \
|
||||
examples/notebook/notebook.c \
|
||||
examples/packbox/Makefile \
|
||||
examples/packbox/packbox.c \
|
||||
examples/paned/Makefile \
|
||||
examples/paned/paned.c \
|
||||
examples/pixmap/Makefile \
|
||||
examples/pixmap/pixmap.c \
|
||||
examples/progressbar/Makefile \
|
||||
examples/progressbar/progressbar.c \
|
||||
examples/radiobuttons/Makefile \
|
||||
examples/radiobuttons/radiobuttons.c \
|
||||
examples/rulers/Makefile \
|
||||
examples/rulers/rulers.c \
|
||||
examples/scribble-simple/Makefile \
|
||||
examples/scribble-simple/scribble-simple.c \
|
||||
examples/scrolledwin/Makefile \
|
||||
examples/scrolledwin/scrolledwin.c \
|
||||
examples/selection/Makefile \
|
||||
examples/selection/gettargets.c \
|
||||
examples/selection/setselection.c \
|
||||
examples/statusbar/Makefile \
|
||||
examples/statusbar/statusbar.c \
|
||||
examples/table/Makefile \
|
||||
examples/table/table.c \
|
||||
examples/tictactoe/Makefile \
|
||||
examples/tictactoe/tictactoe.c \
|
||||
examples/tictactoe/tictactoe.h \
|
||||
examples/tictactoe/ttt_test.c \
|
||||
examples/wheelbarrow/Makefile \
|
||||
examples/wheelbarrow/wheelbarrow.c \
|
||||
examples/find-examples.sh
|
||||
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = gtk.m4
|
||||
|
||||
.PHONY: files populate checkin release
|
||||
|
||||
|
||||
178
NEWS
178
NEWS
@@ -0,0 +1,178 @@
|
||||
Overview of Changes in GTK+ 1.0.6:
|
||||
|
||||
* Minor documentation fixups.
|
||||
* Miscellaneous fixes for Entry, Paned, Table and CList widgets.
|
||||
* More fixes for GtkText, should behave much more stable now.
|
||||
* GtkFileSelection should behave much more nicely in combination with AFS now.
|
||||
* Configuration fixes on various platforms.
|
||||
* Miscellaneous fixes to XInput support.
|
||||
* Build with shared library dependencies on Linux
|
||||
* Fix for a major bug in the type systems memory allocation code that could
|
||||
cause random crashes.
|
||||
|
||||
Overview of Changes in GTK+ 1.0.5:
|
||||
|
||||
* Minor documentation fixups.
|
||||
* Fixes for clist (pixmap clipping), notebook, optionmenu, spinbutton
|
||||
and text widgets.
|
||||
* Minor ficup about base class initializations in the type system.
|
||||
* Fix for a major bug in the signal code that would cause random crashes.
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 1.0.4:
|
||||
|
||||
* Documentation changes (Thanks to Tony Gale!)
|
||||
* autoconf fix for x_lib variable
|
||||
* fixed pixmap clipping in gtkclist
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 1.0.3:
|
||||
|
||||
* Bug fixes, including fix for visuals on SGI machines
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 1.0.2:
|
||||
|
||||
* Speedups for type creation and especially gtk_type_is_a() checks.
|
||||
* Speedups in signal lookup, creation and emissions and connection handling.
|
||||
* Additions to the signal handling API (e.g. *_emitv).
|
||||
* Minor speedups with object data allocation and destruction.
|
||||
* Newly included file gtkfeatures.h which defines compatibility macros to
|
||||
test for certain API features upon program compilation.
|
||||
* Cleanups to give less warnings on 64-bit platforms.
|
||||
* Many bugs fixed, including:
|
||||
- A segfault with selections on Solaris and IRIX.
|
||||
- A segfault that occured for all keypresses on Linux/Alpha.
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 1.0.1:
|
||||
|
||||
* Significant speedups to widget creation and destruction
|
||||
* Upgrade to libtool-1.2
|
||||
* Lots of bug fixes, including one that fixed a major memory leak
|
||||
in 1.0.0.
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 1.0.0:
|
||||
|
||||
* A few bug fixes.
|
||||
|
||||
Overview of Changes in GTK+ 0.99.10:
|
||||
|
||||
* Lots of bug fixes
|
||||
* Documentation improvements
|
||||
* Better looking handlebox
|
||||
* A few convenience functions
|
||||
|
||||
Overview of Changes in GTK+ 0.99.9:
|
||||
|
||||
* Added examples directory, even more examples soon
|
||||
* Added optional word wrap to gtktext
|
||||
* Changes to gtkhandlebox
|
||||
* Lots of bug fixes
|
||||
|
||||
Overview of Changes in GTK+ 0.99.8:
|
||||
|
||||
* Compilation and configuration fixes
|
||||
* DND Fixes
|
||||
* New test in testgtk: cursors
|
||||
* Tutorial updates/additions
|
||||
* Few more FAQ additions
|
||||
* More prep for 1.0
|
||||
|
||||
Overview of Changes in GTK+ 0.99.7:
|
||||
|
||||
* This release is mainly because 0.99.6 did not compile completely
|
||||
due to a missing file.
|
||||
* Fixes to Gtk's quit handlers.
|
||||
|
||||
Overview of Changes in GTK+ 0.99.6:
|
||||
|
||||
* Intermediate release to become 1.0.
|
||||
* More signedness corrections for handler functions in gtkmain.h.
|
||||
* Semantics of GtkWidget::delete_event changed.
|
||||
* Documentation updates.
|
||||
* Inclusion of Gtk tutorial.
|
||||
* Implementation of a new shutdown method for GtkObject's executed prior to
|
||||
actual destruction. WARNING: this breaks binary compatibility, programs using
|
||||
Gtk need to be recompiled.
|
||||
* Clean ups due to compiler warnings.
|
||||
* Various widget fixes.
|
||||
|
||||
Overview of Fixes in GTK+ 0.99.5:
|
||||
|
||||
* Signal signedness and naming corrections
|
||||
* rc/style fixes
|
||||
* text, entry widget fixes
|
||||
* gtkeditable fixes
|
||||
* scrollbar flickering fixed
|
||||
* check casts are more descriptive
|
||||
* DND fixes
|
||||
* FAQ updates
|
||||
* Bug fixes
|
||||
|
||||
Overview of Changes in GTK+ 0.99.4:
|
||||
|
||||
* Reference counting revolution integrated.
|
||||
Refer to docs/refcounting.txt on this issue.
|
||||
* Implementation of a decent debugging system, you would want
|
||||
to export GTK_DEBUG=objects if you are going to develop gtk applications,
|
||||
refer to docs/debugging.txt for further information.
|
||||
* Additions on the signal code for querying information about certain signals,
|
||||
and pending handlers of signals.
|
||||
* Support for user signals, and major changes to internal signal handler
|
||||
handling for proper signal removal and invokation of after signals.
|
||||
* Additional signals for various widgets e.g, GtkHandleBox::child_attached,
|
||||
GtkHandleBox::child_detached, GtkWidget::style_set, GtkWidget::parent_set.
|
||||
* GtkTooltips became a true descendant of GtkObject via derivation from
|
||||
GtkData and facilitates an extra tip string which can be used as e.g. an
|
||||
index into context help.
|
||||
* Split up of the widget/object flags into a private and a public portion,
|
||||
consult docs/widget_system.txt on this.
|
||||
* Support for hot keys on gtk programs via gtk_key_snooper_install().
|
||||
* Reimplementation of the *_interp functions as *_full functions to provide
|
||||
simple callback functions as well.
|
||||
* Idle functions are now prioritized.
|
||||
* Many enhancements to GtkNotebook.
|
||||
* New widget GtkSpinButton, check out testgtk.
|
||||
* New widget GtkTipsQuery for letting the user query tooltips of widgets.
|
||||
* Addition of GtkEditable base widget to encapsulate selection and
|
||||
clipboard handling. (GtkEntry and GtkText use this)
|
||||
* Text widget more complete.
|
||||
* Additions to GtkStatusBar to make it complete.
|
||||
* Gdk now supports regions.
|
||||
* Access masks for widget arguments (GTK_ARG_READABLE/GTK_ARG_WRITABLE).
|
||||
* Function replacements:
|
||||
g_string_hash() -> g_str_hash()
|
||||
g_string_equal() -> g_str_equal()
|
||||
gtk_tooltips_set_tips() -> gtk_tooltips_set_tip()
|
||||
* Support for quit handlers in gtk_main().
|
||||
* Motif window mangaer hints support.
|
||||
* Widget arguments are now flagged for readability/writability.
|
||||
* Additions to documentation.
|
||||
* Various FAQ updates. (FAQ now included)
|
||||
* Clean ups and many many bug fixes by a lot of people all over the place.
|
||||
* New, long and descriptive ChangeLog entries for bored readers ;)
|
||||
|
||||
Overview of Changes in GTK+ 0.99.3:
|
||||
|
||||
* Filesel enhancement / stability changes
|
||||
* New widget, gtkcombo
|
||||
* Widgets in the toolbar do not get the focus
|
||||
* New widget, gtkstatusbar (still in-progress)
|
||||
* g_string_equal renamed g_str_equal
|
||||
* g_string_hash renamed g_str_hash
|
||||
* new gtkbox functions to allow modification of the child
|
||||
linkage after the widget tree is setup
|
||||
* gtk_*_get_arg() and gtk_*_set_arg() fixes and implementations
|
||||
* DND changes/fixes
|
||||
* Entry widget now has set_max_length function
|
||||
* Handlebox widget changes/fixes
|
||||
* Some work on text widget (still in-progress)
|
||||
* Now the toolbar supports arbitrary widgets as well
|
||||
* CList has resizable columns again
|
||||
* CList now looks consistant with scrolled windows
|
||||
* Remove flickering from entry widget
|
||||
* Added switch_page signal to notebook widget
|
||||
* Documentation additions
|
||||
* Other bug fixes...
|
||||
|
||||
74
README
74
README
@@ -1,17 +1,75 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 1.0.6. GTK+, which stands for the Gimp ToolKit,
|
||||
is a library for creating graphical user interfaces for the X Window
|
||||
System. It is designed to be small, efficient, and flexible. GTK+ is
|
||||
written in C with a very object-oriented approach.
|
||||
|
||||
The official ftp site is:
|
||||
ftp://ftp.gimp.org/pub/gtk
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
|
||||
Patches can be uploaded to:
|
||||
ftp://ftp.gimp.org/incoming
|
||||
|
||||
Anonymous CVS access for gtk+ (as well as 'gimp', 'gimp-data', and
|
||||
'gnome') is available via
|
||||
CVSROOT=:pserver:anonymous@cvs.gnome.org:/home/cvs
|
||||
with an empty password.
|
||||
The official web site is:
|
||||
http://www.gtk.org/
|
||||
|
||||
A mailing list is located at:
|
||||
gtk-list@redhat.com
|
||||
|
||||
To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
|
||||
(Send mail to gtk-list-request@redhat.com with the subject "subscribe")
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
|
||||
To report a bug, send mail either to gtk-list, as mentioned
|
||||
above, or to gtk-bugs@gtk.org. If you send mail to gtk-list, you
|
||||
must be subscribed yourself.
|
||||
|
||||
In the mail include:
|
||||
|
||||
* The version of GTK
|
||||
|
||||
* Information about your system. For instance:
|
||||
|
||||
- What operating system and version
|
||||
- What version of X
|
||||
- For Linux, what version of the C library
|
||||
|
||||
And anything else you think is relevant.
|
||||
|
||||
* How to reproduce the bug.
|
||||
|
||||
If you can reproduce it with the testgtk program that is built
|
||||
in the gtk/ subdirectory, that will be most convenient. Otherwise,
|
||||
please include a short test program that exhibits the behavior.
|
||||
As a last resort, you can also provide a pointer to a larger piece
|
||||
of software that can be downloaded.
|
||||
|
||||
(Bugs that can be reproduced within the GIMP are almost as good
|
||||
as bugs that can be reproduced in testgtk. If you are reporting a
|
||||
bug found with the GIMP, please include the version number of the GIMP
|
||||
you are using)
|
||||
|
||||
* If the bug was a crash, the exact text that was printed out
|
||||
when the crash occured.
|
||||
|
||||
* Further information such as stack traces may be useful, but
|
||||
is not necessary. If you do send a stack trace, and the error
|
||||
is an X error, it will be more useful if the stacktrace
|
||||
is produced running the test program with the --sync command
|
||||
line option.
|
||||
|
||||
Patches
|
||||
=======
|
||||
|
||||
Patches can be uploaded to the incoming/ directory on
|
||||
ftp.gtk.org. Please follow the instructions there, and include
|
||||
your name and email address in the README file.
|
||||
|
||||
If the patch fixes a bug, it is usually a good idea to include
|
||||
all the information described in "How to Report Bugs".
|
||||
|
||||
286
TODO
286
TODO
@@ -1,36 +1,280 @@
|
||||
Now
|
||||
---
|
||||
Bugs:
|
||||
* Scrolled windows (GtkList?) get cought in an endless reallocation loop
|
||||
under certain (rare) circumstances.
|
||||
|
||||
3. Fix focus activation of list items. Does list item activation have to be
|
||||
completely reorganized?
|
||||
* Widget redrawing when the window resizes sometimes messes up.
|
||||
GtkLabels sometimes redraw without clearing up the underlying background on
|
||||
window resizes.
|
||||
|
||||
* delay dnd settings to take effect once a widget is realized, this is
|
||||
to avoid force realizations. i think this goes along with owens dnd
|
||||
changes?
|
||||
-timj
|
||||
The way DND data types are set in GtkWidget really needs to be fixed.
|
||||
This is pretty high on my priority list, and I'll get to it as soon as
|
||||
the column list widget is done. The correct way dnd data needs to be set
|
||||
is to have a additional keyed data type with GtkWidget, which is applied to
|
||||
the widget's window upon realize.
|
||||
There also needs to be a way to set dnd-data on widget windows which are
|
||||
not the main window (for widgets that create more than one window).
|
||||
-Jay Painter
|
||||
DnD seems to work for me, but yes, there needs to be some sort of
|
||||
gtk_widget layer that makes it easier... Also, adding support for drop
|
||||
zones might be nice.
|
||||
-Elliot
|
||||
This one is reproducabel for me:
|
||||
testgtk --sync
|
||||
popup colorselection
|
||||
drag/drop works
|
||||
start up preview color
|
||||
drag works but not dropping
|
||||
end preview color
|
||||
drag/drop works
|
||||
start up prewiev color
|
||||
segfault in malloc
|
||||
-timj
|
||||
|
||||
4. Lists should scroll to center the recently selected item if it isn't
|
||||
* Change bitfields to guints from enums, or vice versa?
|
||||
|
||||
* Expose events aren't being generated correctly for DND demo
|
||||
|
||||
Additions:
|
||||
* GScanner: it might be good to ues stdio and getch() instead of 1-character
|
||||
reads. so one can take advantage of buffering. Currently each read() takes
|
||||
a separate syscall.
|
||||
|
||||
* implement gtk_default_draw_oval
|
||||
|
||||
* Lists should scroll to center the recently selected item if it isn't
|
||||
visible.
|
||||
|
||||
* enforce invariants on *_RESIZE* and *_REDRAW* flags.
|
||||
|
||||
The Future
|
||||
----------
|
||||
* asure that child widgets are really get gtk_widget_destroy()ed in their
|
||||
parents destroy handler, and not just unparented or somesuch.
|
||||
|
||||
-Documentation
|
||||
* GtkToolTips:
|
||||
allocate GtkTooltipsData from memchunks
|
||||
look into incorporation of outdated/gtk-dairiki-971208-[01].patch.gz
|
||||
|
||||
* Make widget attributes configurable after the widget is created (timj).
|
||||
|
||||
-Tree widget
|
||||
* Change gtk_widget_propagate_default_style() mechanism to
|
||||
void gtk_rc_string_export (const gchar *rc_additions,
|
||||
gboolean override_rc_styles);
|
||||
|
||||
-Text widget (needs to be finished)
|
||||
* Should release grab before activating menu item (and remove
|
||||
menu from screen?)
|
||||
|
||||
* Make all widget attributes configurable after the widget is created (timj).
|
||||
|
||||
* Widgets dervied from GtkButton need to be able to override
|
||||
GtkButtonClass.paint. e.g. redrawing of GtkToggleButton with CAN_DEFAULT
|
||||
is messed up otheriwse. This does in fact not only apply to (toggle)buttons,
|
||||
we should introduce a common paint member for the GtkWidgetClass.
|
||||
|
||||
* Radio buttons need to display CAN/HAS_DEFAULT correctly.
|
||||
|
||||
-Widget redrawing when the window resizes sometimes messes up.
|
||||
* GtkCList improvements. (Jay Painter)
|
||||
|
||||
-Make sure a widget added to a list is a list item and a widget added
|
||||
to a menu is a menu item, etc...
|
||||
* Seperate GtkObject and signaling system from Gdk dependancies?
|
||||
|
||||
* move *_input_add (wrappers for select(2)) mechanism into glib.
|
||||
|
||||
-More dialogs? Print, font, etc?
|
||||
* Make sure a widget added to a list is a list item and a widget added
|
||||
to a menu is a menu item, etc. GTK_BASIC was a first attempt at this,
|
||||
but it fails with subsequent container_add()s. maybe have another
|
||||
GTK_PARENT_BASIC (similar to GTK_PARENT_SENSITIVE) flag, to prevent
|
||||
tree iterations upon every container addition.
|
||||
|
||||
-Multiple document interface (MDI)?
|
||||
* gdk_expose_compress: ala-Xt, this would really help for opaque moves and
|
||||
such
|
||||
|
||||
-Support another widget style? Should be possible using GtkStyle's, but
|
||||
there may be some work needed to remove any style dependencies in widget
|
||||
code. Maybe GtkStyle's should have 'draw_push_button', 'draw_check_button',
|
||||
etc, functions to draw the various widgets.
|
||||
* Entry should have a password mode (and it should show stars
|
||||
for user feedback).
|
||||
|
||||
-OffiX drag and drop support
|
||||
* Entry should allow set_usize to work better, and should compute
|
||||
a different width when a maximum length is used.
|
||||
|
||||
* More dialogs: Print, GtkFontSelector, maybe others...
|
||||
|
||||
* Multiple document interface (MDI)?
|
||||
|
||||
* Support another widget style? Should be possible using GtkStyle's, but
|
||||
there may be some work needed to remove any style dependencies in widget
|
||||
code. Maybe GtkStyle's should have 'draw_push_button', 'draw_check_button',
|
||||
etc, functions to draw the various widgets.
|
||||
This will be covered by upcoming themability, raster is working on it.
|
||||
|
||||
* make the gtk_main callbacks consistent in their add/remove behaviour.
|
||||
|
||||
* More work on Documentation
|
||||
|
||||
* Check return values on all calls to XIC[Get/Set]Values
|
||||
|
||||
* Rewrite the interface to the i18n stuff so GTK widgets don't need to
|
||||
retrieve X values, and so they don't have to know the value of the
|
||||
XNxxx character constants.
|
||||
|
||||
* The "-geometry" option should be supported
|
||||
|
||||
- Having gdk_init() parse the geometry option. (putting it into
|
||||
GDK means you can use XParseGeometry() without wrapping it)
|
||||
|
||||
- Add a call gdk_get_geometry() that retrieves the results
|
||||
in a form like that returned by XParseGeometry()
|
||||
|
||||
- The application then can modify the results (as would gemvt)
|
||||
then call a routine gtk_window_set_geometry() on whatever
|
||||
it considers to be its main window.
|
||||
|
||||
- Then in some manner GtkWindow takes that into account when
|
||||
setting its hints. (Probably it uses the size and position
|
||||
as the current uposition and usize, and modulates that
|
||||
be the equivalents of the X flags
|
||||
|
||||
XValue, YValue, WidthValue, HeightValue, XNegative, or YNegative
|
||||
|
||||
( You'd have to extend gdk_window_set_hints to accept the
|
||||
window gravity option to get it right. )
|
||||
|
||||
? Allow moving the separator for paned widgets by dragging
|
||||
it directly instead of using the handle.
|
||||
|
||||
? Mark public use of gtk_tree_remove_item as deprecated - it should be used
|
||||
as:
|
||||
gtk_container_remove (GTK_CONTAINER(tree), widget);
|
||||
|
||||
* Standardize that all strings should be passed as gchar *, not
|
||||
guchar *. But what about non-string data? (gdk_property_change,
|
||||
gtk_selection_data_set) X makes these sort of things guchar...
|
||||
|
||||
* Check into XAddConnectionWatch - is this needed for XIM?
|
||||
|
||||
* Places where a _full variant is needed:
|
||||
|
||||
gtk_clist_set_row_data
|
||||
gtk_init_add
|
||||
gtk_menu_popup
|
||||
gtk_toolbar_prepend_element
|
||||
gtk_toolbar_insert_element
|
||||
gtk_widget_dnd_data_set (should be guchar * with a copy?
|
||||
shouldn't be there at all...)
|
||||
??? GtkDrawingarea.draw_data
|
||||
|
||||
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
|
||||
styles are broken for bg pixmaps, and RC styles only hack around
|
||||
that.
|
||||
|
||||
* Try to rationally deal with someone else deleting one of our
|
||||
windows??? This would mean keeping track of our window heirarchy
|
||||
ourselves, for one thing, and will never be safe, because of
|
||||
race conditions.
|
||||
|
||||
* --g-fatal-warnings flag that does
|
||||
g_set_warning_handler ((GWarningHandler)g_error);
|
||||
|
||||
* If a window spontaneously resizes itself N times before any
|
||||
ConfigureNotify events are received, then due to the interaction
|
||||
of the ConfigureNotify compression code in GDK and the resize
|
||||
count used for the window, the window will be size_allocated
|
||||
the next N-1 times it is moved.
|
||||
|
||||
Fix: Only send GDK_EVENT_CONFIGURE when the window is resized,
|
||||
create a new event type for toplevel motion. (GDK_EVENT_REPOSITION?)
|
||||
and eliminate the resize count in GtkWindow.
|
||||
|
||||
* Generic ScrolledWindow interface, which provide automatic scrollbar
|
||||
capability to Viewport, Text, and CList widgets.
|
||||
|
||||
GTK_POLICY_NEVER for scrolled windows.
|
||||
|
||||
* Consider caching more state in GdkWindowPrivate. Currently,
|
||||
every widget realization involves a XGetGeometry and a
|
||||
XGetWindowAttributes. And every GdkWindow destruction
|
||||
involves a XQueryTree.
|
||||
|
||||
* Scrolled windows need to be smarter about when they size-request/allocate
|
||||
their children. In particular, we should not be queuing the resizes
|
||||
on the toplevel window, but on the Viewport.
|
||||
|
||||
* Should all the default handlers really return FALSE? This can
|
||||
cause confusing presses to be sent to containers that actually
|
||||
want to get events on themselves.
|
||||
|
||||
* Fix block_resize, disable_resize.
|
||||
|
||||
* Buttons's should derive from Bin's. (GTK 2.0 change, breaks
|
||||
lots of stuff)
|
||||
|
||||
Text/Edit widget:
|
||||
|
||||
Bugs:
|
||||
|
||||
- Really big font (150 pt), plus lots of editing caused segfault
|
||||
|
||||
Improvements:
|
||||
|
||||
- Unify the key binding support in some fashion between the
|
||||
Entry and Text widget widgets (???)
|
||||
|
||||
- Figure out a way not to recompute the geometry on insertions/deletions
|
||||
which are large, but not a significant fraction of the
|
||||
entire text. (e.g., compute the changes as when the widget
|
||||
is not frozen, but without the actual scrolling)
|
||||
|
||||
- Prune the line start cache. But since it is only 68 bytes
|
||||
per line, and it is a lot faster when lines are in the cache,
|
||||
it may be better not to, at least for now.
|
||||
|
||||
- Show the non-editable state by changing colors. (Use the
|
||||
style entries for insensitive?)
|
||||
|
||||
- Multibyte support for the Text widget.
|
||||
|
||||
- Unicode support to do the multi-byte right.
|
||||
|
||||
- Support an .inputrc. (The readline one doesn't really work,
|
||||
unless it is extended because it can't represent X keysyms,
|
||||
just terminal type input)
|
||||
|
||||
- A vi mode
|
||||
|
||||
- Word wrap, instead of line folding. (Should the continuation
|
||||
characters be shown?)
|
||||
|
||||
- Horizontal scrolling
|
||||
|
||||
- Disable pasting compound text
|
||||
|
||||
- When showing background pixmap (not editable) actually set
|
||||
the background pixmap as the windows bg pixmap, to improve
|
||||
appearance on exposes. But this would require using another
|
||||
window to get the origins.
|
||||
|
||||
- In word wrap mode, break:
|
||||
|
||||
aaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
|
||||
as:
|
||||
| Maximum column
|
||||
aaaaaaaaaaa bbbbbbbbbbb|
|
||||
bbbbbbbbbbbbbbbbbbbbbbb|
|
||||
bbbbbbbbb |
|
||||
|
||||
Instead of:
|
||||
|
|
||||
aaaaaaaaaaa |
|
||||
bbbbbbbbbbbbbbbbbbbbbbb|
|
||||
bbbbbbbbbbbbbbbbbbbb |
|
||||
|
||||
- Blinking cursor
|
||||
|
||||
- API's : gtk_text_clear, gtk_text_delete_lines (gint start, gint end),
|
||||
gtk_text_append/prepend, gtk_text_insert_at (gint row, gint column),
|
||||
some function to get the row/column from the x/y-coordinates of a
|
||||
mouse click, some function to get the word/line under the mouse pointer
|
||||
[ From: Stefan Jeske <jeske@braunschweig.netsurf.de> ]
|
||||
|
||||
- "changed" emitted when doing deletes on empty Text widget.
|
||||
|
||||
-Make all widget attributes configurable after the widget is created.
|
||||
|
||||
@@ -17,10 +17,14 @@
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* some systems do not allow to ipcrm pages prior to
|
||||
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
|
||||
* IRIX 5.2 and 6.2.
|
||||
*/
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
395
aclocal.m4
vendored
395
aclocal.m4
vendored
@@ -1,395 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.2
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||
AM_SANITY_CHECK
|
||||
AC_ARG_PROGRAM
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_PROG_MAKE_SET])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "$@" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
|
||||
# serial 17 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_PROG_RANLIB])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AM_PROG_LD])
|
||||
AC_REQUIRE([AM_PROG_NM])
|
||||
AC_REQUIRE([AC_PROG_LN_S])
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)
|
||||
|
||||
dnl Allow the --disable-shared flag to stop us from building shared libs.
|
||||
AC_ARG_ENABLE(shared,
|
||||
[ --enable-shared build shared libraries [default=yes]],
|
||||
[if test "$enableval" = no; then
|
||||
libtool_enable_shared=no
|
||||
else
|
||||
libtool_enable_shared=yes
|
||||
fi])
|
||||
test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared"
|
||||
libtool_shared=
|
||||
test "$enable_shared" = no && libtool_shared=" --disable-shared"
|
||||
|
||||
dnl Allow the --disable-static flag to stop us from building static libs.
|
||||
AC_ARG_ENABLE(static,
|
||||
[ --enable-static build static libraries [default=yes]],
|
||||
[if test "$enableval" = no; then
|
||||
libtool_enable_static=no
|
||||
else
|
||||
libtool_enable_static=yes
|
||||
fi])
|
||||
test -n "$libtool_enable_static" && enable_static="$libtool_enable_static"
|
||||
libtool_static=
|
||||
test "$enable_static" = no && libtool_static=" --disable-static"
|
||||
|
||||
libtool_flags="$libtool_shared$libtool_static"
|
||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
[case "$host" in
|
||||
*-*-irix6*)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
flag_passed=no
|
||||
for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do
|
||||
case "$f" in
|
||||
ABI)
|
||||
test -n "$SGI_ABI" && flag_passed=yes
|
||||
if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then
|
||||
# Choose the ABI flag according to GCC's specs.
|
||||
if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then
|
||||
LD="${LD-ld} -32"
|
||||
else
|
||||
LD="${LD-ld} -n32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
|
||||
flag_passed=yes
|
||||
LD="${LD-ld} $f"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
;;
|
||||
esac]
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
])
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
/*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[case "$NM" in
|
||||
/*)
|
||||
ac_cv_path_NM="$NM" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb $PATH /bin; do
|
||||
test -z "$ac_dir" && dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
;;
|
||||
esac])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
if test $USE_MAINTAINER_MODE = yes; then
|
||||
MAINT=
|
||||
else
|
||||
MAINT='#M#'
|
||||
fi
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
# If the C compiler in not in ANSI C mode by default, try to add an option
|
||||
# to output variable @code{CC} to make it so. This macro tries various
|
||||
# options that select ANSI C on some system or another. It considers the
|
||||
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
|
||||
# handles function prototypes correctly.
|
||||
#
|
||||
# If you use this macro, you should check after calling it whether the C
|
||||
# compiler has been set to accept ANSI C; if not, the shell variable
|
||||
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
||||
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
||||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN(AM_PROG_CC_STDC,
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_BEFORE([$0], [AC_C_CONST])
|
||||
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
[#if !defined(__STDC__) || __STDC__ != 1
|
||||
choke me
|
||||
#endif
|
||||
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
], [
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};],
|
||||
[am_cv_prog_cc_stdc="$ac_arg"; break])
|
||||
done
|
||||
CC="$ac_save_CC"
|
||||
])
|
||||
if test -z "$am_cv_prog_cc_stdc"; then
|
||||
AC_MSG_RESULT([none needed])
|
||||
else
|
||||
AC_MSG_RESULT($am_cv_prog_cc_stdc)
|
||||
fi
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
*) CC="$CC $am_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
52
autogen.sh
Executable file
52
autogen.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile GTK+."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile GTK+."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile GTK+."
|
||||
echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(test -d gtk && test -d glib) || {
|
||||
echo "You must run this script in the top-level GTK+ directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "I am going to run ./configure with no arguments - if you wish "
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
|
||||
for i in glib .
|
||||
do
|
||||
echo processing $i
|
||||
(cd $i; aclocal; automake; autoconf)
|
||||
done
|
||||
./configure "$@"
|
||||
|
||||
echo
|
||||
echo "Now type 'make' to compile GTK+."
|
||||
16
config.h.in
16
config.h.in
@@ -3,6 +3,9 @@
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
@@ -15,10 +18,14 @@
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* some systems do not allow to ipcrm pages prior to
|
||||
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
|
||||
* IRIX 5.2 and 6.2.
|
||||
*/
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
@@ -32,5 +39,8 @@
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
167
configure.in
167
configure.in
@@ -1,11 +1,31 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(gdk/gdktypes.h)
|
||||
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
GTK_MAJOR_VERSION=1
|
||||
GTK_MINOR_VERSION=0
|
||||
GTK_MICRO_VERSION=6
|
||||
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
|
||||
|
||||
# For automake.
|
||||
VERSION=$GTK_VERSION
|
||||
PACKAGE=gtk+
|
||||
|
||||
# Configure glib
|
||||
AC_CONFIG_SUBDIRS(glib)
|
||||
|
||||
dnl Initialize automake stuff
|
||||
AM_INIT_AUTOMAKE(gtk+, 971109)
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
|
||||
|
||||
AC_SUBST(GTK_MAJOR_VERSION)
|
||||
AC_SUBST(GTK_MINOR_VERSION)
|
||||
AC_SUBST(GTK_MICRO_VERSION)
|
||||
AC_SUBST(GTK_VERSION)
|
||||
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
# Specify a configuration file
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
@@ -20,19 +40,24 @@ AC_CANONICAL_HOST
|
||||
|
||||
AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
|
||||
echo $enable_shm, enable_shm="yes")
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
|
||||
if eval "test x$enable_debug = xyes"; then
|
||||
DEBUGFLAG="-g"
|
||||
fi)
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
|
||||
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
|
||||
, enable_ansi=no)
|
||||
AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
|
||||
echo $enable_xim, enable_xim="yes")
|
||||
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
|
||||
|
||||
AC_ARG_WITH(xinput, [ --with-xinput[=no/gxi/xfree] support XInput ])
|
||||
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
|
||||
|
||||
if test -n "$DEBUGFLAG"; then
|
||||
CFLAGS="$DEBUGFLAG"
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
|
||||
CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
|
||||
else
|
||||
CFLAGS="$CFLAGS -DNDEBUG"
|
||||
if test "x$enable_debug" = "xno"; then
|
||||
CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
|
||||
else
|
||||
CFLAGS="$CFLAGS -DGTK_NO_CHECK_CASTS"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build time sanity check...
|
||||
@@ -44,29 +69,68 @@ AM_PROG_CC_STDC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
if eval "test x$GCC = xyes"; then
|
||||
test `echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null`
|
||||
if test ! $?; then
|
||||
if test "x$GCC" = "xyes"; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
|
||||
if eval "test x$enable_ansi = xyes"; then
|
||||
test `echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null`
|
||||
if test ! $?; then
|
||||
if test "x$enable_ansi" = "xyes"; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -ansi"
|
||||
fi
|
||||
|
||||
test `echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null`
|
||||
if test ! $?; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -pedantic"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
|
||||
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
|
||||
gtk_save_LIBS=$LIBS
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([#include <math.h>
|
||||
int main (void) { return (log(1) != log(1.)); }],
|
||||
AC_MSG_RESULT(none needed),
|
||||
gtk_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -std1"
|
||||
AC_TRY_RUN([#include <math.h>
|
||||
int main (void) { return (log(1) != log(1.)); }],
|
||||
AC_MSG_RESULT(-std1),
|
||||
AC_MSG_RESULT()
|
||||
CFLAGS=$gtk_save_CFLAGS
|
||||
AC_MSG_WARN(
|
||||
[No ANSI prototypes found in library. (-std1 didn't work.)])
|
||||
)
|
||||
)
|
||||
LIBS=$gtk_save_LIBS
|
||||
|
||||
dnl NeXTStep cc seems to need this
|
||||
AC_MSG_CHECKING([for extra flags for POSIX compliance])
|
||||
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
|
||||
AC_MSG_RESULT(none needed),
|
||||
gtk_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -posix"
|
||||
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
|
||||
AC_MSG_RESULT(-posix),
|
||||
AC_MSG_RESULT()
|
||||
CFLAGS=$gtk_save_CFLAGS
|
||||
AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
|
||||
|
||||
if test "x$enable_xim" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -DUSE_XIM"
|
||||
fi
|
||||
|
||||
# Find the X11 include and library directories
|
||||
AC_PATH_X
|
||||
AC_PATH_XTRA
|
||||
|
||||
if test "x$no_x" = "xyes"; then
|
||||
AC_MSG_ERROR([
|
||||
*** X libraries or include files not found. Check 'config.log' for
|
||||
*** more details.])
|
||||
fi
|
||||
|
||||
if test "x$x_includes" = "x"; then
|
||||
x_includes="/usr/include"
|
||||
fi
|
||||
@@ -74,35 +138,50 @@ fi
|
||||
saved_cflags="$CFLAGS"
|
||||
saved_ldflags="$LDFLAGS"
|
||||
|
||||
CFLAGS="$X_CFLAGS"
|
||||
LDFLAGS="$X_LDFLAGS $X_LIBS"
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
|
||||
|
||||
# Checks for libraries.
|
||||
# Check for the X11 library
|
||||
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
|
||||
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
|
||||
AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
|
||||
$X_EXTRA_LIBS)
|
||||
|
||||
if eval "test x$enable_shm = xyes"; then
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for the Xext library (needed for XShm extention)
|
||||
AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
|
||||
AC_CHECK_LIB(Xext, XShmAttach,
|
||||
x_libs="-lXext $x_libs",
|
||||
# On AIX, it is in XextSam instead, but we still need -lXext
|
||||
AC_CHECK_LIB(XextSam, XShmAttach,
|
||||
x_libs="-lXextSam -lXext $x_libs",
|
||||
no_xext_lib=yes, $x_libs),
|
||||
$x_libs)
|
||||
fi
|
||||
|
||||
# Check for shaped window extension
|
||||
|
||||
AC_CHECK_LIB(Xext, XShapeCombineMask,
|
||||
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
|
||||
x_libs="-lXext $x_libs"
|
||||
fi
|
||||
AC_DEFINE(HAVE_SHAPE_EXT),, $x_libs)
|
||||
|
||||
x_cflags="$X_CFLAGS"
|
||||
x_ldflags="$X_LDFLAGS $X_LIBS"
|
||||
|
||||
# set up things for XInput
|
||||
|
||||
if eval "test x$with_xinput = xgxi -o x$with_xinput = xyes"; then
|
||||
if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
|
||||
AC_DEFINE(XINPUT_GXI)
|
||||
xinput_progs=gxid
|
||||
x_libs="-lXi $x_libs"
|
||||
elif eval "test x$with_xinput = xxfree"; then
|
||||
elif test "x$with_xinput" = "xxfree"; then
|
||||
AC_DEFINE(XINPUT_XFREE)
|
||||
x_libs="-lXi $x_libs"
|
||||
else
|
||||
AC_DEFINE(XINPUT_NONE)
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST(x_cflags)
|
||||
AC_SUBST(x_includes)
|
||||
AC_SUBST(x_ldflags)
|
||||
@@ -112,7 +191,7 @@ AC_SUBST(xinput_progs)
|
||||
CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
if eval "test x$enable_shm = xyes"; then
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for shared memory
|
||||
AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
|
||||
AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
|
||||
@@ -151,11 +230,11 @@ if eval "test x$enable_shm = xyes"; then
|
||||
|
||||
# Check for the X shared memory extension header file
|
||||
AC_MSG_CHECKING(X11/extensions/XShm.h)
|
||||
if eval "test x$no_ext_lib = xyes"; then
|
||||
if test "x$no_xext_lib" = "xyes"; then
|
||||
AC_MSG_RESULT(no)
|
||||
no_xshm=yes
|
||||
else
|
||||
if eval "test -f $x_includes/X11/extensions/XShm.h"; then
|
||||
if test -f "$x_includes/X11/extensions/XShm.h"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XSHM_H)
|
||||
else
|
||||
@@ -186,6 +265,27 @@ gtk_cv_display_resource_base="private3")])
|
||||
AC_MSG_RESULT($gtk_cv_display_resource_base)
|
||||
AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
|
||||
|
||||
# Check if X_LOCALE definition is necessary
|
||||
|
||||
AC_MSG_CHECKING(need -DX_LOCALE)
|
||||
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return setlocale (LC_ALL, "${with_locale}") == NULL;
|
||||
}],
|
||||
need_x_locale=no,
|
||||
need_x_locale=yes)
|
||||
AC_MSG_RESULT($need_x_locale)
|
||||
|
||||
if test $need_x_locale = yes; then
|
||||
CFLAGS="$CFLAGS -DX_LOCALE"
|
||||
fi
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
@@ -194,6 +294,7 @@ AC_C_CONST
|
||||
|
||||
# Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_MMAP
|
||||
|
||||
# Check for sys/select.h
|
||||
|
||||
@@ -211,4 +312,12 @@ if test $gtk_ok = no; then
|
||||
AC_DEFINE(NO_FD_SET)
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
gtk-config
|
||||
docs/Makefile
|
||||
gdk/Makefile
|
||||
gtk/Makefile
|
||||
gtk/gtkfeatures.h
|
||||
],
|
||||
[chmod +x gtk-config])
|
||||
|
||||
18
debian/README.debian
vendored
Normal file
18
debian/README.debian
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
libgtk1 for Debian
|
||||
----------------------
|
||||
|
||||
The GIMP Tool Kit (gtk) is a set of widgets to help you program
|
||||
programs for the X Windowing System easily and powerfully.
|
||||
|
||||
gtk is the moving force behind The GNU Image Manipulation Program (The
|
||||
GIMP) -- the number one freely-available image editing and creation
|
||||
program available.
|
||||
|
||||
gtk is rapidly under development, and the source tree has officially
|
||||
been separated from The GIMP now, as other teams of programmers
|
||||
are beginning to write software using its great widget set -- like
|
||||
GNOME, a desktop interface for X, and gzilla, a freely available
|
||||
web browser for X.
|
||||
|
||||
Ben Gertzfield <che@debian.org>, Mon, 29 Sep 1997 13:11:45 -0700
|
||||
|
||||
169
debian/changelog
vendored
Normal file
169
debian/changelog
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
gtk+ (1:0.99.8-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* New file included in libgtk-dev: /usr/share/aclocal/gtk.m4,
|
||||
to help autoconf/automake developers use gtk and gtk-config
|
||||
more easily.
|
||||
* New file included in libgtk-doc: /usr/doc/libgtk-doc/gtk-config.txt
|
||||
Please refer to this doc when developing for gtk or compiling
|
||||
and running into odd path-related errors.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Thu, 19 Mar 1998 19:58:53 -0800
|
||||
|
||||
gtk+ (1:0.99.7-4) frozen unstable; urgency=low
|
||||
|
||||
* Rebuild with native Debian libtool to have libraries properly
|
||||
linked with libc and libX et al.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Tue, 17 Mar 1998 16:05:13 -0800
|
||||
|
||||
gtk+ (1:0.99.7-3) frozen unstable; urgency=low
|
||||
|
||||
* Accidentally included all the html docs in /usr/doc/libgtk-doc/faq-html;
|
||||
moved the tutorial into /usr/doc/libgtk-doc/tutorial-html.
|
||||
* Included the Italian Gtk+ Tutorial in
|
||||
/usr/doc/libgtk-doc/italian-tutorial-html.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 16 Mar 1998 22:39:57 -0800
|
||||
|
||||
gtk+ (1:0.99.7-2) unstable; urgency=low
|
||||
|
||||
* Upstream source added a /usr/lib/glib/ directory that I didn't
|
||||
notice; included this directory in libgtk-dev.
|
||||
* Realized that Xinput support was broken because I was doing
|
||||
./configure --enable-xinput=xfree instead of ./configure
|
||||
--with-xinput=xfree. Fixed.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sun, 15 Mar 1998 19:17:05 -0800
|
||||
|
||||
gtk+ (1:0.99.7-1) unstable; urgency=low
|
||||
|
||||
* New upstream release -- THIS IS INCOMPATIBLE WITH OLDER RELEASES!
|
||||
All Gtk-using packages *will* need patches to work with this Gtk!
|
||||
* Upstream release includes 'gtk-config' script to check installed
|
||||
version of Gtk; included said script in libgtk-dev in /usr/bin.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sun, 15 Mar 1998 11:03:03 -0800
|
||||
|
||||
gtk+ (1:0.99.5-2) unstable; urgency=low
|
||||
|
||||
* Modified libgtk-doc to Replace: libgtk-dev (<< 1:0.99.4) to
|
||||
deal with both packages including the same .info files.
|
||||
Fixes bug #19533.
|
||||
* Also noticed that libgtk-dev depended on libgtk1 without
|
||||
an epoch! Fixed.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Thu, 12 Mar 1998 13:37:11 -0800
|
||||
|
||||
gtk+ (1:0.99.5-1) unstable; urgency=low
|
||||
|
||||
* Wow, that was quick, a new upstream version.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 9 Mar 1998 22:08:08 -0800
|
||||
|
||||
gtk+ (1:0.99.4-3) unstable; urgency=low
|
||||
|
||||
* Recompiled with --enable-xinput=xfree to enable Wacom pads
|
||||
and other physical input devices.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 9 Mar 1998 21:26:07 -0800
|
||||
|
||||
gtk+ (1:0.99.4-2) unstable; urgency=MEDIUM
|
||||
|
||||
* Ack! The shlibs file makes things depend on libgtk1 (>= 0.99.4)
|
||||
rather than (>= 1:0.99.4)! Fixes bug #19134.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sat, 7 Mar 1998 23:57:33 -0800
|
||||
|
||||
gtk+ (1:0.99.4-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Recompiled with new debhelper to remove du warnings.
|
||||
* Upstream source is named gtk+, not libgtk1. Changed source name.
|
||||
* Removed --disable-xim in hopes that xim is no longer broken.
|
||||
* Removed testgtk at the behest of the Gtk developers until I can
|
||||
come up with a better solution, probably related to:
|
||||
* the new libgtk-doc package! :) libgtk-doc contains the Gtk FAQ,
|
||||
the Gtk Tutorial, and the Gtk info files.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Tue, 3 Mar 1998 22:23:47 -0800
|
||||
|
||||
libgtk1 (1:0.99.3-2) unstable; urgency=low
|
||||
|
||||
* Created manpage for testgtk program.
|
||||
* Fixed copyright mention to LGPL.gz to be just LGPL.
|
||||
* This fixes all known lintian errors.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Wed, 11 Feb 1998 14:07:17 -0800
|
||||
|
||||
libgtk1 (1:0.99.3-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Include the testgtk binary in libgtk-dev.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sat, 24 Jan 1998 15:30:09 -0800
|
||||
|
||||
libgtk1 (1:0.99.2-2) unstable; urgency=low
|
||||
|
||||
* Fixed shlibs file to specify version >=1:0.99.2.
|
||||
* Renamed debian/postinst.libgtk1 to debian/postinst, so debhelper
|
||||
would actually install it.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 5 Jan 1998 12:22:46 -0800
|
||||
|
||||
libgtk1 (1:0.99.2-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Sun, 4 Jan 1998 00:21:21 -0800
|
||||
|
||||
libgtk1 (1:0.99.0-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version with new numbering scheme, went to epoch :1
|
||||
correspondingly.
|
||||
* Hopefully fixed entry-field bug.
|
||||
* Converted to use debhelper.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 15 Dec 1997 12:02:25 -0800
|
||||
|
||||
libgtk1 (971201-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Fixed copyright to say LGPL, not GPL. (bug #14867)
|
||||
* Re-added postinst ldconfig call. (bug #14213)
|
||||
* Info files should be correct now. (bugs #14773, #15143)
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 1 Dec 1997 16:41:50 -0800
|
||||
|
||||
libgtk1 (971109-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Name is really 'GIMP Tool Kit', not 'General Tool Kit'.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 10 Nov 1997 16:15:27 -0800
|
||||
|
||||
libgtk1 (970925-3) unstable; urgency=low
|
||||
|
||||
* Moved the include files to /usr/include/{gtk,gdk}.
|
||||
* Removed postinst/postrm ldconfig calls, fixes old gimp bug #13773.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Fri, 17 Oct 1997 17:06:10 -0700
|
||||
|
||||
libgtk1 (970925-2) unstable; urgency=low
|
||||
|
||||
* Added the shlibs file.
|
||||
* Removed the postinst/postrm calls to ldconfig, fixes bug #13733.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Fri, 10 Oct 1997 17:55:39 -0700
|
||||
|
||||
libgtk1 (970925-1) unstable; urgency=low
|
||||
|
||||
* New upstream version.
|
||||
* Split off source tree from gimp's source tree.
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Mon, 29 Sep 1997 13:14:45 -0700
|
||||
|
||||
Local variables:
|
||||
mode: debian-changelog
|
||||
add-log-mailing-address: "che@debian.org"
|
||||
End:
|
||||
41
debian/control
vendored
Normal file
41
debian/control
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
Source: gtk+
|
||||
Priority: optional
|
||||
Section: libs
|
||||
Maintainer: Ben Gertzfield <che@debian.org>
|
||||
Standards-Version: 2.4.0.0
|
||||
|
||||
Package: libgtk1
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends}
|
||||
Description: The GIMP Toolkit set of widgets for X
|
||||
The GIMP Toolkit is a freely available set of widgets for X.
|
||||
GTK is easy to use, and has been implemented in such projects as
|
||||
The GNU Image Manipulation Program (The GIMP), GNOME, a GNU
|
||||
desktop set of utilities for X, and gzilla, a GNU web-browser.
|
||||
|
||||
Package: libgtk-dev
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: libgtk1 (>= 1:0.99.8)
|
||||
Suggests: libgtk-doc
|
||||
Replaces: libgtk1 (<= 0.99.7)
|
||||
Description: Header files and static libraries for the GIMP Toolkit
|
||||
This package contains the header files and static libraries for the
|
||||
GIMP Toolkit set of widgets for X.
|
||||
.
|
||||
Install this package if you wish to develop your own X programs using
|
||||
the GIMP Toolkit, or if you wish to compile your own plug-ins for
|
||||
The GIMP.
|
||||
|
||||
Package: libgtk-doc
|
||||
Architecture: all
|
||||
Section: docs
|
||||
Replaces: libgtk-dev (<< 1:0.99.4)
|
||||
Description: Documentation and example code for the GIMP Toolkit
|
||||
This package contains lots of info-files, HTML docs, FAQs, and
|
||||
other handy documentation about the GIMP Toolkit set of widgets
|
||||
for X.
|
||||
.
|
||||
Install this package if you want to have lots of info about the
|
||||
GIMP toolkit when you're programming.
|
||||
8
debian/copyright
vendored
Normal file
8
debian/copyright
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
This package was debianized by Ben Gertzfield che@imsa.edu on
|
||||
Tue, 22 Jul 1997 20:53:20 -0500
|
||||
|
||||
It was downloaded from ftp.gimp.org.
|
||||
|
||||
It may be redistributed under the terms of the GNU LGPL, Version 2 or
|
||||
later, found on Debian systems in the file /usr/doc/copyright/LGPL.
|
||||
|
||||
7
debian/libgtk-dev.postinst
vendored
Normal file
7
debian/libgtk-dev.postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
6
debian/libgtk-dev.prerm
vendored
Normal file
6
debian/libgtk-dev.prerm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
|
||||
#DEBHELPER#
|
||||
14
debian/libgtk-doc.postinst
vendored
Normal file
14
debian/libgtk-doc.postinst
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
install-info --quiet --description="The GIMP Toolkit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gtk.info.gz
|
||||
|
||||
install-info --quiet --description="The GIMP Drawing Kit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gdk.info.gz
|
||||
|
||||
install-info --quiet --description="The GIMP Library." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/glib.info.gz
|
||||
|
||||
#DEBHELPER#
|
||||
8
debian/libgtk-doc.prerm
vendored
Normal file
8
debian/libgtk-doc.prerm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
install-info --quiet --remove glib
|
||||
install-info --quiet --remove gdk
|
||||
|
||||
#DEBHELPER#
|
||||
7
debian/postinst
vendored
Normal file
7
debian/postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
120
debian/rules
vendored
Executable file
120
debian/rules
vendored
Executable file
@@ -0,0 +1,120 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to compile the package.
|
||||
./configure --prefix=/usr --with-xinput=xfree
|
||||
$(MAKE)
|
||||
cd docs && make -f Makefile.sgml
|
||||
cd ..
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) distclean
|
||||
-rm docs/*.html
|
||||
dh_clean
|
||||
|
||||
install: install-stamp
|
||||
install-stamp: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
$(MAKE) prefix=`pwd`/debian/tmp/usr install
|
||||
touch install-stamp
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install libgtk-doc
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install libgtk-dev libgtk1
|
||||
|
||||
libgtk1: build
|
||||
dh_testdir -plibgtk1
|
||||
dh_testroot -plibgtk1
|
||||
# dh_clean -plibgtk1
|
||||
dh_installdirs -plibgtk1
|
||||
# Add here commands to install the files into debian/tmp
|
||||
rm -rf debian/tmp/usr/bin debian/tmp/usr/include debian/tmp/usr/info debian/tmp/usr/lib/glib debian/tmp/usr/share
|
||||
# dh_movefiles -plibgtk1
|
||||
# $(MAKE) prefix=`pwd`/debian/tmp/usr install
|
||||
# rmdir debian/tmp/usr/bin
|
||||
# rm debian/tmp/usr/lib/*.{so,la,a}
|
||||
# rm -rf debian/tmp/usr/{include,info}
|
||||
dh_installdocs -plibgtk1
|
||||
dh_installchangelogs -plibgtk1
|
||||
dh_strip -plibgtk1
|
||||
dh_compress -plibgtk1
|
||||
dh_fixperms -plibgtk1
|
||||
dh_installdeb -plibgtk1
|
||||
dh_shlibdeps -plibgtk1
|
||||
dh_gencontrol -plibgtk1
|
||||
dh_makeshlibs -plibgtk1 -V 'libgtk1 (>= 1:0.99.7)'
|
||||
# echo "libglib 1 libgtk1 (>=0.99.4)" >> debian/tmp/DEBIAN/shlibs
|
||||
# echo "libgtk 1 libgtk1 (>=0.99.4)" >> debian/tmp/DEBIAN/shlibs
|
||||
# echo "libgdk 1 libgtk1 (>=0.99.4)" >> debian/tmp/DEBIAN/shlibs
|
||||
dh_md5sums -plibgtk1
|
||||
dh_builddeb -plibgtk1
|
||||
|
||||
libgtk-dev: build
|
||||
dh_testdir -plibgtk-dev
|
||||
dh_testroot -plibgtk-dev
|
||||
dh_clean -plibgtk-dev -k
|
||||
dh_installdirs -plibgtk-dev
|
||||
# Add here commands to install the files into debian/tmp
|
||||
dh_movefiles -plibgtk-dev
|
||||
cp gtk-config debian/tmp/usr/bin
|
||||
# $(MAKE) prefix=`pwd`/debian/libgtk-dev/usr install
|
||||
# find debian/libgtk-dev/usr/lib \( -type f -or -type l \) -and ! \( -name \*.so -or -name \*.a \) | xargs rm
|
||||
# cp gtk/.libs/testgtk debian/libgtk-dev/usr/bin
|
||||
# cp debian/testgtk.1 debian/libgtk-dev/usr/man/man1
|
||||
dh_installdocs -plibgtk-dev
|
||||
dh_installchangelogs -plibgtk-dev
|
||||
dh_strip -plibgtk-dev
|
||||
dh_compress -plibgtk-dev
|
||||
dh_fixperms -plibgtk-dev
|
||||
dh_installdeb -plibgtk-dev
|
||||
dh_shlibdeps -plibgtk-dev
|
||||
dh_gencontrol -plibgtk-dev
|
||||
dh_makeshlibs -plibgtk-dev
|
||||
dh_md5sums -plibgtk-dev
|
||||
dh_builddeb -plibgtk-dev
|
||||
|
||||
libgtk-doc:
|
||||
dh_testdir -plibgtk-doc
|
||||
dh_testroot -plibgtk-doc
|
||||
dh_clean -plibgtk-doc -k
|
||||
dh_installdirs -plibgtk-doc usr/doc/libgtk-doc/faq-html \
|
||||
usr/doc/libgtk-doc/tutorial-html usr/doc/libgtk-doc/italian-tutorial-html
|
||||
# Add here commands to install the files into debian/tmp
|
||||
dh_movefiles -plibgtk-doc
|
||||
cp docs/gtkfaq*.html debian/libgtk-doc/usr/doc/libgtk-doc/faq-html
|
||||
cp docs/gtk_tut-*.html debian/libgtk-doc/usr/doc/libgtk-doc/tutorial-html
|
||||
cp docs/gtk_tut.html debian/libgtk-doc/usr/doc/libgtk-doc/tutorial-html
|
||||
cp docs/gtk_tut_it*.html debian/libgtk-doc/usr/doc/libgtk-doc/italian-tutorial-html
|
||||
dh_installdocs -plibgtk-doc docs/{debugging,developers,styles,text_widget,widget_system,gtk-config}.txt ChangeLog TODO NEWS
|
||||
dh_installchangelogs -plibgtk-doc
|
||||
dh_strip -plibgtk-doc
|
||||
dh_compress -plibgtk-doc
|
||||
dh_fixperms -plibgtk-doc
|
||||
dh_installdeb -plibgtk-doc
|
||||
dh_shlibdeps -plibgtk-doc
|
||||
dh_gencontrol -plibgtk-doc
|
||||
dh_makeshlibs -plibgtk-doc
|
||||
dh_md5sums -plibgtk-doc
|
||||
dh_builddeb -plibgtk-doc
|
||||
|
||||
|
||||
source diff:
|
||||
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary
|
||||
@@ -1 +1,18 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.html
|
||||
*.info*
|
||||
*.dvi
|
||||
*.ps
|
||||
*.pg
|
||||
*.ky
|
||||
*.cp
|
||||
*.fn
|
||||
*.tp
|
||||
*.vr
|
||||
*.log
|
||||
*.aux
|
||||
*.toc
|
||||
*.cps
|
||||
*.fns
|
||||
*.vrs
|
||||
|
||||
@@ -1,8 +1,30 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
info_TEXINFOS = gdk.texi gtk.texi
|
||||
info_TEXINFOS = gdk.texi gtk.texi glib.texi
|
||||
|
||||
EXTRA_DIST = texinfo.tex macros.texi
|
||||
man_MANS = gtk-config.1
|
||||
|
||||
EXTRA_DIST = \
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
Makefile.sgml \
|
||||
gtkdocs_fix \
|
||||
gtkfaq.sgml \
|
||||
gtk-config.txt \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt \
|
||||
gtk_tut_packbox1.gif \
|
||||
gtk_tut_packbox2.gif \
|
||||
gtk_tut_table.gif \
|
||||
gtk-config.1
|
||||
|
||||
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
|
||||
40
docs/Makefile.sgml
Normal file
40
docs/Makefile.sgml
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# To use this makefile, do:
|
||||
# make -f Makefile.gtkfaq
|
||||
#
|
||||
# This is not done by default because you might
|
||||
# not have sgml2html installed... Perhaps we could
|
||||
# detect that in the future and combine it in with
|
||||
# the automake stuff...
|
||||
#
|
||||
|
||||
all: html ps
|
||||
|
||||
html: faq tut italian_tut
|
||||
perl gtkdocs_fix gtkfaq*.html gtk_tut*.html
|
||||
|
||||
txt:
|
||||
sgml2txt gtkfaq.sgml
|
||||
sgml2txt gtk_tut.sgml
|
||||
sgml2txt gtk_tut_it.sgml
|
||||
|
||||
ps: dvi
|
||||
dvips -o gtkfaq.ps gtkfaq.dvi
|
||||
dvips -o gtk_tut.ps gtk_tut.dvi
|
||||
dvips -o gtk_tut_it.ps gtk_tut_it.dvi
|
||||
|
||||
dvi:
|
||||
sgml2latex gtkfaq.sgml
|
||||
sgml2latex gtk_tut.sgml
|
||||
sgml2latex gtk_tut_it.sgml
|
||||
|
||||
faq:
|
||||
sgml2html gtkfaq.sgml
|
||||
|
||||
tut:
|
||||
sgml2html gtk_tut.sgml
|
||||
|
||||
italian_tut:
|
||||
sgml2html gtk_tut_it.sgml
|
||||
|
||||
|
||||
97
docs/debugging.txt
Normal file
97
docs/debugging.txt
Normal file
@@ -0,0 +1,97 @@
|
||||
The GLIB, GDK, and GTK libraries have extensive support for
|
||||
debugging the library and your programs.
|
||||
|
||||
The amount of debugging being done can be determined both
|
||||
at run time and compile time.
|
||||
|
||||
COMPILE TIME OPTIONS
|
||||
--------------------
|
||||
|
||||
At compile time, the amount of debugging support included is
|
||||
determined by four macros:
|
||||
|
||||
G_ENABLE_DEBUG
|
||||
If set, enable support for runtime checking.
|
||||
|
||||
G_DISABLE_ASSERT
|
||||
If set, disable g_assert macros
|
||||
|
||||
G_DISABLE_CHECKS
|
||||
If set, disable the g_return_if_fail and g_return_val_if_fail macros
|
||||
|
||||
GTK_NO_CHECK_CASTS
|
||||
If set, don't check casts between different object types
|
||||
|
||||
|
||||
Whether these macros are defined is controlled at configuration
|
||||
time by the --enable-debug option.
|
||||
|
||||
--enable-debug=minimum [default]
|
||||
Enable only inexpensive sanity checking
|
||||
sets GTK_NO_CHECK_CASTS
|
||||
|
||||
--enable-debug=yes
|
||||
Enable all debugging support
|
||||
sets G_ENABLE_DEBUG
|
||||
|
||||
--enable-debug=no (or --disable-debug)
|
||||
Disable all debugging support (fastest)
|
||||
sets G_DISABLE_ASSERT, G_DISABLE_CHECKS, and GTK_NO_CHECK_CASTS
|
||||
|
||||
|
||||
RUN TIME OPTIONS
|
||||
----------------
|
||||
|
||||
At run time, if GTK+ was compiled with debugging enabled, different
|
||||
types of debugging information can be printed out. This is controlled
|
||||
by the:
|
||||
|
||||
GTK_DEBUG and GDK_DEBUG environment variables
|
||||
--gtk-debug and --gdk-debug command line options
|
||||
--gtk-no-debug and --gdk-no-debug command line options
|
||||
|
||||
First the environment variables are applied, then the command line
|
||||
options are applied in the order given on the command line.
|
||||
|
||||
Each of these can either be the special value 'all', or a sequence of
|
||||
':' separated options. (case is ignored). The environment variables
|
||||
and the --gtk-debug and --gdk-debug options add debugging options and
|
||||
the --gtk-no-debug and --gdk-no-debug options remove them.
|
||||
|
||||
As noted below, some of these are useful in application debugging, but
|
||||
most are only interested to those debugging the libraries
|
||||
|
||||
For instance:
|
||||
|
||||
GDK_DEBUG_FLAGS=misc:dnd testgtk --gdk-no-debug dnd --gdk-debug events
|
||||
|
||||
runs testgtk with the 'misc' and 'events' debugging options.
|
||||
|
||||
GTK_DEBUG
|
||||
---------
|
||||
|
||||
Application relevant options:
|
||||
|
||||
'objects' - Trace the creation and destruction of objects, print
|
||||
out a summary at program termination
|
||||
|
||||
Options only interesting to library maintainers:
|
||||
|
||||
GDK_DEBUG
|
||||
---------
|
||||
|
||||
Application relevant options:
|
||||
|
||||
'events' - Show all events received by GTK
|
||||
|
||||
Options only interesting to library maintainers:
|
||||
|
||||
'misc' - Miscellaneous information
|
||||
'dnd' - Information about drag-and-drop
|
||||
'color-context' - Information about the internal workings of
|
||||
GdkColorContext
|
||||
'xim' - Information about X Input Method support
|
||||
|
||||
|
||||
- Owen Taylor <owt1@cornell.edu>
|
||||
98/02/19
|
||||
69
docs/developers.txt
Normal file
69
docs/developers.txt
Normal file
@@ -0,0 +1,69 @@
|
||||
Things to care about when using/programing for GTK+
|
||||
===================================================
|
||||
|
||||
This file is meant to collect some frequently triggered failures when
|
||||
programming for/with Gtk, having the spirit of a developers FAQ.
|
||||
It is also the correct place to list up things that programmers should
|
||||
care about in general.
|
||||
|
||||
In the hope that this text might be usefull to someone,
|
||||
|
||||
- Tim Janik <timj@gimp.org>
|
||||
1998/02/11
|
||||
|
||||
|
||||
Automatic destruction of widgets on removal from parent
|
||||
-------------------------------------------------------
|
||||
|
||||
This is a reference counting issue, you would want to refer
|
||||
to refcounting.txt on it.
|
||||
|
||||
|
||||
What are all the widget flags about?
|
||||
------------------------------------
|
||||
|
||||
Refer to the file widget_system.txt which covers widget flags and the
|
||||
resulting invariants in a detailed way.
|
||||
|
||||
|
||||
GdkWindow pointers may be NULL in GdkEvents
|
||||
-------------------------------------------
|
||||
|
||||
The notification nature of the signal mechanism might cause events to
|
||||
be emitted that have their GdkWindow pointer set to NULL.
|
||||
This is due to the fact that certain events need to be emitted after the
|
||||
real GdkWindow of a widget is not any longer pertinent.
|
||||
It's up to the signal handling function (application) to check for the
|
||||
window field of the event structure to be != NULL, if it is going to
|
||||
perform any operations through Gdk calls on it.
|
||||
Events that a likely to trigger a missing check for the window pointer
|
||||
currently are (and correspond to the trailing signals):
|
||||
|
||||
GDK_SELECTION_CLEAR GtkWidget::selection_clear_event
|
||||
GDK_FOCUS_CHANGE GtkWidget::focus_in_event
|
||||
GtkWidget::focus_out_event
|
||||
|
||||
Events that are asured to have a valid GdkEvent.any.window field are
|
||||
|
||||
GDK_EXPOSE GtkWidget::expose_event
|
||||
|
||||
|
||||
gtk_widget_ref() vs. gtk_object_ref()
|
||||
-------------------------------------
|
||||
|
||||
The widget referencing functions gtk_widget_ref() and gtk_widget_unref()
|
||||
are currently just wrappers about the corresponding referencing functions
|
||||
for objects. Still you should use the widget referencing functions if you
|
||||
are sure the referenced object is of type GTK_WIDGET_TYPE.
|
||||
|
||||
|
||||
Writing Gdk functions
|
||||
---------------------
|
||||
|
||||
When writing Gdk functions that operate on GdkWindow structures in any
|
||||
maeningfull sense, that is casting to a GdkWindowPrivate structure for
|
||||
access to fields other then GdkWindow.user_data, the programmer is
|
||||
recommended to check for the GdkWindowPrivate.destroyed field to be ==
|
||||
FALSE, especially if the GdkWindowPrivate.xwindow field is used.
|
||||
Silent abortion of the Gdk function is the correct behaviour if this
|
||||
condition isn't met.
|
||||
1076
docs/faq/gtkfaq.sgml
Normal file
1076
docs/faq/gtkfaq.sgml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -324,3 +324,11 @@ handle_event ()
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
455
docs/glib.texi
Normal file
455
docs/glib.texi
Normal file
@@ -0,0 +1,455 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename glib.info
|
||||
@settitle GLIB
|
||||
@setchapternewpage odd
|
||||
|
||||
@set edition 1.0
|
||||
@set update-date 3 Feburary 1998
|
||||
@set update-month Feburary 1998
|
||||
@c %**end of header
|
||||
|
||||
@ifinfo
|
||||
This file documents GLIB, A library of useful routines for C programming
|
||||
|
||||
Copyright (C) 1998 Gregory A McLean
|
||||
|
||||
Permission is granted to make and distributed verbatim copies of this
|
||||
manual, provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file throught TeX and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Gregory McLean.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title GLIB, Useful routines for C programming
|
||||
@subtitle Version 1.0
|
||||
@subtitle @value{update-month}
|
||||
@author by Gregory McLean
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1998 Gregory McLean
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Gregory McLean.
|
||||
@end titlepage
|
||||
|
||||
@dircategory Library of useful routines for 'C' programing
|
||||
@direntry
|
||||
* GLIB: (glib). useful routines for 'C' programming
|
||||
@end direntry
|
||||
|
||||
@node Top, Copying, (dir), (dir)
|
||||
@top useful routines for 'C' programming
|
||||
@ifinfo
|
||||
This is edition @value{edition} of the GLIB documentation,
|
||||
@w{@value{update-date}}.
|
||||
@end ifinfo
|
||||
|
||||
@menu
|
||||
* Copying:: Your rights.
|
||||
* Overview:: What is GLIB?
|
||||
* Doubly linked lists:: Doubly linked lists
|
||||
* Signly linked lists:: Singly linked lists
|
||||
* List allocators:: List Allocators
|
||||
* Hash tables:: Hash tables
|
||||
* Caches:: Cache handling
|
||||
* Trees:: Tree handling
|
||||
* Memory:: Memory handling
|
||||
* Timers:: Timer functions
|
||||
* Output:: Output handling
|
||||
* Utilities:: Utilitiy functions
|
||||
* Errors:: Error handling
|
||||
* String Chunks:: String Chunks
|
||||
* Strings:: String handling
|
||||
* Resizable arrays:: Resizeable arrays
|
||||
* GScanner:: Flexible lexical scanner
|
||||
* Miscellany:: Other stuff
|
||||
* Function Index:: Index of functions
|
||||
* Concept Index:: Index of concepts
|
||||
@end menu
|
||||
|
||||
@node Copying, Overview, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Copying
|
||||
|
||||
@node Overview, Doubly linked lists, Copying, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter What is GLIB
|
||||
|
||||
@node Doubly linked lists, Signly linked lists, Overview, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Doubly linked lists
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun GList* g_list_alloc (void)
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_list_free (GList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_list_free_1 (GList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_append (GList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_prepend (GList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_insert (GList *@var{list}, gpointer @var{data}, gint @var{position})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_insert_sorted (GList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_concat (GList *@var{list1}, GList *@var{list2})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_remove (GList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_remove_link (GList *@var{list}, GList *@var{link})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_reverse (GList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_nth (GList *@var{list}, gint @var{n})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_find (GList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_last (GList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GList* g_list_first (GList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint g_list_length (GList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_list_foreach (GList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
|
||||
@end deftypefun
|
||||
|
||||
@node Signly linked lists, List allocators, Doubly linked lists, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Signly linked lists
|
||||
|
||||
@subsection Functions
|
||||
@deftypefun GSList* g_slist_alloc (void)
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_slist_free (GSList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_slist_free_1 (GSList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_append (GSList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_prepend (GSList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_insert (GSList *@var{list}, gpointer @var{data}, gint @var{position})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_insert_sorted (GSList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_concat (GSList *@var{list1}, GSList *@var{list2})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_remove (GSList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_remove_link (GSList *@var{list}, GSList *@var{link})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_reverse (GSList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_nth (GSList *@var{list}, gint @var{n})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_find (GSList *@var{list}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GSList* g_slist_last (GSList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint g_slist_length (GSList *@var{list})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_slist_foreach (GSList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
|
||||
@end deftypefun
|
||||
|
||||
@node List allocators, Hash tables, Signly linked lists, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter List allocators
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun GListAllocator* g_list_allocator_new (void)
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_list_allocator_free (GListAllocator *@var{allocator})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GListAllocator* g_slist_set_allocator (GListAllocator *@var{allocator})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GListAllocator* g_list_set_allocator (GListAllocator *@var{allocator})
|
||||
@end deftypefun
|
||||
|
||||
@node Hash tables, Caches, List allocators, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Hash tables
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun GHashTable* g_hash_table_new (GHashFunc @var{hash_func}, GCompareFunc @var{key_compare_func})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_hash_table_destroy (GHashTable *@var{hash_table})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_hash_table_insert (GHashTable *@var{hash_table}, gpointer @var{key}, gpointer @var{value})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_hash_table_remove (GHashTable *@var{hash_table}, gpointer @var{key})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_hash_table_lookup (GHashTable *@var{hash_table}, gpointer @var{key})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_hash_table_freeze (GHashTable *@var{hash_table})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_hash_table_thaw (GHashTable *@var{hash_table})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_hash_table_foreach (GHashTable *@var{hash_table}, GHFunc @var{func}, gpointer @var{user_data})
|
||||
@end deftypefun
|
||||
|
||||
@node Caches, Trees, Hash tables, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Cache handling
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun GCache* g_cache_new (GCacheNewFunc @var{value_new_func}, GCacheDestroyFunc @var{value_destroy_func}, GCacheDupFunc @var{key_dup_func}, GCacheDestroyFunc @var{key_destroy_func}, GHashFunc @var{hash_key_func}, GHashFunc @var{hash_value_func}, GCompareFunc @var{key_compare_func})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_cache_destroy (GCache *@var{cache})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_cache_insert (GCache *@var{cache}, gpointer @var{key})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_cache_remove (GCache *@var{cache}, gpointer @var{key})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_cache_key_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_cache_value_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
|
||||
@end deftypefun
|
||||
|
||||
@node Trees, Memory, Caches, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Tree handling
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun GTree* g_tree_new (GCompareFunc @var{key_compare_func})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_tree_destroy (GTree *@var{tree})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_tree_remove (GTree *@var{tree}, gpointer @var{key}, gpointer @var{value})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_tree_lookup (GTree *@var{tree}, gpointer @var{key})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_tree_traverse (GTree *@var{tree}, GTraverseFunc @var{traverse_func}, GTraverseType @var{traverse_type}, gpointer @var{data}
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_tree_search (GTree *@var{tree}, GSearchFunc @var{search_func}, gpointer @var{data})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint g_tree_height (GTree *@var{tree})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint g_tree_nnodes (GTree *@var{tree})
|
||||
@end deftypefun
|
||||
|
||||
@node Memory, Timers, Trees, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Memory handling
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun gpointer g_malloc (gulong @var{size})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_malloc0 (gulong @var{size})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_realloc (gpointer @var{mem}, gulong @var{size})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_profile (void)
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_check (gpointer @var{mem})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun GMemChunk* g_mem_chunk_new (gchar *@var{name}, gint @var{atom_size}, gulong @var{area_size}, gint @var{type})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_chunk_destroy (GMemChunk *@var{mem_chunk})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer g_mem_chunk_alloc (GMemChunk *@var{mem_chunk})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_chunk_free (GMemChunk *@var{mem_chunk}, gpointer @var{mem})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_chunk_clean (GMemChunk *@var{mem_chunk})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_chunk_reset (GMemChunk *@var{mem_chunk})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_chunk_print (GMemChunk *@var{mem_chunk})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_mem_chunk_info (void)
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_blow_chunks (void)
|
||||
Not what you might be thinking, @code{g_blow_chunks()} simply compresses all
|
||||
the chunks. This operation consists of freeing every memory area that should
|
||||
be freed (but which we haven't gotten around to doing yet).
|
||||
@end deftypefun
|
||||
|
||||
@node Timers, Output, Memory, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Timer functions
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun GTimer* g_timer_new (void)
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_timer_destroy (GTimer *@var{timer})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_timer_start (GTimer *@var{timer})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_timer_stop (GTimer *@var{timer})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_timer_reset (GTimer *@var{timer})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gdouble g_timer_elapsed (GTimer *@var{timer}, gulong *@var{microseconds})
|
||||
@end deftypefun
|
||||
|
||||
@node Output, Utilities, Timers, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Output functions
|
||||
|
||||
@subsection Functions
|
||||
|
||||
@deftypefun void g_error (gchar *@var{format}, @dots{})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_warning (gchar *@var{format}, @dots{})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_message (gchar *@var{format}, @dots{})
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void g_print (gchar *@var{format}, @dots{})
|
||||
@end deftypefun
|
||||
|
||||
@node Utilities, Errors, Output, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Utility functions
|
||||
|
||||
@node Errors, String Chunks, Utilities, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Error handling
|
||||
|
||||
@node String Chunks, Strings, Errors, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter String chunks
|
||||
|
||||
@node Strings, Resizable arrays, String Chunks, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter String handling
|
||||
|
||||
@node Resizable arrays, GScanner, Strings, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Resizable arrays
|
||||
|
||||
@node GScanner, Miscellany, Resizable arrays, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Flexible lexical scanner
|
||||
|
||||
@node Miscellany, Function Index, GScanner, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Other stuff
|
||||
|
||||
@node Function Index, Concept Index, Miscellany, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Function Index
|
||||
|
||||
@printindex fn
|
||||
|
||||
@node Concept Index, , Function Index, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
|
||||
49
docs/gtk-config.1
Normal file
49
docs/gtk-config.1
Normal file
@@ -0,0 +1,49 @@
|
||||
.TH GTK+ 1 "11 May 1998" Version 1.0.2
|
||||
.SH NAME
|
||||
gtk-config - script to get information about the installed version of GTK+
|
||||
.SH SYNOPSIS
|
||||
.B gtk-config
|
||||
[\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fIgtk-config\fP is a tool that is used to configure to determine
|
||||
the compiler and linker flags that should be used to compile
|
||||
and link programs that use \fIGTK+\fP. It is also used internally
|
||||
to the .m4 macros for GNU autoconf that are included with \fIGTK+\fP.
|
||||
.
|
||||
.SH OPTIONS
|
||||
.l
|
||||
\fIgtk-config\fP accepts the following options:
|
||||
.TP 8
|
||||
.B \-\-version
|
||||
Print the currently installed version of \fIGTK+\fP on the standard output.
|
||||
.TP 8
|
||||
.B \-\-libs
|
||||
Print the linker flags that are necessary to link a \fIGTK+\fP program.
|
||||
.TP 8
|
||||
.B \-\-cflags
|
||||
Print the compiler flags that are necessary to compile a \fIGTK+\fP program.
|
||||
.TP 8
|
||||
.B \-\-prefix=PREFIX
|
||||
If specified, use PREFIX instead of the installation prefix that \fIGTK+\fP
|
||||
was built with when computing the output for the \-\-cflags and
|
||||
\-\-libs options. This option is also used for the exec prefix
|
||||
if \-\-exec\-prefix was not specified. This option must be specified
|
||||
before any \-\-libs or \-\-cflags options.
|
||||
.TP 8
|
||||
.B \-\-exec\-prefix=PREFIX
|
||||
If specified, use PREFIX instead of the installation exec prefix that
|
||||
\fIGTK+\fP was built with when computing the output for the \-\-cflags
|
||||
and \-\-libs options. This option must be specified before any
|
||||
\-\-libs or \-\-cflags options.
|
||||
.SH SEE ALSO
|
||||
.BR gimp (1),
|
||||
.BR gimptool (1)
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 1995 Spencer Kimball and Peter Mattis
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation.
|
||||
228
docs/gtk-config.txt
Normal file
228
docs/gtk-config.txt
Normal file
@@ -0,0 +1,228 @@
|
||||
CONFIGURING PACKAGES TO WORK WITH GTK
|
||||
-------------------------------------
|
||||
|
||||
Compiling a program succesfully against the GTK, GDK, and GLIB
|
||||
libraries can require a large number of command line options
|
||||
to your compiler and linker that are hard to guess correctly.
|
||||
The additional libraries required may, for example, depend on the
|
||||
manner which GTK was configured
|
||||
|
||||
Several tools are included in this package to make process
|
||||
easier.
|
||||
|
||||
First, there is the shell script 'gtk-config' (installed in
|
||||
$exec_prefix/bin):
|
||||
|
||||
Invoking gtk-config
|
||||
-------------------
|
||||
|
||||
gtk-config takes the following flags:
|
||||
|
||||
--version
|
||||
Prints out the version of GTK installed
|
||||
|
||||
--cflags
|
||||
Prints '-I' flags pointing to the installed header files.
|
||||
|
||||
--libs
|
||||
Prints out the linker flags necessary to link a program against GTK
|
||||
|
||||
--prefix[=PREFIX]
|
||||
If PREFIX is specified, overrides the configured value of $prefix.
|
||||
(And of exec-prefix, unless --exec-prefix is also specified)
|
||||
Otherwise, prints out the configured value of $prefix
|
||||
|
||||
--exec-prefix[=PREFIX]
|
||||
If PREFIX is specified, overrides the configured value of $exec_prefix.
|
||||
Otherwise, prints out the configured value of $exec_prefix
|
||||
|
||||
|
||||
|
||||
Example of using gtk-config
|
||||
---------------------------
|
||||
|
||||
Typically, gtk-config will be used within a configure script,
|
||||
as described below. It, however, can also be used directly
|
||||
from the command line to compile a simple program. For example:
|
||||
|
||||
cc -o simple `gtk-config --cflags` simple.c `gtk-config --libs`
|
||||
|
||||
This command line might expand to (for example):
|
||||
|
||||
cc -o simple -I/usr/local/lib/glib/include -I/usr/local/include \
|
||||
-I/usr/X11R6/include simple.c -L/usr/local/lib -L/usr/X11R6/lib \
|
||||
-lgtk -lgdk -lglib -lXi -lXext -lX11 -lm
|
||||
|
||||
Not only is the form using gtk-config easier to type, it will
|
||||
work on any system, no matter how GTK was configured.
|
||||
|
||||
|
||||
AM_PATH_GTK
|
||||
-----------
|
||||
|
||||
For packages configured using GNU automake, GTK also provides
|
||||
a macro to automate the process of running GTK.
|
||||
|
||||
AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
|
||||
This macro:
|
||||
|
||||
* Determines the location of GTK using gtk-config, which is either
|
||||
found in the user's path, or from the environment variable
|
||||
GTK_CONFIG
|
||||
|
||||
* Tests the installed libraries to make sure that there version
|
||||
is later than MINIMUM-VERSION. (A default version will be used
|
||||
if not specified)
|
||||
|
||||
* If the required version was found, sets the GTK_CFLAGS variable to
|
||||
the output of `gtk-config --cflags` and the GTK_LIBS variable to
|
||||
the output of `gtk-config --libs`, and calls AC_SUBST() for these
|
||||
variables so they can be used in generated makefiles, and then
|
||||
executes ACTION-IF-FOUND.
|
||||
|
||||
* If the required version was not found, sets GTK_CFLAGS and GTK_LIBS
|
||||
to empty strings, and executes ACTION-IF-NOT-FOUND.
|
||||
|
||||
This macro is in file 'gtk.m4' which is installed in $datadir/aclocal.
|
||||
Note that if automake was installed with a different --prefix than
|
||||
GTK, you will either have to manually move gtk.m4 to automake's
|
||||
$datadir/aclocal, or give aclocal the -I option when running it.
|
||||
|
||||
|
||||
Configuring a package that uses AM_PATH_GTK
|
||||
-------------------------------------------
|
||||
|
||||
Simply make sure that gtk-config is in your path, and run
|
||||
the configure script.
|
||||
|
||||
Notes:
|
||||
|
||||
* The directory where the GTK libraries are installed needs
|
||||
to be found by your system's dynamic linker.
|
||||
|
||||
This is generally done by
|
||||
|
||||
editing /etc/ld.so.conf and running ldconfig
|
||||
|
||||
Or by:
|
||||
|
||||
setting the environment variable LD_LIBRARY_PATH,
|
||||
|
||||
or, as a last resort,
|
||||
|
||||
Giving a -R or -rpath flag (depending on your linker) when
|
||||
running configure, for instance:
|
||||
|
||||
LDFLAGS=-R/usr/home/owen/lib ./configure
|
||||
|
||||
* You can also specify a gtk-config not in your path by
|
||||
setting the GTK_CONFIG environment variable to the
|
||||
name of the executable
|
||||
|
||||
* If you move the GTK package from its installed location,
|
||||
you will need either need to modify gtk-config script
|
||||
manually to point to the new location or rebuild GTK.
|
||||
|
||||
Advanced note:
|
||||
|
||||
* configure flags
|
||||
|
||||
--with-gtk-prefix=PREFIX
|
||||
--with-gtk-exec-prefix=PREFIX
|
||||
|
||||
are provided to override the prefix and exec-prefix that were stored
|
||||
in the gtk-config shell script by GTK's configure. You are generally
|
||||
better off configuring GTK with the right path to begin with.
|
||||
|
||||
Example of a package using AM_PATH_GTK
|
||||
--------------------------------------
|
||||
|
||||
The following shows how to build a simple package using automake
|
||||
and the AM_PATH_GTK macro. The program used here is the testinput.c
|
||||
|
||||
You should first read the introductory portions of the automake
|
||||
Manual, if you are not already familiar with it.
|
||||
|
||||
Two files are needed, 'configure.in', which is used to build the
|
||||
configure script:
|
||||
|
||||
==configure.in===
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(testinput.c)
|
||||
|
||||
AM_INIT_AUTOMAKE(testinput.c, 1.0.0)
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AM_PATH_GTK(0.99.5,
|
||||
[LIBS="$LIBS $GTK_LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"],
|
||||
AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
=================
|
||||
|
||||
The only command in this which is not standard for automake
|
||||
is the AM_PATH_GTK() macro.
|
||||
|
||||
That command does the following:
|
||||
|
||||
If a GTK version greater than 0.99.5 is found, adds $GTK_LIBS to
|
||||
$LIBS and $GTK_CFLAGS to $CFLAGS. Otherwise, dies with the error
|
||||
message "Cannot find GTK: Is gtk-config in path?"
|
||||
|
||||
And the 'Makefile.am', which will be used to build the Makefile.
|
||||
|
||||
== Makefile.am ==
|
||||
bin_PROGRAMS = testinput
|
||||
testinput_SOURCES = testinput.c
|
||||
=================
|
||||
|
||||
This Makefile.am, says that we are building a single executable,
|
||||
from a single sourcefile 'testinput.c'. Since every program
|
||||
we are building uses GTK we simply added the GTK options
|
||||
to $LIBS and $CFLAGS, but in other circumstances, we might
|
||||
want to specify them on a per-program basis: for instance by
|
||||
adding the lines:
|
||||
|
||||
testinput_LDADD = $(GTK_LIBS)
|
||||
INCLUDES = $(GTK_CFLAGS)
|
||||
|
||||
to the Makefile.am.
|
||||
|
||||
To try this example out, create a new directory, add the two
|
||||
files above two it, and copy the testinput.c file from
|
||||
the gtk/ subdirectory to the new directory. Edit the line:
|
||||
|
||||
#include "gtk.h"
|
||||
|
||||
in testgtk.c, to read:
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
Now execute the following commands:
|
||||
|
||||
automake --add-missing
|
||||
aclocal
|
||||
autoconf
|
||||
|
||||
You now have a package that can be built in the normal fashion
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
* If you are converting a package that used a pre-1.0 version of
|
||||
GTK, you should remove the autoconf tests for X. The results
|
||||
of these tests are included in gtk-config and will be added
|
||||
to GTK_LIBS and GTK_CFLAGS by the AM_PATH_GTK macro.
|
||||
|
||||
Owen Taylor
|
||||
14 Mar 1997
|
||||
2062
docs/gtk.texi
2062
docs/gtk.texi
File diff suppressed because it is too large
Load Diff
14129
docs/gtk_tut.sgml
Normal file
14129
docs/gtk_tut.sgml
Normal file
File diff suppressed because it is too large
Load Diff
10090
docs/gtk_tut_it.sgml
Normal file
10090
docs/gtk_tut_it.sgml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
docs/gtk_tut_packbox1.gif
Normal file
BIN
docs/gtk_tut_packbox1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/gtk_tut_packbox2.gif
Normal file
BIN
docs/gtk_tut_packbox2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
docs/gtk_tut_table.gif
Normal file
BIN
docs/gtk_tut_table.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
11
docs/gtkdocs_fix
Executable file
11
docs/gtkdocs_fix
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Stupid script to fix look of html files created with sgml2html...
|
||||
|
||||
foreach (@ARGV) {
|
||||
print "Fixing... $_\n";
|
||||
system("mv $_ $_.orig");
|
||||
system("sed -e 's/<BODY>/<BODY BGCOLOR=\"#FFFFFF\">/g' -e 's/<HR>/<HR NOSHADE>/g' $_.orig > $_");
|
||||
unlink("$_.orig");
|
||||
}
|
||||
|
||||
1076
docs/gtkfaq.sgml
Normal file
1076
docs/gtkfaq.sgml
Normal file
File diff suppressed because it is too large
Load Diff
26
docs/man/gtk.pod
Normal file
26
docs/man/gtk.pod
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
GTK+ - The GIMP Toolkit
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
For information on GTK+, see the man pages below.
|
||||
|
||||
=head1 COMMANDS
|
||||
|
||||
=head1 CONTAINER WIDGETS
|
||||
|
||||
gtk_box(3)
|
||||
gtk_vbox(3)
|
||||
gtk_hbox(3)
|
||||
|
||||
=head1 WIDGETS
|
||||
|
||||
gtk_button(3)
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
|
||||
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.
|
||||
|
||||
206
docs/man/gtk_button.pod
Normal file
206
docs/man/gtk_button.pod
Normal file
@@ -0,0 +1,206 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
gtk_button - GTK+ push button widget
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <gtk/gtkbutton.h>
|
||||
|
||||
GtkType gtk_button_get_type (void);
|
||||
GtkWidget* gtk_button_new (void);
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
void gtk_button_pressed (GtkButton *button);
|
||||
void gtk_button_released (GtkButton *button);
|
||||
void gtk_button_clicked (GtkButton *button);
|
||||
void gtk_button_enter (GtkButton *button);
|
||||
void gtk_button_leave (GtkButton *button);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This widget is a standard push button widget. Push button widgets
|
||||
are generally used for allowing the user to click on them to initiate
|
||||
a command.
|
||||
|
||||
This widget is a container widget which contains one child.
|
||||
|
||||
=head1 OBJECT HIERARCHY
|
||||
|
||||
gtk_object
|
||||
gtk_widget
|
||||
gtk_container
|
||||
gtk_button
|
||||
|
||||
=head1 SIGNAL PROTOTYPES
|
||||
|
||||
"clicked" void user_function (GtkWidget *widget, gpointer data);
|
||||
"pressed" void user_function (GtkWidget *widget, gpointer data);
|
||||
"released" void user_function (GtkWidget *widget, gpointer data);
|
||||
"enter" void user_function (GtkWidget *widget, gpointer data);
|
||||
"leave" void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
=head2 Creation
|
||||
|
||||
The most common way to create a button is with a label in it, which
|
||||
contains text for the user to read. The child of the button will then
|
||||
be a L<gtk_label(3)> widget with the text you passwd in. You can
|
||||
do this in one command:
|
||||
|
||||
GtkWidget *button;
|
||||
button = gtk_button_new_with_label ("This is a button");
|
||||
|
||||
To create a gtk_button widget which does not already have a child,
|
||||
use gtk_button_new():
|
||||
|
||||
GtkWidget *button;
|
||||
button = gtk_button_new ();
|
||||
|
||||
After you have created a button you can then add a widget to the
|
||||
button (such as a label or pixmap) using gtk_container_add(). See
|
||||
L<gtk_container(3)> for more information on adding widgets to
|
||||
containers.
|
||||
|
||||
=head2 Creating a pixmap in a button in a window
|
||||
|
||||
After we have an empty gtk_button, such as above, and we have a gtk_pixmap,
|
||||
we can simply add the gtk_pixmap to the gtk_button with gtk_container_add().
|
||||
|
||||
The following code will open the file "gimp.xpm" and place it in a
|
||||
button.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
GtkStyle *style;
|
||||
GdkPixmap *gdkpixmap;
|
||||
GdkBitmap *mask;
|
||||
char *filename = "gimp.xpm";
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
/* The button is realized now, which creates button->window
|
||||
used below to create the pixmap. */
|
||||
gtk_widget_realize (button);
|
||||
|
||||
style = gtk_widget_get_style (button);
|
||||
gdkpixmap = gdk_pixmap_create_from_xpm (button->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
filename);
|
||||
pixmap = gtk_pixmap_new (gdkpixmap, mask);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
=head2 Executing a command when the button is pressed
|
||||
|
||||
To execute a function when a button is pressed, use
|
||||
gtk_signal_connect() to connect to the "clicked" signal.
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (user_function),
|
||||
NULL);
|
||||
|
||||
user_function is a user defined function, like the following:
|
||||
|
||||
void user_function (GtkWidget *button, gpointer data)
|
||||
{
|
||||
printf("clicked\n");
|
||||
}
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
GtkType gtk_button_get_type (void);
|
||||
|
||||
This function returns the GtkType which is assigned to the
|
||||
object class for gtk_button.
|
||||
|
||||
GtkWidget* gtk_button_new (void);
|
||||
|
||||
This functions returns a new button widget which can then be
|
||||
used as a container for another widget.
|
||||
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
|
||||
This function returns a new button widget with a label widget
|
||||
as a child. The label widget will have the text passed into
|
||||
the commant.
|
||||
|
||||
void gtk_button_pressed (GtkButton *button);
|
||||
|
||||
This function sends a "pressed" signal to the button.
|
||||
|
||||
void gtk_button_released (GtkButton *button);
|
||||
|
||||
This function sends a "released" signal to the button.
|
||||
|
||||
void gtk_button_clicked (GtkButton *button);
|
||||
|
||||
This function sends a "clicked" signal to the button.
|
||||
|
||||
void gtk_button_enter (GtkButton *button);
|
||||
|
||||
This function sends a "enter" signal to the button.
|
||||
|
||||
void gtk_button_leave (GtkButton *button);
|
||||
|
||||
This function sends a "leave" signal to the button.
|
||||
|
||||
=head1 SIGNALS
|
||||
|
||||
"clicked"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the button is clicked. A click is
|
||||
a press and release of the button when the cursor is
|
||||
inside the button on release.
|
||||
|
||||
"pressed"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the left mouse button is pressed.
|
||||
|
||||
"released"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the left mouse button is released and
|
||||
the widget was previously pressed.
|
||||
|
||||
"enter"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Emitted when the mouse cursor enters the button.
|
||||
|
||||
"leave"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Emitted when the mouse cursor leaves the button.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
|
||||
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.
|
||||
|
||||
|
||||
73
docs/man/gtk_hbox.pod
Normal file
73
docs/man/gtk_hbox.pod
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
gtk_hbox - GTK+ horizontal box widget
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <gtk/gtkhbox.h>
|
||||
|
||||
guint gtk_hbox_get_type (void);
|
||||
GtkWidget* gtk_hbox_new (gint homogeneous,
|
||||
gint spacing);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This widget is a container used to place widgets horizontally in relation
|
||||
to each other. This is done by "packing" them into the box with
|
||||
the functions gtk_box_pack_start and gtk_box_pack_end.
|
||||
|
||||
General box functions can be found in gtk_box(1).
|
||||
|
||||
=head1 OBJECT HIERARCHY
|
||||
|
||||
gtk_object
|
||||
gtk_widget
|
||||
gtk_container
|
||||
gtk_box
|
||||
gtk_hbox
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
=head2 Creation
|
||||
|
||||
To create a hbox, use the function gtk_hbox_new(). The arguments
|
||||
you pass to gtk_hbox_new indicate if the hbox should be homogeneous
|
||||
(that is, if the children should all be given the same amount of
|
||||
space all the time), and the amount of space inbetween the children.
|
||||
|
||||
The following creates a hbox which is non-homogeneous and will have
|
||||
4 spacing pixels between the children:
|
||||
|
||||
GtkWidget *hbox;
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
For instructions on adding children to this newly created hbox,
|
||||
consult gtk_box(3).
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
guint gtk_hbox_get_type (void);
|
||||
|
||||
This function returns the GtkType which is assigned to the
|
||||
object class for gtk_hbox.
|
||||
|
||||
GtkWidget* gtk_hbox_new (gint homogeneous, gint spacing);
|
||||
|
||||
This functions returns a new hbox widget which can then be
|
||||
used as a container for other widgets. Homogeneous can be
|
||||
either TRUE or FALSE and indicates if the children widgets
|
||||
will be always be allocated equal area. Spacing is the
|
||||
number of pixels to put inbetween the children of the box.
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
gtk_box(3), gtk_vbox(3), gtk_container(3), gtk_widget(3)
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
|
||||
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.
|
||||
|
||||
|
||||
73
docs/man/gtk_vbox.pod
Normal file
73
docs/man/gtk_vbox.pod
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
gtk_vbox - GTK+ vertical box widget
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <gtk/gtkvbox.h>
|
||||
|
||||
guint gtk_vbox_get_type (void);
|
||||
GtkWidget* gtk_vbox_new (gint homogeneous,
|
||||
gint spacing);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This widget is a container used to place widgets vertically in relation
|
||||
to each other. This is done by "packing" them into the boxes with
|
||||
the functions gtk_box_pack_start and gtk_box_pack_end.
|
||||
|
||||
General box functions can be found in gtk_box(1).
|
||||
|
||||
=head1 OBJECT HIERARCHY
|
||||
|
||||
gtk_object
|
||||
gtk_widget
|
||||
gtk_container
|
||||
gtk_box
|
||||
gtk_vbox
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
=head2 Creation
|
||||
|
||||
To create a vbox, use the function gtk_vbox_new(). The arguments
|
||||
you pass to gtk_vbox_new indicate if the vbox should be homogeneous
|
||||
(that is, if the children should all be given the same amount of
|
||||
space all the time), and the amount of space inbetween the children.
|
||||
|
||||
The following creates a vbox which is non-homogeneous and will have
|
||||
4 spacing pixels between the children:
|
||||
|
||||
GtkWidget *vbox;
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
||||
For instructions on adding children to this newly created vbox,
|
||||
consult gtk_box(3).
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
guint gtk_vbox_get_type (void);
|
||||
|
||||
This function returns the GtkType which is assigned to the
|
||||
object class for gtk_vbox.
|
||||
|
||||
GtkWidget* gtk_vbox_new (gint homogeneous, gint spacing);
|
||||
|
||||
This functions returns a new vbox widget which can then be
|
||||
used as a container for other widgets. Homogeneous can be
|
||||
either TRUE or FALSE and indicates if the children widgets
|
||||
will be always be allocated equal area. Spacing is the
|
||||
number of pixels to put inbetween the children of the box.
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
gtk_box(3), gtk_hbox(3), gtk_container(3), gtk_widget(3)
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
|
||||
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.
|
||||
|
||||
|
||||
315
docs/refcounting.txt
Normal file
315
docs/refcounting.txt
Normal file
@@ -0,0 +1,315 @@
|
||||
The Reference Counting Scheme of GDK an GTK+
|
||||
============================================
|
||||
|
||||
Each data structure that provides reference counting offers a bunch of
|
||||
functions that follow these conventions:
|
||||
|
||||
*_new: Create a new structure with a reference count of 1.
|
||||
*_ref: Increase ref count by one.
|
||||
*_unref: Decrease ref count by one. If the count drops to zero,
|
||||
run appropriate finalization code and free the memory.
|
||||
For data structures with a _destroy function, it will be
|
||||
invoked at this point, if the data structure is not
|
||||
already in a destroyed state.
|
||||
|
||||
GtkObjects also provide the following functions:
|
||||
|
||||
*_destroy: Render an object `unusable', but as long as there are
|
||||
references to it, it's allocated memory will not be freed.
|
||||
*_sink: Clear a GtkObjects `floating' state and decrement the
|
||||
reference count by 1.
|
||||
|
||||
GdkWindow
|
||||
---------
|
||||
|
||||
A GdkWindow has to be explicitely destroyed with gdk_window_destroy.
|
||||
This will send out a request to destroy this window and all its
|
||||
children, and will decrement the ref_count of the GdkWindow by one.
|
||||
Thus, it releases the inital reference created by gdk_window_new.
|
||||
|
||||
All GdkWindows are kept in a hash table to translate from their XId to
|
||||
the actual structure and the pointer in the hash table is reflected in
|
||||
the reference count. When a DestroyNotify event is received for a
|
||||
particular GdkWindow, it is removed from the hash table and the
|
||||
ref_count is updated accordingly.
|
||||
|
||||
You can call gdk_window_destroy more than once on a particular
|
||||
GdkWindow, it will only be destroyed when it hasn't been yet. The
|
||||
ref_count is *always* decremented, tho. Be careful.
|
||||
|
||||
Remark: When writing NO_WINDOW widgets, care should be taken about
|
||||
proper referencing/unreferencing of the parent's GdkWindow
|
||||
that is used by the widget.
|
||||
|
||||
GdkPixmap
|
||||
---------
|
||||
|
||||
There is no gdk_pixmap_destroy function. The Pixmap is destroyed when
|
||||
the last reference to it vanishes.
|
||||
|
||||
GdkPixmaps are kept in the same hash table as GdkWindows but the
|
||||
pointer in the hash table is *not* reflected in the ref_count.
|
||||
|
||||
This works only when Pixmaps never get XEvents. I'm not sure if this
|
||||
is the case.
|
||||
|
||||
GdkBitmap
|
||||
---------
|
||||
|
||||
A GdkBitmap is only another name for a special use of GdkPixmap.
|
||||
|
||||
GdkVisual
|
||||
---------
|
||||
|
||||
There are no *_new or *_destroy functions and the *_ref and *_unref
|
||||
functions are noops. GdkVisuals are static structures and thus do not
|
||||
need reference counting. The ref counting functions are only there
|
||||
for extra defensive programming.
|
||||
|
||||
GdkColormap
|
||||
-----------
|
||||
|
||||
Nothing special. There is no gdk_colormap_destroy function.
|
||||
|
||||
GdkFont / GdkFontSet
|
||||
--------------------
|
||||
|
||||
GdkFont and GdkFontSet are equivalent as far as ref counting is
|
||||
concerned. Use gdk_font_ref and gdk_font_unref for both.
|
||||
|
||||
There is no gdk_font_free or gdk_fontset_free function.
|
||||
|
||||
GtkAcceleratorTable
|
||||
-------------------
|
||||
|
||||
There is no gtk_accelerator_table_destroy function.
|
||||
|
||||
GtkTooltips
|
||||
-----------
|
||||
|
||||
There is no gtk_tooltips_destroy function.
|
||||
|
||||
GtkStyle
|
||||
--------
|
||||
|
||||
There is no gtk_style_destroy function.
|
||||
|
||||
GtkObject
|
||||
---------
|
||||
|
||||
GtkObjects follow the usual ref_counting strategy, but with a twist.
|
||||
|
||||
They are created with a ref_count of 1. GtkObjects are able to
|
||||
run finalization code when the ref_count drops to zero but you cannot
|
||||
register arbitrary signal handlers to run at finalization time.
|
||||
|
||||
There is also the old gtk_object_destroy function and the "destroy"
|
||||
signal but they are somewhat independent from finalization. Just as
|
||||
stated at the top of this text, gtk_object_destroy merely renders an
|
||||
object unusable. When the object is a container widget for example,
|
||||
it unrealizes that widget, removes all children and disconnects all
|
||||
signal handlers. The finalization code is different, it would for
|
||||
example free associated memory for text strings and release the
|
||||
attached style.
|
||||
|
||||
This is the biggest change. Every widget must be revised to have a
|
||||
proper "destroy" function, etc. Such a destroy function will only
|
||||
be called once and is expected to leave the widget in a minimal but
|
||||
consistent state. Widgets that have been "destroyed" but not yet
|
||||
finalized are flagged with GTK_DESTROY. The "finalization" function
|
||||
is new and should perform last-minute cleanup actions, in contrast
|
||||
to the destroy function it will not be emitted as signal though.
|
||||
It can assume that the "destroy" function has been called as the
|
||||
last function on this widget.
|
||||
|
||||
Essentially, the old "destroy" function has been split into a
|
||||
"finalize" plus a "destroy" function.
|
||||
|
||||
It is not possible to create GtkObjects with a ref_count of 0
|
||||
because the first ref/unref pair will destroy it unintentionally.
|
||||
|
||||
To be mostly backward compatible with existing practice, a GtkObject
|
||||
leads a more complicated life than the other reference counted structures.
|
||||
|
||||
When a GtkObject is created, it starts out in a special state called
|
||||
"floating" (this is the twist). This means that it is alive and has a
|
||||
reference to it, but the `owner' of this reference is not known.
|
||||
There are certain `potential owners' that will adopt a floating
|
||||
GtkObject. For GtkWidgets the most common adopters are the parent
|
||||
widget.
|
||||
|
||||
When you want to adopt a possibly floating GtkObject, you call
|
||||
gtk_object_sink on it. This clears the floating state of the
|
||||
GtkObject and decrements the ref_count by one, if it has been floating
|
||||
previously. Once the floating state has been cleared, it will never
|
||||
be set again.
|
||||
|
||||
All widgets that are part of the display are linked into a
|
||||
parent/child tree. The link from the parent to a child is reflected
|
||||
in the ref_count of the child, but the link from the child to the
|
||||
parent is not reflected in the ref_count of the parent.
|
||||
|
||||
Like a GtkObject, a GtkWidget is created with a ref_count of 1 and
|
||||
initially flagged as `floating'. As soon as it is added as a child to
|
||||
a parent, the `floating' flag is cleared and never will be set again.
|
||||
Not even when it is later unparented. The act of clearing the
|
||||
`floating' flag also decrements the ref_count of the widget by one.
|
||||
|
||||
When the widget is unparented, its underlying GdkWindow is destroyed
|
||||
(when it has one), it loses its reference from the parent and
|
||||
naturally the ref_count is decremented.
|
||||
|
||||
It is considered a bug if a widget still has a GdkWindow when it is
|
||||
being freed.
|
||||
|
||||
Toplevel widgets, which don't have a `natural' parent, are adopted by
|
||||
special registering functions. Because the of the reference count that
|
||||
is set by the registering functions, toplevel widgets will have to be
|
||||
explicitly destroyed, with the exception of GtkMenus. GtkMenus are a
|
||||
special case of toplevel widgets in that they will be `attached' to and
|
||||
`detached' from other widgets. The act of attaching a GtkMenu to a
|
||||
widget will be reflected in its reference count. The act of detaching
|
||||
a GtkMenu will revert that. Therefore GtkMenus naturally get destroyed
|
||||
and finalized once they are detached from their reference holder.
|
||||
|
||||
So, the typical career of a GtkWindow a GtMenu attached to a
|
||||
GtkOptionMenu looks like this:
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
/* window is created with ref_count == 1. It is not flagged as
|
||||
* `floating' because it has already been registered as a toplevel
|
||||
* widget.
|
||||
*/
|
||||
|
||||
option_menu = gtk_option_menu_new ();
|
||||
/* option_menu->ref_count == 1 and it is flagged as `floating'.
|
||||
*/
|
||||
|
||||
gtk_container_add (window, option_menu);
|
||||
/* option_menu->ref_count still == 1, but it is no longer `floating'.
|
||||
*/
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
/* menu->ref_count == 1 and it is flagged as `floating'.
|
||||
*/
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Choose Me");
|
||||
/* menu_item->ref_count == 1 and it is flagged as `floating'.
|
||||
*/
|
||||
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
/* menu_item->ref_count still == 1, but it is no longer `floating'.
|
||||
*/
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
/* menu->ref_count still == 1, but it is no longer `floating'.
|
||||
*/
|
||||
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_widget_show (option_menu);
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* The widgets get their GdkWindows, nothing significant happens to
|
||||
* the ref_counts.
|
||||
*/
|
||||
|
||||
Then, when the user wants to get rid of the window:
|
||||
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
/* The GdkWindow of `window' and all its child GdkWindows are
|
||||
* destroyed.
|
||||
*
|
||||
* window is unregistered from the loplevel list and its ref_count
|
||||
* drops to zero. The destroy code of `window' destroyes `option_menu'.
|
||||
*
|
||||
* The destroy code of `option_menu' causes the `menu' to be detached
|
||||
* from it and its reference count drops to zero.
|
||||
*
|
||||
* The destroy code of `menu' destroyes `menu_item'.
|
||||
*
|
||||
* The destruction of `menu_item' removes it from its parent, the
|
||||
* menu_item->ref_count drops to zero and `menu_item' is finalized (freed).
|
||||
*
|
||||
* Now `menu', `option_menu' and `window' will be destroyed and finalized,
|
||||
* in this order, since the reference count of each is zero.
|
||||
*/
|
||||
|
||||
|
||||
Taking care of proper referencing
|
||||
---------------------------------
|
||||
|
||||
There are some cases where referencing of widgets from outside the toolkit
|
||||
(on the application side is needed).
|
||||
Once the application performes an operation on a widget that will cause
|
||||
its reference count to drop, if it wants to take further actions on the
|
||||
widget, it needs to hold a reference to it.
|
||||
|
||||
Example code sequences that require reference wraps:
|
||||
|
||||
/* gtk_container_remove() will unparent the child and therefore
|
||||
* cause it's reference count to be decremented by one.
|
||||
*/
|
||||
gtk_widget_ref (widget);
|
||||
gtk_container_remove (container, widget);
|
||||
/* without the reference count, the widget would have been destroyed here.
|
||||
*/
|
||||
gtk_container_add (container, widget);
|
||||
gtk_widget_unref (widget);
|
||||
|
||||
|
||||
/* all items in item_list need to be referenced
|
||||
* before gtk_list_remove_items() is invoked.
|
||||
* this is somewhat tricky as gtk_list_append_items/gtk_list_prepend_items/
|
||||
* gtk_list_insert_items will take over the lists nodes.
|
||||
* we therefore have an extra GSList `*slist' for later unreferencing.
|
||||
*/
|
||||
slist = NULL;
|
||||
for (list = item_list; list; list = list->next)
|
||||
{
|
||||
gtk_widget_ref (GTK_WIDGET (list->data));
|
||||
slist = g_slist_prepend (slist, list->data);
|
||||
}
|
||||
gtk_list_remove_items (list, item_list);
|
||||
gtk_list_append_items (other_list, item_list);
|
||||
/* gtk_list_prepend_items (other_list, item_list); */
|
||||
/* gtk_list_insert_items (other_list, item_list, 3); */
|
||||
while (slist)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
tmp = slist;
|
||||
slist = slist->next;
|
||||
gtk_widget_unref (GTK_WIDGET (tmp->data));
|
||||
g_slist_free_1 (tmp);
|
||||
}
|
||||
|
||||
/* Alternatively to the removal above you could just use
|
||||
* gtk_list_remove_items_no_unref() which will add the additional
|
||||
* reference count to the widget.
|
||||
*/
|
||||
gtk_list_remove_items_no_unref (list, item_list);
|
||||
gtk_list_prepend_items (other_list, item_list);
|
||||
|
||||
|
||||
Now a (hopefully) complete list of functions that require
|
||||
wrappers similar to the examples above:
|
||||
|
||||
void gtk_container_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
void gtk_list_remove_items (GtkList *list,
|
||||
GList *items);
|
||||
void gtk_tree_remove_items (GtkTree *tree,
|
||||
GList *items);
|
||||
void gtk_tree_item_remove_subtree (GtkTreeItem *tree_item);
|
||||
void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item);
|
||||
void gtk_option_menu_remove_menu (GtkOptionMenu *option_menu);
|
||||
|
||||
|
||||
|
||||
Initial proposal:
|
||||
- Marius Vollmer <mvo@zagadka.ping.de>
|
||||
|
||||
Some modifications/additions, "Taking care of proper referencing" and
|
||||
reference counting solution for GtkMenus:
|
||||
- Tim Janik <timj@gimp.org>
|
||||
104
docs/styles.txt
Normal file
104
docs/styles.txt
Normal file
@@ -0,0 +1,104 @@
|
||||
HANDLING WIDGET STYLES
|
||||
======================
|
||||
|
||||
|
||||
A widget gets created with a default style.
|
||||
The global default style can be affected by gtk_widget_set_default_style()
|
||||
and can be queried by gtk_widget_get_default_style().
|
||||
The initial style that is assigned to a widget as default style upon
|
||||
creation can be affected by wrapping the widget's creation as follows:
|
||||
gtk_widget_push_style (my_style);
|
||||
widget = gtk_type_new (gtk_button_get_type ());
|
||||
gtk_widget_pop_style ();
|
||||
|
||||
There are certain functions to affect widget styles after a widget's
|
||||
creation:
|
||||
|
||||
gtk_widget_set_style ()
|
||||
Save the default style and set a user style.
|
||||
This will override a previously set user style or
|
||||
previously set rc styles.
|
||||
|
||||
gtk_widget_set_rc_style ()
|
||||
Set GTK_RC_STYLE to indicate that an rc lookup has been performed.
|
||||
If there is an rc style for a widget, set it and save the default style,
|
||||
restore the default style otherwise.
|
||||
This will override a previously set user style or rc style.
|
||||
|
||||
gtk_widget_restore_default_style ()
|
||||
Reset the widget's style to the default style, this is only usefull if
|
||||
the widgets default style had been saved by previous calls to
|
||||
gtk_widget_set_style() or gtk_widget_set_rc_style().
|
||||
|
||||
gtk_widget_ensure_style ()
|
||||
Ensure taht the widget either has a user style set, or an rc lookup
|
||||
has been performed.
|
||||
|
||||
gtk_rc_get_style ()
|
||||
Return an rc style for a widget if there is one.
|
||||
|
||||
gtk_widget_set_name ()
|
||||
Change widget name, and perform a new rc lookup if no user style
|
||||
is set.
|
||||
|
||||
gtk_widget_realize ()
|
||||
Besides realizing the widget this function will:
|
||||
- perform an rc lookup if neccessary,
|
||||
- attach a widget's style.
|
||||
|
||||
gtk_widget_get_style ()
|
||||
Return a widgets style, this function will perform an rc lookup
|
||||
if neccessary.
|
||||
|
||||
gtk_widget_set_parent ()
|
||||
This function will perform rc lookups recursively for all widgets
|
||||
that do not have a user style set.
|
||||
|
||||
gtk_style_copy ()
|
||||
This function can be used to copy a widgets style.
|
||||
The style can subsequntly be changed (e.g., by modifications to the
|
||||
red/green/blue values of a certain color) and then be applied to the
|
||||
widget via gtk_widget_set_style().
|
||||
|
||||
|
||||
GtkWidget::style_set
|
||||
This signal will be emitted for a widget once its style changes with
|
||||
an additional argument previous_style wich will hold the widget->style
|
||||
avlue from a previous emission.
|
||||
The initial emission of this signal is guaranteed to happen prior
|
||||
to any GtkWidget::size_request emission, and will have the previous_style
|
||||
argument set to NULL.
|
||||
The GtkWidgetClass implements a default handler for this signal that
|
||||
will set the widget's window's background of widgets that provide their
|
||||
own windows according to the new style.
|
||||
Derived widgets need to overide this default handler, if:
|
||||
- their size requisition depends on the current style.
|
||||
(e.g., on the style's fonts)
|
||||
- they set the background of widget->window to something other than.
|
||||
style->bg. (e.g., GtkListItem)
|
||||
- the widget provides windows other than widget->window.
|
||||
- the widget has any other stored dependencies on the style.
|
||||
|
||||
|
||||
|
||||
Flag indications:
|
||||
|
||||
!GTK_RC_STYLE && !GTK_USER_STYLE:
|
||||
The widget has it's default style set, no rc lookup has been
|
||||
performed, the widget has not been size requested yet and is
|
||||
therefore not yet realized.
|
||||
|
||||
GTK_USER_STYLE:
|
||||
GTK_RC_STYLE is not set.
|
||||
The widget has a user style assigned, and it's default style has been
|
||||
saved.
|
||||
|
||||
GTK_RC_STYLE:
|
||||
GTK_USER_STYLE is not set.
|
||||
If the widget has a saved default style, it has been assigned an
|
||||
rc style. If the widget does not have a saved default style, it still
|
||||
has its default style but an rc lookup has already been performed.
|
||||
|
||||
|
||||
- Tim Janik <timj@gimp.org>
|
||||
1998/02/27
|
||||
487
docs/text_widget.txt
Normal file
487
docs/text_widget.txt
Normal file
@@ -0,0 +1,487 @@
|
||||
Date: Sun, 14 Sep 1997 20:17:06 -0700 (PDT)
|
||||
From: Josh MacDonald <jmacd@CS.Berkeley.EDU>
|
||||
To: gnome@athena.nuclecu.unam.mx, gtk-list@redhat.com
|
||||
Subject: [gtk-list] gtktext widget internal documentation
|
||||
|
||||
|
||||
Pete convinced me to just write up the text widget and let someone else
|
||||
finish it. I'm pretty busy and have other commitments now. Sorry. I think
|
||||
I'm not the most qualified for some of the remaining work anyway, because I
|
||||
don't really know Gtk and it's event model very well. Most of the work so
|
||||
far was possible without knowing Gtk all that well, it was simply a data
|
||||
structure exercise (though after reading this you might say it was a fairly
|
||||
complicated data structure exercise). I'm happy to answer questions.
|
||||
|
||||
-josh
|
||||
|
||||
|
||||
High level description:
|
||||
|
||||
There are several layers of data structure to the widget. They are
|
||||
seperated from each other as much as possible. The first is a gapped
|
||||
text segment similar to the data structure Emacs uses for representing
|
||||
text. Then there is a property list, which stores text properties for
|
||||
various ranges of text. There is no direct relation between the text
|
||||
property list and the gapped text segment. Finally there is a drawn
|
||||
line parameter cache to speed calculations when drawing and redrawing
|
||||
lines on screen. In addition to these data structures, there are
|
||||
structures to help iterate over text in the buffer.
|
||||
|
||||
The gapped text segment is quite simple. It's parameters are (all
|
||||
parameters I mention here are in the structure GtkText):
|
||||
|
||||
guchar* text;
|
||||
guint text_len;
|
||||
guint gap_position;
|
||||
guint gap_size;
|
||||
guint text_end;
|
||||
|
||||
TEXT is the buffer, TEXT_LEN is its allocated length. TEXT_END is the
|
||||
length of the text, including the gap. GAP_POSITION is the start of
|
||||
the gap, and GAP_SIZE is the gap's length. Therefore, TEXT_END -
|
||||
GAP_SIZE is the length of the text in the buffer. The macro
|
||||
TEXT_LENGTH returns this value. To get the value of a character in
|
||||
the buffer, use the macro TEXT_INDEX(TEXT,INDEX). This macro tests
|
||||
whether the index is less than the GAP_POSITION and returns
|
||||
TEXT[INDEX] or returns TEXT[GAP_SIZE+INDEX]. The function
|
||||
MOVE_GAP_TO_POINT positions the gap to a particular index. The
|
||||
function MAKE_FORWARD_SPACE lengthens the gap to provide room for a
|
||||
certain number of characters.
|
||||
|
||||
The property list is a doubly linked list (GList) of text property
|
||||
data for each contiguous set of characters with similar properties.
|
||||
The data field of the GList points to a TextProperty structure, which
|
||||
contains:
|
||||
|
||||
TextFont* font;
|
||||
GdkColor* back_color;
|
||||
GdkColor* fore_color;
|
||||
guint length;
|
||||
|
||||
Currently, only font and color data are contained in the property
|
||||
list, but it can be extended by modifying the INSERT_TEXT_PROPERTY,
|
||||
TEXT_PROPERTIES_EQUAL, and a few other procedures. The text property
|
||||
structure does not contain an absolute offset, only a length. As a
|
||||
result, inserting a character into the buffer simply requires moving
|
||||
the gap to the correct position, making room in the buffer, and either
|
||||
inserting a new property or extending the old one. This logic is done
|
||||
by INSERT_TEXT_PROPERTY. A similar procedure exists to delete from
|
||||
the text property list, DELETE_TEXT_PROPERTY. Since the property
|
||||
structure doesn't contain an offset, insertion into the list is an
|
||||
O(1) operation. All such operations act on the insertion point, which
|
||||
is the POINT field of the GtkText structure.
|
||||
|
||||
The GtkPropertyMark structure is used for keeping track of the mapping
|
||||
between absolute buffer offsets and positions in the property list.
|
||||
These will be referred to as property marks. Generally, there are
|
||||
four property marks the system keeps track of. Two are trivial, the
|
||||
beginning and the end of the buffer are easy to find. The other two
|
||||
are the insertion point (POINT) and the cursor point (CURSOR_MARK).
|
||||
All operations on the text buffer are done using a property mark as a
|
||||
sort of cursor to keep track of the alignment of the property list and
|
||||
the absolute buffer offset. The GtkPropertyMark structure contains:
|
||||
|
||||
GList* property;
|
||||
guint offset;
|
||||
guint index;
|
||||
|
||||
PROPERTY is a pointer at the current property list element. INDEX is
|
||||
the absolute buffer index, and OFFSET is the offset of INDEX from the
|
||||
beginning of PROPERTY. It is essential to keep property marks valid,
|
||||
or else you will have the wrong text properties at each property mark
|
||||
transition. An important point is that all property marks are invalid
|
||||
after a buffer modification unless care is taken to keep them
|
||||
accurate. That is the difficulty of the insert and delete operations,
|
||||
because as the next section describes, line data is cached and by
|
||||
neccesity contains text property marks. The functions for operating
|
||||
and computing property marks are:
|
||||
|
||||
void advance_mark (GtkPropertyMark* mark);
|
||||
void decrement_mark (GtkPropertyMark* mark);
|
||||
void advance_mark_n (GtkPropertyMark* mark, gint n);
|
||||
void decrement_mark_n (GtkPropertyMark* mark, gint n);
|
||||
void move_mark_n (GtkPropertyMark* mark, gint n);
|
||||
|
||||
GtkPropertyMark find_mark (GtkText* text, guint mark_position);
|
||||
GtkPropertyMark find_mark_near (GtkText* text, guint mark_position,
|
||||
const GtkPropertyMark* near);
|
||||
|
||||
ADVANCE_MARK and DECREMENT_MARK modify the mark by plus or minus one
|
||||
buffer index. ADVANCE_MARK_N and DECREMENT_MARK_N modify the mark by
|
||||
plus or minus N indices. MOVE_MARK_N accepts a positive or negative
|
||||
argument. FIND_MARK returns a mark at MARK_POSITION using a linear
|
||||
search from the nearest known property mark (the beginning, the end,
|
||||
the point, etc). FIND_MARK_NEAR also does a linear search, but
|
||||
searches from the NEAR argument. A number of macros exist at the top
|
||||
of the file for doing things like getting the current text property,
|
||||
or some component of the current property. See the MARK_* macros.
|
||||
|
||||
Next there is a LineParams structure which contains all the
|
||||
information neccesary to draw one line of text on screen. When I say
|
||||
"line" here, I do not mean one line of text seperated by newlines,
|
||||
rather I mean one row of text on screen. It is a matter of policy how
|
||||
visible lines are chosen and there are currently two policies,
|
||||
line-wrap and no-line-wrap. I suspect it would not be difficult to
|
||||
implement new policies for doing such things as justification. The
|
||||
LineParams structure includes the following fields:
|
||||
|
||||
guint font_ascent;
|
||||
guint font_descent;
|
||||
guint pixel_width;
|
||||
guint displayable_chars;
|
||||
guint wraps : 1;
|
||||
|
||||
PrevTabCont tab_cont;
|
||||
PrevTabCont tab_cont_next;
|
||||
|
||||
GtkPropertyMark start;
|
||||
GtkPropertyMark end;
|
||||
|
||||
FONT_ASCENT and FONT_DESCENT are the maximum ascent and descent of any
|
||||
character in the line. PIXEL_WIDTH is the number of pixels wide the
|
||||
drawn region is, though I don't think it's actually being used
|
||||
currently. You may wish to remove this field, eventually, though I
|
||||
suspect it will come in handy implementing horizontal scrolling.
|
||||
DISPLAYABLE_CHARS is the number of characters in the line actually
|
||||
drawn. This may be less than the number of characters in the line
|
||||
when line wrapping is off (see below). The bitflag WRAPS tells
|
||||
whether the next line is a continuation of this line. START and END
|
||||
are the marks at the beginning and end of the line. Note that END is
|
||||
the actual last character, not one past it, so the smallest line
|
||||
(containing, for example, one newline) has START == END. TAB_CONT and
|
||||
TAB_CONT_NEXT are for computation of tab positions. I will discuss
|
||||
them later.
|
||||
|
||||
A point about the end of the buffer. You may be tempted to consider
|
||||
working with the buffer as an array of length TEXT_LENGTH(TEXT), but
|
||||
you have to be careful that the editor allows you to position your
|
||||
cursor at the last index of the buffer, one past the last character.
|
||||
The macro LAST_INDEX(TEXT, MARK) returns true if MARK is positioned at
|
||||
this index. If you see or add a special case in the code for this
|
||||
end-of-buffer case, make sure to use LAST_INDEX if you can. Very
|
||||
often, the last index is treated as a newline.
|
||||
|
||||
[ One way the last index is special is that, although it is always
|
||||
part of some property, it will never be part of a property of
|
||||
length 1 unless there are no other characters in the text. That
|
||||
is, its properties are always that of the preceding character,
|
||||
if any.
|
||||
|
||||
There is a fair bit of special case code to mantain this condition -
|
||||
which is needed so that user has control over the properties of
|
||||
characters inserted at the last position. OWT 2/9/98 ]
|
||||
|
||||
Tab stops are variable width. A list of tab stops is contained in the
|
||||
GtkText structure:
|
||||
|
||||
GList *tab_stops;
|
||||
gint default_tab_width;
|
||||
|
||||
The elements of tab_stops are integers casted to gpointer. This is a
|
||||
little bogus, but works. For example:
|
||||
|
||||
text->default_tab_width = 4;
|
||||
text->tab_stops = NULL;
|
||||
text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
|
||||
text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
|
||||
|
||||
is how these fields are initialized, currently. This means that the
|
||||
first two tabs occur at 8 and 16, and every 4 characters thereafter.
|
||||
Tab stops are used in the computation of line geometry (to fill in a
|
||||
LineParams structure), and the width of the space character in the
|
||||
current font is used. The PrevTabCont structure, of which two are
|
||||
stored per line, is used to compute the geometry of lines which may
|
||||
have wrapped and carried part of a tab with them:
|
||||
|
||||
guint pixel_offset;
|
||||
TabStopMark tab_start;
|
||||
|
||||
PIXEL_OFFSET is the number of pixels at which the line should start,
|
||||
and tab_start is a tab stop mark, which is similar to a property mark,
|
||||
only it keeps track of the mapping between line position (column) and
|
||||
the next tab stop. A TabStopMark contains:
|
||||
|
||||
GList* tab_stops;
|
||||
gint to_next_tab;
|
||||
|
||||
TAB_STOPS is a pointer into the TAB_STOPS field of the GtkText
|
||||
structure. TO_NEXT_TAB is the number of characters before the next
|
||||
tab. The functions ADVANCE_TAB_MARK and ADVANCE_TAB_MARK_N advance
|
||||
these marks. The LineParams structure contains two PrevTabCont
|
||||
structures, which each contain a tab stop. The first (TAB_CONT) is
|
||||
for computing the beginning pixel offset, as mentioned above. The
|
||||
second (TAB_CONT_NEXT) is used to initialize the TAB_CONT field of the
|
||||
next line if it wraps.
|
||||
|
||||
Since computing the parameters of a line are fairly complicated, I
|
||||
have one interface that should be all you ever need to figure out
|
||||
something about a line. The function FIND_LINE_PARAMS computes the
|
||||
parameters of a single line. The function LINE_PARAMS_ITERATE is used
|
||||
for computing the properties of some number (> 0) of sequential lines.
|
||||
|
||||
void
|
||||
line_params_iterate (GtkText* text,
|
||||
const GtkPropertyMark* mark0,
|
||||
const PrevTabCont* tab_mark0,
|
||||
gboolean alloc,
|
||||
gpointer data,
|
||||
LineIteratorFunction iter);
|
||||
|
||||
where LineIteratorFunction is:
|
||||
|
||||
typedef gint (*LineIteratorFunction) (GtkText* text,
|
||||
LineParams* lp,
|
||||
gpointer data);
|
||||
|
||||
The arguments are a text widget (TEXT), the property mark at the
|
||||
beginning of the first line (MARK0), the tab stop mark at the
|
||||
beginning of that line (TAB_MARK0), whether to heap-allocate the
|
||||
LineParams structure (ALLOC), some client data (DATA), and a function
|
||||
to call with the parameters of each line. TAB_MARK0 may be NULL, but
|
||||
if so MARK0 MUST BE A REAL LINE START (not a continued line start; it
|
||||
is preceded by a newline). If TAB_MARK0 is not NULL, MARK0 may be any
|
||||
line start (continued or not). See the code for examples. The
|
||||
function ITER is called with each LineParams computed. If ALLOC was
|
||||
true, LINE_PARAMS_ITERATE heap-allocates the LineParams and does not
|
||||
free them. Otherwise, no storage is permanently allocated. ITER
|
||||
should return TRUE when it wishes to continue no longer.
|
||||
|
||||
There are currently two uses of LINE_PARAMS_ITERATE:
|
||||
|
||||
* Compute the total buffer height for setting the parameters of the
|
||||
scroll bars. This is done in SET_VERTICAL_SCROLL each time the
|
||||
window is resized. When horizontal scrolling is added, depending on
|
||||
the policy chosen, the max line width can be computed here as well.
|
||||
|
||||
* Computing geometry of some pixel height worth of lines. This is
|
||||
done in FETCH_LINES, FETCH_LINES_BACKWARD, FETCH_LINES_FORWARD, etc.
|
||||
|
||||
The GtkText structure contains a cache of the LineParams data for all
|
||||
visible lines:
|
||||
|
||||
GList *current_line;
|
||||
GList *line_start_cache;
|
||||
|
||||
guint first_line_start_index;
|
||||
guint first_cut_pixels;
|
||||
guint first_onscreen_hor_pixel;
|
||||
guint first_onscreen_ver_pixel;
|
||||
|
||||
LINE_START_CACHE is a doubly linked list of LineParams. CURRENT_LINE
|
||||
is a transient piece of data which is set in varoius places such as
|
||||
the mouse click code. Generally, it is the line on which the cursor
|
||||
property mark CURSOR_MARK is on. LINE_START_CACHE points to the first
|
||||
visible line and may contain PREV pointers if the cached data of
|
||||
offscreen lines is kept around. I haven't come up with a policy. The
|
||||
cache can keep more lines than are visible if desired, but the result
|
||||
is that inserts and deletes will then become slower as the entire
|
||||
cache has to be "corrected". Right now it doesn't delete from the
|
||||
cache (it should). As a result, scrolling through the whole buffer
|
||||
once will fill the cache with an entry for each line, and subsequent
|
||||
modifications will be slower than they should
|
||||
be. FIRST_LINE_START_INDEX is the index of the *REAL* line start of
|
||||
the first line. That is, if the first visible line is a continued
|
||||
line, this is the index of the real line start (preceded by a
|
||||
newline). FIRST_CUT_PIXELS is the number of pixels which are not
|
||||
drawn on the first visible line. If FIRST_CUT_PIXELS is zero, the
|
||||
whole line is visible. FIRST_ONSCREEN_HOR_PIXEL is not used.
|
||||
FIRST_ONSCREEN_VER_PIXEL is the absolute pixel which starts the
|
||||
visible region. This is used for setting the vertical scroll bar.
|
||||
|
||||
Other miscellaneous things in the GtkText structure:
|
||||
|
||||
Gtk specific things:
|
||||
|
||||
GtkWidget widget;
|
||||
|
||||
GdkWindow *text_area;
|
||||
|
||||
GtkAdjustment *hadj;
|
||||
GtkAdjustment *vadj;
|
||||
|
||||
GdkGC *gc;
|
||||
|
||||
GdkPixmap* line_wrap_bitmap;
|
||||
GdkPixmap* line_arrow_bitmap;
|
||||
|
||||
These are pretty self explanatory, especially if you know Gtk.
|
||||
LINE_WRAP_BITMAP and LINE_ARROW_BITMAP are two bitmaps used to
|
||||
indicate that a line wraps and is continued offscreen, respectively.
|
||||
|
||||
Some flags:
|
||||
|
||||
guint has_cursor : 1;
|
||||
guint is_editable : 1;
|
||||
guint line_wrap : 1;
|
||||
guint freeze : 1;
|
||||
guint has_selection : 1;
|
||||
guint own_selection : 1;
|
||||
|
||||
HAS_CURSOR is true iff the cursor is visible. IS_EDITABLE is true iff
|
||||
the user is allowed to modify the buffer. If IS_EDITABLE is false,
|
||||
HAS_CURSOR is guaranteed to be false. If IS_EDITABLE is true,
|
||||
HAS_CURSOR starts out false and is set to true the first time the user
|
||||
clicks in the window. LINE_WRAP is where the line-wrap policy is
|
||||
set. True means wrap lines, false means continue lines offscreen,
|
||||
horizontally.
|
||||
|
||||
The text properties list:
|
||||
|
||||
GList *text_properties;
|
||||
GList *text_properties_end;
|
||||
|
||||
A scratch area used for constructing a contiguous piece of the buffer
|
||||
which may otherwise span the gap. It is not strictly neccesary
|
||||
but simplifies the drawing code because it does not need to deal with
|
||||
the gap.
|
||||
|
||||
guchar* scratch_buffer;
|
||||
guint scratch_buffer_len;
|
||||
|
||||
The last vertical scrollbar position. Currently this looks the same
|
||||
as FIRST_ONSCREEN_VER_PIXEL. I can't remember why I have two values.
|
||||
Perhaps someone should clean this up.
|
||||
|
||||
gint last_ver_value;
|
||||
|
||||
The cursor:
|
||||
|
||||
gint cursor_pos_x;
|
||||
gint cursor_pos_y;
|
||||
GtkPropertyMark cursor_mark;
|
||||
gchar cursor_char;
|
||||
gchar cursor_char_offset;
|
||||
gint cursor_virtual_x;
|
||||
gint cursor_drawn_level;
|
||||
|
||||
CURSOR_POS_X and CURSOR_POS_Y are the screen coordinates of the
|
||||
cursor. CURSOR_MARK is the buffer position. CURSOR_CHAR is
|
||||
TEXT_INDEX (TEXT, CURSOR_MARK.INDEX) if a drawable character, or 0 if
|
||||
it is whitespace, which is treated specially. CURSOR_CHAR_OFFSET is
|
||||
the pixel offset above the base of the line at which it should be
|
||||
drawn. Note that the base of the line is not the "baseline" in the
|
||||
traditional font metric sense. A line (LineParams) is
|
||||
FONT_ASCENT+FONT_DESCENT high (use the macro LINE_HEIGHT). The
|
||||
"baseline" is FONT_DESCENT below the base of the line. I think this
|
||||
requires a drawing.
|
||||
|
||||
0 AAAAAAA
|
||||
1 AAAAAAA
|
||||
2 AAAAAAAAA
|
||||
3 AAAAAAAAA
|
||||
4 AAAAA AAAAA
|
||||
5 AAAAA AAAAA
|
||||
6 AAAAA AAAAA
|
||||
7 AAAAA AAAAA
|
||||
8 AAAAA AAAAA
|
||||
9 AAAAAAAAAAAAAAAAA
|
||||
10 AAAAAAAAAAAAAAAAA
|
||||
11 AAAAA AAAAA
|
||||
12 AAAAA AAAAA
|
||||
13 AAAAAA AAAAAA
|
||||
14______________AAAAA___________AAAAA__________________________________
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
|
||||
This line is 20 pixels high, has FONT_ASCENT=14, FONT_DESCENT=6. It's
|
||||
"base" is at y=20. Characters are drawn at y=14. The LINE_START
|
||||
macro returns the pixel height. The LINE_CONTAINS macro is true if
|
||||
the line contains a certain buffer index. The LINE_STARTS_AT macro is
|
||||
true if the line starts at a certain buffer index. The
|
||||
LINE_START_PIXEL is the pixel offset the line should be drawn at,
|
||||
according the the tab continuation of the previous line.
|
||||
|
||||
Exposure and drawing:
|
||||
|
||||
Exposure is handled from the EXPOSE_TEXT function. It assumes that
|
||||
the LINE_START_CACHE and all it's parameters are accurate and simply
|
||||
exposes any line which is in the exposure region. It calls the
|
||||
CLEAR_AREA function to clear the background and/or lay down a pixmap
|
||||
background. The text widget has a scrollable pixmap background, which
|
||||
is implemented in CLEAR_AREA. CLEAR_AREA does the math to figure out
|
||||
how to tile the pixmap itself so that it can scroll the text with a
|
||||
copy area call. If the CURSOR argument to EXPOSE_TEXT is true, it
|
||||
also draws the cursor.
|
||||
|
||||
The function DRAW_LINE draws a single line, doing all the tab and
|
||||
color computations neccesary. The function DRAW_LINE_WRAP draws the
|
||||
line wrap bitmap at the end of the line if it wraps. TEXT_EXPOSE will
|
||||
expand the cached line data list if it has to by calling
|
||||
FETCH_LINES_FORWARD. The functions DRAW_CURSOR and UNDRAW_CURSOR draw
|
||||
and undraw the cursor. They count the number of draws and undraws so
|
||||
that the cursor may be undrawn even if the cursor is already undrawn
|
||||
and the re-draw will not occur too early. This is useful in handling
|
||||
scrolling.
|
||||
|
||||
Handling of the cursor is a little messed up, I should add. It has to
|
||||
be undrawn and drawn at various places. Something better needs to be
|
||||
done about this, because it currently doesn't do the right thing in
|
||||
certain places. I can't remember where very well. Look for the calls
|
||||
to DRAW_CURSOR and UNDRAW_CURSOR.
|
||||
|
||||
RECOMPUTE_GEOMETRY is called when the geometry of the window changes
|
||||
or when it is first drawn. This is probably not done right. My
|
||||
biggest weakness in writing this code is that I've never written a
|
||||
widget before so I got most of the event handling stuff wrong as far
|
||||
as Gtk is concerned. Fortunatly, most of the code is unrelated and
|
||||
simply an exercise in data structure manipulation.
|
||||
|
||||
Scrolling:
|
||||
|
||||
Scrolling is fairly straighforward. It looks at the top line, and
|
||||
advances it pixel by pixel until the FIRST_CUT_PIXELS equals the line
|
||||
height and then advances the LINE_START_CACHE. When it runs out of
|
||||
lines it fetches more. The function SCROLL_INT is used to scroll from
|
||||
inside the code, it calls the appropriate functions and handles
|
||||
updating the scroll bars. It dispatches a change event which causes
|
||||
Gtk to call the correct scroll action, which then enters SCROLL_UP or
|
||||
SCROLL_DOWN. Careful with the cursor during these changes.
|
||||
|
||||
Insertion, deletion:
|
||||
|
||||
There's some confusion right now over what to do with the cursor when
|
||||
it's offscreen due to scrolling. This is a policy decision. I don't
|
||||
know what's best. Spencer criticized me for forcing it to stay
|
||||
onscreen. It shouldn't be hard to make stuff work with the cursor
|
||||
offscreen.
|
||||
|
||||
Currently I've got functions to do insertion and deletion of a single
|
||||
character. It's fairly complicated. In order to do efficient pasting
|
||||
into the buffer, or write code that modifies the buffer while the
|
||||
buffer is drawn, it needs to do multiple characters at at time. This
|
||||
is the hardest part of what remains. Currently, gtk_text_insert does
|
||||
not reexpose the modified lines. It needs to. Pete did this wrong at
|
||||
one point and I disabled modification completely, I don't know what
|
||||
the current state of things are. The functions
|
||||
INSERT_CHAR_LINE_EXPOSE and DELETE_CHAR_LINE_EXPOSE do the work.
|
||||
Here's pseudo code for insert. Delete is quite similar.
|
||||
|
||||
insert character into the buffer
|
||||
update the text property list
|
||||
move the point
|
||||
undraw the cursor
|
||||
correct all LineParams cache entries after the insertion point
|
||||
compute the new height of the modified line
|
||||
compare with the old height of the modified line
|
||||
remove the old LineParams from the cache
|
||||
insert the new LineParams into the cache
|
||||
if the lines are of different height, do a copy area to move the
|
||||
area below the insertion down
|
||||
expose the current line
|
||||
update the cursor mark
|
||||
redraw the cursor
|
||||
|
||||
What needs to be done:
|
||||
|
||||
Horizintal scrolling, robustness, testing, selection handling. If you
|
||||
want to work in the text widget pay attention to the debugging
|
||||
facilities I've written at the end of gtktext.c. I'm sorry I waited
|
||||
so long to try and pass this off. I'm super busy with school and
|
||||
work, and when I have free time my highest priority is another version
|
||||
of PRCS.
|
||||
|
||||
Feel free to ask me questions.
|
||||
14129
docs/tutorial/gtk_tut.sgml
Normal file
14129
docs/tutorial/gtk_tut.sgml
Normal file
File diff suppressed because it is too large
Load Diff
10090
docs/tutorial/gtk_tut_it.sgml
Normal file
10090
docs/tutorial/gtk_tut_it.sgml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
docs/tutorial/gtk_tut_packbox1.gif
Normal file
BIN
docs/tutorial/gtk_tut_packbox1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/tutorial/gtk_tut_packbox2.gif
Normal file
BIN
docs/tutorial/gtk_tut_packbox2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
docs/tutorial/gtk_tut_table.gif
Normal file
BIN
docs/tutorial/gtk_tut_table.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
492
docs/widget_system.txt
Normal file
492
docs/widget_system.txt
Normal file
@@ -0,0 +1,492 @@
|
||||
Notes about the inner workings of the widget system of GTK+
|
||||
===========================================================
|
||||
|
||||
This file contains some notes as to how the widget system does
|
||||
and should work. It consists of three parts:
|
||||
|
||||
I) A description of the meaning of the various flags
|
||||
|
||||
II) A list of invariants about the states of the widgets.
|
||||
(Throughout this document, we refer to the states of the
|
||||
widgets by referring to the flags for GtkWidget)
|
||||
|
||||
III) Some notes about the ways that a widget changes states
|
||||
|
||||
IV) A list of responsibilities of various widget signals when
|
||||
the states change.
|
||||
|
||||
Any action necessary to maintain the invariants in II which is not
|
||||
explicitly mentioned in IV), is the responsibility of the core GTK
|
||||
code, which is roughly defined as:
|
||||
|
||||
gtkobject.c
|
||||
gtkwidget.c
|
||||
gtkcontainer.c
|
||||
gtkmain.c
|
||||
gtksignal.c
|
||||
|
||||
Section II is mostly of interest to those maintaining GTK, the
|
||||
other sections may also be interesting to people writing
|
||||
new widgets.
|
||||
|
||||
Main outline:
|
||||
- Owen Taylor <owt1@cornell.edu>
|
||||
1998/02/03
|
||||
|
||||
Flag descriptions:
|
||||
- Tim Janik <timj@gimp.org>
|
||||
1998/02/04
|
||||
|
||||
I. Flags
|
||||
--------
|
||||
|
||||
GtkObject:
|
||||
|
||||
GTK_DESTROYED:
|
||||
This flagged is set for a GtkObject right before its
|
||||
destruction code is executed. Its main use is the
|
||||
prevention of multiple destruction invokations.
|
||||
|
||||
GTK_FLOATING:
|
||||
This flag reflects the fact that the holder of the
|
||||
initial reference count is unknown. Refer to refcounting.txt
|
||||
for further details.
|
||||
|
||||
GTK_RESERVED_1:
|
||||
GTK_RESERVED_2:
|
||||
Reserved flags.
|
||||
|
||||
|
||||
GtkWidget, public flags:
|
||||
|
||||
GTK_TOPLEVEL:
|
||||
Widgets without a real parent, as there are GtkWindows and
|
||||
GtkMenus have this flag set throughout their lifetime.
|
||||
Toplevel widgets always contain their own GdkWindow.
|
||||
|
||||
GTK_NO_WINDOW:
|
||||
This flag is indicative for a widget that does not provide
|
||||
its own GdkWindow. Visible action (e.g. drawing) is performed
|
||||
on the parent's GdkWindow.
|
||||
|
||||
GTK_REALIZED:
|
||||
Set by gtk_widget_realize, unset by gtk_widget_unrealize.
|
||||
Relies on ((widget->parent && widget->parent->window)
|
||||
|| GTK_WIDGET_TOPLEVEL (widget));
|
||||
Means: widget has an associated GdkWindow (XWindow).
|
||||
|
||||
GTK_MAPPED:
|
||||
Set by gtk_widget_map, unset by gtk_widget_unmap.
|
||||
May only be set if GTK_WIDGET_REALIZED (widget).
|
||||
Means: gdk_window_show() has been called on the widgets window(s).
|
||||
|
||||
GTK_VISIBLE:
|
||||
Set by gtk_widget_show.
|
||||
Implies that a widget will be flagged GTK_MAPPED as soon as its
|
||||
parent is mapped.
|
||||
!GTK_VISIBLE:
|
||||
Set by gtk_widget_hide.
|
||||
Implies that a widget is not onscreen, therefore !GTK_MAPPED.
|
||||
|
||||
GTK_SENSITIVE:
|
||||
Set and unset by gtk_widget_set_sensitive.
|
||||
The sensitivity of a widget determines whether it will receive
|
||||
certain events (e.g. button or key presses). One premise for
|
||||
the widgets sensitivity is to have GTK_SENSITIVE set.
|
||||
|
||||
GTK_PARENT_SENSITIVE:
|
||||
Set and unset by gtk_widget_set_sensitive operations on the
|
||||
parents of the widget.
|
||||
This is the second premise for the widgets sensitivity. Once
|
||||
it has GTK_SENSITIVE and GTK_PARENT_SENSITIVE set, its state is
|
||||
effectively sensitive. This is expressed (and can be examined) by
|
||||
the GTK_WIDGET_IS_SENSITIVE macro.
|
||||
|
||||
GTK_CAN_FOCUS:
|
||||
There are no directly corresponding functions for setting/unsetting
|
||||
this flag, but it can be affected by the GtkWidget::has_focus argument
|
||||
via gtk_widget_set_arg.
|
||||
This flag determines whether a widget is able to handle focus grabs.
|
||||
|
||||
GTK_HAS_FOCUS:
|
||||
This flag will be set by gtk_widget_grab_focus for widgets that also
|
||||
have GTK_CAN_FOCUS set. The flag will be unset once another widget
|
||||
grabs the focus.
|
||||
|
||||
GTK_CAN_DEFAULT:
|
||||
GTK_HAS_DEFAULT:
|
||||
These two flags are mostly equal in functionality to their *_FOCUS
|
||||
counterparts, but for the default widget.
|
||||
|
||||
GTK_HAS_GRAB:
|
||||
Set by gtk_grab_add, unset by gtk_grab_remove.
|
||||
Means: widget is in the grab_widgets stack, and will be the preferred
|
||||
one for receiving events other than ones of cosmetic value.
|
||||
|
||||
GTK_BASIC:
|
||||
The GTK_BASIC flag is an attempt at making a distinction
|
||||
between widgets that handle user input e.g. key/button presses
|
||||
and those that don't. Subsequent parent<->child relation ships
|
||||
of non `basic' widgets should be avoided. The checking for
|
||||
this is currently not properly enforced in the code. For
|
||||
example GtkButton is a non `basic' widget, that will therefore
|
||||
disallow to act as a container for another GtkButton. Now the
|
||||
gnit is, one can add a GtkHBox (which is a `basic' widget) to
|
||||
the first button, and put the second into the box.
|
||||
|
||||
GTK_RESERVED_3:
|
||||
|
||||
GTK_RC_STYLE:
|
||||
This flag indicates that its style has been looked up through
|
||||
the rc mechanism. It does not imply that the widget actually
|
||||
had a style defined through the rc mechanism.
|
||||
|
||||
|
||||
GtkWidget, private flags:
|
||||
|
||||
GTK_USER_STYLE:
|
||||
A widget is flagged to have a user style, once gtk_widget_set_style
|
||||
has been invoked for it. The use of this flag is to tell widgets
|
||||
wich share a global user style from the ones which got a certain
|
||||
style assign from outside the toolkit.
|
||||
|
||||
GTK_REDRAW_PENDING:
|
||||
Relies on GTK_WIDGET_MAPPED (widget).
|
||||
[FIXME: this is not really enforced throughout the code, but should
|
||||
be. it only requires a few checks for GTK_WIDGET_MAPPED and
|
||||
minor changes to gtk_widget_unmap, we can then remove the check
|
||||
in gtk_widget_real_destroy]
|
||||
Means: there is an idle handler waiting for the widget, that
|
||||
will cause a full redraw (gtk_widget_draw (widget, NULL)).
|
||||
|
||||
GTK_RESIZE_PENDING:
|
||||
First, this is only valid for GtkContainers.
|
||||
[some of the code should move to gtkcontainer.c therefore]
|
||||
Relies on GTK_WIDGET_REALIZED(widget)
|
||||
[this is not really enforced throughout the code, but should
|
||||
be. it only requires a few checks for GTK_WIDGET_RELIZED and
|
||||
minor changes to gtk_widget_unrealize, we can then remove the check
|
||||
in gtk_widget_real_destroy]
|
||||
Means: there is an idle handler waiting for the container to
|
||||
resize it.
|
||||
|
||||
GTK_RESIZE_NEEDED:
|
||||
Relies on GTK_WIDGET_REALIZED(widget)
|
||||
[this is not really enforced throughout the code, but should
|
||||
be. once this is done special checking in gtk_widget_real_destroy
|
||||
can be avoided]
|
||||
Means: a widget has been added to the resize_widgets list of
|
||||
its _toplevel_ container (keep this in mind for GtkViewport).
|
||||
Remark: this flag is also used internaly by gtkwindow.c during
|
||||
the evaluation of resizing worthy widgets.
|
||||
|
||||
GTK_LEAVE_PENDING:
|
||||
A widget is flagged as such if there is a leave_notify event
|
||||
pending for it. It will receive this event regardless of a grab
|
||||
through another widget or its current sensitivity.
|
||||
[this should be made relying on GTK_REALIZED]
|
||||
|
||||
GTK_HAS_SHAPE_MASK:
|
||||
Set by gtk_widget_shape_combine_mask if a widget got a shape mask
|
||||
assigned (making use of the X11 shaped window extension).
|
||||
|
||||
GTK_IN_REPARENT:
|
||||
During the act of reparentation widgets which are already
|
||||
realized and will be added to an already realized parent need
|
||||
to have this flag set to prevent natural unrealization on the
|
||||
process of getting unparented.
|
||||
|
||||
Related Macros:
|
||||
|
||||
GTK_WIDGET_DRAWABLE:
|
||||
This macro examines whether a widget is flagged as GTK_WIDGET_VISIBLE
|
||||
and GTK_WIDGET_MAPPED.
|
||||
Means: it _makes sense_ to draw in a widgets window.
|
||||
|
||||
GTK_WIDGET_IS_SENSITIVE:
|
||||
This macro tells the real sensitivity state of a widget. It returns
|
||||
whether both the widget and all its parents are in sensitive state.
|
||||
|
||||
|
||||
II. Invariants:
|
||||
---------------
|
||||
|
||||
This section describes various constraints on the states of
|
||||
the widget:
|
||||
|
||||
In the following
|
||||
|
||||
A => B means if A is true, than B is true
|
||||
A <=> B means A is true, if and only if B is true
|
||||
(equivalent to A => B and A <= B)
|
||||
|
||||
|
||||
1) GTK_WIDGET_DESTROYED (widget) => !GTK_WIDGET_REALIZED (widget)
|
||||
=> !GTK_WIDGET_VISIBLE (widget)
|
||||
[ The latter is not currently in place, but it should be ]
|
||||
|
||||
2) GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_REALIZED (widget)
|
||||
|
||||
3) if GTK_WIDGET_TOPLEVEL (widget):
|
||||
GTK_WIDGET_VISIBLE (widget) <=> GTK_WIDGET_MAPPED (widget)
|
||||
|
||||
4) if !GTK_WIDGET_TOPLEVEL (widget):
|
||||
widget->parent && GTK_WIDGET_REALIZED (widget->parent) <=>
|
||||
GTK_WIDGET_REALIZED (widget)
|
||||
|
||||
5) if !GTK_WIDGET_TOPLEVEL (widget):
|
||||
|
||||
GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_VISIBLE (widget)
|
||||
=> GTK_WIDGET_REALIZED (widget)
|
||||
|
||||
widget->parent && GTK_WIDGET_MAPPED (widget->parent) &&
|
||||
GTK_WIDGET_VISIBLE (widget) => GTK_WIDGET_MAPPED (widget)
|
||||
|
||||
Note:, the definition
|
||||
|
||||
[ GTK_WIDGET_DRAWABLE = GTK_WIDGET_VISIBLE && GTK_WIDGET_MAPPED
|
||||
is made in gtkwidget.c, but by 3) and 5),
|
||||
|
||||
GTK_WIDGET_MAPPED => GTK_WIDGET_VISIBLE
|
||||
]
|
||||
|
||||
6) GTK_REDRAW_PENDING => GTK_WIDGET_REALIZED
|
||||
GTK_RESIZE_PENDING => "
|
||||
GTK_LEAVE_PENDING => "
|
||||
GTK_RESIZE_NEEDED => "
|
||||
|
||||
III. How states are changed:
|
||||
----------------------------
|
||||
|
||||
How can the user control the state of a widget:
|
||||
-----------------------------------------------
|
||||
|
||||
(In the following, set flag means set the flag, do appropriate
|
||||
actions, and enforce above invariants)
|
||||
|
||||
gtk_widget_show:
|
||||
if !GTK_DESTROYED sets GTK_VISIBLE
|
||||
|
||||
gtk_widget_hide:
|
||||
if !GTK_VISIBLE for widget
|
||||
|
||||
gtk_widget_destroy:
|
||||
sets GTK_DESTROYED
|
||||
For a top-level widget
|
||||
|
||||
gtk_widget_realize:
|
||||
if !GTK_DESTROYED sets GTK_REALIZED
|
||||
- Calling gtk_widget_realize when the widget is not a descendent
|
||||
of a toplevel is an ERROR.
|
||||
|
||||
gtk_container_add (container, widget) [ and container-specific variants ]
|
||||
Sets widget->parent
|
||||
|
||||
gtk_container_remove (container, widget)
|
||||
unsets widget->parent
|
||||
|
||||
gtk_widget_reparent (widget, new_parent)
|
||||
Equivalent to removing widget from old parent and adding it to
|
||||
the new parent, except that the widget will not be temporarily
|
||||
unrealized if both the old parent and the new parent are realized.
|
||||
|
||||
|
||||
gtk_widget_unrealize
|
||||
gtk_widget_map
|
||||
gtk_widget_unmap
|
||||
|
||||
These functions are not meant to be used by applications - they
|
||||
are used only by GTK and widgets to enforce invariants on the
|
||||
state.
|
||||
|
||||
When The X window corresponding to a GTK window is destroyed:
|
||||
-------------------------------------------------------------
|
||||
|
||||
gtk_widget_destroy is called (as above).
|
||||
|
||||
|
||||
|
||||
IV. Responsibilities of widgets
|
||||
--------------------------------
|
||||
|
||||
Adding to a container
|
||||
---------------------
|
||||
|
||||
When a widget is added to a container, the container:
|
||||
|
||||
1) calls gtk_widget_set_parent (widget, container)
|
||||
2) calls gtk_widget_set_parent_window (widget, window) if
|
||||
the widget is being added to something other than container->window
|
||||
3) if container is realized, and not widget, realizes widget
|
||||
4) if container is mapped, and not widget and widget is GTK_VISIBLE,
|
||||
maps widget
|
||||
5) Queues a resize if the widget is mapped
|
||||
|
||||
Note: It would be nice to remove 3) and 4) out of widget specific code
|
||||
since they are of the invariant-enforcing nature, but it is
|
||||
a bit hard, since they can't be done until after 2)
|
||||
|
||||
|
||||
Removing from a container
|
||||
-------------------------
|
||||
|
||||
When a widget is removed to a container, the container:
|
||||
|
||||
1) Calls gtk_widget_unparent (widget)
|
||||
2) Queues a resize.
|
||||
|
||||
Notes:
|
||||
|
||||
gtk_widget_unparent unrealizes the widget except in the
|
||||
special case GTK_IN_REPARENT is set.
|
||||
|
||||
|
||||
At widget creation
|
||||
------------------
|
||||
|
||||
Widgets are created in an unrealized state.
|
||||
|
||||
1) The widget should allocate and initialize needed data structures
|
||||
|
||||
|
||||
The Realize signal
|
||||
------------------
|
||||
|
||||
When a widget recieves the "realize" signal it should:
|
||||
|
||||
NO_WINDOW widgets: (probably OK to use default handler)
|
||||
|
||||
1) set the realized flag
|
||||
2) set widget->window
|
||||
widget->window = gtk_widget_get_parent_window (widget);
|
||||
gdk_window_ref (widget->window);
|
||||
3) attach the widget's style
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
widget with window(s)
|
||||
|
||||
1) set the REALIZED flag
|
||||
2) create windows with the parent obtained from
|
||||
gtk_widget_get_parent_window (widget);
|
||||
3) attach the widget's style
|
||||
4) set the background color for the new window based on the style
|
||||
|
||||
The Map signal
|
||||
--------------
|
||||
|
||||
1) Set the MAPPED flag
|
||||
2) If the widget has any windows, gdk_window_show those windows
|
||||
3) call gtk_widget_map for all child widgets that are
|
||||
VISIBLE and !MAPPED.
|
||||
3) Do any other functions related to putting the widget onscreen.
|
||||
(for instance, showing extra popup windows...)
|
||||
|
||||
The Unmap signal
|
||||
----------------
|
||||
|
||||
When a widget receives the unmap signal, it must:
|
||||
|
||||
1) If the widget has a window, gdk_window_hide that window,
|
||||
2) If the widget does not have a window, unmap all child widgets
|
||||
3) Do any other functions related to taking the widget offscreen
|
||||
(for instance, removing popup windows...)
|
||||
3) Unset GTK_MAPPED
|
||||
|
||||
|
||||
The Unrealize signal
|
||||
--------------------
|
||||
|
||||
When a widget receives the unrealize signal, it must
|
||||
|
||||
1) For any windows other than widget->window do:
|
||||
|
||||
gdk_window_set_user_data (window, NULL);
|
||||
gdk_window_destroy (window);
|
||||
|
||||
2) Call the parent's unrealize handler
|
||||
|
||||
|
||||
The Widget class unrealize handler will take care of unrealizing
|
||||
all children if necessary. [should this be made consistent with
|
||||
unmap???]
|
||||
|
||||
|
||||
The Destroy Signal
|
||||
------------------
|
||||
|
||||
Commentary:
|
||||
|
||||
The destroy signal probably shouldn't exist at all. A widget
|
||||
should merely be unrealized and removed from its parent
|
||||
when the user calls gtk_widget_destroy or a GDK_DESTROY event
|
||||
is received. However, a large body of code depends on
|
||||
getting a definitive signal when a widget goes away.
|
||||
|
||||
That could be put in the finalization step, but, especially
|
||||
with language bindings, the cleanup step may need to refer
|
||||
back to the widget. (To use gtk_widget_get_data, for instance)
|
||||
If it does so via a pointer in a closure (natural for
|
||||
Scheme, or Perl), then the finalization procedure will never
|
||||
be called.
|
||||
|
||||
Also, if we made that the finalization step, we would have
|
||||
to propagate the GDK_DESTROY event in any case, since it is
|
||||
at that point at which user-visible actions need to be taken.
|
||||
|
||||
|
||||
When a widget receives the destroy signal, it must:
|
||||
|
||||
1) If the widget "owns" any widgets other than its child
|
||||
widgets, (for instance popup windows) it should
|
||||
call gtk_widget_destroy () for them.
|
||||
|
||||
2) Call the parent class's destroy handler.
|
||||
|
||||
|
||||
The "destroy" signal will only be received once. A widget
|
||||
will never receive any other signals after the destroy
|
||||
signal (but see the sectionalize on "Finalize" below)
|
||||
|
||||
The widget must handle calls to all publically accessible
|
||||
functions in an innocuous manner even after a "destroy"
|
||||
signal. (A widget can assume that it will not be realized
|
||||
after a "destroy" signal is received, which may simplify
|
||||
handling this requirement)
|
||||
|
||||
|
||||
The Finalize Pseudo-signal
|
||||
--------------------------
|
||||
|
||||
The finalize pseudo-signal is received after all references
|
||||
to the widget have been removed. The finalize callback
|
||||
cannot make any GTK calls with the widget as a parameter.
|
||||
|
||||
1) Free any memory allocated by the widget. (But _not_
|
||||
the widget structure itself.
|
||||
|
||||
2) Call the parent class's finalize signal
|
||||
|
||||
|
||||
A note on chaining "destroy" signals and finalize signals:
|
||||
---------------------------------------------------------
|
||||
|
||||
This is done by code like:
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
|
||||
It may not be completely obvious why this works. Note
|
||||
that parent_class is a static variable on a per-class
|
||||
basis. So say: we have
|
||||
|
||||
GtkFoo <- GtkBar <- GtkWidget <-GtkObject
|
||||
|
||||
And that Foo, Widget, and Object all have destructors, but
|
||||
not Bar.
|
||||
|
||||
Then gtk_foo_destroy will call gtk_widget_destroy (because
|
||||
it was not overridden in the Bar class structure) and
|
||||
gtk_widget_destroy will call gtk_object_destroy because
|
||||
the parent_class variable referenced by gtk_foo_destroy is the
|
||||
static variable in gtkwidget.c: GtkObjectClass.
|
||||
41
examples/README.1ST
Normal file
41
examples/README.1ST
Normal file
@@ -0,0 +1,41 @@
|
||||
GTK Example Code - Tony Gale <gale@gtk.org> 980623
|
||||
--------------------------------------------------
|
||||
|
||||
I have written an awk script to automatically extract the code
|
||||
examples from the GTK Tutorial (in sgml), so they only have to be
|
||||
changed in one place.
|
||||
|
||||
It's called 'extract.awk', and there is a shell wrapper to invoke
|
||||
it called 'extract.sh'
|
||||
|
||||
It takes the following switches:
|
||||
-c : Just do checking rather than output files
|
||||
-f <filename> : Extract a specific file
|
||||
-d : Extract file(s) to current directory
|
||||
|
||||
Without the -d switch, the code will be placed in the appropriate
|
||||
sub-directory. Those sub-directories will be created if they do not
|
||||
exist.
|
||||
|
||||
Without the -f switch, all code examples will be extracted.
|
||||
|
||||
The shell wrapper assumes that the GTK Tutorial is in the
|
||||
file "../docs/gtk_tut.sgml"
|
||||
|
||||
It works by looking for sections of text in the tutorial surrounded
|
||||
by, for example:
|
||||
|
||||
/* example-start helloworld helloworld.c */
|
||||
|
||||
and
|
||||
|
||||
/* example-end */
|
||||
|
||||
Where "helloworld" is the directory into which the file will be
|
||||
placed (which can also be a directory spec like hello/hello1), and
|
||||
"helloworld.c" is the file name for the code.
|
||||
|
||||
So, the code between these lines would be extracted to the file
|
||||
helloworld/helloworld.c
|
||||
|
||||
It also handles replacing the sgml tag '&' with '&'
|
||||
8
examples/aspectframe/Makefile
Normal file
8
examples/aspectframe/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
aspectframe: aspectframe.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` aspectframe.c -o aspectframe
|
||||
|
||||
clean:
|
||||
rm -f *.o aspectframe
|
||||
43
examples/aspectframe/aspectframe.c
Normal file
43
examples/aspectframe/aspectframe.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* aspectframe.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *aspect_frame;
|
||||
GtkWidget *drawing_area;
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create an aspect_frame and add it to our toplevel window */
|
||||
|
||||
aspect_frame = gtk_aspect_frame_new ("2x1", /* label */
|
||||
0.5, /* center x */
|
||||
0.5, /* center y */
|
||||
2, /* xsize/ysize = 2 */
|
||||
FALSE /* ignore child's aspect */);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER(window), aspect_frame);
|
||||
gtk_widget_show (aspect_frame);
|
||||
|
||||
/* Now add a child widget to the aspect frame */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
|
||||
/* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
|
||||
* window since we are forcing a 2x1 aspect ratio */
|
||||
gtk_widget_set_usize (drawing_area, 200, 200);
|
||||
gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area);
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
gtk_widget_show (window);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
8
examples/buttons/Makefile
Normal file
8
examples/buttons/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
buttons: buttons.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` buttons.c -o buttons
|
||||
|
||||
clean:
|
||||
rm -f *.o buttons
|
||||
106
examples/buttons/buttons.c
Normal file
106
examples/buttons/buttons.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* buttons.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* create a new hbox with an image and a label packed into it
|
||||
* and return the box.. */
|
||||
|
||||
GtkWidget *xpm_label_box (GtkWidget *parent, gchar *xpm_filename, gchar *label_text)
|
||||
{
|
||||
GtkWidget *box1;
|
||||
GtkWidget *label;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
|
||||
/* create box for xpm and label */
|
||||
box1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (box1), 2);
|
||||
|
||||
/* get style of button.. I assume it's to get the background color.
|
||||
* if someone knows the real reason, please enlighten me. */
|
||||
style = gtk_widget_get_style(parent);
|
||||
|
||||
/* now on to the xpm stuff.. load xpm */
|
||||
pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
xpm_filename);
|
||||
pixmapwid = gtk_pixmap_new (pixmap, mask);
|
||||
|
||||
/* create label for button */
|
||||
label = gtk_label_new (label_text);
|
||||
|
||||
/* pack the pixmap and label into the box */
|
||||
gtk_box_pack_start (GTK_BOX (box1),
|
||||
pixmapwid, FALSE, FALSE, 3);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3);
|
||||
|
||||
gtk_widget_show(pixmapwid);
|
||||
gtk_widget_show(label);
|
||||
|
||||
return (box1);
|
||||
}
|
||||
|
||||
/* our usual callback function */
|
||||
void callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box1;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!");
|
||||
|
||||
/* It's a good idea to do this for all windows. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
|
||||
/* sets the border width of the window. */
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_widget_realize(window);
|
||||
|
||||
/* create a new button */
|
||||
button = gtk_button_new ();
|
||||
|
||||
/* You should be getting used to seeing most of these functions by now */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "cool button");
|
||||
|
||||
/* this calls our box creating function */
|
||||
box1 = xpm_label_box(window, "info.xpm", "cool button");
|
||||
|
||||
/* pack and show all our widgets */
|
||||
gtk_widget_show(box1);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), box1);
|
||||
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* rest in gtk_main and wait for the fun to begin! */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
92
examples/buttons/info.xpm
Normal file
92
examples/buttons/info.xpm
Normal file
@@ -0,0 +1,92 @@
|
||||
/* XPM */
|
||||
static char *openfile[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 20 19 66 2",
|
||||
/* colors */
|
||||
".. c None",
|
||||
".# c #000000",
|
||||
".a c #dfdfdf",
|
||||
".b c #7f7f7f",
|
||||
".c c #006f6f",
|
||||
".d c #00efef",
|
||||
".e c #009f9f",
|
||||
".f c #004040",
|
||||
".g c #00bfbf",
|
||||
".h c #ff0000",
|
||||
".i c #ffffff",
|
||||
".j c #7f0000",
|
||||
".k c #007070",
|
||||
".l c #00ffff",
|
||||
".m c #00a0a0",
|
||||
".n c #004f4f",
|
||||
".o c #00cfcf",
|
||||
".p c #8f8f8f",
|
||||
".q c #6f6f6f",
|
||||
".r c #a0a0a0",
|
||||
".s c #7f7f00",
|
||||
".t c #007f7f",
|
||||
".u c #5f5f5f",
|
||||
".v c #707070",
|
||||
".w c #00f0f0",
|
||||
".x c #009090",
|
||||
".y c #ffff00",
|
||||
".z c #0000ff",
|
||||
".A c #00afaf",
|
||||
".B c #00d0d0",
|
||||
".C c #00dfdf",
|
||||
".D c #005f5f",
|
||||
".E c #00b0b0",
|
||||
".F c #001010",
|
||||
".G c #00c0c0",
|
||||
".H c #000f0f",
|
||||
".I c #00007f",
|
||||
".J c #005050",
|
||||
".K c #002f2f",
|
||||
".L c #dfcfcf",
|
||||
".M c #dfd0d0",
|
||||
".N c #006060",
|
||||
".O c #00e0e0",
|
||||
".P c #00ff00",
|
||||
".Q c #002020",
|
||||
".R c #dfc0c0",
|
||||
".S c #008080",
|
||||
".T c #001f1f",
|
||||
".U c #003f3f",
|
||||
".V c #007f00",
|
||||
".W c #00000f",
|
||||
".X c #000010",
|
||||
".Y c #00001f",
|
||||
".Z c #000020",
|
||||
".0 c #00002f",
|
||||
".1 c #000030",
|
||||
".2 c #00003f",
|
||||
".3 c #000040",
|
||||
".4 c #00004f",
|
||||
".5 c #000050",
|
||||
".6 c #00005f",
|
||||
".7 c #000060",
|
||||
".8 c #00006f",
|
||||
".9 c #000070",
|
||||
"#. c #7f7f80",
|
||||
"## c #9f9f9f",
|
||||
/* pixels */
|
||||
"........................................",
|
||||
"........................................",
|
||||
"........................................",
|
||||
".......................#.#.#............",
|
||||
".....................#.......#...#......",
|
||||
"...............................#.#......",
|
||||
".......#.#.#.................#.#.#......",
|
||||
".....#.y.i.y.#.#.#.#.#.#.#..............",
|
||||
".....#.i.y.i.y.i.y.i.y.i.#..............",
|
||||
".....#.y.i.y.i.y.i.y.i.y.#..............",
|
||||
".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....",
|
||||
".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......",
|
||||
".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........",
|
||||
".....#.y.#.s.s.s.s.s.s.s.s.s.#..........",
|
||||
".....#.#.s.s.s.s.s.s.s.s.s.#............",
|
||||
".....#.#.#.#.#.#.#.#.#.#.#..............",
|
||||
"........................................",
|
||||
"........................................",
|
||||
"........................................"
|
||||
};
|
||||
8
examples/clist/Makefile
Normal file
8
examples/clist/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
clist: clist.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` clist.c -o clist
|
||||
|
||||
clean:
|
||||
rm -f *.o clist
|
||||
173
examples/clist/clist.c
Normal file
173
examples/clist/clist.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/* example-start clist clist.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
|
||||
/* These are just the prototypes of the various callbacks */
|
||||
void button_add_clicked( GtkWidget *button, gpointer data);
|
||||
void button_clear_clicked( GtkWidget *button, gpointer data);
|
||||
void button_hide_show_clicked( GtkWidget *button, gpointer data);
|
||||
void selection_made( GtkWidget *clist, gint row, gint column,
|
||||
GdkEventButton *event, gpointer data);
|
||||
|
||||
gint main (int argc, gchar *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *hbox;
|
||||
GtkWidget *clist;
|
||||
GtkWidget *button_add, *button_clear, *button_hide_show;
|
||||
gchar *titles[2] = {"Ingredients","Amount"};
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
|
||||
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize(GTK_WIDGET(window), 300, 150);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkCList Example");
|
||||
gtk_signal_connect(GTK_OBJECT(window),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
vbox=gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* Create the GtkCList. For this example we use 2 columns */
|
||||
clist = gtk_clist_new_with_titles( 2, titles);
|
||||
|
||||
/* When a selection is made, we want to know about it. The callback
|
||||
* used is selection_made, and it's code can be found further down */
|
||||
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
|
||||
GTK_SIGNAL_FUNC(selection_made),
|
||||
NULL);
|
||||
|
||||
/* It isn't necessary to shadow the border, but it looks nice :) */
|
||||
gtk_clist_set_border(GTK_CLIST(clist), GTK_SHADOW_OUT);
|
||||
|
||||
/* What however is important, is that we set the column widths as
|
||||
* they will never be right otherwise. Note that the columns are
|
||||
* numbered from 0 and up (to 1 in this case).
|
||||
*/
|
||||
gtk_clist_set_column_width (GTK_CLIST(clist), 0, 150);
|
||||
|
||||
/* Scollbars _only when needed_ */
|
||||
gtk_clist_set_policy(GTK_CLIST(clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
/* Add the GtkCList widget to the vertical box and show it. */
|
||||
gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
|
||||
gtk_widget_show(clist);
|
||||
|
||||
/* Create the buttons and add them to the window. See the button
|
||||
* tutorial for more examples and comments on this.
|
||||
*/
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
|
||||
gtk_widget_show(hbox);
|
||||
|
||||
button_add = gtk_button_new_with_label("Add List");
|
||||
button_clear = gtk_button_new_with_label("Clear List");
|
||||
button_hide_show = gtk_button_new_with_label("Hide/Show titles");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button_add, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button_clear, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), button_hide_show, TRUE, TRUE, 0);
|
||||
|
||||
/* Connect our callbacks to the three buttons */
|
||||
gtk_signal_connect_object(GTK_OBJECT(button_add), "clicked",
|
||||
GTK_SIGNAL_FUNC(button_add_clicked),
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect_object(GTK_OBJECT(button_clear), "clicked",
|
||||
GTK_SIGNAL_FUNC(button_clear_clicked),
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect_object(GTK_OBJECT(button_hide_show), "clicked",
|
||||
GTK_SIGNAL_FUNC(button_hide_show_clicked),
|
||||
(gpointer) clist);
|
||||
|
||||
gtk_widget_show(button_add);
|
||||
gtk_widget_show(button_clear);
|
||||
gtk_widget_show(button_hide_show);
|
||||
|
||||
/* The interface is completely set up so we show the window and
|
||||
* enter the gtk_main loop.
|
||||
*/
|
||||
gtk_widget_show(window);
|
||||
gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* User clicked the "Add List" button. */
|
||||
void button_add_clicked( GtkWidget *button, gpointer data)
|
||||
{
|
||||
int indx;
|
||||
|
||||
/* Something silly to add to the list. 4 rows of 2 columns each */
|
||||
gchar *drink[4][2] = {{"Milk", "3 Oz"},
|
||||
{"Water", "6 l"},
|
||||
{"Carrots", "2"},
|
||||
{"Snakes", "55"}};
|
||||
|
||||
/* Here we do the actual adding of the text. It's done once for
|
||||
* each row.
|
||||
*/
|
||||
for( indx=0; indx < 4; indx++)
|
||||
gtk_clist_append( (GtkCList*) data, drink[indx]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* User clicked the "Clear List" button. */
|
||||
void button_clear_clicked( GtkWidget *button, gpointer data)
|
||||
{
|
||||
/* Clear the list using gtk_clist_clear. This is much faster than
|
||||
* calling gtk_clist_remove once for each row.
|
||||
*/
|
||||
gtk_clist_clear((GtkCList*) data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* The user clicked the "Hide/Show titles" button. */
|
||||
void button_hide_show_clicked( GtkWidget *button, gpointer data)
|
||||
{
|
||||
/* Just a flag to remember the status. 0 = currently visible */
|
||||
static short int flag = 0;
|
||||
|
||||
if (flag == 0)
|
||||
{
|
||||
/* Hide the titles and set the flag to 1 */
|
||||
gtk_clist_column_titles_hide((GtkCList*) data);
|
||||
flag++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Show the titles and reset flag to 0 */
|
||||
gtk_clist_column_titles_show((GtkCList*) data);
|
||||
flag--;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we come here, then the user has selected a row in the list. */
|
||||
void selection_made( GtkWidget *clist, gint row, gint column,
|
||||
GdkEventButton *event, gpointer data)
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
/* Get the text that is stored in the selected row and column
|
||||
* which was clicked in. We will receive it as a pointer in the
|
||||
* argument text.
|
||||
*/
|
||||
gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);
|
||||
|
||||
/* Just prints some information about the selected row */
|
||||
g_print("You selected row %d. More specifically you clicked in column %d, and the text in this cell is %s\n\n", row, column, text);
|
||||
|
||||
return;
|
||||
}
|
||||
/* example-end */
|
||||
8
examples/entry/Makefile
Normal file
8
examples/entry/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
entry: entry.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` entry.c -o entry
|
||||
|
||||
clean:
|
||||
rm -f *.o entry
|
||||
92
examples/entry/entry.c
Normal file
92
examples/entry/entry.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* entry.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void enter_callback(GtkWidget *widget, GtkWidget *entry)
|
||||
{
|
||||
gchar *entry_text;
|
||||
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
printf("Entry contents: %s\n", entry_text);
|
||||
}
|
||||
|
||||
void entry_toggle_editable (GtkWidget *checkbutton,
|
||||
GtkWidget *entry)
|
||||
{
|
||||
gtk_entry_set_editable(GTK_ENTRY(entry),
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
void entry_toggle_visibility (GtkWidget *checkbutton,
|
||||
GtkWidget *entry)
|
||||
{
|
||||
gtk_entry_set_visibility(GTK_ENTRY(entry),
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *hbox;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *button;
|
||||
GtkWidget *check;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title(GTK_WINDOW (window), "GTK Entry");
|
||||
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
|
||||
(GtkSignalFunc) gtk_exit, NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
entry = gtk_entry_new_with_max_length (50);
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "activate",
|
||||
GTK_SIGNAL_FUNC(enter_callback),
|
||||
entry);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
|
||||
gtk_entry_append_text (GTK_ENTRY (entry), " world");
|
||||
gtk_entry_select_region (GTK_ENTRY (entry),
|
||||
0, GTK_ENTRY(entry)->text_length);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
check = gtk_check_button_new_with_label("Editable");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT(check), "toggled",
|
||||
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
check = gtk_check_button_new_with_label("Visible");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT(check), "toggled",
|
||||
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
|
||||
gtk_widget_show (check);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_exit),
|
||||
GTK_OBJECT (window));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main();
|
||||
return(0);
|
||||
}
|
||||
8
examples/eventbox/Makefile
Normal file
8
examples/eventbox/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
eventbox: eventbox.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` eventbox.c -o eventbox
|
||||
|
||||
clean:
|
||||
rm -f *.o eventbox
|
||||
55
examples/eventbox/eventbox.c
Normal file
55
examples/eventbox/eventbox.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* eventbox.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *event_box;
|
||||
GtkWidget *label;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* Create an EventBox and add it to our toplevel window */
|
||||
|
||||
event_box = gtk_event_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER(window), event_box);
|
||||
gtk_widget_show (event_box);
|
||||
|
||||
/* Create a long label */
|
||||
|
||||
label = gtk_label_new ("Click here to quit, quit, quit, quit, quit");
|
||||
gtk_container_add (GTK_CONTAINER (event_box), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Clip it short. */
|
||||
gtk_widget_set_usize (label, 110, 20);
|
||||
|
||||
/* And bind an action to it */
|
||||
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
|
||||
gtk_signal_connect (GTK_OBJECT(event_box), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
/* Yet one more thing you need an X window for ... */
|
||||
|
||||
gtk_widget_realize (event_box);
|
||||
gdk_window_set_cursor (event_box->window, gdk_cursor_new (GDK_HAND1));
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
57
examples/extract.awk
Normal file
57
examples/extract.awk
Normal file
@@ -0,0 +1,57 @@
|
||||
# extract - extract C source files from GTK Tutorial
|
||||
# Copyright (C) Tony Gale 1998
|
||||
# Contact: gale@gtk.org
|
||||
#
|
||||
# Command Switches:
|
||||
# -c : Just do checking rather than output files
|
||||
# -f <filename> : Extract a specific file
|
||||
# -d : Extract files to current directory
|
||||
|
||||
BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0
|
||||
for (i=0 ; i < ARGC ; i++) {
|
||||
if ( ARGV[i] == "-c" ) {
|
||||
check = 1;
|
||||
ARGV[i]="";
|
||||
} else if ( ARGV[i] == "-f" ) {
|
||||
spec_example=ARGV[i+1];
|
||||
ARGV[i]="";
|
||||
ARGV[i+1]="";
|
||||
if ( length(spec_example) == 0 ) {
|
||||
print "usage: -f <filename>";
|
||||
exit;
|
||||
}
|
||||
} else if ( ARGV[i] == "-d" ) {
|
||||
flatten = 1;
|
||||
ARGV[i]="";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$2 == "example-start" && in_example == 1 { printf("\nERROR: nested example at line %d\n", NR) > "/dev/stderr";
|
||||
exit}
|
||||
|
||||
$2 == "example-start" { in_example=1 }
|
||||
|
||||
$2 == "example-start" && check == 0 \
|
||||
{ if ( (spec_example == "") || (spec_example == $4) ) {
|
||||
if ( flatten == 0 ) {
|
||||
file_name = sprintf("%s/%s",$3, $4);
|
||||
command = sprintf("mkdir -p %s", $3);
|
||||
system(command);
|
||||
} else {
|
||||
file_name = $4;
|
||||
}
|
||||
do_output=1;
|
||||
}
|
||||
}
|
||||
|
||||
in_example==1 && check==0 && do_output==1 { gsub(/&/, "\\&", $0);
|
||||
print $0 >file_name }
|
||||
|
||||
$2 == "example-end" && in_example == 0 { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr";
|
||||
exit}
|
||||
$2 == "example-end" { in_example=0; do_output=0 }
|
||||
|
||||
|
||||
END {}
|
||||
|
||||
2
examples/extract.sh
Executable file
2
examples/extract.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#! /bin/sh
|
||||
awk -f extract.awk ../docs/gtk_tut.sgml $1 $2 $3 $4 $5
|
||||
8
examples/filesel/Makefile
Normal file
8
examples/filesel/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
filesel: filesel.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` filesel.c -o filesel
|
||||
|
||||
clean:
|
||||
rm -f *.o filesel
|
||||
46
examples/filesel/filesel.c
Normal file
46
examples/filesel/filesel.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* filesel.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Get the selected filename and print it to the console */
|
||||
void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
||||
{
|
||||
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||
}
|
||||
|
||||
void destroy (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *filew;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* Create a new file selection widget */
|
||||
filew = gtk_file_selection_new ("File selection");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (filew), "destroy",
|
||||
(GtkSignalFunc) destroy, &filew);
|
||||
/* Connect the ok_button to file_ok_sel function */
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
|
||||
"clicked", (GtkSignalFunc) file_ok_sel, filew );
|
||||
|
||||
/* Connect the cancel_button to destroy the widget */
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
|
||||
"clicked", (GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (filew));
|
||||
|
||||
/* Lets set the filename, as if this were a save dialog, and we are giving
|
||||
a default filename */
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew),
|
||||
"penguin.png");
|
||||
|
||||
gtk_widget_show(filew);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
4
examples/find-examples.sh
Executable file
4
examples/find-examples.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
find . -name CVS -prune -o \
|
||||
-not \( -type d -o -name Makefile.am -o -name find-examples.sh \) -print |
|
||||
sed 's%\./\(.*\)% examples/\1 \\%'
|
||||
echo " examples/find-examples.sh"
|
||||
14
examples/gtkdial/Makefile
Normal file
14
examples/gtkdial/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
dial_test: gtkdial.o dial_test.o
|
||||
$(CC) `gtk-config --libs` dial_test.o gtkdial.o -o dial_test
|
||||
|
||||
dial_test.o: dial_test.c gtkdial.h
|
||||
$(CC) `gtk-config --cflags` -c dial_test.c -o dial_test.o
|
||||
|
||||
gtkdial.o: gtkdial.c gtkdial.h
|
||||
$(CC) `gtk-config --cflags` -c gtkdial.c -o gtkdial.o
|
||||
|
||||
clean:
|
||||
rm -f *.o dial_test
|
||||
64
examples/gtkdial/dial_test.c
Normal file
64
examples/gtkdial/dial_test.c
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkdial.h"
|
||||
|
||||
void
|
||||
value_changed (GtkAdjustment *adjustment, GtkWidget *label)
|
||||
{
|
||||
char buffer[16];
|
||||
|
||||
sprintf(buffer,"%4.2f",adjustment->value);
|
||||
gtk_label_set (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkWidget *dial;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dial");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX(vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, -1.0, 1.0, 0.01, 0.1, 0));
|
||||
|
||||
dial = gtk_dial_new(adjustment);
|
||||
gtk_dial_set_update_policy (GTK_DIAL(dial), GTK_UPDATE_DELAYED);
|
||||
/* gtk_widget_set_usize (dial, 100, 100); */
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), dial);
|
||||
gtk_widget_show (dial);
|
||||
|
||||
label = gtk_label_new("0.00");
|
||||
gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (value_changed), label);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
591
examples/gtkdial/gtkdial.c
Normal file
591
examples/gtkdial/gtkdial.c
Normal file
@@ -0,0 +1,591 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
||||
#include "gtkdial.h"
|
||||
|
||||
#define SCROLL_DELAY_LENGTH 300
|
||||
#define DIAL_DEFAULT_SIZE 100
|
||||
|
||||
/* Forward declararations */
|
||||
|
||||
static void gtk_dial_class_init (GtkDialClass *klass);
|
||||
static void gtk_dial_init (GtkDial *dial);
|
||||
static void gtk_dial_destroy (GtkObject *object);
|
||||
static void gtk_dial_realize (GtkWidget *widget);
|
||||
static void gtk_dial_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_dial_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gint gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gint gtk_dial_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gint gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
static gint gtk_dial_timer (GtkDial *dial);
|
||||
|
||||
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
|
||||
static void gtk_dial_update (GtkDial *dial);
|
||||
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
|
||||
/* Local data */
|
||||
|
||||
static GtkWidgetClass *parent_class = NULL;
|
||||
|
||||
guint
|
||||
gtk_dial_get_type ()
|
||||
{
|
||||
static guint dial_type = 0;
|
||||
|
||||
if (!dial_type)
|
||||
{
|
||||
GtkTypeInfo dial_info =
|
||||
{
|
||||
"GtkDial",
|
||||
sizeof (GtkDial),
|
||||
sizeof (GtkDialClass),
|
||||
(GtkClassInitFunc) gtk_dial_class_init,
|
||||
(GtkObjectInitFunc) gtk_dial_init,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
dial_type = gtk_type_unique (gtk_widget_get_type (), &dial_info);
|
||||
}
|
||||
|
||||
return dial_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_class_init (GtkDialClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_widget_get_type ());
|
||||
|
||||
object_class->destroy = gtk_dial_destroy;
|
||||
|
||||
widget_class->realize = gtk_dial_realize;
|
||||
widget_class->expose_event = gtk_dial_expose;
|
||||
widget_class->size_request = gtk_dial_size_request;
|
||||
widget_class->size_allocate = gtk_dial_size_allocate;
|
||||
widget_class->button_press_event = gtk_dial_button_press;
|
||||
widget_class->button_release_event = gtk_dial_button_release;
|
||||
widget_class->motion_notify_event = gtk_dial_motion_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_init (GtkDial *dial)
|
||||
{
|
||||
dial->button = 0;
|
||||
dial->policy = GTK_UPDATE_CONTINUOUS;
|
||||
dial->timer = 0;
|
||||
dial->radius = 0;
|
||||
dial->pointer_width = 0;
|
||||
dial->angle = 0.0;
|
||||
dial->old_value = 0.0;
|
||||
dial->old_lower = 0.0;
|
||||
dial->old_upper = 0.0;
|
||||
dial->adjustment = NULL;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_dial_new (GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
dial = gtk_type_new (gtk_dial_get_type ());
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
gtk_dial_set_adjustment (dial, adjustment);
|
||||
|
||||
return GTK_WIDGET (dial);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_destroy (GtkObject *object)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (object));
|
||||
|
||||
dial = GTK_DIAL (object);
|
||||
|
||||
if (dial->adjustment)
|
||||
gtk_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
GtkAdjustment*
|
||||
gtk_dial_get_adjustment (GtkDial *dial)
|
||||
{
|
||||
g_return_val_if_fail (dial != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), NULL);
|
||||
|
||||
return dial->adjustment;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_dial_set_update_policy (GtkDial *dial,
|
||||
GtkUpdateType policy)
|
||||
{
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
dial->policy = policy;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_dial_set_adjustment (GtkDial *dial,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
if (dial->adjustment)
|
||||
{
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (dial->adjustment), (gpointer) dial);
|
||||
gtk_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
}
|
||||
|
||||
dial->adjustment = adjustment;
|
||||
gtk_object_ref (GTK_OBJECT (dial->adjustment));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
|
||||
(GtkSignalFunc) gtk_dial_adjustment_changed,
|
||||
(gpointer) dial);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) gtk_dial_adjustment_value_changed,
|
||||
(gpointer) dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
dial->old_lower = adjustment->lower;
|
||||
dial->old_upper = adjustment->upper;
|
||||
|
||||
gtk_dial_update (dial);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (widget));
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
attributes.x = widget->allocation.x;
|
||||
attributes.y = widget->allocation.y;
|
||||
attributes.width = widget->allocation.width;
|
||||
attributes.height = widget->allocation.height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.event_mask = gtk_widget_get_events (widget) |
|
||||
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gdk_window_set_user_data (widget->window, widget);
|
||||
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
requisition->width = DIAL_DEFAULT_SIZE;
|
||||
requisition->height = DIAL_DEFAULT_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (widget));
|
||||
g_return_if_fail (allocation != NULL);
|
||||
|
||||
widget->allocation = *allocation;
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
|
||||
}
|
||||
dial->radius = MIN(allocation->width,allocation->height) * 0.45;
|
||||
dial->pointer_width = dial->radius / 5;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkPoint points[3];
|
||||
gdouble s,c;
|
||||
gdouble theta;
|
||||
gint xc, yc;
|
||||
gint tick_length;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (event->count > 0)
|
||||
return FALSE;
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
gdk_window_clear_area (widget->window,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
xc = widget->allocation.width/2;
|
||||
yc = widget->allocation.height/2;
|
||||
|
||||
/* Draw ticks */
|
||||
|
||||
for (i=0; i<25; i++)
|
||||
{
|
||||
theta = (i*M_PI/18. - M_PI/6.);
|
||||
s = sin(theta);
|
||||
c = cos(theta);
|
||||
|
||||
tick_length = (i%6 == 0) ? dial->pointer_width : dial->pointer_width/2;
|
||||
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->fg_gc[widget->state],
|
||||
xc + c*(dial->radius - tick_length),
|
||||
yc - s*(dial->radius - tick_length),
|
||||
xc + c*dial->radius,
|
||||
yc - s*dial->radius);
|
||||
}
|
||||
|
||||
/* Draw pointer */
|
||||
|
||||
s = sin(dial->angle);
|
||||
c = cos(dial->angle);
|
||||
|
||||
|
||||
points[0].x = xc + s*dial->pointer_width/2;
|
||||
points[0].y = yc + c*dial->pointer_width/2;
|
||||
points[1].x = xc + c*dial->radius;
|
||||
points[1].y = yc - s*dial->radius;
|
||||
points[2].x = xc - s*dial->pointer_width/2;
|
||||
points[2].y = yc - c*dial->pointer_width/2;
|
||||
|
||||
gtk_draw_polygon (widget->style,
|
||||
widget->window,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_OUT,
|
||||
points, 3,
|
||||
TRUE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
gint dx, dy;
|
||||
double s, c;
|
||||
double d_parallel;
|
||||
double d_perpendicular;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
/* Determine if button press was within pointer region - we
|
||||
do this by computing the parallel and perpendicular distance of
|
||||
the point where the mouse was pressed from the line passing through
|
||||
the pointer */
|
||||
|
||||
dx = event->x - widget->allocation.width / 2;
|
||||
dy = widget->allocation.height / 2 - event->y;
|
||||
|
||||
s = sin(dial->angle);
|
||||
c = cos(dial->angle);
|
||||
|
||||
d_parallel = s*dy + c*dx;
|
||||
d_perpendicular = fabs(s*dx - c*dy);
|
||||
|
||||
if (!dial->button &&
|
||||
(d_perpendicular < dial->pointer_width/2) &&
|
||||
(d_parallel > - dial->pointer_width))
|
||||
{
|
||||
gtk_grab_add (widget);
|
||||
|
||||
dial->button = event->button;
|
||||
|
||||
gtk_dial_update_mouse (dial, event->x, event->y);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
if (dial->button == event->button)
|
||||
{
|
||||
gtk_grab_remove (widget);
|
||||
|
||||
dial->button = 0;
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
gtk_timeout_remove (dial->timer);
|
||||
|
||||
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
|
||||
(dial->old_value != dial->adjustment->value))
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkModifierType mods;
|
||||
gint x, y, mask;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
if (dial->button != 0)
|
||||
{
|
||||
x = event->x;
|
||||
y = event->y;
|
||||
|
||||
if (event->is_hint || (event->window != widget->window))
|
||||
gdk_window_get_pointer (widget->window, &x, &y, &mods);
|
||||
|
||||
switch (dial->button)
|
||||
{
|
||||
case 1:
|
||||
mask = GDK_BUTTON1_MASK;
|
||||
break;
|
||||
case 2:
|
||||
mask = GDK_BUTTON2_MASK;
|
||||
break;
|
||||
case 3:
|
||||
mask = GDK_BUTTON3_MASK;
|
||||
break;
|
||||
default:
|
||||
mask = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mods & mask)
|
||||
gtk_dial_update_mouse (dial, x,y);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_dial_timer (GtkDial *dial)
|
||||
{
|
||||
g_return_val_if_fail (dial != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
{
|
||||
gint xc, yc;
|
||||
gfloat old_value;
|
||||
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
xc = GTK_WIDGET(dial)->allocation.width / 2;
|
||||
yc = GTK_WIDGET(dial)->allocation.height / 2;
|
||||
|
||||
old_value = dial->adjustment->value;
|
||||
dial->angle = atan2(yc-y, x-xc);
|
||||
|
||||
if (dial->angle < -M_PI/2.)
|
||||
dial->angle += 2*M_PI;
|
||||
|
||||
if (dial->angle < -M_PI/6)
|
||||
dial->angle = -M_PI/6;
|
||||
|
||||
if (dial->angle > 7.*M_PI/6.)
|
||||
dial->angle = 7.*M_PI/6.;
|
||||
|
||||
dial->adjustment->value = dial->adjustment->lower + (7.*M_PI/6 - dial->angle) *
|
||||
(dial->adjustment->upper - dial->adjustment->lower) / (4.*M_PI/3.);
|
||||
|
||||
if (dial->adjustment->value != old_value)
|
||||
{
|
||||
if (dial->policy == GTK_UPDATE_CONTINUOUS)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_draw (GTK_WIDGET(dial), NULL);
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
{
|
||||
if (dial->timer)
|
||||
gtk_timeout_remove (dial->timer);
|
||||
|
||||
dial->timer = gtk_timeout_add (SCROLL_DELAY_LENGTH,
|
||||
(GtkFunction) gtk_dial_timer,
|
||||
(gpointer) dial);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_update (GtkDial *dial)
|
||||
{
|
||||
gfloat new_value;
|
||||
|
||||
g_return_if_fail (dial != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (dial));
|
||||
|
||||
new_value = dial->adjustment->value;
|
||||
|
||||
if (new_value < dial->adjustment->lower)
|
||||
new_value = dial->adjustment->lower;
|
||||
|
||||
if (new_value > dial->adjustment->upper)
|
||||
new_value = dial->adjustment->upper;
|
||||
|
||||
if (new_value != dial->adjustment->value)
|
||||
{
|
||||
dial->adjustment->value = new_value;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
|
||||
(dial->adjustment->upper - dial->adjustment->lower);
|
||||
|
||||
gtk_widget_draw (GTK_WIDGET(dial), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (adjustment != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
dial = GTK_DIAL (data);
|
||||
|
||||
if ((dial->old_value != adjustment->value) ||
|
||||
(dial->old_lower != adjustment->lower) ||
|
||||
(dial->old_upper != adjustment->upper))
|
||||
{
|
||||
gtk_dial_update (dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
dial->old_lower = adjustment->lower;
|
||||
dial->old_upper = adjustment->upper;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (adjustment != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
dial = GTK_DIAL (data);
|
||||
|
||||
if (dial->old_value != adjustment->value)
|
||||
{
|
||||
gtk_dial_update (dial);
|
||||
|
||||
dial->old_value = adjustment->value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
89
examples/gtkdial/gtkdial.h
Normal file
89
examples/gtkdial/gtkdial.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GTK_DIAL_H__
|
||||
#define __GTK_DIAL_H__
|
||||
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkadjustment.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GTK_DIAL(obj) GTK_CHECK_CAST (obj, gtk_dial_get_type (), GtkDial)
|
||||
#define GTK_DIAL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_dial_get_type (), GtkDialClass)
|
||||
#define GTK_IS_DIAL(obj) GTK_CHECK_TYPE (obj, gtk_dial_get_type ())
|
||||
|
||||
|
||||
typedef struct _GtkDial GtkDial;
|
||||
typedef struct _GtkDialClass GtkDialClass;
|
||||
|
||||
struct _GtkDial
|
||||
{
|
||||
GtkWidget widget;
|
||||
|
||||
/* update policy (GTK_UPDATE_[CONTINUOUS/DELAYED/DISCONTINUOUS]) */
|
||||
guint policy : 2;
|
||||
|
||||
/* Button currently pressed or 0 if none */
|
||||
guint8 button;
|
||||
|
||||
/* Dimensions of dial components */
|
||||
gint radius;
|
||||
gint pointer_width;
|
||||
|
||||
/* ID of update timer, or 0 if none */
|
||||
guint32 timer;
|
||||
|
||||
/* Current angle */
|
||||
gfloat angle;
|
||||
|
||||
/* Old values from adjustment stored so we know when something changes */
|
||||
gfloat old_value;
|
||||
gfloat old_lower;
|
||||
gfloat old_upper;
|
||||
|
||||
/* The adjustment object that stores the data for this dial */
|
||||
GtkAdjustment *adjustment;
|
||||
};
|
||||
|
||||
struct _GtkDialClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkWidget* gtk_dial_new (GtkAdjustment *adjustment);
|
||||
guint gtk_dial_get_type (void);
|
||||
GtkAdjustment* gtk_dial_get_adjustment (GtkDial *dial);
|
||||
void gtk_dial_set_update_policy (GtkDial *dial,
|
||||
GtkUpdateType policy);
|
||||
|
||||
void gtk_dial_set_adjustment (GtkDial *dial,
|
||||
GtkAdjustment *adjustment);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GTK_DIAL_H__ */
|
||||
8
examples/helloworld/Makefile
Normal file
8
examples/helloworld/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
helloworld: helloworld.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` helloworld.c -o helloworld
|
||||
|
||||
clean:
|
||||
rm -f helloworld
|
||||
97
examples/helloworld/helloworld.c
Normal file
97
examples/helloworld/helloworld.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* helloworld.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* this is a callback function. the data arguments are ignored in this example.
|
||||
* More on callbacks below. */
|
||||
void hello (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ("Hello World\n");
|
||||
}
|
||||
|
||||
|
||||
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
{
|
||||
g_print ("delete event occured\n");
|
||||
/* if you return FALSE in the "delete_event" signal handler,
|
||||
* GTK will emit the "destroy" signal. Returning TRUE means
|
||||
* you don't want the window to be destroyed.
|
||||
* This is useful for popping up 'are you sure you want to quit ?'
|
||||
* type dialogs. */
|
||||
|
||||
/* Change TRUE to FALSE and the main window will be destroyed with
|
||||
* a "delete_event". */
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/* another callback */
|
||||
void destroy (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
|
||||
/* this is called in all GTK applications. arguments are parsed from
|
||||
* the command line and are returned to the application. */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* when the window is given the "delete_event" signal (this is given
|
||||
* by the window manager (usually the 'close' option, or on the
|
||||
* titlebar), we ask it to call the delete_event () function
|
||||
* as defined above. The data passed to the callback
|
||||
* function is NULL and is ignored in the callback. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
|
||||
/* here we connect the "destroy" event to a signal handler.
|
||||
* This event occurs when we call gtk_widget_destroy() on the window,
|
||||
* or if we return 'FALSE' in the "delete_event" callback. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
/* sets the border width of the window. */
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* creates a new button with the label "Hello World". */
|
||||
button = gtk_button_new_with_label ("Hello World");
|
||||
|
||||
/* When the button receives the "clicked" signal, it will call the
|
||||
* function hello() passing it NULL as it's argument. The hello()
|
||||
* function is defined above. */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (hello), NULL);
|
||||
|
||||
/* This will cause the window to be destroyed by calling
|
||||
* gtk_widget_destroy(window) when "clicked". Again, the destroy
|
||||
* signal could come from here, or the window manager. */
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
|
||||
/* this packs the button into the window (a gtk container). */
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
/* the final step is to display this newly created widget... */
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* and the window */
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* all GTK applications must have a gtk_main(). Control ends here
|
||||
* and waits for an event to occur (like a key press or mouse event). */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
8
examples/helloworld2/Makefile
Normal file
8
examples/helloworld2/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
helloworld2: helloworld2.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` helloworld2.c -o helloworld2
|
||||
|
||||
clean:
|
||||
rm -f helloworld2
|
||||
94
examples/helloworld2/helloworld2.c
Normal file
94
examples/helloworld2/helloworld2.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* helloworld2.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Our new improved callback. The data passed to this function is printed
|
||||
* to stdout. */
|
||||
void callback (GtkWidget *widget, gpointer *data)
|
||||
{
|
||||
g_print ("Hello again - %s was pressed\n", (char *) data);
|
||||
}
|
||||
|
||||
/* another callback */
|
||||
void delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box1;
|
||||
|
||||
/* this is called in all GTK applications. arguments are parsed from
|
||||
* the command line and are returned to the application. */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* this is a new call, this just sets the title of our
|
||||
* new window to "Hello Buttons!" */
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!");
|
||||
|
||||
/* Here we just set a handler for delete_event that immediately
|
||||
* exits GTK. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
|
||||
|
||||
/* sets the border width of the window. */
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* we create a box to pack widgets into. this is described in detail
|
||||
* in the "packing" section below. The box is not really visible, it
|
||||
* is just used as a tool to arrange widgets. */
|
||||
box1 = gtk_hbox_new(FALSE, 0);
|
||||
|
||||
/* put the box into the main window. */
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
|
||||
/* creates a new button with the label "Button 1". */
|
||||
button = gtk_button_new_with_label ("Button 1");
|
||||
|
||||
/* Now when the button is clicked, we call the "callback" function
|
||||
* with a pointer to "button 1" as it's argument */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
|
||||
|
||||
/* instead of gtk_container_add, we pack this button into the invisible
|
||||
* box, which has been packed into the window. */
|
||||
gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
|
||||
|
||||
/* always remember this step, this tells GTK that our preparation for
|
||||
* this button is complete, and it can be displayed now. */
|
||||
gtk_widget_show(button);
|
||||
|
||||
/* do these same steps again to create a second button */
|
||||
button = gtk_button_new_with_label ("Button 2");
|
||||
|
||||
/* call the same callback function with a different argument,
|
||||
* passing a pointer to "button 2" instead. */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
|
||||
|
||||
/* The order in which we show the buttons is not really important, but I
|
||||
* recommend showing the window last, so it all pops up at once. */
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_widget_show(box1);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* rest in gtk_main and wait for the fun to begin! */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
8
examples/list/Makefile
Normal file
8
examples/list/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
list: list.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` list.c -o list
|
||||
|
||||
clean:
|
||||
rm -f *.o list
|
||||
284
examples/list/list.c
Normal file
284
examples/list/list.c
Normal file
@@ -0,0 +1,284 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* list.c */
|
||||
|
||||
/* include the gtk+ header files
|
||||
* include stdio.h, we need that for the printf() function
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* this is our data identification string to store
|
||||
* data in list items
|
||||
*/
|
||||
const gchar *list_item_data_key="list_item_data";
|
||||
|
||||
|
||||
/* prototypes for signal handler that we are going to connect
|
||||
* to the GtkList widget
|
||||
*/
|
||||
static void sigh_print_selection (GtkWidget *gtklist,
|
||||
gpointer func_data);
|
||||
static void sigh_button_event (GtkWidget *gtklist,
|
||||
GdkEventButton *event,
|
||||
GtkWidget *frame);
|
||||
|
||||
|
||||
/* main function to set up the user interface */
|
||||
|
||||
gint main (int argc, gchar *argv[])
|
||||
{
|
||||
GtkWidget *separator;
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *gtklist;
|
||||
GtkWidget *button;
|
||||
GtkWidget *list_item;
|
||||
GList *dlist;
|
||||
guint i;
|
||||
gchar buffer[64];
|
||||
|
||||
|
||||
/* initialize gtk+ (and subsequently gdk) */
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
|
||||
/* create a window to put all the widgets in
|
||||
* connect gtk_main_quit() to the "destroy" event of
|
||||
* the window to handle window manager close-window-events
|
||||
*/
|
||||
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkList Example");
|
||||
gtk_signal_connect(GTK_OBJECT(window),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
|
||||
/* inside the window we need a box to arrange the widgets
|
||||
* vertically */
|
||||
vbox=gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* this is the scolled window to put the GtkList widget inside */
|
||||
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_widget_set_usize(scrolled_window, 250, 150);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
|
||||
gtk_widget_show(scrolled_window);
|
||||
|
||||
/* create the GtkList widget
|
||||
* connect the sigh_print_selection() signal handler
|
||||
* function to the "selection_changed" signal of the GtkList
|
||||
* to print out the selected items each time the selection
|
||||
* has changed */
|
||||
gtklist=gtk_list_new();
|
||||
gtk_container_add(GTK_CONTAINER(scrolled_window), gtklist);
|
||||
gtk_widget_show(gtklist);
|
||||
gtk_signal_connect(GTK_OBJECT(gtklist),
|
||||
"selection_changed",
|
||||
GTK_SIGNAL_FUNC(sigh_print_selection),
|
||||
NULL);
|
||||
|
||||
/* we create a "Prison" to put a list item in ;)
|
||||
*/
|
||||
frame=gtk_frame_new("Prison");
|
||||
gtk_widget_set_usize(frame, 200, 50);
|
||||
gtk_container_border_width(GTK_CONTAINER(frame), 5);
|
||||
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), frame);
|
||||
gtk_widget_show(frame);
|
||||
|
||||
/* connect the sigh_button_event() signal handler to the GtkList
|
||||
* wich will handle the "arresting" of list items
|
||||
*/
|
||||
gtk_signal_connect(GTK_OBJECT(gtklist),
|
||||
"button_release_event",
|
||||
GTK_SIGNAL_FUNC(sigh_button_event),
|
||||
frame);
|
||||
|
||||
/* create a separator
|
||||
*/
|
||||
separator=gtk_hseparator_new();
|
||||
gtk_container_add(GTK_CONTAINER(vbox), separator);
|
||||
gtk_widget_show(separator);
|
||||
|
||||
/* finaly create a button and connect it´s "clicked" signal
|
||||
* to the destroyment of the window
|
||||
*/
|
||||
button=gtk_button_new_with_label("Close");
|
||||
gtk_container_add(GTK_CONTAINER(vbox), button);
|
||||
gtk_widget_show(button);
|
||||
gtk_signal_connect_object(GTK_OBJECT(button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroy),
|
||||
GTK_OBJECT(window));
|
||||
|
||||
|
||||
/* now we create 5 list items, each having it´s own
|
||||
* label and add them to the GtkList using gtk_container_add()
|
||||
* also we query the text string from the label and
|
||||
* associate it with the list_item_data_key for each list item
|
||||
*/
|
||||
for (i=0; i<5; i++) {
|
||||
GtkWidget *label;
|
||||
gchar *string;
|
||||
|
||||
sprintf(buffer, "ListItemContainer with Label #%d", i);
|
||||
label=gtk_label_new(buffer);
|
||||
list_item=gtk_list_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(list_item), label);
|
||||
gtk_widget_show(label);
|
||||
gtk_container_add(GTK_CONTAINER(gtklist), list_item);
|
||||
gtk_widget_show(list_item);
|
||||
gtk_label_get(GTK_LABEL(label), &string);
|
||||
gtk_object_set_data(GTK_OBJECT(list_item),
|
||||
list_item_data_key,
|
||||
string);
|
||||
}
|
||||
/* here, we are creating another 5 labels, this time
|
||||
* we use gtk_list_item_new_with_label() for the creation
|
||||
* we can´t query the text string from the label because
|
||||
* we don´t have the labels pointer and therefore
|
||||
* we just associate the list_item_data_key of each
|
||||
* list item with the same text string
|
||||
* for adding of the list items we put them all into a doubly
|
||||
* linked list (GList), and then add them by a single call to
|
||||
* gtk_list_append_items()
|
||||
* because we use g_list_prepend() to put the items into the
|
||||
* doubly linked list, their order will be descending (instead
|
||||
* of ascending when using g_list_append())
|
||||
*/
|
||||
dlist=NULL;
|
||||
for (; i<10; i++) {
|
||||
sprintf(buffer, "List Item with Label %d", i);
|
||||
list_item=gtk_list_item_new_with_label(buffer);
|
||||
dlist=g_list_prepend(dlist, list_item);
|
||||
gtk_widget_show(list_item);
|
||||
gtk_object_set_data(GTK_OBJECT(list_item),
|
||||
list_item_data_key,
|
||||
"ListItem with integrated Label");
|
||||
}
|
||||
gtk_list_append_items(GTK_LIST(gtklist), dlist);
|
||||
|
||||
/* finaly we want to see the window, don´t we? ;)
|
||||
*/
|
||||
gtk_widget_show(window);
|
||||
|
||||
/* fire up the main event loop of gtk
|
||||
*/
|
||||
gtk_main();
|
||||
|
||||
/* we get here after gtk_main_quit() has been called which
|
||||
* happens if the main window gets destroyed
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* this is the signal handler that got connected to button
|
||||
* press/release events of the GtkList
|
||||
*/
|
||||
void
|
||||
sigh_button_event (GtkWidget *gtklist,
|
||||
GdkEventButton *event,
|
||||
GtkWidget *frame)
|
||||
{
|
||||
/* we only do something if the third (rightmost mouse button
|
||||
* was released
|
||||
*/
|
||||
if (event->type==GDK_BUTTON_RELEASE &&
|
||||
event->button==3) {
|
||||
GList *dlist, *free_list;
|
||||
GtkWidget *new_prisoner;
|
||||
|
||||
/* fetch the currently selected list item which
|
||||
* will be our next prisoner ;)
|
||||
*/
|
||||
dlist=GTK_LIST(gtklist)->selection;
|
||||
if (dlist)
|
||||
new_prisoner=GTK_WIDGET(dlist->data);
|
||||
else
|
||||
new_prisoner=NULL;
|
||||
|
||||
/* look for already prisoned list items, we
|
||||
* will put them back into the list
|
||||
* remember to free the doubly linked list that
|
||||
* gtk_container_children() returns
|
||||
*/
|
||||
dlist=gtk_container_children(GTK_CONTAINER(frame));
|
||||
free_list=dlist;
|
||||
while (dlist) {
|
||||
GtkWidget *list_item;
|
||||
|
||||
list_item=dlist->data;
|
||||
|
||||
gtk_widget_reparent(list_item, gtklist);
|
||||
|
||||
dlist=dlist->next;
|
||||
}
|
||||
g_list_free(free_list);
|
||||
|
||||
/* if we have a new prisoner, remove him from the
|
||||
* GtkList and put him into the frame "Prison"
|
||||
* we need to unselect the item before
|
||||
*/
|
||||
if (new_prisoner) {
|
||||
GList static_dlist;
|
||||
|
||||
static_dlist.data=new_prisoner;
|
||||
static_dlist.next=NULL;
|
||||
static_dlist.prev=NULL;
|
||||
|
||||
gtk_list_unselect_child(GTK_LIST(gtklist),
|
||||
new_prisoner);
|
||||
gtk_widget_reparent(new_prisoner, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* this is the signal handler that gets called if GtkList
|
||||
* emits the "selection_changed" signal
|
||||
*/
|
||||
void
|
||||
sigh_print_selection (GtkWidget *gtklist,
|
||||
gpointer func_data)
|
||||
{
|
||||
GList *dlist;
|
||||
|
||||
/* fetch the doubly linked list of selected items
|
||||
* of the GtkList, remember to treat this as read-only!
|
||||
*/
|
||||
dlist=GTK_LIST(gtklist)->selection;
|
||||
|
||||
/* if there are no selected items there is nothing more
|
||||
* to do than just telling the user so
|
||||
*/
|
||||
if (!dlist) {
|
||||
g_print("Selection cleared\n");
|
||||
return;
|
||||
}
|
||||
/* ok, we got a selection and so we print it
|
||||
*/
|
||||
g_print("The selection is a ");
|
||||
|
||||
/* get the list item from the doubly linked list
|
||||
* and then query the data associated with list_item_data_key
|
||||
* we then just print it
|
||||
*/
|
||||
while (dlist) {
|
||||
GtkObject *list_item;
|
||||
gchar *item_data_string;
|
||||
|
||||
list_item=GTK_OBJECT(dlist->data);
|
||||
item_data_string=gtk_object_get_data(list_item,
|
||||
list_item_data_key);
|
||||
g_print("%s ", item_data_string);
|
||||
|
||||
dlist=dlist->next;
|
||||
}
|
||||
g_print("\n");
|
||||
}
|
||||
19
examples/menu/Makefile
Normal file
19
examples/menu/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
all: menu menufactory
|
||||
|
||||
menu: menu.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` menu.c -o menu
|
||||
|
||||
menufactory: menufactory.o mfmain.o
|
||||
$(CC) `gtk-config --libs` menufactory.o mfmain.o -o menufactory
|
||||
|
||||
menufactory.o: menufactory.c mfmain.h
|
||||
$(CC) `gtk-config --cflags` -c menufactory.c -o menufactory.o
|
||||
|
||||
mfmain.o: mfmain.c mfmain.h menufactory.h
|
||||
$(CC) `gtk-config --cflags` -c mfmain.c -o mfmain.o
|
||||
|
||||
clean:
|
||||
rm -f *.o menu menufactory
|
||||
134
examples/menu/menu.c
Normal file
134
examples/menu/menu.c
Normal file
@@ -0,0 +1,134 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* menu.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gint button_press (GtkWidget *, GdkEvent *);
|
||||
static void menuitem_response (gchar *);
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_bar;
|
||||
GtkWidget *root_menu;
|
||||
GtkWidget *menu_items;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
char buf[128];
|
||||
int i;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title(GTK_WINDOW (window), "GTK Menu Test");
|
||||
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
|
||||
(GtkSignalFunc) gtk_exit, NULL);
|
||||
|
||||
/* Init the menu-widget, and remember -- never
|
||||
* gtk_show_widget() the menu widget!!
|
||||
* This is the menu that holds the menu items, the one that
|
||||
* will pop up when you click on the "Root Menu" in the app */
|
||||
menu = gtk_menu_new();
|
||||
|
||||
/* Next we make a little loop that makes three menu-entries for "test-menu".
|
||||
* Notice the call to gtk_menu_append. Here we are adding a list of
|
||||
* menu items to our menu. Normally, we'd also catch the "clicked"
|
||||
* signal on each of the menu items and setup a callback for it,
|
||||
* but it's omitted here to save space. */
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
/* Copy the names to the buf. */
|
||||
sprintf(buf, "Test-undermenu - %d", i);
|
||||
|
||||
/* Create a new menu-item with a name... */
|
||||
menu_items = gtk_menu_item_new_with_label(buf);
|
||||
|
||||
/* ...and add it to the menu. */
|
||||
gtk_menu_append(GTK_MENU (menu), menu_items);
|
||||
|
||||
/* Do something interesting when the menuitem is selected */
|
||||
gtk_signal_connect_object(GTK_OBJECT(menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC(menuitem_response), (gpointer) g_strdup(buf));
|
||||
|
||||
/* Show the widget */
|
||||
gtk_widget_show(menu_items);
|
||||
}
|
||||
|
||||
/* This is the root menu, and will be the label
|
||||
* displayed on the menu bar. There won't be a signal handler attached,
|
||||
* as it only pops up the rest of the menu when pressed. */
|
||||
root_menu = gtk_menu_item_new_with_label("Root Menu");
|
||||
|
||||
gtk_widget_show(root_menu);
|
||||
|
||||
/* Now we specify that we want our newly created "menu" to be the menu
|
||||
* for the "root menu" */
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_menu), menu);
|
||||
|
||||
/* A vbox to put a menu and a button in: */
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* Create a menu-bar to hold the menus and add it to our main window */
|
||||
menu_bar = gtk_menu_bar_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 2);
|
||||
gtk_widget_show(menu_bar);
|
||||
|
||||
/* Create a button to which to attach menu as a popup */
|
||||
button = gtk_button_new_with_label("press me");
|
||||
gtk_signal_connect_object(GTK_OBJECT(button), "event",
|
||||
GTK_SIGNAL_FUNC (button_press), GTK_OBJECT(menu));
|
||||
gtk_box_pack_end(GTK_BOX(vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
/* And finally we append the menu-item to the menu-bar -- this is the
|
||||
* "root" menu-item I have been raving about =) */
|
||||
gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_menu);
|
||||
|
||||
/* always display the window as the last step so it all splashes on
|
||||
* the screen at once. */
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Respond to a button-press by posting a menu passed in as widget.
|
||||
*
|
||||
* Note that the "widget" argument is the menu being posted, NOT
|
||||
* the button that was pressed.
|
||||
*/
|
||||
|
||||
static gint button_press (GtkWidget *widget, GdkEvent *event)
|
||||
{
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS) {
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
gtk_menu_popup (GTK_MENU(widget), NULL, NULL, NULL, NULL,
|
||||
bevent->button, bevent->time);
|
||||
/* Tell calling code that we have handled this event; the buck
|
||||
* stops here. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Tell calling code that we have not handled this event; pass it on. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Print a string when a menu item is selected */
|
||||
|
||||
static void menuitem_response (gchar *string)
|
||||
{
|
||||
printf("%s\n", string);
|
||||
}
|
||||
54
examples/menu/menufactory.c
Normal file
54
examples/menu/menufactory.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/* example-start menu menufactory.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mfmain.h"
|
||||
|
||||
static void print_hello(GtkWidget *widget, gpointer data);
|
||||
|
||||
|
||||
/* this is the GtkMenuEntry structure used to create new menus. The
|
||||
* first member is the menu definition string. The second, the
|
||||
* default accelerator key used to access this menu function with
|
||||
* the keyboard. The third is the callback function to call when
|
||||
* this menu item is selected (by the accelerator key, or with the
|
||||
* mouse.) The last member is the data to pass to your callback function.
|
||||
*/
|
||||
|
||||
static GtkMenuEntry menu_items[] =
|
||||
{
|
||||
{"<Main>/File/New", "<control>N", print_hello, NULL},
|
||||
{"<Main>/File/Open", "<control>O", print_hello, NULL},
|
||||
{"<Main>/File/Save", "<control>S", print_hello, NULL},
|
||||
{"<Main>/File/Save as", NULL, NULL, NULL},
|
||||
{"<Main>/File/<separator>", NULL, NULL, NULL},
|
||||
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
|
||||
{"<Main>/Options/Test", NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
print_hello(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
printf("hello!\n");
|
||||
}
|
||||
|
||||
void get_main_menu(GtkWidget *window, GtkWidget ** menubar)
|
||||
{
|
||||
int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
|
||||
GtkMenuFactory *factory;
|
||||
GtkMenuFactory *subfactory;
|
||||
|
||||
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
subfactory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
|
||||
gtk_menu_factory_add_subfactory(factory, subfactory, "<Main>");
|
||||
gtk_menu_factory_add_entries(factory, menu_items, nmenu_items);
|
||||
gtk_window_add_accelerator_table(GTK_WINDOW(window), subfactory->table);
|
||||
|
||||
if (menubar)
|
||||
*menubar = subfactory->widget;
|
||||
}
|
||||
|
||||
/* example-end */
|
||||
18
examples/menu/menufactory.h
Normal file
18
examples/menu/menufactory.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/* example-start menu menufactory.h */
|
||||
|
||||
#ifndef __MENUFACTORY_H__
|
||||
#define __MENUFACTORY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void get_main_menu (GtkWidget *, GtkWidget **menubar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MENUFACTORY_H__ */
|
||||
|
||||
/* example-end */
|
||||
48
examples/menu/mfmain.c
Normal file
48
examples/menu/mfmain.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* example-start menu mfmain.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "mfmain.h"
|
||||
#include "menufactory.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *menubar;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(file_quit_cmd_callback),
|
||||
"WM destroy");
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Menu Factory");
|
||||
gtk_widget_set_usize(GTK_WIDGET(window), 300, 200);
|
||||
|
||||
main_vbox = gtk_vbox_new(FALSE, 1);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
|
||||
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
||||
gtk_widget_show(main_vbox);
|
||||
|
||||
get_main_menu(window, &menubar);
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show(menubar);
|
||||
|
||||
gtk_widget_show(window);
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* This is just to demonstrate how callbacks work when using the
|
||||
* menufactory. Often, people put all the callbacks from the menus
|
||||
* in a separate file, and then have them call the appropriate functions
|
||||
* from there. Keeps it more organized. */
|
||||
void file_quit_cmd_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
g_print ("%s\n", (char *) data);
|
||||
gtk_exit(0);
|
||||
}
|
||||
|
||||
/* example-end */
|
||||
19
examples/menu/mfmain.h
Normal file
19
examples/menu/mfmain.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* example-start menu mfmain.h */
|
||||
|
||||
#ifndef __MFMAIN_H__
|
||||
#define __MFMAIN_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void file_quit_cmd_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MFMAIN_H__ */
|
||||
|
||||
/* example-end */
|
||||
8
examples/notebook/Makefile
Normal file
8
examples/notebook/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
notebook: notebook.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` notebook.c -o notebook
|
||||
|
||||
clean:
|
||||
rm -f *.o notebook
|
||||
174
examples/notebook/notebook.c
Normal file
174
examples/notebook/notebook.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* notebook.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* This function rotates the position of the tabs */
|
||||
void rotate_book (GtkButton *button, GtkNotebook *notebook)
|
||||
{
|
||||
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos +1) %4);
|
||||
}
|
||||
|
||||
/* Add/Remove the page tabs and the borders */
|
||||
void tabsborder_book (GtkButton *button, GtkNotebook *notebook)
|
||||
{
|
||||
gint tval = FALSE;
|
||||
gint bval = FALSE;
|
||||
if (notebook->show_tabs == 0)
|
||||
tval = TRUE;
|
||||
if (notebook->show_border == 0)
|
||||
bval = TRUE;
|
||||
|
||||
gtk_notebook_set_show_tabs (notebook, tval);
|
||||
gtk_notebook_set_show_border (notebook, bval);
|
||||
}
|
||||
|
||||
/* Remove a page from the notebook */
|
||||
void remove_book (GtkButton *button, GtkNotebook *notebook)
|
||||
{
|
||||
gint page;
|
||||
|
||||
page = gtk_notebook_current_page(notebook);
|
||||
gtk_notebook_remove_page (notebook, page);
|
||||
/* Need to refresh the widget --
|
||||
This forces the widget to redraw itself. */
|
||||
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
|
||||
}
|
||||
|
||||
void delete (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *table;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *label;
|
||||
GtkWidget *checkbutton;
|
||||
int i;
|
||||
char bufferf[32];
|
||||
char bufferl[32];
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
table = gtk_table_new(2,6,TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
/* Create a new notebook, place the position of the tabs */
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0,6,0,1);
|
||||
gtk_widget_show(notebook);
|
||||
|
||||
/* lets append a bunch of pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Append Frame %d", i+1);
|
||||
sprintf(bufferl, "Page %d", i+1);
|
||||
|
||||
frame = gtk_frame_new (bufferf);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_widget_set_usize (frame, 100, 75);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
label = gtk_label_new (bufferf);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (bufferl);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
|
||||
}
|
||||
|
||||
|
||||
/* now lets add a page to a specific spot */
|
||||
checkbutton = gtk_check_button_new_with_label ("Check me please!");
|
||||
gtk_widget_set_usize(checkbutton, 100, 75);
|
||||
gtk_widget_show (checkbutton);
|
||||
|
||||
label = gtk_label_new ("Add spot");
|
||||
gtk_container_add (GTK_CONTAINER (checkbutton), label);
|
||||
gtk_widget_show (label);
|
||||
label = gtk_label_new ("Add page");
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), checkbutton, label, 2);
|
||||
|
||||
/* Now finally lets prepend pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Prepend Frame %d", i+1);
|
||||
sprintf(bufferl, "PPage %d", i+1);
|
||||
|
||||
frame = gtk_frame_new (bufferf);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_widget_set_usize (frame, 100, 75);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
label = gtk_label_new (bufferf);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (bufferl);
|
||||
gtk_notebook_prepend_page (GTK_NOTEBOOK(notebook), frame, label);
|
||||
}
|
||||
|
||||
/* Set what page to start at (page 4) */
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 3);
|
||||
|
||||
|
||||
/* create a bunch of buttons */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("next page");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_notebook_next_page,
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("prev page");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_notebook_prev_page,
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 2,3,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("tab position");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) rotate_book, GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("tabs/border on/off");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tabsborder_book,
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 4,5,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
button = gtk_button_new_with_label ("remove page");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) remove_book,
|
||||
GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_widget_show(table);
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/packbox/Makefile
Normal file
8
examples/packbox/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
packbox: packbox.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` packbox.c -o packbox
|
||||
|
||||
clean:
|
||||
rm -f *.o packbox
|
||||
285
examples/packbox/packbox.c
Normal file
285
examples/packbox/packbox.c
Normal file
@@ -0,0 +1,285 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* packbox.c */
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
|
||||
void
|
||||
delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
/* Make a new hbox filled with button-labels. Arguments for the
|
||||
* variables we're interested are passed in to this function.
|
||||
* We do not show the box, but do show everything inside. */
|
||||
GtkWidget *make_box (gint homogeneous, gint spacing,
|
||||
gint expand, gint fill, gint padding)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *button;
|
||||
char padstr[80];
|
||||
|
||||
/* create a new hbox with the appropriate homogeneous and spacing
|
||||
* settings */
|
||||
box = gtk_hbox_new (homogeneous, spacing);
|
||||
|
||||
/* create a series of buttons with the appropriate settings */
|
||||
button = gtk_button_new_with_label ("gtk_box_pack");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("(box,");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("button,");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* create a button with the label depending on the value of
|
||||
* expand. */
|
||||
if (expand == TRUE)
|
||||
button = gtk_button_new_with_label ("TRUE,");
|
||||
else
|
||||
button = gtk_button_new_with_label ("FALSE,");
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* This is the same as the button creation for "expand"
|
||||
* above, but uses the shorthand form. */
|
||||
button = gtk_button_new_with_label (fill ? "TRUE," : "FALSE,");
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
sprintf (padstr, "%d);", padding);
|
||||
|
||||
button = gtk_button_new_with_label (padstr);
|
||||
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
|
||||
gtk_widget_show (button);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *label;
|
||||
GtkWidget *quitbox;
|
||||
int which;
|
||||
|
||||
/* Our init, don't forget this! :) */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf (stderr, "usage: packbox num, where num is 1, 2, or 3.\n");
|
||||
/* this just does cleanup in GTK, and exits with an exit status of 1. */
|
||||
gtk_exit (1);
|
||||
}
|
||||
|
||||
which = atoi (argv[1]);
|
||||
|
||||
/* Create our window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* You should always remember to connect the destroy signal to the
|
||||
* main window. This is very important for proper intuitive
|
||||
* behavior */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
/* We create a vertical box (vbox) to pack the horizontal boxes into.
|
||||
* This allows us to stack the horizontal boxes filled with buttons one
|
||||
* on top of the other in this vbox. */
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
/* which example to show. These correspond to the pictures above. */
|
||||
switch (which) {
|
||||
case 1:
|
||||
/* create a new label. */
|
||||
label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
|
||||
|
||||
/* Align the label to the left side. We'll discuss this function and
|
||||
* others in the section on Widget Attributes. */
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
|
||||
/* Pack the label into the vertical box (vbox box1). Remember that
|
||||
* widgets added to a vbox will be packed one on top of the other in
|
||||
* order. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
|
||||
/* show the label */
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* call our make box function - homogeneous = FALSE, spacing = 0,
|
||||
* expand = FALSE, fill = FALSE, padding = 0 */
|
||||
box2 = make_box (FALSE, 0, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* call our make box function - homogeneous = FALSE, spacing = 0,
|
||||
* expand = FALSE, fill = FALSE, padding = 0 */
|
||||
box2 = make_box (FALSE, 0, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 0, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* creates a separator, we'll learn more about these later,
|
||||
* but they are quite simple. */
|
||||
separator = gtk_hseparator_new ();
|
||||
|
||||
/* pack the separator into the vbox. Remember each of these
|
||||
* widgets are being packed into a vbox, so they'll be stacked
|
||||
* vertically. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
/* create another new label, and show it. */
|
||||
label = gtk_label_new ("gtk_hbox_new (TRUE, 0);");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (TRUE, 0, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (TRUE, 0, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* another new separator. */
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
/* create a new label, remember box1 is a vbox as created
|
||||
* near the beginning of main() */
|
||||
label = gtk_label_new ("gtk_hbox_new (FALSE, 10);");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 10, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 10, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 0, TRUE, FALSE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Args are: homogeneous, spacing, expand, fill, padding */
|
||||
box2 = make_box (FALSE, 0, TRUE, TRUE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
/* This demonstrates the ability to use gtk_box_pack_end() to
|
||||
* right justify widgets. First, we create a new box as before. */
|
||||
box2 = make_box (FALSE, 0, FALSE, FALSE, 0);
|
||||
/* create the label that will be put at the end. */
|
||||
label = gtk_label_new ("end");
|
||||
/* pack it using gtk_box_pack_end(), so it is put on the right side
|
||||
* of the hbox created in the make_box() call. */
|
||||
gtk_box_pack_end (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
/* show the label. */
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* pack box2 into box1 (the vbox remember ? :) */
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* a separator for the bottom. */
|
||||
separator = gtk_hseparator_new ();
|
||||
/* this explicitly sets the separator to 400 pixels wide by 5 pixels
|
||||
* high. This is so the hbox we created will also be 400 pixels wide,
|
||||
* and the "end" label will be separated from the other labels in the
|
||||
* hbox. Otherwise, all the widgets in the hbox would be packed as
|
||||
* close together as possible. */
|
||||
gtk_widget_set_usize (separator, 400, 5);
|
||||
/* pack the separator into the vbox (box1) created near the start
|
||||
* of main() */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
}
|
||||
|
||||
/* Create another new hbox.. remember we can use as many as we need! */
|
||||
quitbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
/* Our quit button. */
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
|
||||
/* setup the signal to destroy the window. Remember that this will send
|
||||
* the "destroy" signal to the window which will be caught by our signal
|
||||
* handler as defined above. */
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
GTK_OBJECT (window));
|
||||
/* pack the button into the quitbox.
|
||||
* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, FALSE, 0);
|
||||
/* pack the quitbox into the vbox (box1) */
|
||||
gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0);
|
||||
|
||||
/* pack the vbox (box1) which now contains all our widgets, into the
|
||||
* main window. */
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
|
||||
/* and show everything left */
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (quitbox);
|
||||
|
||||
gtk_widget_show (box1);
|
||||
/* Showing the window last so everything pops up at once. */
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* And of course, our main function. */
|
||||
gtk_main ();
|
||||
|
||||
/* control returns here when gtk_main_quit() is called, but not when
|
||||
* gtk_exit is used. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
examples/paned/Makefile
Normal file
8
examples/paned/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
paned: paned.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` paned.c -o paned
|
||||
|
||||
clean:
|
||||
rm -f *.o paned
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user