Compare commits
1675 Commits
wxPy_2_4_m
...
WX_HTML_BE
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3126696b7c | ||
|
|
92337e39b9 | ||
|
|
c09615b8ed | ||
|
|
c91a2f7e67 | ||
|
|
6390284bfa | ||
|
|
46a5010a06 | ||
|
|
7c5e6fc68e | ||
|
|
44d511ad4d | ||
|
|
9a595736d0 | ||
|
|
882b1d8d0e | ||
|
|
f332a5a0f8 | ||
|
|
932b55d0d6 | ||
|
|
7699361c96 | ||
|
|
6678c7f838 | ||
|
|
f2034f1b6e | ||
|
|
6769d0cbf3 | ||
|
|
11eadd92f3 | ||
|
|
47be989f6b | ||
|
|
3f85391ea7 | ||
|
|
0cc1d4ff2a | ||
|
|
22a746d726 | ||
|
|
975ee4b4a9 | ||
|
|
be9b0663d9 | ||
|
|
0cf5de1133 | ||
|
|
5eae641dd6 | ||
|
|
bffa02ff6f | ||
|
|
c4e54c6d80 | ||
|
|
3136f782be | ||
|
|
51e257806f | ||
|
|
7db39dd699 | ||
|
|
4431a7322b | ||
|
|
e8617760b0 | ||
|
|
edf6a06341 | ||
|
|
e8117e7f5c | ||
|
|
3399051ee9 | ||
|
|
d5f3e1ebf5 | ||
|
|
275a63e3a6 | ||
|
|
c9fcf5817f | ||
|
|
edb57eaebe | ||
|
|
70cd62e95c | ||
|
|
aaa9782834 | ||
|
|
d9ef4e06ed | ||
|
|
8fa97a5819 | ||
|
|
73baf01ab3 | ||
|
|
82eba82658 | ||
|
|
41b78190ad | ||
|
|
a8fbc9cc57 | ||
|
|
4b8ab2f93a | ||
|
|
edf8e8e071 | ||
|
|
2f22353e37 | ||
|
|
2c92d7e398 | ||
|
|
ff38281aa1 | ||
|
|
243dbf1a50 | ||
|
|
b5f159ac91 | ||
|
|
d171743ed3 | ||
|
|
1925be658c | ||
|
|
76a60a81b4 | ||
|
|
4506b24a05 | ||
|
|
140f2012cd | ||
|
|
7af6b69e74 | ||
|
|
1162d0a257 | ||
|
|
50ef440170 | ||
|
|
faad0a95e1 | ||
|
|
7e6874c014 | ||
|
|
45ff80056c | ||
|
|
0bbeb42dde | ||
|
|
139c5871c9 | ||
|
|
b63fce942f | ||
|
|
ef5df12bdf | ||
|
|
dd38c87578 | ||
|
|
27c7397611 | ||
|
|
31e7e89fdd | ||
|
|
6ae0daf6c5 | ||
|
|
05d3cd45e5 | ||
|
|
44e8cf38f1 | ||
|
|
e81cf2eb73 | ||
|
|
f5705f7e3e | ||
|
|
f0fc695806 | ||
|
|
acd42a2395 | ||
|
|
8adb5d4557 | ||
|
|
0b887a21d4 | ||
|
|
fe3d9123c6 | ||
|
|
957f03699b | ||
|
|
59fac08507 | ||
|
|
6d18407fa4 | ||
|
|
ce51dc7507 | ||
|
|
025bbf5bcf | ||
|
|
8161ba085f | ||
|
|
bcc4c54184 | ||
|
|
2b5b932572 | ||
|
|
84e7741af6 | ||
|
|
1ae2e0af5a | ||
|
|
7f5f144a81 | ||
|
|
d60913555c | ||
|
|
1dfc3cda6e | ||
|
|
eb6fa4b425 | ||
|
|
b0feedc5db | ||
|
|
cfbf444a53 | ||
|
|
1d105d58f4 | ||
|
|
84969af72d | ||
|
|
28169f14ec | ||
|
|
44f5b99574 | ||
|
|
819451b6c7 | ||
|
|
40f359cafe | ||
|
|
2cee82b781 | ||
|
|
afd366a714 | ||
|
|
dddcedbf7f | ||
|
|
5962bdb85a | ||
|
|
4b8f491298 | ||
|
|
cb27bab1e6 | ||
|
|
69e66915e3 | ||
|
|
ff865c132a | ||
|
|
8c18da2e41 | ||
|
|
384c96533e | ||
|
|
c754f4aa00 | ||
|
|
19b4237945 | ||
|
|
9d4a05be9b | ||
|
|
a36d790a7b | ||
|
|
dec2b82453 | ||
|
|
76c718091a | ||
|
|
1e3c12d774 | ||
|
|
7a311019db | ||
|
|
e6c13db6ec | ||
|
|
7581faf616 | ||
|
|
bf978f96c2 | ||
|
|
384f18ed35 | ||
|
|
2bdf715463 | ||
|
|
0b3f29b359 | ||
|
|
e7e793efd3 | ||
|
|
33caa9948d | ||
|
|
20f18ea193 | ||
|
|
eb76cc945b | ||
|
|
4d0d77affc | ||
|
|
660b190686 | ||
|
|
d694de12e7 | ||
|
|
2eefae6efa | ||
|
|
8e0a317c4f | ||
|
|
e8c6a69c9d | ||
|
|
e9c8005b47 | ||
|
|
8ab40c5227 | ||
|
|
10545ca4e7 | ||
|
|
adf9e09990 | ||
|
|
ea39221211 | ||
|
|
2015f2b308 | ||
|
|
a452af5e68 | ||
|
|
b72b192036 | ||
|
|
1cf1238db4 | ||
|
|
3e3a7b97ec | ||
|
|
5c180caf1b | ||
|
|
444d3e017e | ||
|
|
2423ef22ee | ||
|
|
cf5e94bc6d | ||
|
|
c0ef107e6b | ||
|
|
4241baae44 | ||
|
|
dd49c69170 | ||
|
|
ef33c57631 | ||
|
|
00013f54a2 | ||
|
|
7102c47355 | ||
|
|
e0f4c2c88b | ||
|
|
6a7e641161 | ||
|
|
e97251c58e | ||
|
|
f734e1dad1 | ||
|
|
91fd135b38 | ||
|
|
5d19b6acd1 | ||
|
|
f15dcc0158 | ||
|
|
3e6477f4ab | ||
|
|
a3bb1d14a5 | ||
|
|
6cee329241 | ||
|
|
cd01e3646a | ||
|
|
9a55c2ee2a | ||
|
|
b8985048a5 | ||
|
|
2f930c8501 | ||
|
|
01d0d0e57d | ||
|
|
6298b8d0b2 | ||
|
|
1d2f48b681 | ||
|
|
b9bcaf117a | ||
|
|
96df9ed9b1 | ||
|
|
bb793b0cfb | ||
|
|
13a6fb3a25 | ||
|
|
a722995e62 | ||
|
|
7f7a740336 | ||
|
|
e6be3e7c1b | ||
|
|
4f1f340199 | ||
|
|
77e0239d76 | ||
|
|
94923d5127 | ||
|
|
9a8ffaddeb | ||
|
|
d56327cd06 | ||
|
|
8a73873fa0 | ||
|
|
c8011d7377 | ||
|
|
0cad49b42c | ||
|
|
c5a2f27478 | ||
|
|
56cc1400c7 | ||
|
|
a28fda44bc | ||
|
|
d26fad77f7 | ||
|
|
7960c7b4c5 | ||
|
|
2cea8d2558 | ||
|
|
ee252037cf | ||
|
|
e9196d9c63 | ||
|
|
5bfebd013e | ||
|
|
50382578c1 | ||
|
|
6e7d0063bc | ||
|
|
b41f79f59d | ||
|
|
96f4ca4201 | ||
|
|
6804a3f719 | ||
|
|
56689e1b3a | ||
|
|
368a4a4784 | ||
|
|
1bc54e3257 | ||
|
|
465b213606 | ||
|
|
33688b28c3 | ||
|
|
4ded51f2fa | ||
|
|
0caac3b4a9 | ||
|
|
9e82cf9876 | ||
|
|
a84c0558d8 | ||
|
|
e5db28fd7c | ||
|
|
b867ed682d | ||
|
|
9e730a7876 | ||
|
|
ce8897bbff | ||
|
|
059b646254 | ||
|
|
48bac87b56 | ||
|
|
cc972ac67e | ||
|
|
4ce1efe123 | ||
|
|
e668651137 | ||
|
|
fb45bb1fb2 | ||
|
|
5822d04ada | ||
|
|
475b09e7a7 | ||
|
|
9bd1404d20 | ||
|
|
90771fe589 | ||
|
|
06ea1f023e | ||
|
|
692db919db | ||
|
|
90b2e44c5b | ||
|
|
0b93f59c51 | ||
|
|
abd9b10e39 | ||
|
|
632cfe57c5 | ||
|
|
8fb29449e7 | ||
|
|
de996ce082 | ||
|
|
ca5020c229 | ||
|
|
46b24ef914 | ||
|
|
feea0f9569 | ||
|
|
4b460879a2 | ||
|
|
0474c6efc6 | ||
|
|
c4e98b3311 | ||
|
|
29676ca095 | ||
|
|
e8737b66aa | ||
|
|
f77e1e5d0d | ||
|
|
6e348b12dc | ||
|
|
9dff851556 | ||
|
|
95bf19daf8 | ||
|
|
fc17ff87a1 | ||
|
|
94dc12383d | ||
|
|
e23279e1a7 | ||
|
|
8174870699 | ||
|
|
3faedeb065 | ||
|
|
2dab56e91e | ||
|
|
12fddefcbb | ||
|
|
4f5c180eba | ||
|
|
b823f462a1 | ||
|
|
756c27045d | ||
|
|
8e7cd32b33 | ||
|
|
249aad307f | ||
|
|
753f2cb491 | ||
|
|
eaa6852f39 | ||
|
|
68698f0308 | ||
|
|
a8680e3e0e | ||
|
|
69dbb7098b | ||
|
|
fe802fc2ed | ||
|
|
b67d3706d9 | ||
|
|
e5a87141b4 | ||
|
|
d477aa2bb3 | ||
|
|
fa275e8648 | ||
|
|
8ffc8f1fb9 | ||
|
|
3692b94818 | ||
|
|
30ad0a1469 | ||
|
|
4455332266 | ||
|
|
8d60dc8aa0 | ||
|
|
e340193bb6 | ||
|
|
06d0938900 | ||
|
|
70ddb200c1 | ||
|
|
7af64aace1 | ||
|
|
878711c01c | ||
|
|
cc37ebe090 | ||
|
|
98ea6b7d6a | ||
|
|
69440cd26c | ||
|
|
12338247ae | ||
|
|
106c33bb1d | ||
|
|
a968cb805f | ||
|
|
13c13ecbbf | ||
|
|
e34dcad290 | ||
|
|
510bf1ec20 | ||
|
|
e1b998ce2d | ||
|
|
10b41b53cb | ||
|
|
bc9f356d52 | ||
|
|
bfe9ffbc8f | ||
|
|
c2fa4af423 | ||
|
|
e67cc398eb | ||
|
|
b79297d243 | ||
|
|
d5ca66298a | ||
|
|
84a667dc06 | ||
|
|
376b18eac7 | ||
|
|
8c9564b392 | ||
|
|
fba1b53b87 | ||
|
|
a25d51afbc | ||
|
|
f7155274cc | ||
|
|
30a8c81ddb | ||
|
|
a42c2eece0 | ||
|
|
ddaf55663f | ||
|
|
d0b50ad939 | ||
|
|
5571f3d3d7 | ||
|
|
e624f5ba66 | ||
|
|
1a31de36a4 | ||
|
|
707a378282 | ||
|
|
96c0a5167b | ||
|
|
732b3a752b | ||
|
|
2027c6db5b | ||
|
|
100cf085fb | ||
|
|
a364b95710 | ||
|
|
7875262d29 | ||
|
|
89e3b3e448 | ||
|
|
ff101af5b8 | ||
|
|
021fde89a6 | ||
|
|
260d684906 | ||
|
|
1d2e5548c4 | ||
|
|
ef6a2689b4 | ||
|
|
918dc51991 | ||
|
|
a5e3c24d7b | ||
|
|
4a8900f257 | ||
|
|
66f2199449 | ||
|
|
d26d975463 | ||
|
|
7ce4426ae3 | ||
|
|
dca9009bcc | ||
|
|
851ccc357b | ||
|
|
5db932052d | ||
|
|
65dc921d3f | ||
|
|
ef4a634b1b | ||
|
|
4365da58c8 | ||
|
|
dc7219d2e1 | ||
|
|
6eb37239e0 | ||
|
|
e2a5251d01 | ||
|
|
3251b83466 | ||
|
|
bd4a25bc50 | ||
|
|
66010e8d0d | ||
|
|
bfe835d075 | ||
|
|
6a76384f2d | ||
|
|
11968fef9c | ||
|
|
e12c92c2f7 | ||
|
|
b1a28eef7c | ||
|
|
19bb2f5bbe | ||
|
|
1eb1eae717 | ||
|
|
f7f78039d2 | ||
|
|
aae0472bf3 | ||
|
|
507db85d59 | ||
|
|
4f4d07644f | ||
|
|
1eb9ddb9f8 | ||
|
|
6d460f765d | ||
|
|
20e4242f93 | ||
|
|
c3b3654e9b | ||
|
|
be8a703f96 | ||
|
|
59a9a6bcc6 | ||
|
|
2e491df9fa | ||
|
|
c9ee09924f | ||
|
|
4eb38db745 | ||
|
|
cf21abe595 | ||
|
|
643a0828da | ||
|
|
376c2fba79 | ||
|
|
a29c6824c2 | ||
|
|
1ca61fa7a7 | ||
|
|
02a48e3b0a | ||
|
|
9ce8d6a2b0 | ||
|
|
13fc3db40e | ||
|
|
ce50c4d1c6 | ||
|
|
2894667fa4 | ||
|
|
64440d7734 | ||
|
|
de6dab5f7c | ||
|
|
01f5f03e7f | ||
|
|
8d0eaedd07 | ||
|
|
b400d50ac6 | ||
|
|
6c342f3ff1 | ||
|
|
e40bef9f54 | ||
|
|
06efac1f8d | ||
|
|
d515343ca2 | ||
|
|
b229c8a911 | ||
|
|
06cc1fb991 | ||
|
|
5015e02267 | ||
|
|
673e612079 | ||
|
|
409bd44e7b | ||
|
|
efa14cf20a | ||
|
|
01562b11f2 | ||
|
|
edb247200c | ||
|
|
5ae8a62ccf | ||
|
|
1f6c4d4746 | ||
|
|
891d0563f7 | ||
|
|
ec4e4a1415 | ||
|
|
2ace5cf632 | ||
|
|
ddf7346ac0 | ||
|
|
c29e274378 | ||
|
|
82de126c11 | ||
|
|
842f5c94c9 | ||
|
|
fb29dcac01 | ||
|
|
3eae0c0b43 | ||
|
|
4f5583b5c5 | ||
|
|
4bc6471261 | ||
|
|
b78ce094c7 | ||
|
|
62ad3cb358 | ||
|
|
b71e94da10 | ||
|
|
833e610da7 | ||
|
|
a2f9a63688 | ||
|
|
ddea7eb614 | ||
|
|
6344162a81 | ||
|
|
f5b1bb5e76 | ||
|
|
6af507f77e | ||
|
|
4e6beae5ec | ||
|
|
0a2c03984a | ||
|
|
a967f0480b | ||
|
|
02822c8cdf | ||
|
|
6568015373 | ||
|
|
a01fe3d6d2 | ||
|
|
91ce04cf9e | ||
|
|
e5c4c38b5d | ||
|
|
23254b138a | ||
|
|
72c30d6572 | ||
|
|
715d7d25b3 | ||
|
|
5a618a14c6 | ||
|
|
333a6456b9 | ||
|
|
695c21b118 | ||
|
|
736f28f8d8 | ||
|
|
49fca29840 | ||
|
|
128e0251fe | ||
|
|
3908fe9b00 | ||
|
|
d03bb63c48 | ||
|
|
be05eab690 | ||
|
|
6799385e8c | ||
|
|
395cb311cf | ||
|
|
236de6f62a | ||
|
|
59e034c034 | ||
|
|
70aac632a1 | ||
|
|
739e366ac9 | ||
|
|
2408a0d514 | ||
|
|
8dda7c0c48 | ||
|
|
5e7ea8ebb2 | ||
|
|
3037523a7c | ||
|
|
873a543b62 | ||
|
|
db657fb29a | ||
|
|
6e9b4c7659 | ||
|
|
083f7497d3 | ||
|
|
baf3431445 | ||
|
|
aa812de01b | ||
|
|
8ea5271ee7 | ||
|
|
edd2522079 | ||
|
|
b0abe9eeec | ||
|
|
a6bc93cc74 | ||
|
|
5c451707f3 | ||
|
|
973ac5bbb2 | ||
|
|
dfa2a1d92b | ||
|
|
e8508ea8a8 | ||
|
|
01772f64db | ||
|
|
df32effb39 | ||
|
|
3b69115cba | ||
|
|
965b4f87d9 | ||
|
|
170e293d9f | ||
|
|
7c9955d147 | ||
|
|
f2638c97a5 | ||
|
|
2fc9385a2c | ||
|
|
642067e02a | ||
|
|
7cb81afa43 | ||
|
|
4b78db237a | ||
|
|
c6dafd93ca | ||
|
|
3e3a8c40c5 | ||
|
|
82e20720c9 | ||
|
|
f3aa39c7ac | ||
|
|
4a3bdee6a9 | ||
|
|
820893d0d4 | ||
|
|
ed0c2af3ab | ||
|
|
07831c160b | ||
|
|
66f8b9ace2 | ||
|
|
ccb234b4d0 | ||
|
|
fdfd5d49eb | ||
|
|
79fb264130 | ||
|
|
973451afc6 | ||
|
|
8768548b81 | ||
|
|
b1823f8b46 | ||
|
|
d003330ce4 | ||
|
|
31907d0307 | ||
|
|
1940f66914 | ||
|
|
64407854c1 | ||
|
|
ed4e170a7a | ||
|
|
3470af1c9a | ||
|
|
1cbf0cc6d3 | ||
|
|
085c26ac14 | ||
|
|
4a9dba0e56 | ||
|
|
f0f7bd8a4f | ||
|
|
6a87168b30 | ||
|
|
3b3ca9beb8 | ||
|
|
dd1eb4e315 | ||
|
|
2a73612989 | ||
|
|
1542ea396a | ||
|
|
7728856b75 | ||
|
|
69a3ae88fc | ||
|
|
2d2ed20f7b | ||
|
|
a1e71b1032 | ||
|
|
2c1a331259 | ||
|
|
84e7f94cb0 | ||
|
|
e49079b2ab | ||
|
|
34415ceaac | ||
|
|
7e0777dabb | ||
|
|
3362e80e71 | ||
|
|
a2facb9415 | ||
|
|
e9a86b3c00 | ||
|
|
fe9c9eb022 | ||
|
|
61bfe4b0ca | ||
|
|
5175dbbd9f | ||
|
|
427ff66291 | ||
|
|
44c44c82a3 | ||
|
|
3dd709d8c3 | ||
|
|
c4e41ce37a | ||
|
|
76806f5906 | ||
|
|
aae91497f6 | ||
|
|
fc7ca9b347 | ||
|
|
9ec1ed2a7e | ||
|
|
2b9e4799b9 | ||
|
|
3856ee0ba4 | ||
|
|
3100de9921 | ||
|
|
2187eef5bb | ||
|
|
d8d1818419 | ||
|
|
6789bce964 | ||
|
|
e0fb15a1c3 | ||
|
|
2d13837901 | ||
|
|
bf78c81c04 | ||
|
|
8b611f0eb2 | ||
|
|
8dfc2d9896 | ||
|
|
ba2fcb0711 | ||
|
|
51d5ec5408 | ||
|
|
c176a11a0e | ||
|
|
27397d6682 | ||
|
|
c8023fed76 | ||
|
|
9c712743cb | ||
|
|
e08a9b55e6 | ||
|
|
a95e8d8b8c | ||
|
|
9cbf6f6ea3 | ||
|
|
fc0821b650 | ||
|
|
7e50db3f1d | ||
|
|
7108497a54 | ||
|
|
1adff2f56f | ||
|
|
26b8693ba5 | ||
|
|
446a798ddc | ||
|
|
bcd44ac1b0 | ||
|
|
230e09add6 | ||
|
|
b67a932778 | ||
|
|
b9ac87bc5c | ||
|
|
1e4a197e4c | ||
|
|
9b4e3f352b | ||
|
|
f0fe27a041 | ||
|
|
d80f416f62 | ||
|
|
2f52b4e15c | ||
|
|
cdd732de07 | ||
|
|
581ee8a9c5 | ||
|
|
82ac3b0a42 | ||
|
|
9cf743aa7f | ||
|
|
697b08a89a | ||
|
|
a8beba7230 | ||
|
|
a6b4ff2e62 | ||
|
|
d449cf47c3 | ||
|
|
f40f9976fd | ||
|
|
548dd93d7d | ||
|
|
981af57ccf | ||
|
|
576a15443d | ||
|
|
0bcd741653 | ||
|
|
5460b9e30b | ||
|
|
17dd9caaa5 | ||
|
|
c1f7d193f6 | ||
|
|
2b17e39106 | ||
|
|
d5f229692e | ||
|
|
a8c80eb142 | ||
|
|
72ad377f13 | ||
|
|
85b0fd7098 | ||
|
|
925f154dac | ||
|
|
da32743f22 | ||
|
|
c5c04fabb0 | ||
|
|
d8103d31f7 | ||
|
|
f7556ff05f | ||
|
|
41aebd5d79 | ||
|
|
0fa939c29a | ||
|
|
c5f5e891ec | ||
|
|
acbf95340f | ||
|
|
08af0d25f9 | ||
|
|
9b4d9d5638 | ||
|
|
09f6516cda | ||
|
|
8c9a1303d8 | ||
|
|
fa7e240226 | ||
|
|
4b1f929cc3 | ||
|
|
4c49b5d83e | ||
|
|
810f173e8d | ||
|
|
2b254edf9c | ||
|
|
26f0e9e2e4 | ||
|
|
563e3ecb6c | ||
|
|
51a2a728e5 | ||
|
|
f7292ebeba | ||
|
|
2f8b6a1dcc | ||
|
|
2ab25aca26 | ||
|
|
621b931778 | ||
|
|
6ceef8efe9 | ||
|
|
ce109c530a | ||
|
|
6aa855b9ec | ||
|
|
767ed8fd8c | ||
|
|
40c79fab3a | ||
|
|
da9df1f51e | ||
|
|
22be0335df | ||
|
|
5cb0f77dfe | ||
|
|
3bb70c4026 | ||
|
|
8f4b6405ff | ||
|
|
3c5bd1886a | ||
|
|
1201b3ef40 | ||
|
|
f2bb16493d | ||
|
|
0b2e45b162 | ||
|
|
474df21877 | ||
|
|
7fd328a34d | ||
|
|
c11bf84234 | ||
|
|
b0ea5d9603 | ||
|
|
a2f10a1768 | ||
|
|
42b6a61ef6 | ||
|
|
211b54b109 | ||
|
|
d1bf777402 | ||
|
|
d35cb50456 | ||
|
|
b3f04dc2b2 | ||
|
|
f28e099ec3 | ||
|
|
2cf45d6944 | ||
|
|
bbc1265c40 | ||
|
|
916b0ea345 | ||
|
|
60a68e0024 | ||
|
|
4d53042a6a | ||
|
|
93e73c740e | ||
|
|
13de23f6d8 | ||
|
|
55427034af | ||
|
|
ac4eaadf80 | ||
|
|
bc85826802 | ||
|
|
178b5412d1 | ||
|
|
8029fe033c | ||
|
|
e64df9bcc3 | ||
|
|
0201182bf5 | ||
|
|
51a8edc7e6 | ||
|
|
1a4ebaf865 | ||
|
|
9a7324a6d9 | ||
|
|
e0ea95b6f7 | ||
|
|
f4515f987d | ||
|
|
fed66a8797 | ||
|
|
ab590906ba | ||
|
|
a24aff654f | ||
|
|
812edc2530 | ||
|
|
94c3ff9091 | ||
|
|
27ef58ba02 | ||
|
|
8d512476c5 | ||
|
|
ee9768c9e0 | ||
|
|
e38b6ea8d2 | ||
|
|
da0634c140 | ||
|
|
fb896a322a | ||
|
|
43225e09fe | ||
|
|
befdb27f7d | ||
|
|
71f23c9aa8 | ||
|
|
01ba8b3931 | ||
|
|
aa2d605997 | ||
|
|
e835c3693b | ||
|
|
aa5973eef4 | ||
|
|
a4ab8ed5ff | ||
|
|
2e5794713c | ||
|
|
17240438f2 | ||
|
|
db4444f0ce | ||
|
|
ac0c4cc396 | ||
|
|
0e68a26a43 | ||
|
|
39989a8093 | ||
|
|
00524cfd67 | ||
|
|
d9e2e4c242 | ||
|
|
6f87d5542d | ||
|
|
b994671df0 | ||
|
|
7ebcb58495 | ||
|
|
a125b1b9d5 | ||
|
|
09a1dffa32 | ||
|
|
9750481f36 | ||
|
|
92ee0ef908 | ||
|
|
dd360466a5 | ||
|
|
174046a33c | ||
|
|
1cfa5d8e39 | ||
|
|
0f48e3d518 | ||
|
|
68fcaeb98e | ||
|
|
13acdb7d36 | ||
|
|
6b9aec458f | ||
|
|
7818a75c16 | ||
|
|
355f240724 | ||
|
|
6d89ddefa9 | ||
|
|
be55ddb10d | ||
|
|
1a19e369fb | ||
|
|
6aa89a22b8 | ||
|
|
55d99c7a77 | ||
|
|
e3a1e3e0e5 | ||
|
|
6c9a19aaba | ||
|
|
371a5b4e62 | ||
|
|
3f0fac91ab | ||
|
|
0d7fb283bb | ||
|
|
d40708e2fd | ||
|
|
b1ef882100 | ||
|
|
4eecf1150d | ||
|
|
5851504dfc | ||
|
|
cc3da3f8a1 | ||
|
|
e136b74763 | ||
|
|
18efb19f9d | ||
|
|
94af6953cf | ||
|
|
5e284dd5e8 | ||
|
|
ea9868e8d2 | ||
|
|
3a73cc5203 | ||
|
|
d6379fa35a | ||
|
|
d3a80c922c | ||
|
|
f72199d117 | ||
|
|
77fc3492f9 | ||
|
|
441b8072ee | ||
|
|
a8f473ac36 | ||
|
|
7ed2b47bf5 | ||
|
|
8aa2cea1d0 | ||
|
|
271d1110ed | ||
|
|
d8c65cf488 | ||
|
|
fb718549cd | ||
|
|
f3076f9fae | ||
|
|
39d6715fdf | ||
|
|
62ae2780a8 | ||
|
|
3e2d47e1a9 | ||
|
|
a63b009834 | ||
|
|
521196a26a | ||
|
|
79e929e79e | ||
|
|
28cafc44d2 | ||
|
|
d46342af50 | ||
|
|
578dc95029 | ||
|
|
c9570d3076 | ||
|
|
84fb430b97 | ||
|
|
0ddf7c0cad | ||
|
|
fb5230de74 | ||
|
|
ab89a5b59b | ||
|
|
e9d804ebea | ||
|
|
637988a4f6 | ||
|
|
8dd336cba3 | ||
|
|
3ca22d5e92 | ||
|
|
10d1f4131d | ||
|
|
0c2d357716 | ||
|
|
7e0e5fe1e4 | ||
|
|
63d1f74fe9 | ||
|
|
c4a49e11f7 | ||
|
|
8950f7cc7e | ||
|
|
853f8094df | ||
|
|
a87758e451 | ||
|
|
65ed018215 | ||
|
|
b19a74b0bc | ||
|
|
35af98e482 | ||
|
|
da494b405d | ||
|
|
bdb9ccbfd6 | ||
|
|
393cbb8ff7 | ||
|
|
eaafd2f8b7 | ||
|
|
53eff2a282 | ||
|
|
336b8a4257 | ||
|
|
acf8e3d29e | ||
|
|
0c543b7a19 | ||
|
|
9ae2ec95cf | ||
|
|
27bb2b7cea | ||
|
|
487659e0fa | ||
|
|
c0589c62a6 | ||
|
|
5169844ada | ||
|
|
ddb4769e7c | ||
|
|
c8ce283736 | ||
|
|
fd9655adba | ||
|
|
534f031251 | ||
|
|
6627d4dfb7 | ||
|
|
652ab15353 | ||
|
|
7dc85fe2be | ||
|
|
a02afd1452 | ||
|
|
e49c85af1c | ||
|
|
c5ef41d3b4 | ||
|
|
1265e13d17 | ||
|
|
2b293fc78f | ||
|
|
da804130ba | ||
|
|
7541150812 | ||
|
|
42683dfb10 | ||
|
|
2a61618831 | ||
|
|
c5e591789b | ||
|
|
78e053ec45 | ||
|
|
30727fae8d | ||
|
|
5f7a6626aa | ||
|
|
3352cfffbc | ||
|
|
653a3ed956 | ||
|
|
483561c568 | ||
|
|
a73903480f | ||
|
|
9ca4dd06de | ||
|
|
84267f0dfc | ||
|
|
e3612e8b54 | ||
|
|
c6985199b0 | ||
|
|
716645d361 | ||
|
|
4a95c88547 | ||
|
|
8585e2b506 | ||
|
|
bfc9081049 | ||
|
|
af49404386 | ||
|
|
458ca8c1fd | ||
|
|
6b9eeef230 | ||
|
|
1119b89942 | ||
|
|
866c0d96cb | ||
|
|
3b43289082 | ||
|
|
3211bccf7c | ||
|
|
913ff1a703 | ||
|
|
1a44c9258a | ||
|
|
461573cc24 | ||
|
|
e40298d54e | ||
|
|
7de24929eb | ||
|
|
cec773c6fc | ||
|
|
7f980cffb8 | ||
|
|
c5969a3848 | ||
|
|
13a7abf973 | ||
|
|
d921af5140 | ||
|
|
072df0b3af | ||
|
|
79132cd302 | ||
|
|
a31a5f8534 | ||
|
|
7532d2928e | ||
|
|
f81387bd80 | ||
|
|
e9b77bccb0 | ||
|
|
c32b107789 | ||
|
|
402ce75571 | ||
|
|
d264d7091c | ||
|
|
3cdf176163 | ||
|
|
c54322338f | ||
|
|
647b8e379e | ||
|
|
9e023db73b | ||
|
|
e8800dcfa7 | ||
|
|
702c420889 | ||
|
|
8a09029e0c | ||
|
|
7854746ec1 | ||
|
|
850c6ed46e | ||
|
|
d60de5167e | ||
|
|
62b4ae0811 | ||
|
|
9ef896e152 | ||
|
|
72cd2fcc00 | ||
|
|
d3c0ce3402 | ||
|
|
07cc7ddca5 | ||
|
|
7c6ad433be | ||
|
|
c3d8ee42db | ||
|
|
f1a19f1478 | ||
|
|
eeb029a965 | ||
|
|
9230920176 | ||
|
|
a9d3434a3b | ||
|
|
07601f5945 | ||
|
|
4756503a3d | ||
|
|
77b0d411e3 | ||
|
|
bad93b357f | ||
|
|
5315ebfaed | ||
|
|
e549bec483 | ||
|
|
34b6a45ab9 | ||
|
|
117395866e | ||
|
|
817f640621 | ||
|
|
a6861c1dc8 | ||
|
|
ca1aac5387 | ||
|
|
6b8877197f | ||
|
|
10e8e34f71 | ||
|
|
e1aae52885 | ||
|
|
8dcc14725d | ||
|
|
d4d46b56f0 | ||
|
|
1da51aafba | ||
|
|
4561e95d96 | ||
|
|
67de05a11c | ||
|
|
8829fa8200 | ||
|
|
7c6cd4a86b | ||
|
|
749caeeb38 | ||
|
|
ec8b106913 | ||
|
|
e74bade6d8 | ||
|
|
5aab763c09 | ||
|
|
010ba10dc5 | ||
|
|
0a514d12e8 | ||
|
|
69c4481222 | ||
|
|
e7370dac93 | ||
|
|
729be74dd1 | ||
|
|
9dc8c75994 | ||
|
|
21342bba68 | ||
|
|
3ebd765df5 | ||
|
|
2862acdeb7 | ||
|
|
2aefc52854 | ||
|
|
af7b5345ed | ||
|
|
e587e144c8 | ||
|
|
3cfda0b764 | ||
|
|
7de595519a | ||
|
|
8b49ecd77a | ||
|
|
038a5591e4 | ||
|
|
d43851f77e | ||
|
|
0878fb4c7d | ||
|
|
2cdd094b12 | ||
|
|
a8f4cabe1e | ||
|
|
8586126c7b | ||
|
|
c6e2af4570 | ||
|
|
787d22ec24 | ||
|
|
e6396ed451 | ||
|
|
e0496eaaa4 | ||
|
|
ae23a52a16 | ||
|
|
b1ef887ad8 | ||
|
|
904a2463aa | ||
|
|
e38ed919ba | ||
|
|
ed5317e538 | ||
|
|
45a959a33b | ||
|
|
57b486583d | ||
|
|
e56aba8dd5 | ||
|
|
73d33f1ac6 | ||
|
|
369da72455 | ||
|
|
b1e343f2bb | ||
|
|
22cbd10ea3 | ||
|
|
63d6802445 | ||
|
|
80793cda3e | ||
|
|
6faf4b5f59 | ||
|
|
41e6092432 | ||
|
|
c18670e45c | ||
|
|
a08e7186b4 | ||
|
|
6bc5a86729 | ||
|
|
366e20d6fc | ||
|
|
d3abc823be | ||
|
|
d8bb3c9c64 | ||
|
|
9c11ecdbed | ||
|
|
c3d15542d6 | ||
|
|
08e5319b03 | ||
|
|
9045ad9dfc | ||
|
|
bf3353768a | ||
|
|
7899ef9592 | ||
|
|
6db2faf3ad | ||
|
|
4df410bf5c | ||
|
|
8e7361ccbc | ||
|
|
100f92893d | ||
|
|
b6e2df0b36 | ||
|
|
6185050104 | ||
|
|
1a55595e69 | ||
|
|
fd52ec657f | ||
|
|
5c0ee4a80a | ||
|
|
67a26a1a0b | ||
|
|
ed39ff57b3 | ||
|
|
d51f2e6587 | ||
|
|
2ad50cc75b | ||
|
|
cfef519aaa | ||
|
|
27e229f55a | ||
|
|
d9e403cc40 | ||
|
|
91388efc15 | ||
|
|
3e43d6143b | ||
|
|
111ee2fdb8 | ||
|
|
bc33be3b05 | ||
|
|
2b830c41f7 | ||
|
|
b64c979322 | ||
|
|
1c52210086 | ||
|
|
2eefc6d59e | ||
|
|
0e878cfcc6 | ||
|
|
6ef7c8e01e | ||
|
|
6dbc7fb4e5 | ||
|
|
81b41c03c6 | ||
|
|
07c76470e9 | ||
|
|
d1e3f88a08 | ||
|
|
2a391f8718 | ||
|
|
9c3c584918 | ||
|
|
9d1461a451 | ||
|
|
bf91e65285 | ||
|
|
80e297514d | ||
|
|
4fedd384a1 | ||
|
|
ca7353de3a | ||
|
|
e2b87f38d9 | ||
|
|
83911a5a4d | ||
|
|
895066d8c8 | ||
|
|
debc914bdc | ||
|
|
4f5a7f7409 | ||
|
|
d8e9da78a0 | ||
|
|
a19f009bce | ||
|
|
04f2e99050 | ||
|
|
1845da40f2 | ||
|
|
49bbd59b01 | ||
|
|
9b1bd0c6e7 | ||
|
|
205b0c9c6a | ||
|
|
9d1e1be463 | ||
|
|
677a9e28b5 | ||
|
|
f6eff86e7e | ||
|
|
d4c8e4a1d4 | ||
|
|
e4d47fbd6f | ||
|
|
1cff04deb5 | ||
|
|
a2f26963ba | ||
|
|
ac856b274a | ||
|
|
bf60426831 | ||
|
|
94311eef78 | ||
|
|
00dd3b1897 | ||
|
|
ff7d1dcb82 | ||
|
|
7f88f624d6 | ||
|
|
0aa35d1962 | ||
|
|
1092b2a039 | ||
|
|
d76240bfe1 | ||
|
|
ab9f788e31 | ||
|
|
f083414031 | ||
|
|
7e1bcfa80e | ||
|
|
d894c20113 | ||
|
|
766c5e24a5 | ||
|
|
9cb98d8995 | ||
|
|
01feccc204 | ||
|
|
f2b99f6323 | ||
|
|
6f7c5199ed | ||
|
|
e2ca829e7d | ||
|
|
61a83c1c50 | ||
|
|
f68c6b523c | ||
|
|
c48e9cbb17 | ||
|
|
017fcf32be | ||
|
|
fb6e5b179a | ||
|
|
90e2cbf780 | ||
|
|
9c9c3d7a8f | ||
|
|
cf41e1a4d5 | ||
|
|
eff4ffbf4f | ||
|
|
62a0bb2788 | ||
|
|
cf54972ea2 | ||
|
|
367f7c4570 | ||
|
|
f09c8393cb | ||
|
|
922c7dcb6f | ||
|
|
ce9462d21d | ||
|
|
93fac60414 | ||
|
|
11a1face0e | ||
|
|
c921fd5994 | ||
|
|
70687b638d | ||
|
|
e69a1ea87c | ||
|
|
e3cff1fbb7 | ||
|
|
7f3c339c0d | ||
|
|
597a3d06bf | ||
|
|
f77cf4e68a | ||
|
|
464f1a1da6 | ||
|
|
adfb70c30f | ||
|
|
288059b2b9 | ||
|
|
a148cfb644 | ||
|
|
6b5cdfed73 | ||
|
|
ce6cea6808 | ||
|
|
68c124a168 | ||
|
|
6edf791ccb | ||
|
|
cca784632f | ||
|
|
e74563e412 | ||
|
|
c5c9378c98 | ||
|
|
ac9b5f9889 | ||
|
|
233d603a09 | ||
|
|
2726cac595 | ||
|
|
5fa00d2425 | ||
|
|
4abac0c027 | ||
|
|
45a0fd3723 | ||
|
|
95fd868c8f | ||
|
|
4c200e8d87 | ||
|
|
f352dd54f0 | ||
|
|
cd28bcaded | ||
|
|
88522554f8 | ||
|
|
0f5cc041d2 | ||
|
|
4c2300c6a1 | ||
|
|
701d8d7606 | ||
|
|
e004299a08 | ||
|
|
378ad9574d | ||
|
|
57fbe23f68 | ||
|
|
82d4311313 | ||
|
|
1e4786bb37 | ||
|
|
a3195b73a6 | ||
|
|
851b3a889f | ||
|
|
7c15086ca4 | ||
|
|
01fbf5d755 | ||
|
|
581bebd192 | ||
|
|
15b41e900b | ||
|
|
64820d33a1 | ||
|
|
1dd85cc3d6 | ||
|
|
0150a5b8b9 | ||
|
|
2e97b58c63 | ||
|
|
408ad8789c | ||
|
|
9145b0c6ce | ||
|
|
bf918b97ed | ||
|
|
cbf8aca6d4 | ||
|
|
b89f23763c | ||
|
|
f3fb0a0719 | ||
|
|
339e0cf110 | ||
|
|
6357cb9d09 | ||
|
|
36825681b5 | ||
|
|
ab82ab0704 | ||
|
|
6394c5966c | ||
|
|
e8d19ddd5f | ||
|
|
150c8d89c7 | ||
|
|
dd91da4ed1 | ||
|
|
fccacb2a9d | ||
|
|
2b61c41b71 | ||
|
|
cab8f76eb8 | ||
|
|
eaf498dffe | ||
|
|
903972f999 | ||
|
|
7cb9cf8992 | ||
|
|
2f5b93fb9f | ||
|
|
e4da1035e4 | ||
|
|
25d599ae91 | ||
|
|
805f26b316 | ||
|
|
eed1be652a | ||
|
|
f2dec5b10d | ||
|
|
5eac771d09 | ||
|
|
f357c0d42c | ||
|
|
4519ac17a7 | ||
|
|
9dd96c0f6d | ||
|
|
77efa6a8fc | ||
|
|
cfcc393212 | ||
|
|
138618acb9 | ||
|
|
e046e5f1e7 | ||
|
|
778262c49b | ||
|
|
99c2d4f20c | ||
|
|
1558859090 | ||
|
|
65f19af139 | ||
|
|
5d76f46282 | ||
|
|
2abb9d2f17 | ||
|
|
0bbe4e299c | ||
|
|
5709329c88 | ||
|
|
c781807d89 | ||
|
|
e0d8fb4572 | ||
|
|
d162a7ee7d | ||
|
|
5e3841bf80 | ||
|
|
8e41796c6c | ||
|
|
df861444a1 | ||
|
|
2c74cde0c6 | ||
|
|
04cd30dea2 | ||
|
|
cdd64cc06c | ||
|
|
8f91dda1b4 | ||
|
|
4f8090e092 | ||
|
|
a0f3867a6a | ||
|
|
8ddf18dd0d | ||
|
|
c155898a21 | ||
|
|
7b4c314952 | ||
|
|
01802c507c | ||
|
|
4fd899b671 | ||
|
|
c0ae383ac0 | ||
|
|
5d9ea849d8 | ||
|
|
85b7bb3557 | ||
|
|
82e5f91bff | ||
|
|
c8c5c7f62e | ||
|
|
e910c00040 | ||
|
|
95bcc40c74 | ||
|
|
53b982112d | ||
|
|
5cdff2990b | ||
|
|
6766e5d136 | ||
|
|
350777b68f | ||
|
|
d1be6261e3 | ||
|
|
2f0c19d0a8 | ||
|
|
182c0f4675 | ||
|
|
9f667cbcb2 | ||
|
|
a663cce7f9 | ||
|
|
c4f4cf895c | ||
|
|
06e8e72d84 | ||
|
|
ae7583b4bf | ||
|
|
3492e7c804 | ||
|
|
efa7066d36 | ||
|
|
8bbbae215c | ||
|
|
33a7c3dd0b | ||
|
|
545d1e6050 | ||
|
|
a7b4607f4a | ||
|
|
c9b6238d67 | ||
|
|
a0499e2f21 | ||
|
|
23d2edff35 | ||
|
|
7d2304132b | ||
|
|
23efb556d9 | ||
|
|
b45bca403a | ||
|
|
9794cae1b3 | ||
|
|
c220541de4 | ||
|
|
730dfeb496 | ||
|
|
9e300531e5 | ||
|
|
f823cacbda | ||
|
|
7eb833e673 | ||
|
|
e7b6ce1cf9 | ||
|
|
63a76696df | ||
|
|
c3f64df223 | ||
|
|
dc259b7926 | ||
|
|
cba5a276e4 | ||
|
|
e879e020e7 | ||
|
|
18f7d0e1db | ||
|
|
82e94f591f | ||
|
|
214bdb93da | ||
|
|
fd397f9966 | ||
|
|
5ff72dc423 | ||
|
|
db8b7c5061 | ||
|
|
24dc054793 | ||
|
|
a203834e6b | ||
|
|
cceb71da44 | ||
|
|
1bc822dfb5 | ||
|
|
2fda214570 | ||
|
|
192ce0bec9 | ||
|
|
432be5aade | ||
|
|
c37ffc1fef | ||
|
|
fd304d989b | ||
|
|
52c71b808f | ||
|
|
8d90d2f25f | ||
|
|
ec0d6da38d | ||
|
|
677eb52d3f | ||
|
|
1b80ba97f3 | ||
|
|
cc81d32f2b | ||
|
|
4aa3178674 | ||
|
|
e7266247d5 | ||
|
|
65d8ef1e73 | ||
|
|
b4a89d27eb | ||
|
|
56acdfef2f | ||
|
|
0894707e7c | ||
|
|
7f891ef107 | ||
|
|
c9c50e2395 | ||
|
|
4522bb3ecf | ||
|
|
d66dcb6022 | ||
|
|
b78a78f779 | ||
|
|
e107213f89 | ||
|
|
b448f30e9c | ||
|
|
525582584c | ||
|
|
649a48a216 | ||
|
|
448025b0dc | ||
|
|
f81127c568 | ||
|
|
b9e3bdc539 | ||
|
|
9f67b77690 | ||
|
|
ac17f9b104 | ||
|
|
24174c30e0 | ||
|
|
dc18c8f1b2 | ||
|
|
974d9c98f0 | ||
|
|
0ec6fd04eb | ||
|
|
46675b4610 | ||
|
|
b05206c98b | ||
|
|
476d311420 | ||
|
|
2c4c6c0ad0 | ||
|
|
c718e0b31c | ||
|
|
d3d3426196 | ||
|
|
2f82c92009 | ||
|
|
f21fcc9d2e | ||
|
|
eff41ee7f5 | ||
|
|
d9b21c9f47 | ||
|
|
5ab6aab880 | ||
|
|
ce72eadb4d | ||
|
|
22ab1509cd | ||
|
|
1b6b675be3 | ||
|
|
513c3efc49 | ||
|
|
4e0862c4fd | ||
|
|
e5db16098c | ||
|
|
317a0d7361 | ||
|
|
dc5e3b9ec5 | ||
|
|
82a649b67c | ||
|
|
1fd16ce13c | ||
|
|
89e6bf6d7a | ||
|
|
134ecc85d0 | ||
|
|
d118863525 | ||
|
|
cdc1d13baa | ||
|
|
a0be434e78 | ||
|
|
a3bc6643b7 | ||
|
|
8da8907446 | ||
|
|
9b67a3fd2e | ||
|
|
732b838637 | ||
|
|
37a0271532 | ||
|
|
b826684e26 | ||
|
|
747798efb8 | ||
|
|
6a629e51df | ||
|
|
5553c7cfe0 | ||
|
|
a006e78bd3 | ||
|
|
ab83849cea | ||
|
|
0211e0d557 | ||
|
|
0b481c72b6 | ||
|
|
0cd0d9a5ae | ||
|
|
2e38557f30 | ||
|
|
333b7dac15 | ||
|
|
5a2db5f1df | ||
|
|
eb22f2a6dc | ||
|
|
8baeca5b24 | ||
|
|
85da04e95b | ||
|
|
54ab82b3f9 | ||
|
|
9cbee2ceee | ||
|
|
6b57b49ae3 | ||
|
|
c6a071d2d2 | ||
|
|
8165e9b648 | ||
|
|
b1d4dd7add | ||
|
|
5797172366 | ||
|
|
64f590eaa1 | ||
|
|
a40c9444bb | ||
|
|
14347204d3 | ||
|
|
a30c309aa8 | ||
|
|
652703802c | ||
|
|
4c87eb44c2 | ||
|
|
c5c843e007 | ||
|
|
b2697d4205 | ||
|
|
29f82345df | ||
|
|
890741df89 | ||
|
|
e30285abc6 | ||
|
|
12c44eb56d | ||
|
|
7f04165e6f | ||
|
|
7b507740a8 | ||
|
|
4995ca8037 | ||
|
|
a43d5db22b | ||
|
|
77e00fe9da | ||
|
|
0fccfc51e6 | ||
|
|
1c1572053a | ||
|
|
a29ee70613 | ||
|
|
07157c53d0 | ||
|
|
a969055e89 | ||
|
|
a4e64fb55e | ||
|
|
992c81e203 | ||
|
|
3d963f8137 | ||
|
|
67e3d9d399 | ||
|
|
094e328c21 | ||
|
|
82c23bb595 | ||
|
|
1ec5cbf3de | ||
|
|
6dd16e4f26 | ||
|
|
29020b9048 | ||
|
|
278c927dd9 | ||
|
|
eb199c515b | ||
|
|
450a5bdd2d | ||
|
|
738a6daa71 | ||
|
|
72625f830b | ||
|
|
106844da7d | ||
|
|
b8afeb4321 | ||
|
|
521a2cb154 | ||
|
|
eb017efed9 | ||
|
|
1f6189acd0 | ||
|
|
e5940192b2 | ||
|
|
95d43281c3 | ||
|
|
d95861551a | ||
|
|
c4f48f14f1 | ||
|
|
f346733b72 | ||
|
|
23f0f906a2 | ||
|
|
d1a9c82bd1 | ||
|
|
79f306d721 | ||
|
|
381adb7449 | ||
|
|
d11cd571c9 | ||
|
|
b1e635598d | ||
|
|
0447ac8e64 | ||
|
|
90b1d65f2f | ||
|
|
038305d008 | ||
|
|
a12df58228 | ||
|
|
b4da152ea3 | ||
|
|
eaa6418668 | ||
|
|
3d8704720a | ||
|
|
1d390a62f9 | ||
|
|
ddbfcced85 | ||
|
|
5283098e13 | ||
|
|
12a3f2275c | ||
|
|
db50ec5a50 | ||
|
|
29343d0492 | ||
|
|
5e2411ab49 | ||
|
|
b447a1a7bc | ||
|
|
2f60dbe2e9 | ||
|
|
af30429f59 | ||
|
|
9419379a37 | ||
|
|
0de6dfa701 | ||
|
|
7563339557 | ||
|
|
0904e5e12a | ||
|
|
57ff8a875b | ||
|
|
798a4529fe | ||
|
|
f58d1d9978 | ||
|
|
79597b2a4a | ||
|
|
bbd006c0ce | ||
|
|
60d85ccb3d | ||
|
|
cba9ef7f73 | ||
|
|
ba71852396 | ||
|
|
8b39c006d8 | ||
|
|
f1872c18e6 | ||
|
|
7379599933 | ||
|
|
48594fd2cd | ||
|
|
8166ab4343 | ||
|
|
ad0e4b6691 | ||
|
|
db0834fab8 | ||
|
|
7071c92817 | ||
|
|
17e7431567 | ||
|
|
e9e4acc519 | ||
|
|
52d6f640e8 | ||
|
|
cd9a673cd7 | ||
|
|
6431e33a50 | ||
|
|
55804c9363 | ||
|
|
deefd67952 | ||
|
|
0ecfbbea12 | ||
|
|
6c99908c51 | ||
|
|
f3030ba726 | ||
|
|
df37f0c65c | ||
|
|
2188f34751 | ||
|
|
d89e39fcdc | ||
|
|
12335fa6aa | ||
|
|
c5f53eb8cb | ||
|
|
c3a6a2bc10 | ||
|
|
c8f9a56b7c | ||
|
|
be0b002a3e | ||
|
|
d4e5272b3a | ||
|
|
df4a528177 | ||
|
|
2ac013b1a5 | ||
|
|
478d4ab7cf | ||
|
|
3e6562c110 | ||
|
|
59018c74fe | ||
|
|
00e7a427a0 | ||
|
|
22f3361e1c | ||
|
|
0becd47010 | ||
|
|
f178ab7e82 | ||
|
|
c75274f93c | ||
|
|
b254d1fe03 | ||
|
|
802df2b744 | ||
|
|
93401be962 | ||
|
|
e1e1272f20 | ||
|
|
9baf5184bd | ||
|
|
caa20b1e31 | ||
|
|
6770762dd3 | ||
|
|
df4ac4c7e9 | ||
|
|
d553ceb286 | ||
|
|
ea8e90b7ce | ||
|
|
a562f4fbde | ||
|
|
47710b3b4f | ||
|
|
92629fa47b | ||
|
|
2beae4b5a5 | ||
|
|
f2d990adc1 | ||
|
|
047f39deb9 | ||
|
|
0f66923e84 | ||
|
|
fa06b433fc | ||
|
|
cd916794f0 | ||
|
|
fdd04d720f | ||
|
|
e08bbf3708 | ||
|
|
30e0e2518f | ||
|
|
9112af3fd1 | ||
|
|
65ca8c0b79 | ||
|
|
e2ca995fa3 | ||
|
|
a8dade3e27 | ||
|
|
3dabb1e51b | ||
|
|
bed5584e2a | ||
|
|
0c98a14e54 | ||
|
|
ec341c7e1f | ||
|
|
2d4e4f802f | ||
|
|
15126fa8c2 | ||
|
|
edc738528a | ||
|
|
8eb70827f3 | ||
|
|
05159a2750 | ||
|
|
05ac7ac578 | ||
|
|
fa2f5d3bc9 | ||
|
|
96fdbb60f1 | ||
|
|
00976fe56b | ||
|
|
41f0b62a32 | ||
|
|
4fa47e5643 | ||
|
|
e13f128877 | ||
|
|
9a718b8623 | ||
|
|
916095ba21 | ||
|
|
a8853c78ed | ||
|
|
b9ecc16a80 | ||
|
|
17fe68bd23 | ||
|
|
99006e446e | ||
|
|
01a4679360 | ||
|
|
0222a60b34 | ||
|
|
2dcb5b11f4 | ||
|
|
f657dbe781 | ||
|
|
52ee226853 | ||
|
|
f54b065ea7 | ||
|
|
0a3451df8a | ||
|
|
3880dd5161 | ||
|
|
78e376b56f | ||
|
|
17ebae657e | ||
|
|
91f580b235 | ||
|
|
762e199741 | ||
|
|
5f133dc1bb | ||
|
|
16990160f6 | ||
|
|
22f2279860 | ||
|
|
657c88188f | ||
|
|
317246dfcb | ||
|
|
f9eee2db81 | ||
|
|
8251c0d6ac | ||
|
|
d07ce169a8 | ||
|
|
0156594543 | ||
|
|
85452d7496 | ||
|
|
ba5da12f72 | ||
|
|
4249ec2c52 | ||
|
|
99ab3e3f56 | ||
|
|
c13c9657a4 | ||
|
|
8a653baab6 | ||
|
|
d0604192a5 | ||
|
|
4b4381cb84 | ||
|
|
6d407f1953 | ||
|
|
8d1e36f7e3 | ||
|
|
c90c201ab3 | ||
|
|
441582ddd8 | ||
|
|
aff23fcd97 | ||
|
|
f37c24e078 | ||
|
|
a55e5190c7 | ||
|
|
45747ae371 | ||
|
|
b74cce40fd | ||
|
|
46a5e01e86 | ||
|
|
168954a1d1 | ||
|
|
894c8f3ef2 | ||
|
|
5dac8a3b0e | ||
|
|
437bd21582 | ||
|
|
6267a331cb | ||
|
|
fc9a9b2ab2 | ||
|
|
d863ed8333 | ||
|
|
f9becb8622 | ||
|
|
98e19a5863 | ||
|
|
c76b1a30fa | ||
|
|
5f265f87d9 | ||
|
|
e39081afef | ||
|
|
0bc836492e | ||
|
|
192a9bf10f | ||
|
|
643e16ac3b | ||
|
|
76985f52b2 | ||
|
|
8155b6405f | ||
|
|
d840aae3ae | ||
|
|
94bc8b14d4 | ||
|
|
75c116ab2c | ||
|
|
0cde01aedc | ||
|
|
2f9a4d0e30 | ||
|
|
b4eecb7e2f | ||
|
|
b819b854dd | ||
|
|
e01893d4ca | ||
|
|
9e05364039 | ||
|
|
bfedf6212c | ||
|
|
968bed8c37 | ||
|
|
cd501207cf | ||
|
|
0fa2e104c5 | ||
|
|
d1859a1fc1 | ||
|
|
ba7fe276d4 | ||
|
|
4a69b0600a | ||
|
|
18976605f5 | ||
|
|
90aaa86507 | ||
|
|
d47f8a6ec0 | ||
|
|
111c1e2c20 | ||
|
|
fbb2b01c2c | ||
|
|
2243113487 | ||
|
|
4cd513abbc | ||
|
|
55b7aaea10 | ||
|
|
5bab6390a9 | ||
|
|
fdec65df6d | ||
|
|
b829bf55a0 | ||
|
|
8325937efa | ||
|
|
1bd71df911 | ||
|
|
3d2814f3c3 | ||
|
|
5c8756b04c | ||
|
|
7d1dcec23a | ||
|
|
e5d94b6381 | ||
|
|
ea5ef76f07 | ||
|
|
c4c3659cf2 | ||
|
|
62e819ee45 | ||
|
|
aab49a0b6a | ||
|
|
37d81cc2e2 | ||
|
|
d775acfa77 | ||
|
|
34bed6d9ec | ||
|
|
7baf4bdbb6 | ||
|
|
14ac4f3c54 | ||
|
|
d0200d9eff | ||
|
|
1383482892 | ||
|
|
600683ca05 | ||
|
|
ee682a94cb | ||
|
|
42ed75321c | ||
|
|
7cf4f7e21f | ||
|
|
7e99eddf64 | ||
|
|
a949e8fac2 | ||
|
|
59da340790 | ||
|
|
118cc185eb | ||
|
|
f6d90fb9ce | ||
|
|
ab1ca7b3dd | ||
|
|
3996031094 | ||
|
|
196f463f62 | ||
|
|
2c0a4e08a3 | ||
|
|
0441833277 | ||
|
|
b657b4c986 | ||
|
|
a3671ac092 | ||
|
|
c742a6ae90 | ||
|
|
008a56c968 | ||
|
|
7a8b9bd950 | ||
|
|
4d144d07e7 | ||
|
|
b951c85fec | ||
|
|
9f84eccdea | ||
|
|
c17ba76f38 | ||
|
|
a2638e741d | ||
|
|
09f8c2a029 | ||
|
|
e0d8e433c1 | ||
|
|
099d4217df | ||
|
|
fbb1226068 | ||
|
|
03d1ae1799 | ||
|
|
f0e1c34310 | ||
|
|
dda4f6c089 | ||
|
|
5e66eee143 | ||
|
|
9ec5e01204 | ||
|
|
66525ca43b | ||
|
|
0a9f0ef7d0 | ||
|
|
84023968e5 | ||
|
|
368c9c6d84 | ||
|
|
c8c29c490b | ||
|
|
07243717e2 | ||
|
|
2a5d3f5738 | ||
|
|
f3d3a0e751 | ||
|
|
1de1d24e96 | ||
|
|
9d683b445c | ||
|
|
2d6c58d653 | ||
|
|
27635a90c7 | ||
|
|
d7f6918abd | ||
|
|
7e1525b2e7 | ||
|
|
7bb8798ce7 | ||
|
|
dba06cd016 | ||
|
|
8ad944dcbc | ||
|
|
969096ef37 | ||
|
|
76c451b8c1 | ||
|
|
43b8a532e0 | ||
|
|
3434b611aa | ||
|
|
1e702ab351 | ||
|
|
678b263756 | ||
|
|
73145b0ed1 | ||
|
|
552a0ebdb2 | ||
|
|
247ef58d1a | ||
|
|
9c136858af | ||
|
|
df41317113 | ||
|
|
84cff96585 | ||
|
|
48aa18c000 | ||
|
|
635eb8bcc4 | ||
|
|
2a2a71e326 | ||
|
|
1d30a0a132 | ||
|
|
7a0363dd04 | ||
|
|
fc7c8ae9c3 | ||
|
|
5c6bd4a957 | ||
|
|
77416abdc5 | ||
|
|
ce788ad93a | ||
|
|
ecb7e58c24 | ||
|
|
8def689d42 | ||
|
|
1b489359c4 | ||
|
|
11d667e7eb | ||
|
|
fcf77487ed | ||
|
|
cc37ecaf2d | ||
|
|
9548c49a6a | ||
|
|
ec75d791f0 | ||
|
|
21b273736b | ||
|
|
5fd588d229 | ||
|
|
df135f2b4d | ||
|
|
cdbecb3946 | ||
|
|
f24badde9a | ||
|
|
69a8b5b457 | ||
|
|
e77d4369de | ||
|
|
3acd4349a5 | ||
|
|
64e9f56b80 | ||
|
|
39bc7d8020 | ||
|
|
53c9228ead | ||
|
|
3ddcf967d6 | ||
|
|
6d613d8d4a | ||
|
|
0e0126c220 | ||
|
|
694f2f3cc7 | ||
|
|
1b6f93fcfe | ||
|
|
2e8e834c0a | ||
|
|
158b668823 | ||
|
|
7912e6332f | ||
|
|
dac7d53a83 | ||
|
|
d86939c4c9 | ||
|
|
5d3f766d26 | ||
|
|
136d4499d5 | ||
|
|
e622dd68c2 | ||
|
|
859e25d4ad | ||
|
|
3993765614 | ||
|
|
d2ec53ea4a | ||
|
|
6eccc0c485 | ||
|
|
de628f984b | ||
|
|
2c62b3c3a1 | ||
|
|
285013b384 | ||
|
|
c1eb1102aa | ||
|
|
801a492c49 | ||
|
|
38c1f6f765 | ||
|
|
409e38cd65 | ||
|
|
adb45366da | ||
|
|
815b393a5a | ||
|
|
61ecf6d34f | ||
|
|
f7a201b94e | ||
|
|
d00b880a79 | ||
|
|
9b798c66c7 | ||
|
|
513e0cea96 | ||
|
|
85045dd09e | ||
|
|
42b7406da2 | ||
|
|
1257f68432 | ||
|
|
4a6ea63e87 | ||
|
|
36d3844cbb | ||
|
|
0ba344c712 | ||
|
|
1a4fe894fe | ||
|
|
42280e48f2 | ||
|
|
5db9e0e80d | ||
|
|
8473839e3a | ||
|
|
c31752dadf | ||
|
|
1353f87837 | ||
|
|
088117622c | ||
|
|
d643b80eb9 | ||
|
|
589c71635a | ||
|
|
b6b2d787e3 | ||
|
|
2b5f62a0b2 | ||
|
|
59a944cb63 | ||
|
|
4c51b68810 | ||
|
|
01cb1c2617 | ||
|
|
7bfbbc0efb | ||
|
|
376ef4a1f4 | ||
|
|
13053f649b | ||
|
|
841346f01f | ||
|
|
d21441bd9b | ||
|
|
ef4d6ce8e4 | ||
|
|
1507adbb8c | ||
|
|
942e06785c | ||
|
|
4a28b9b81c | ||
|
|
243116066d | ||
|
|
923b48fc63 | ||
|
|
c09245191c |
83
contrib/src/xrc/xh_html.cpp
Normal file
83
contrib/src/xrc/xh_html.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_html.cpp
|
||||
// Purpose: XRC resource for wxHtmlWindow
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "xh_html.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/xrc/xh_html.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/filesys.h"
|
||||
|
||||
|
||||
wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
|
||||
: wxXmlResourceHandler()
|
||||
{
|
||||
XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER);
|
||||
XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO);
|
||||
AddWindowStyles();
|
||||
}
|
||||
|
||||
wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
|
||||
{
|
||||
XRC_MAKE_INSTANCE(control, wxHtmlWindow)
|
||||
|
||||
control->Create(m_parentAsWindow,
|
||||
GetID(),
|
||||
GetPosition(), GetSize(),
|
||||
GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO),
|
||||
GetName());
|
||||
|
||||
if (HasParam(wxT("borders")))
|
||||
{
|
||||
control->SetBorders(GetDimension(wxT("borders")));
|
||||
}
|
||||
|
||||
if (HasParam(wxT("url")))
|
||||
{
|
||||
wxString url = GetParamValue(wxT("url"));
|
||||
wxFileSystem& fsys = GetCurFileSystem();
|
||||
|
||||
wxFSFile *f = fsys.OpenFile(url);
|
||||
if (f)
|
||||
{
|
||||
control->LoadPage(f->GetLocation());
|
||||
delete f;
|
||||
}
|
||||
else
|
||||
control->LoadPage(url);
|
||||
}
|
||||
|
||||
else if (HasParam(wxT("htmlcode")))
|
||||
{
|
||||
control->SetPage(GetText(wxT("htmlcode")));
|
||||
}
|
||||
|
||||
SetupWindow(control);
|
||||
|
||||
return control;
|
||||
}
|
||||
|
||||
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
|
||||
{
|
||||
return IsOfClass(node, wxT("wxHtmlWindow"));
|
||||
}
|
||||
|
||||
#endif // wxUSE_HTML
|
||||
262
docs/latex/wx/htcell.tex
Normal file
262
docs/latex/wx/htcell.tex
Normal file
@@ -0,0 +1,262 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlcell.tex at 21/Mar/99 22:45:23
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlCell}}\label{wxhtmlcell}
|
||||
|
||||
Internal data structure. It represents fragments of parsed HTML
|
||||
page, the so-called {\bf cell} - a word, picture, table, horizontal line and so on.
|
||||
It is used by \helpref{wxHtmlWindow}{wxhtmlwindow} and
|
||||
\helpref{wxHtmlWinParser}{wxhtmlwinparser} to represent HTML page in memory.
|
||||
|
||||
You can divide cells into two groups : {\it visible} cells with non-zero width and
|
||||
height and {\it helper} cells (usually with zero width and height) that
|
||||
perform special actions such as color or font change.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlcell.h>
|
||||
|
||||
\wxheading{See Also}
|
||||
|
||||
\helpref{Cells Overview}{cells},
|
||||
\helpref{wxHtmlContainerCell}{wxhtmlcontainercell}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlCell::wxHtmlCell}\label{wxhtmlcellwxhtmlcell}
|
||||
|
||||
\func{}{wxHtmlCell}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxHtmlCell::AdjustPagebreak}\label{wxhtmlcelladjustpagebreak}
|
||||
|
||||
\func{virtual bool}{AdjustPagebreak}{\param{int * }{pagebreak}}
|
||||
|
||||
This method is used to adjust pagebreak position. The parameter is
|
||||
variable that contains y-coordinate of page break (= horizontal line that
|
||||
should not be crossed by words, images etc.). If this cell cannot be divided
|
||||
into two pieces (each one on another page) then it moves the pagebreak
|
||||
few pixels up.
|
||||
|
||||
Returns true if pagebreak was modified, false otherwise
|
||||
|
||||
Usage:
|
||||
\begin{verbatim}
|
||||
while (container->AdjustPagebreak(&p)) {}
|
||||
\end{verbatim}
|
||||
|
||||
\membersection{wxHtmlCell::Draw}\label{wxhtmlcelldraw}
|
||||
|
||||
\func{virtual void}{Draw}{\param{wxDC\& }{dc}, \param{int }{x}, \param{int }{y}, \param{int }{view\_y1}, \param{int }{view\_y2}}
|
||||
|
||||
Renders the cell.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{dc}{Device context to which the cell is to be drawn}
|
||||
|
||||
\docparam{x,y}{Coordinates of parent's upper left corner (origin). You must
|
||||
add this to m\_PosX,m\_PosY when passing coordinates to dc's methods
|
||||
Example : {\tt dc -> DrawText("hello", x + m\_PosX, y + m\_PosY)}}
|
||||
|
||||
\docparam{view\_y1}{y-coord of the first line visible in window. This is
|
||||
used to optimize rendering speed}
|
||||
|
||||
\docparam{view\_y2}{y-coord of the last line visible in window. This is
|
||||
used to optimize rendering speed}
|
||||
|
||||
\membersection{wxHtmlCell::DrawInvisible}\label{wxhtmlcelldrawinvisible}
|
||||
|
||||
\func{virtual void}{DrawInvisible}{\param{wxDC\& }{dc}, \param{int }{x}, \param{int }{y}}
|
||||
|
||||
This method is called instead of \helpref{Draw}{wxhtmlcelldraw} when the
|
||||
cell is certainly out of the screen (and thus invisible). This is not
|
||||
nonsense - some tags (like \helpref{wxHtmlColourCell}{wxhtmlcolourcell}
|
||||
or font setter) must be drawn even if they are invisible!
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{dc}{Device context to which the cell is to be drawn}
|
||||
|
||||
\docparam{x,y}{Coordinates of parent's upper left corner. You must
|
||||
add this to m\_PosX,m\_PosY when passing coordinates to dc's methods
|
||||
Example : {\tt dc -> DrawText("hello", x + m\_PosX, y + m\_PosY)}}
|
||||
|
||||
\membersection{wxHtmlCell::Find}\label{wxhtmlcellfind}
|
||||
|
||||
\func{virtual const wxHtmlCell*}{Find}{\param{int }{condition}, \param{const void* }{param}}
|
||||
|
||||
Returns pointer to itself if this cell matches condition (or if any of the cells
|
||||
following in the list matches), NULL otherwise.
|
||||
(In other words if you call top-level container's Find it will
|
||||
return pointer to the first cell that matches the condition)
|
||||
|
||||
It is recommended way how to obtain pointer to particular cell or
|
||||
to cell of some type (e.g. wxHtmlAnchorCell reacts on
|
||||
wxHTML\_COND\_ISANCHOR condition)
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{condition}{Unique integer identifier of condition}
|
||||
|
||||
\docparam{param}{Optional parameters}
|
||||
|
||||
\wxheading{Defined conditions}
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_COND\_ISANCHOR}}{Finds particular anchor.
|
||||
{\it param} is pointer to wxString with name of the anchor.}
|
||||
\twocolitem{{\bf wxHTML\_COND\_USER}}{User-defined conditions start
|
||||
from this number.}
|
||||
\end{twocollist}
|
||||
|
||||
\membersection{wxHtmlCell::GetDescent}\label{wxhtmlcellgetdescent}
|
||||
|
||||
\constfunc{int}{GetDescent}{\void}
|
||||
|
||||
Returns descent value of the cell (m\_Descent member).
|
||||
\helponly{See explanation:
|
||||
|
||||
\image{}{descent.bmp}
|
||||
}
|
||||
|
||||
\membersection{wxHtmlCell::GetHeight}\label{wxhtmlcellgetheight}
|
||||
|
||||
\constfunc{int}{GetHeight}{\void}
|
||||
|
||||
Returns height of the cell (m\_Height member).
|
||||
|
||||
\membersection{wxHtmlCell::GetId}\label{wxhtmlcellgetid}
|
||||
|
||||
\constfunc{virtual wxString}{GetId}{\void}
|
||||
|
||||
Returns unique cell identifier if there is any, empty string otherwise.
|
||||
|
||||
\membersection{wxHtmlCell::GetLink}\label{wxhtmlcellgetlink}
|
||||
|
||||
\constfunc{virtual wxHtmlLinkInfo*}{GetLink}{\param{int }{x = 0}, \param{int }{y = 0}}
|
||||
|
||||
Returns hypertext link if associated with this cell or NULL otherwise.
|
||||
See \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
|
||||
(Note: this makes sense only for visible tags).
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{x,y}{Coordinates of position where the user pressed mouse button.
|
||||
These coordinates are used e.g. by COLORMAP. Values are relative to the
|
||||
upper left corner of THIS cell (i.e. from 0 to m\_Width or m\_Height)}
|
||||
|
||||
\membersection{wxHtmlCell::GetNext}\label{wxhtmlcellgetnext}
|
||||
|
||||
\constfunc{wxHtmlCell*}{GetNext}{\void}
|
||||
|
||||
Returns pointer to the next cell in list (see htmlcell.h if you're
|
||||
interested in details).
|
||||
|
||||
\membersection{wxHtmlCell::GetParent}\label{wxhtmlcellgetparent}
|
||||
|
||||
\constfunc{wxHtmlContainerCell*}{GetParent}{\void}
|
||||
|
||||
Returns pointer to parent container.
|
||||
|
||||
\membersection{wxHtmlCell::GetPosX}\label{wxhtmlcellgetposx}
|
||||
|
||||
\constfunc{int}{GetPosX}{\void}
|
||||
|
||||
Returns X position within parent (the value is relative to parent's
|
||||
upper left corner). The returned value is meaningful only if
|
||||
parent's \helpref{Layout}{wxhtmlcelllayout} was called before!
|
||||
|
||||
\membersection{wxHtmlCell::GetPosY}\label{wxhtmlcellgetposy}
|
||||
|
||||
\constfunc{int}{GetPosY}{\void}
|
||||
|
||||
Returns Y position within parent (the value is relative to parent's
|
||||
upper left corner). The returned value is meaningful only if
|
||||
parent's \helpref{Layout}{wxhtmlcelllayout} was called before!
|
||||
|
||||
\membersection{wxHtmlCell::GetWidth}\label{wxhtmlcellgetwidth}
|
||||
|
||||
\constfunc{int}{GetWidth}{\void}
|
||||
|
||||
Returns width of the cell (m\_Width member).
|
||||
|
||||
\membersection{wxHtmlCell::Layout}\label{wxhtmlcelllayout}
|
||||
|
||||
\func{virtual void}{Layout}{\param{int }{w}}
|
||||
|
||||
This method performs two actions:
|
||||
|
||||
\begin{enumerate}\itemsep=0pt
|
||||
\item adjusts the cell's width according to the fact that maximal possible width is {\it w}.
|
||||
(this has sense when working with horizontal lines, tables etc.)
|
||||
\item prepares layout (=fill-in m\_PosX, m\_PosY (and sometimes m\_Height) members)
|
||||
based on actual width {\it w}
|
||||
\end{enumerate}
|
||||
|
||||
It must be called before displaying cells structure because
|
||||
m\_PosX and m\_PosY are undefined (or invalid)
|
||||
before calling Layout.
|
||||
|
||||
\membersection{wxHtmlCell::OnMouseClick}\label{wxhtmlcellonmouseclick}
|
||||
|
||||
\func{virtual void}{OnMouseClick}{\param{wxWindow* }{parent}, \param{int}{x}, \param{int }{y}, \param{const wxMouseEvent\& }{event}}
|
||||
|
||||
This function is simple event handler. Each time the user clicks mouse button over a cell
|
||||
within \helpref{wxHtmlWindow}{wxhtmlwindow} this method of that cell is called. Default behavior is
|
||||
that it calls \helpref{wxHtmlWindow::LoadPage}{wxhtmlwindowloadpage}.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
If you need more "advanced" event handling
|
||||
you should use wxHtmlBinderCell instead.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{parent}{parent window (always wxHtmlWindow!)}
|
||||
|
||||
\docparam{x, y}{coordinates of mouse click (this is relative to cell's origin}
|
||||
|
||||
\docparam{left, middle, right}{boolean flags for mouse buttons. true if the left/middle/right
|
||||
button is pressed, false otherwise}
|
||||
|
||||
\membersection{wxHtmlCell::SetId}\label{wxhtmlcellsetid}
|
||||
|
||||
\func{void}{SetId}{\param{const wxString\& }{id}}
|
||||
|
||||
Sets unique cell identifier. Default value is no identifier, i.e. empty string.
|
||||
|
||||
\membersection{wxHtmlCell::SetLink}\label{wxhtmlcellsetlink}
|
||||
|
||||
\func{void}{SetLink}{\param{const wxHtmlLinkInfo\& }{link}}
|
||||
|
||||
Sets the hypertext link associated with this cell. (Default value
|
||||
is \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}("", "") (no link))
|
||||
|
||||
\membersection{wxHtmlCell::SetNext}\label{wxhtmlcellsetnext}
|
||||
|
||||
\func{void}{SetNext}{\param{wxHtmlCell }{*cell}}
|
||||
|
||||
Sets the next cell in the list. This shouldn't be called by user - it is
|
||||
to be used only by \helpref{wxHtmlContainerCell::InsertCell}{wxhtmlcontainercellinsertcell}.
|
||||
|
||||
\membersection{wxHtmlCell::SetParent}\label{wxhtmlcellsetparent}
|
||||
|
||||
\func{void}{SetParent}{\param{wxHtmlContainerCell }{*p}}
|
||||
|
||||
Sets parent container of this cell. This is called from
|
||||
\helpref{wxHtmlContainerCell::InsertCell}{wxhtmlcontainercellinsertcell}.
|
||||
|
||||
\membersection{wxHtmlCell::SetPos}\label{wxhtmlcellsetpos}
|
||||
|
||||
\func{void}{SetPos}{\param{int }{x}, \param{int }{y}}
|
||||
|
||||
Sets the cell's position within parent container.
|
||||
|
||||
37
docs/latex/wx/htcolor.tex
Normal file
37
docs/latex/wx/htcolor.tex
Normal file
@@ -0,0 +1,37 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlcolourcell.tex at 14/Mar/99 20:13:37
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlColourCell}}\label{wxhtmlcolourcell}
|
||||
|
||||
This cell changes the colour of either the background or the foreground.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxHtmlCell}{wxhtmlcell}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlcell.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlColourCell::wxHtmlColourCell}\label{wxhtmlcolourcellwxhtmlcolourcell}
|
||||
|
||||
\func{}{wxHtmlColourCell}{\param{wxColour }{clr}, \param{int }{flags = wxHTML\_CLR\_FOREGROUND}}
|
||||
|
||||
Constructor.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{clr}{The color}
|
||||
|
||||
\docparam{flags}{Can be one of following:
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_CLR\_FOREGROUND}}{change color of text}
|
||||
\twocolitem{{\bf wxHTML\_CLR\_BACKGROUND}}{change background color}
|
||||
\end{twocollist}
|
||||
}
|
||||
|
||||
250
docs/latex/wx/htcontnr.tex
Normal file
250
docs/latex/wx/htcontnr.tex
Normal file
@@ -0,0 +1,250 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlcontainercell.tex at 21/Mar/99 22:45:23
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlContainerCell}}\label{wxhtmlcontainercell}
|
||||
|
||||
The wxHtmlContainerCell class is an implementation of a cell that may
|
||||
contain more cells in it. It is heavily used in the wxHTML layout algorithm.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxHtmlCell}{wxhtmlcell}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlcell.h>
|
||||
|
||||
\wxheading{See Also}
|
||||
|
||||
\helpref{Cells Overview}{cells}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlContainerCell::wxHtmlContainerCell}\label{wxhtmlcontainercellwxhtmlcontainercell}
|
||||
|
||||
\func{}{wxHtmlContainerCell}{\param{wxHtmlContainerCell }{*parent}}
|
||||
|
||||
Constructor. {\it parent} is pointer to parent container or NULL.
|
||||
|
||||
|
||||
\membersection{wxHtmlContainerCell::GetAlignHor}\label{wxhtmlcontainercellgetalignhor}
|
||||
|
||||
\constfunc{int}{GetAlignHor}{\void}
|
||||
|
||||
Returns container's horizontal alignment.
|
||||
|
||||
\membersection{wxHtmlContainerCell::GetAlignVer}\label{wxhtmlcontainercellgetalignver}
|
||||
|
||||
\constfunc{int}{GetAlignVer}{\void}
|
||||
|
||||
Returns container's vertical alignment.
|
||||
|
||||
\membersection{wxHtmlContainerCell::GetBackgroundColour}\label{wxhtmlcontainercellgetbackgroundcolour}
|
||||
|
||||
\func{wxColour}{GetBackgroundColour}{\void}
|
||||
|
||||
Returns the background colour of the container or {\tt wxNullColour} if no background
|
||||
colour is set.
|
||||
|
||||
\membersection{wxHtmlContainerCell::GetFirstCell}\label{wxhtmlcontainercellgetfirstcell}
|
||||
|
||||
\func{wxHtmlCell*}{GetFirstCell}{\void}
|
||||
|
||||
Returns pointer to the first cell in the list.
|
||||
You can then use wxHtmlCell's GetNext method to obtain pointer to the next
|
||||
cell in list.
|
||||
|
||||
{\bf Note:} This shouldn't be used by the end user. If you need some way of
|
||||
finding particular cell in the list, try \helpref{Find}{wxhtmlcellfind} method
|
||||
instead.
|
||||
|
||||
\membersection{wxHtmlContainerCell::GetIndent}\label{wxhtmlcontainercellgetindent}
|
||||
|
||||
\constfunc{int}{GetIndent}{\param{int }{ind}}
|
||||
|
||||
Returns the indentation. {\it ind} is one of the {\bf wxHTML\_INDENT\_*} constants.
|
||||
|
||||
{\bf Note:} You must call \helpref{GetIndentUnits}{wxhtmlcontainercellgetindentunits}
|
||||
with same {\it ind} parameter in order to correctly interpret the returned integer value.
|
||||
It is NOT always in pixels!
|
||||
|
||||
\membersection{wxHtmlContainerCell::GetIndentUnits}\label{wxhtmlcontainercellgetindentunits}
|
||||
|
||||
\constfunc{int}{GetIndentUnits}{\param{int }{ind}}
|
||||
|
||||
Returns the units of indentation for {\it ind} where {\it ind} is one
|
||||
of the {\bf wxHTML\_INDENT\_*} constants.
|
||||
|
||||
\membersection{wxHtmlContainerCell::InsertCell}\label{wxhtmlcontainercellinsertcell}
|
||||
|
||||
\func{void}{InsertCell}{\param{wxHtmlCell }{*cell}}
|
||||
|
||||
Inserts new cell into the container.
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetAlign}\label{wxhtmlcontainercellsetalign}
|
||||
|
||||
\func{void}{SetAlign}{\param{const wxHtmlTag\& }{tag}}
|
||||
|
||||
Sets the container's alignment (both horizontal and vertical) according to
|
||||
the values stored in {\it tag}. (Tags {\tt ALIGN} parameter is extracted.) In fact
|
||||
it is only a front-end to \helpref{SetAlignHor}{wxhtmlcontainercellsetalignhor}
|
||||
and \helpref{SetAlignVer}{wxhtmlcontainercellsetalignver}.
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetAlignHor}\label{wxhtmlcontainercellsetalignhor}
|
||||
|
||||
\func{void}{SetAlignHor}{\param{int }{al}}
|
||||
|
||||
Sets the container's {\it horizontal alignment}. During \helpref{Layout}{wxhtmlcelllayout}
|
||||
each line is aligned according to {\it al} value.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{al}{new horizontal alignment. May be one of these values:
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_LEFT}}{lines are left-aligned (default)}
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_JUSTIFY}}{lines are justified}
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_CENTER}}{lines are centered}
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_RIGHT}}{lines are right-aligned}
|
||||
\end{twocollist}
|
||||
}
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetAlignVer}\label{wxhtmlcontainercellsetalignver}
|
||||
|
||||
\func{void}{SetAlignVer}{\param{int }{al}}
|
||||
|
||||
Sets the container's {\it vertical alignment}. This is per-line alignment!
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{al}{new vertical alignment. May be one of these values:
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_BOTTOM}}{cells are over the line (default)}
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_CENTER}}{cells are centered on line}
|
||||
\twocolitem{{\bf wxHTML\_ALIGN\_TOP}}{cells are under the line}
|
||||
\end{twocollist}
|
||||
|
||||
\helponly{\image{}{alignv.bmp}}
|
||||
}
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetBackgroundColour}\label{wxhtmlcontainercellsetbackgroundcolour}
|
||||
|
||||
\func{void}{SetBackgroundColour}{\param{const wxColour\& }{clr}}
|
||||
|
||||
Sets the background colour for this container.
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetBorder}\label{wxhtmlcontainercellsetborder}
|
||||
|
||||
\func{void}{SetBorder}{\param{const wxColour\& }{clr1}, \param{const wxColour\& }{clr2}}
|
||||
|
||||
Sets the border (frame) colours. A border is a rectangle around the container.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{clr1}{Colour of top and left lines}
|
||||
|
||||
\docparam{clr2}{Colour of bottom and right lines}
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetIndent}\label{wxhtmlcontainercellsetindent}
|
||||
|
||||
\func{void}{SetIndent}{\param{int }{i}, \param{int }{what}, \param{int }{units = wxHTML\_UNITS\_PIXELS}}
|
||||
|
||||
Sets the indentation (free space between borders of container and subcells).
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{i}{Indentation value.}
|
||||
|
||||
\docparam{what}{Determines which of the four borders we're setting. It is OR
|
||||
combination of following constants:
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_TOP}}{top border}
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_BOTTOM}}{bottom}
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_LEFT}}{left}
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_RIGHT}}{right}
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_HORIZONTAL}}{left and right}
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_VERTICAL}}{top and bottom}
|
||||
\twocolitem{{\bf wxHTML\_INDENT\_ALL}}{all 4 borders}
|
||||
\end{twocollist}
|
||||
|
||||
\helponly{\image{}{indent.bmp}}
|
||||
}
|
||||
|
||||
\docparam{units}{Units of {\it i}. This parameter affects interpretation of {\it} value.
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_UNITS\_PIXELS}}{{\it i} is number of pixels}
|
||||
\twocolitem{{\bf wxHTML\_UNITS\_PERCENT}}{{\it i} is interpreted as percents of width
|
||||
of parent container}
|
||||
\end{twocollist}
|
||||
}
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetMinHeight}\label{wxhtmlcontainercellsetminheight}
|
||||
|
||||
\func{void}{SetMinHeight}{\param{int }{h}, \param{int }{align = wxHTML\_ALIGN\_TOP}}
|
||||
|
||||
Sets minimal height of the container.
|
||||
|
||||
When container's \helpref{Layout}{wxhtmlcelllayout} is called, m\_Height
|
||||
is set depending on layout of subcells to the height of area covered
|
||||
by layed-out subcells. Calling this method guarantees you that the height
|
||||
of container is never smaller than {\it h} - even if the subcells cover
|
||||
much smaller area.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{h}{The minimal height.}
|
||||
|
||||
\docparam{align}{If height of the container is lower than the minimum height, empty space must be inserted
|
||||
somewhere in order to ensure minimal height. This parameter is one of {\bf wxHTML\_ALIGN\_TOP,
|
||||
wxHTML\_ALIGN\_BOTTOM, wxHTML\_ALIGN\_CENTER}. It refers to the {\it contents}, not to the
|
||||
empty place.}
|
||||
|
||||
\membersection{wxHtmlContainerCell::SetWidthFloat}\label{wxhtmlcontainercellsetwidthfloat}
|
||||
|
||||
\func{void}{SetWidthFloat}{\param{int }{w}, \param{int }{units}}
|
||||
|
||||
\func{void}{SetWidthFloat}{\param{const wxHtmlTag\& }{tag}, \param{double }{pixel\_scale = 1.0}}
|
||||
|
||||
Sets floating width adjustment.
|
||||
|
||||
The normal behaviour of container is that its width is the same as the width of
|
||||
parent container (and thus you can have only one sub-container per line).
|
||||
You can change this by setting FWA.
|
||||
|
||||
{\it pixel\_scale} is number of real pixels that equals to 1 HTML pixel.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{w}{Width of the container. If the value is negative it means
|
||||
complement to full width of parent container (e.g.
|
||||
{\tt SetWidthFloat(-50, wxHTML\_UNITS\_PIXELS)} sets the width
|
||||
of container to parent's width minus 50 pixels. This is useful when
|
||||
creating tables - you can call SetWidthFloat(50) and SetWidthFloat(-50))}
|
||||
|
||||
\docparam{units}{Units of {\it w} This parameter affects the interpretation of {\it} value.
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_UNITS\_PIXELS}}{{\it w} is number of pixels}
|
||||
\twocolitem{{\bf wxHTML\_UNITS\_PERCENT}}{{\it w} is interpreted as percents of width
|
||||
of parent container}
|
||||
\end{twocollist}
|
||||
}
|
||||
|
||||
\docparam{tag}{In the second version of method, {\it w} and {\it units}
|
||||
info is extracted from tag's {\tt WIDTH} parameter.}
|
||||
|
||||
\pythonnote{The second form of this method is named
|
||||
SetWidthFloatFromTag in wxPython.}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
111
docs/latex/wx/htdcrend.tex
Normal file
111
docs/latex/wx/htdcrend.tex
Normal file
@@ -0,0 +1,111 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmprint.h at 17/Oct/99 12:48:02
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlDCRenderer}}\label{wxhtmldcrenderer}
|
||||
|
||||
This class can render HTML document into a specified area of a DC. You can use it
|
||||
in your own printing code, although use of \helpref{wxHtmlEasyPrinting}{wxhtmleasyprinting}
|
||||
or \helpref{wxHtmlPrintout}{wxhtmlprintout} is strongly recommended.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmprint.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlDCRenderer::wxHtmlDCRenderer}\label{wxhtmldcrendererwxhtmldcrenderer}
|
||||
|
||||
\func{}{wxHtmlDCRenderer}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxHtmlDCRenderer::SetDC}\label{wxhtmldcrenderersetdc}
|
||||
|
||||
\func{void}{SetDC}{\param{wxDC* }{dc}, \param{double }{pixel\_scale = 1.0}}
|
||||
|
||||
Assign DC instance to the renderer.
|
||||
|
||||
{\it pixel\_scale} can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics.
|
||||
(Many dimensions in HTML are given in pixels -- e.g. image sizes. 300x300 image would be only one
|
||||
inch wide on typical printer. With pixel\_scale = 3.0 it would be 3 inches.)
|
||||
|
||||
\membersection{wxHtmlDCRenderer::SetFonts}\label{wxhtmldcrenderersetfonts}
|
||||
|
||||
\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}}
|
||||
|
||||
Sets fonts. See \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} for
|
||||
detailed description.
|
||||
|
||||
See also \helpref{SetSize}{wxhtmldcrenderersetsize}.
|
||||
|
||||
\membersection{wxHtmlDCRenderer::SetSize}\label{wxhtmldcrenderersetsize}
|
||||
|
||||
\func{void}{SetSize}{\param{int }{width}, \param{int }{height}}
|
||||
|
||||
Set size of output rectangle, in pixels. Note that you {\bf can't} change
|
||||
width of the rectangle between calls to \helpref{Render}{wxhtmldcrendererrender}!
|
||||
(You can freely change height.)
|
||||
|
||||
\membersection{wxHtmlDCRenderer::SetHtmlText}\label{wxhtmldcrenderersethtmltext}
|
||||
|
||||
\func{void}{SetHtmlText}{\param{const wxString\& }{html}, \param{const wxString\& }{basepath = wxEmptyString}, \param{bool }{isdir = true}}
|
||||
|
||||
Assign text to the renderer. \helpref{Render}{wxhtmldcrendererrender} then draws
|
||||
the text onto DC.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{html}{HTML text. This is {\it not} a filename.}
|
||||
|
||||
\docparam{basepath}{base directory (html string would be stored there if it was in
|
||||
file). It is used to determine path for loading images, for example.}
|
||||
|
||||
\docparam{isdir}{false if basepath is filename, true if it is directory name
|
||||
(see \helpref{wxFileSystem}{wxfilesystem} for detailed explanation)}
|
||||
|
||||
\membersection{wxHtmlDCRenderer::Render}\label{wxhtmldcrendererrender}
|
||||
|
||||
\func{int}{Render}{\param{int }{x}, \param{int }{y}, \param{int }{from = 0}, \param{int }{dont\_render = false}}
|
||||
|
||||
Renders HTML text to the DC.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{x,y}{ position of upper-left corner of printing rectangle (see \helpref{SetSize}{wxhtmldcrenderersetsize})}
|
||||
|
||||
\docparam{from}{y-coordinate of the very first visible cell}
|
||||
|
||||
\docparam{dont\_render}{if true then this method only returns y coordinate of the next page
|
||||
and does not output anything}
|
||||
|
||||
Returned value is y coordinate of first cell than didn't fit onto page.
|
||||
Use this value as {\it from} in next call to Render in order to print multipages
|
||||
document.
|
||||
|
||||
\wxheading{Caution!}
|
||||
|
||||
The Following three methods {\bf must} always be called before any call to Render (preferably
|
||||
in this order):
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
\item \helpref{SetDC}{wxhtmldcrenderersetdc}
|
||||
\item \helpref{SetSize}{wxhtmldcrenderersetsize}
|
||||
\item \helpref{SetHtmlText}{wxhtmldcrenderersethtmltext}
|
||||
\end{itemize}
|
||||
|
||||
{\bf Render() changes the DC's user scale and does NOT restore it.}
|
||||
|
||||
\membersection{wxHtmlDCRenderer::GetTotalHeight}\label{wxhtmldcrenderergettotalheight}
|
||||
|
||||
\func{int}{GetTotalHeight}{\void}
|
||||
|
||||
Returns the height of the HTML text. This is important if area height (see \helpref{SetSize}{wxhtmldcrenderersetsize})
|
||||
is smaller that total height and thus the page cannot fit into it. In that case you're supposed to
|
||||
call \helpref{Render}{wxhtmldcrendererrender} as long as its return value is smaller than GetTotalHeight's.
|
||||
|
||||
164
docs/latex/wx/hteasypr.tex
Normal file
164
docs/latex/wx/hteasypr.tex
Normal file
@@ -0,0 +1,164 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmprint.h at 17/Oct/99 12:48:02
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlEasyPrinting}}\label{wxhtmleasyprinting}
|
||||
|
||||
This class provides very simple interface to printing
|
||||
architecture. It allows you to print HTML documents using
|
||||
only a few commands.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
Do not create this class on the stack only. You should create an instance on app
|
||||
startup and use this instance for all printing operations. The reason is that
|
||||
this class stores various settings in it.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmprint.h>
|
||||
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::wxHtmlEasyPrinting}\label{wxhtmleasyprintingwxhtmleasyprinting}
|
||||
|
||||
\func{}{wxHtmlEasyPrinting}{\param{const wxString\& }{name = "Printing"}, \param{wxWindow* }{parentWindow = NULL}}
|
||||
|
||||
Constructor.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{name}{Name of the printing object. Used by preview frames and setup dialogs.}
|
||||
|
||||
\docparam{parentWindow}{pointer to the window that will own the preview frame and setup dialogs. May be NULL.}
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::PreviewFile}\label{wxhtmleasyprintingpreviewfile}
|
||||
|
||||
\func{bool}{PreviewFile}{\param{const wxString\& }{htmlfile}}
|
||||
|
||||
Preview HTML file.
|
||||
|
||||
Returns false in case of error -- call
|
||||
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
|
||||
information about the kind of the error.
|
||||
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::PreviewText}\label{wxhtmleasyprintingpreviewtext}
|
||||
|
||||
\func{bool}{PreviewText}{\param{const wxString\& }{htmltext}, \param{const wxString\& }{basepath = wxEmptyString}}
|
||||
|
||||
Preview HTML text (not file!).
|
||||
|
||||
Returns false in case of error -- call
|
||||
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
|
||||
information about the kind of the error.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{htmltext}{HTML text.}
|
||||
|
||||
\docparam{basepath}{base directory (html string would be stored there if it was in
|
||||
file). It is used to determine path for loading images, for example.}
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::PrintFile}\label{wxhtmleasyprintingprintfile}
|
||||
|
||||
\func{bool}{PrintFile}{\param{const wxString\& }{htmlfile}}
|
||||
|
||||
Print HTML file.
|
||||
|
||||
Returns false in case of error -- call
|
||||
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
|
||||
information about the kind of the error.
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::PrintText}\label{wxhtmleasyprintingprinttext}
|
||||
|
||||
\func{bool}{PrintText}{\param{const wxString\& }{htmltext}, \param{const wxString\& }{basepath = wxEmptyString}}
|
||||
|
||||
Print HTML text (not file!).
|
||||
|
||||
Returns false in case of error -- call
|
||||
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
|
||||
information about the kind of the error.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{htmltext}{HTML text.}
|
||||
|
||||
\docparam{basepath}{base directory (html string would be stored there if it was in
|
||||
file). It is used to determine path for loading images, for example.}
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::PrinterSetup}\label{wxhtmleasyprintingprintersetup}
|
||||
|
||||
\func{void}{PrinterSetup}{\void}
|
||||
|
||||
Display printer setup dialog and allows the user to modify settings.
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::PageSetup}\label{wxhtmleasyprintingpagesetup}
|
||||
|
||||
\func{void}{PageSetup}{\void}
|
||||
|
||||
Display page setup dialog and allows the user to modify settings.
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::SetFonts}\label{wxhtmleasyprintingsetfonts}
|
||||
|
||||
\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}}
|
||||
|
||||
Sets fonts. See \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} for
|
||||
detailed description.
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::SetHeader}\label{wxhtmleasyprintingsetheader}
|
||||
|
||||
\func{void}{SetHeader}{\param{const wxString\& }{header}, \param{int }{pg = wxPAGE\_ALL}}
|
||||
|
||||
Set page header.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{header}{HTML text to be used as header. You can use macros in it:
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
\item @PAGENUM@ is replaced by page number
|
||||
\item @PAGESCNT@ is replaced by total number of pages
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::SetFooter}\label{wxhtmleasyprintingsetfooter}
|
||||
|
||||
\func{void}{SetFooter}{\param{const wxString\& }{footer}, \param{int }{pg = wxPAGE\_ALL}}
|
||||
|
||||
Set page footer.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{footer}{HTML text to be used as footer. You can use macros in it:
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
\item @PAGENUM@ is replaced by page number
|
||||
\item @PAGESCNT@ is replaced by total number of pages
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::GetPrintData}\label{wxhtmleasyprintinggetprintdata}
|
||||
|
||||
\func{wxPrintData*}{GetPrintData}{\void}
|
||||
|
||||
Returns pointer to \helpref{wxPrintData}{wxprintdata} instance used by this class. You can
|
||||
set its parameters (via SetXXXX methods).
|
||||
|
||||
\membersection{wxHtmlEasyPrinting::GetPageSetupData}\label{wxhtmleasyprintinggetpagesetupdata}
|
||||
|
||||
\func{wxPageSetupDialogData*}{GetPageSetupData}{\void}
|
||||
|
||||
Returns a pointer to \helpref{wxPageSetupDialogData}{wxpagesetupdialogdata} instance used by
|
||||
this class. You can set its parameters (via SetXXXX methods).
|
||||
|
||||
63
docs/latex/wx/htfilter.tex
Normal file
63
docs/latex/wx/htfilter.tex
Normal file
@@ -0,0 +1,63 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlfilter.tex at 29/Mar/99 18:35:09
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlFilter}}\label{wxhtmlfilter}
|
||||
|
||||
This class is an input filter for \helpref{wxHtmlWindow}{wxhtmlwindow}.
|
||||
It allows you to read and display files of different file formats.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlfilt.h>
|
||||
|
||||
|
||||
\wxheading{See Also}
|
||||
|
||||
\helpref{Overview}{filters}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlFilter::wxHtmlFilter}\label{wxhtmlfilterwxhtmlfilter}
|
||||
|
||||
\func{}{wxHtmlFilter}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxHtmlFilter::CanRead}\label{wxhtmlfiltercanread}
|
||||
|
||||
\func{bool}{CanRead}{\param{const wxFSFile\& }{file}}
|
||||
|
||||
Returns true if this filter is capable of reading file {\it file}.
|
||||
|
||||
Example:
|
||||
|
||||
\begin{verbatim}
|
||||
bool MyFilter::CanRead(const wxFSFile& file)
|
||||
{
|
||||
return (file.GetMimeType() == "application/x-ugh");
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
\membersection{wxHtmlFilter::ReadFile}\label{wxhtmlfilterreadfile}
|
||||
|
||||
\func{wxString}{ReadFile}{\param{const wxFSFile\& }{file}}
|
||||
|
||||
Reads the file and returns string with HTML document.
|
||||
|
||||
Example:
|
||||
|
||||
\begin{verbatim}
|
||||
wxString MyImgFilter::ReadFile(const wxFSFile& file)
|
||||
{
|
||||
return "<html><body><img src=\"" +
|
||||
file.GetLocation() +
|
||||
"\"></body></html>";
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
221
docs/latex/wx/hthelpct.tex
Normal file
221
docs/latex/wx/hthelpct.tex
Normal file
@@ -0,0 +1,221 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlhelp.h at 02/May/99 19:58:53
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlHelpController}}\label{wxhtmlhelpcontroller}
|
||||
|
||||
{\bf WARNING!} Although this class has an API compatible with other wxWindows
|
||||
help controllers as documented by \helpref{wxHelpController}{wxhelpcontroller}, it
|
||||
is recommended that you use the enhanced capabilities of wxHtmlHelpController's API.
|
||||
|
||||
This help controller provides an easy way of displaying HTML help in your
|
||||
application (see {\it test} sample). The help system is based on {\bf books}
|
||||
(see \helpref{AddBook}{wxhtmlhelpcontrolleraddbook}). A book is a logical
|
||||
section of documentation (for example "User's Guide" or "Programmer's Guide" or
|
||||
"C++ Reference" or "wxWindows Reference"). The help controller can handle as
|
||||
many books as you want.
|
||||
|
||||
wxHTML uses Microsoft's HTML Help Workshop project files (.hhp, .hhk, .hhc) as its
|
||||
native format. The file format is described \helpref{here}{helpformat}.
|
||||
Have a look at docs/html/ directory where sample project files are stored.
|
||||
|
||||
You can use Tex2RTF to produce these files when generating HTML, if you set {\bf htmlWorkshopFiles} to {\bf true} in
|
||||
your tex2rtf.ini file.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
It is strongly recommended to use preprocessed {\bf .hhp.cached} version of
|
||||
projects. It can be either created on-the-fly (see
|
||||
\helpref{SetTempDir}{wxhtmlhelpcontrollersettempdir}) or you can use
|
||||
{\bf hhp2cached} utility from {\it utils/hhp2cached} to create it and
|
||||
distribute the cached version together with helpfiles. See {\it samples/html/help}
|
||||
sample for demonstration of its use.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Information about wxBestHelpController}{wxhelpcontroller}
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
wxHelpControllerBase
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/helpctrl.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlHelpController::wxHtmlHelpController}\label{wxhtmlhelpcontrollerwxhtmlhelpcontroller}
|
||||
|
||||
\func{}{wxHtmlHelpController}{\param{int }{style = wxHF\_DEFAULT\_STYLE}}
|
||||
|
||||
Constructor.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
{\it style} is combination of these flags:
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{\windowstyle{wxHF\_TOOLBAR}}{Help frame has toolbar.}
|
||||
\twocolitem{\windowstyle{wxHF\_FLAT\_TOOLBAR}}{Help frame has toolbar with flat buttons (aka coolbar).}
|
||||
\twocolitem{\windowstyle{wxHF\_CONTENTS}}{Help frame has contents panel.}
|
||||
\twocolitem{\windowstyle{wxHF\_INDEX}}{Help frame has index panel.}
|
||||
\twocolitem{\windowstyle{wxHF\_SEARCH}}{Help frame has search panel.}
|
||||
\twocolitem{\windowstyle{wxHF\_BOOKMARKS}}{Help frame has bookmarks controls.}
|
||||
\twocolitem{\windowstyle{wxHF\_OPEN\_FILES}}{Allow user to open arbitrary HTML document.}
|
||||
\twocolitem{\windowstyle{wxHF\_PRINT}}{Toolbar contains "print" button.}
|
||||
\twocolitem{\windowstyle{wxHF\_MERGE\_BOOKS}}{Contents pane does not show
|
||||
book nodes. All books are merged together and appear as single book to the
|
||||
user.}
|
||||
\twocolitem{\windowstyle{wxHF\_ICONS\_BOOK}}{All nodes in contents pane
|
||||
have a book icon. This is how Microsoft's HTML help viewer behaves.}
|
||||
\twocolitem{\windowstyle{wxHF\_ICONS\_FOLDER}}{Book nodes in contents pane have
|
||||
a book icon, book's sections have a folder icon. This is the default.}
|
||||
\twocolitem{\windowstyle{wxHF\_ICONS\_BOOK\_CHAPTER}}{Both book nodes and
|
||||
nodes of top-level sections of a book (i.e. chapters) have a book icon,
|
||||
all other sections (sections, subsections, ...) have a folder icon.}
|
||||
\twocolitem{\windowstyle{wxHF\_DEFAULT\_STYLE}}{{\tt wxHF\_TOOLBAR | wxHF\_CONTENTS
|
||||
| wxHF\_INDEX | wxHF\_SEARCH | wxHF\_BOOKMARKS | wxHF\_PRINT}}
|
||||
\end{twocollist}
|
||||
|
||||
\membersection{wxHtmlHelpController::AddBook}\label{wxhtmlhelpcontrolleraddbook}
|
||||
|
||||
\func{bool}{AddBook}{\param{const wxFileName\& }{book\_file}, \param{bool }{show\_wait\_msg}}
|
||||
|
||||
\func{bool}{AddBook}{\param{const wxString\& }{book\_url}, \param{bool }{show\_wait\_msg}}
|
||||
|
||||
Adds book (\helpref{.hhp file}{helpformat} - HTML Help Workshop project file) into the list of loaded books.
|
||||
This must be called at least once before displaying any help.
|
||||
|
||||
{\it book\_file} or {\it book\_url} may be either .hhp file or ZIP archive
|
||||
that contains arbitrary number of .hhp files in
|
||||
top-level directory. This ZIP archive must have .zip or .htb extension
|
||||
(the latter stands for "HTML book"). In other words,
|
||||
{\tt AddBook(wxFileName("help.zip"))}
|
||||
is possible and, in fact, recommended way.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{show\_wait\_msg}{If true then a decoration-less window with progress message is displayed.}
|
||||
\docparam{book\_file}{Help book filename. It is recommended to use this prototype
|
||||
instead of the one taking URL, because it is less error-prone.}
|
||||
\docparam{book\_url}{Help book URL (note that syntax of filename and URL is
|
||||
different on most platforms)}
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
Don't forget to install wxFileSystem ZIP handler with
|
||||
{\tt wxFileSystem::AddHandler(new wxZipFSHandler);} before calling this method
|
||||
on a .zip or .htb file!
|
||||
|
||||
\membersection{wxHtmlHelpController::CreateHelpFrame}\label{wxhtmlhelpcontrollercreatehelpframe}
|
||||
|
||||
\func{virtual wxHtmlHelpFrame*}{CreateHelpFrame}{\param{wxHtmlHelpData * }{data}}
|
||||
|
||||
This protected virtual method may be overridden so that the controller
|
||||
uses slightly different frame. See {\it samples/html/helpview} sample for
|
||||
an example.
|
||||
\membersection{wxHtmlHelpController::Display}\label{wxhtmlhelpcontrollerdisplay}
|
||||
|
||||
\func{void}{Display}{\param{const wxString\& }{x}}
|
||||
|
||||
Displays page {\it x}. This is THE important function - it is used to display
|
||||
the help in application.
|
||||
|
||||
You can specify the page in many ways:
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
\item as direct filename of HTML document
|
||||
\item as chapter name (from contents) or as a book name
|
||||
\item as some word from index
|
||||
\item even as any word (will be searched)
|
||||
\end{itemize}
|
||||
|
||||
Looking for the page runs in these steps:
|
||||
|
||||
\begin{enumerate}\itemsep=0pt
|
||||
\item try to locate file named x (if x is for example "doc/howto.htm")
|
||||
\item try to open starting page of book named x
|
||||
\item try to find x in contents (if x is for example "How To ...")
|
||||
\item try to find x in index (if x is for example "How To ...")
|
||||
\item switch to Search panel and start searching
|
||||
\end{enumerate}
|
||||
|
||||
\func{void}{Display}{\param{const int }{id}}
|
||||
|
||||
This alternative form is used to search help contents by numeric IDs.
|
||||
|
||||
\pythonnote{The second form of this method is named DisplayId in
|
||||
wxPython.}
|
||||
|
||||
\membersection{wxHtmlHelpController::DisplayContents}\label{wxhtmlhelpcontrollerdisplaycontents}
|
||||
|
||||
\func{void}{DisplayContents}{\void}
|
||||
|
||||
Displays help window and focuses contents panel.
|
||||
|
||||
\membersection{wxHtmlHelpController::DisplayIndex}\label{wxhtmlhelpcontrollerdisplayindex}
|
||||
|
||||
\func{void}{DisplayIndex}{\void}
|
||||
|
||||
Displays help window and focuses index panel.
|
||||
|
||||
\membersection{wxHtmlHelpController::KeywordSearch}\label{wxhtmlhelpcontrollerkeywordsearch}
|
||||
|
||||
\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}}
|
||||
|
||||
Displays help window, focuses search panel and starts searching.
|
||||
Returns true if the keyword was found.
|
||||
|
||||
{\bf Important:} KeywordSearch searches only pages listed in .hhc file(s).
|
||||
You should list all pages in the contents file.
|
||||
|
||||
\membersection{wxHtmlHelpController::ReadCustomization}\label{wxhtmlhelpcontrollerreadcustomization}
|
||||
|
||||
\func{void}{ReadCustomization}{\param{wxConfigBase* }{cfg}, \param{wxString }{path = wxEmptyString}}
|
||||
|
||||
Reads the controller's setting (position of window, etc.)
|
||||
|
||||
\membersection{wxHtmlHelpController::SetTempDir}\label{wxhtmlhelpcontrollersettempdir}
|
||||
|
||||
\func{void}{SetTempDir}{\param{const wxString\& }{path}}
|
||||
|
||||
Sets the path for storing temporary files - cached binary versions of index and contents files. These binary
|
||||
forms are much faster to read. Default value is empty string (empty string means
|
||||
that no cached data are stored). Note that these files are {\it not}
|
||||
deleted when program exits.
|
||||
|
||||
Once created these cached files will be used in all subsequent executions
|
||||
of your application. If cached files become older than corresponding .hhp
|
||||
file (e.g. if you regenerate documentation) it will be refreshed.
|
||||
|
||||
\membersection{wxHtmlHelpController::SetTitleFormat}\label{wxhtmlhelpcontrollersettitleformat}
|
||||
|
||||
\func{void}{SetTitleFormat}{\param{const wxString\& }{format}}
|
||||
|
||||
Sets format of title of the frame. Must contain exactly one "\%s"
|
||||
(for title of displayed HTML page).
|
||||
|
||||
\membersection{wxHtmlHelpController::UseConfig}\label{wxhtmlhelpcontrolleruseconfig}
|
||||
|
||||
\func{void}{UseConfig}{\param{wxConfigBase* }{config}, \param{const wxString\& }{rootpath = wxEmptyString}}
|
||||
|
||||
Associates {\it config} object with the controller.
|
||||
|
||||
If there is associated config object, wxHtmlHelpController automatically
|
||||
reads and writes settings (including wxHtmlWindow's settings) when needed.
|
||||
|
||||
The only thing you must do is create wxConfig object and call UseConfig.
|
||||
|
||||
If you do not use {\it UseConfig}, wxHtmlHelpController will use
|
||||
default wxConfig object if available (for details see
|
||||
\helpref{wxConfigBase::Get}{wxconfigbaseget} and
|
||||
\helpref{wxConfigBase::Set}{wxconfigbaseset}).
|
||||
|
||||
\membersection{wxHtmlHelpController::WriteCustomization}\label{wxhtmlhelpcontrollerwritecustomization}
|
||||
|
||||
\func{void}{WriteCustomization}{\param{wxConfigBase* }{cfg}, \param{wxString }{path = wxEmptyString}}
|
||||
|
||||
Stores controllers setting (position of window etc.)
|
||||
|
||||
87
docs/latex/wx/hthlpdat.tex
Normal file
87
docs/latex/wx/hthlpdat.tex
Normal file
@@ -0,0 +1,87 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% helpdata.h at 24/Oct/99 18:03:10
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlHelpData}}\label{wxhtmlhelpdata}
|
||||
|
||||
This class is used by \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}
|
||||
and \helpref{wxHtmlHelpFrame}{wxhtmlhelpframe} to access HTML help items.
|
||||
It is internal class and should not be used directly - except for the case
|
||||
you're writing your own HTML help controller.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/helpdata.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlHelpData::wxHtmlHelpData}\label{wxhtmlhelpdatawxhtmlhelpdata}
|
||||
|
||||
\func{}{wxHtmlHelpData}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxHtmlHelpData::AddBook}\label{wxhtmlhelpdataaddbook}
|
||||
|
||||
\func{bool}{AddBook}{\param{const wxString\& }{book\_url}}
|
||||
|
||||
Adds new book. {\it book} is URL (not filename!) of HTML help project (hhp)
|
||||
or ZIP file that contains arbitrary number of .hhp projects (this zip
|
||||
file can have either .zip or .htb extension, htb stands for "html book").
|
||||
Returns success.
|
||||
|
||||
\membersection{wxHtmlHelpData::FindPageById}\label{wxhtmlhelpdatafindpagebyid}
|
||||
|
||||
\func{wxString}{FindPageById}{\param{int }{id}}
|
||||
|
||||
Returns page's URL based on integer ID stored in project.
|
||||
|
||||
\membersection{wxHtmlHelpData::FindPageByName}\label{wxhtmlhelpdatafindpagebyname}
|
||||
|
||||
\func{wxString}{FindPageByName}{\param{const wxString\& }{page}}
|
||||
|
||||
Returns page's URL based on its (file)name.
|
||||
|
||||
\membersection{wxHtmlHelpData::GetBookRecArray}\label{wxhtmlhelpdatagetbookrecarray}
|
||||
|
||||
\func{const wxHtmlBookRecArray\&}{GetBookRecArray}{\void}
|
||||
|
||||
Returns array with help books info.
|
||||
|
||||
\membersection{wxHtmlHelpData::GetContents}\label{wxhtmlhelpdatagetcontents}
|
||||
|
||||
\func{wxHtmlContentsItem*}{GetContents}{\void}
|
||||
|
||||
Returns contents lists pointer.
|
||||
|
||||
\membersection{wxHtmlHelpData::GetContentsCnt}\label{wxhtmlhelpdatagetcontentscnt}
|
||||
|
||||
\func{int}{GetContentsCnt}{\void}
|
||||
|
||||
Returns size of contents list.
|
||||
|
||||
\membersection{wxHtmlHelpData::GetIndex}\label{wxhtmlhelpdatagetindex}
|
||||
|
||||
\func{wxHtmlContentsItem*}{GetIndex}{\void}
|
||||
|
||||
Returns pointer to index items list.
|
||||
|
||||
\membersection{wxHtmlHelpData::GetIndexCnt}\label{wxhtmlhelpdatagetindexcnt}
|
||||
|
||||
\func{int}{GetIndexCnt}{\void}
|
||||
|
||||
Returns size of index list.
|
||||
|
||||
\membersection{wxHtmlHelpData::SetTempDir}\label{wxhtmlhelpdatasettempdir}
|
||||
|
||||
\func{void}{SetTempDir}{\param{const wxString\& }{path}}
|
||||
|
||||
Sets temporary directory where binary cached versions of MS HTML Workshop
|
||||
files will be stored. (This is turned off by default and you can enable
|
||||
this feature by setting non-empty temp dir.)
|
||||
|
||||
170
docs/latex/wx/hthlpfrm.tex
Normal file
170
docs/latex/wx/hthlpfrm.tex
Normal file
@@ -0,0 +1,170 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% helpfrm.h at 24/Oct/99 18:03:10
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlHelpFrame}}\label{wxhtmlhelpframe}
|
||||
|
||||
This class is used by \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}
|
||||
to display help.
|
||||
It is an internal class and should not be used directly - except for the case
|
||||
when you're writing your own HTML help controller.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxFrame}{wxframe}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/helpfrm.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlHelpFrame::wxHtmlHelpFrame}\label{wxhtmlhelpframewxhtmlhelpframe}
|
||||
|
||||
\func{}{wxHtmlHelpFrame}{\param{wxHtmlHelpData* }{data = NULL}}
|
||||
|
||||
\func{}{wxHtmlHelpFrame}{\param{wxWindow* }{parent}, \param{int }{wxWindowID}, \param{const wxString\& }{title = wxEmptyString}, \param{int }{style = wxHF\_DEFAULT\_STYLE}, \param{wxHtmlHelpData* }{data = NULL}}
|
||||
|
||||
Constructor.
|
||||
|
||||
{\it style} is combination of these flags:
|
||||
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{\windowstyle{wxHF\_TOOLBAR}}{Help frame has toolbar.}
|
||||
\twocolitem{\windowstyle{wxHF\_FLAT\_TOOLBAR}}{Help frame has toolbar with flat buttons (aka coolbar).}
|
||||
\twocolitem{\windowstyle{wxHF\_CONTENTS}}{Help frame has contents panel.}
|
||||
\twocolitem{\windowstyle{wxHF\_INDEX}}{Help frame has index panel.}
|
||||
\twocolitem{\windowstyle{wxHF\_SEARCH}}{Help frame has search panel.}
|
||||
\twocolitem{\windowstyle{wxHF\_BOOKMARKS}}{Help frame has bookmarks controls.}
|
||||
\twocolitem{\windowstyle{wxHF\_OPEN\_FILES}}{Allow user to open arbitrary HTML document.}
|
||||
\twocolitem{\windowstyle{wxHF\_PRINT}}{Toolbar contains "print" button.}
|
||||
\twocolitem{\windowstyle{wxHF\_MERGE\_BOOKS}}{Contents pane does not show
|
||||
book nodes. All books are merged together and appear as single book to the
|
||||
user.}
|
||||
\twocolitem{\windowstyle{wxHF\_ICONS\_BOOK}}{All nodes in contents pane
|
||||
have a book icon. This is how Microsoft's HTML help viewer behaves.}
|
||||
\twocolitem{\windowstyle{wxHF\_ICONS\_FOLDER}}{Book nodes in contents pane have
|
||||
a book icon, book's sections have a folder icon. This is the default.}
|
||||
\twocolitem{\windowstyle{wxHF\_ICONS\_BOOK\_CHAPTER}}{Both book nodes and
|
||||
nodes of top-level sections of a book (i.e. chapters) have a book icon,
|
||||
all other sections (sections, subsections, ...) have a folder icon.}
|
||||
\twocolitem{\windowstyle{wxHF\_DEFAULT\_STYLE}}{{\tt wxHF\_TOOLBAR | wxHF\_CONTENTS
|
||||
| wxHF\_INDEX | wxHF\_SEARCH | wxHF\_BOOKMARKS | wxHF\_PRINT}}
|
||||
\end{twocollist}
|
||||
|
||||
\membersection{wxHtmlHelpFrame::Create}\label{wxhtmlhelpframecreate}
|
||||
|
||||
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{title = wxEmptyString}, \param{int }{style = wxHF\_DEFAULT\_STYLE}}
|
||||
|
||||
Creates the frame. See \helpref{the constructor}{wxhtmlhelpframewxhtmlhelpframe}
|
||||
for parameters description.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::CreateContents}\label{wxhtmlhelpframecreatecontents}
|
||||
|
||||
\func{void}{CreateContents}{\param{bool }{show\_progress = false}}
|
||||
|
||||
Creates contents panel. (May take some time.)
|
||||
|
||||
\membersection{wxHtmlHelpFrame::CreateIndex}\label{wxhtmlhelpframecreateindex}
|
||||
|
||||
\func{void}{CreateIndex}{\param{bool }{show\_progress = false}}
|
||||
|
||||
Creates index panel. (May take some time.)
|
||||
|
||||
\membersection{wxHtmlHelpFrame::CreateSearch}\label{wxhtmlhelpframecreatesearch}
|
||||
|
||||
\func{void}{CreateSearch}{\void}
|
||||
|
||||
Creates search panel.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::Display}\label{wxhtmlhelpframedisplay}
|
||||
|
||||
\func{bool}{Display}{\param{const wxString\& }{x}}
|
||||
|
||||
\func{bool}{Display}{\param{const int }{id}}
|
||||
|
||||
Displays page x. If not found it will give the user the choice of
|
||||
searching books.
|
||||
Looking for the page runs in these steps:
|
||||
|
||||
\begin{enumerate}\itemsep=0pt
|
||||
\item try to locate file named x (if x is for example "doc/howto.htm")
|
||||
\item try to open starting page of book x
|
||||
\item try to find x in contents (if x is for example "How To ...")
|
||||
\item try to find x in index (if x is for example "How To ...")
|
||||
\end{enumerate}
|
||||
|
||||
The second form takes numeric ID as the parameter.
|
||||
(uses extension to MS format, <param name="ID" value=id>)
|
||||
|
||||
\pythonnote{The second form of this method is named DisplayId in
|
||||
wxPython.}
|
||||
|
||||
\membersection{wxHtmlHelpFrame::DisplayContents}\label{wxhtmlhelpframedisplaycontents}
|
||||
|
||||
\func{bool}{DisplayContents}{\void}
|
||||
|
||||
Displays contents panel.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::DisplayIndex}\label{wxhtmlhelpframedisplayindex}
|
||||
|
||||
\func{bool}{DisplayIndex}{\void}
|
||||
|
||||
Displays index panel.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::GetData}\label{wxhtmlhelpframegetdata}
|
||||
|
||||
\func{wxHtmlHelpData*}{GetData}{\void}
|
||||
|
||||
Return wxHtmlHelpData object.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::KeywordSearch}\label{wxhtmlhelpframekeywordsearch}
|
||||
|
||||
\func{bool}{KeywordSearch}{\param{const wxString\& }{keyword}}
|
||||
|
||||
Search for given keyword.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::ReadCustomization}\label{wxhtmlhelpframereadcustomization}
|
||||
|
||||
\func{void}{ReadCustomization}{\param{wxConfigBase* }{cfg}, \param{const wxString\& }{path = wxEmptyString}}
|
||||
|
||||
Reads user's settings for this frame (see \helpref{wxHtmlHelpController::ReadCustomization}{wxhtmlhelpcontrollerreadcustomization})
|
||||
|
||||
\membersection{wxHtmlHelpFrame::RefreshLists}\label{wxhtmlhelpframerefreshlists}
|
||||
|
||||
\func{void}{RefreshLists}{\param{bool }{show\_progress = false}}
|
||||
|
||||
Refresh all panels. This is necessary if a new book was added.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::SetTitleFormat}\label{wxhtmlhelpframesettitleformat}
|
||||
|
||||
\func{void}{SetTitleFormat}{\param{const wxString\& }{format}}
|
||||
|
||||
Sets the frame's title format. {\it format} must contain exactly one "\%s"
|
||||
(it will be replaced by the page title).
|
||||
|
||||
\membersection{wxHtmlHelpFrame::UseConfig}\label{wxhtmlhelpframeuseconfig}
|
||||
|
||||
\func{void}{UseConfig}{\param{wxConfigBase* }{config}, \param{const wxString\& }{rootpath = wxEmptyString}}
|
||||
|
||||
Add books to search choice panel.
|
||||
|
||||
\membersection{wxHtmlHelpFrame::WriteCustomization}\label{wxhtmlhelpframewritecustomization}
|
||||
|
||||
\func{void}{WriteCustomization}{\param{wxConfigBase* }{cfg}, \param{const wxString\& }{path = wxEmptyString}}
|
||||
|
||||
Saves user's settings for this frame (see \helpref{wxHtmlHelpController::WriteCustomization}{wxhtmlhelpcontrollerwritecustomization}).
|
||||
|
||||
\membersection{wxHtmlHelpFrame::AddToolbarButtons}\label{wxhtmlhelpframeaddtoolbarbuttons}
|
||||
|
||||
\func{virtual void}{AddToolbarButtons}{\param{wxToolBar *}{toolBar}, \param{int }{style}}
|
||||
|
||||
You may override this virtual method to add more buttons into help frame's
|
||||
toolbar. {\it toolBar} is a pointer to the toolbar and {\it style} is the style
|
||||
flag as passed to Create method.
|
||||
|
||||
wxToolBar::Realize is called immediately after returning from this function.
|
||||
|
||||
See {\it samples/html/helpview} for an example.
|
||||
|
||||
59
docs/latex/wx/htlnkinf.tex
Normal file
59
docs/latex/wx/htlnkinf.tex
Normal file
@@ -0,0 +1,59 @@
|
||||
\section{\class{wxHtmlLinkInfo}}\label{wxhtmllinkinfo}
|
||||
|
||||
This class stores all necessary information about hypertext
|
||||
links (as represented by {\tt <A>} tag in HTML documents). In
|
||||
current implementation it stores URL and target frame name.
|
||||
{\it Note that frames are not currently supported by wxHTML!}
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlcell.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlLinkInfo::wxHtmlLinkInfo}\label{wxhtmllinkinfowxhtmllinkinfo}
|
||||
|
||||
\func{}{wxHtmlLinkInfo}{\void}
|
||||
|
||||
Default ctor.
|
||||
|
||||
\func{}{wxHtmlLinkInfo}{\param{const wxString\& }{href}, \param{const wxString\& }{target = wxEmptyString}}
|
||||
|
||||
Construct hypertext link from HREF (aka URL) and TARGET (name of target
|
||||
frame).
|
||||
|
||||
\membersection{wxHtmlLinkInfo::GetEvent}\label{wxhtmllinkinfogetevent}
|
||||
|
||||
\func{const wxMouseEvent *}{GetEvent}{\void}
|
||||
|
||||
Return pointer to event that generated OnLinkClicked event. Valid
|
||||
only within \helpref{wxHtmlWindow::OnLinkClicked}{wxhtmlwindowonlinkclicked},
|
||||
NULL otherwise.
|
||||
|
||||
\membersection{wxHtmlLinkInfo::GetHtmlCell}\label{wxhtmllinkinfogethtmlcell}
|
||||
|
||||
\func{const wxHtmlCell *}{GetHtmlCell}{\void}
|
||||
|
||||
Return pointer to the cell that was clicked. Valid
|
||||
only within \helpref{wxHtmlWindow::OnLinkClicked}{wxhtmlwindowonlinkclicked},
|
||||
NULL otherwise.
|
||||
|
||||
|
||||
\membersection{wxHtmlLinkInfo::GetHref}\label{wxhtmllinkinfogethref}
|
||||
|
||||
\func{wxString}{GetHref}{\void}
|
||||
|
||||
Return {\it HREF} value of the {\tt <A>} tag.
|
||||
|
||||
\membersection{wxHtmlLinkInfo::GetTarget}\label{wxhtmllinkinfogettarget}
|
||||
|
||||
\func{wxString}{GetTarget}{\void}
|
||||
|
||||
Return {\it TARGET} value of the {\tt <A>} tag (this value
|
||||
is used to specify in which frame should be the page pointed
|
||||
by \helpref{Href}{wxhtmllinkinfogethref} opened).
|
||||
|
||||
82
docs/latex/wx/htmlcell.tex
Normal file
82
docs/latex/wx/htmlcell.tex
Normal file
@@ -0,0 +1,82 @@
|
||||
\subsection{Cells and Containers}\label{cells}
|
||||
|
||||
This article describes mechanism used by
|
||||
\helpref{wxHtmlWinParser}{wxhtmlwinparser} and
|
||||
\helpref{wxHtmlWindow}{wxhtmlwindow} to parse and display HTML documents.
|
||||
|
||||
\wxheading{Cells}
|
||||
|
||||
You can divide any text (or HTML) into small fragments. Let's call these
|
||||
fragments {\bf cells}. Cell is for example one word, horizontal line, image
|
||||
or any other part of document. Each cell has width and height (except special
|
||||
"magic" cells with zero dimensions - e.g. colour changers or font changers).
|
||||
|
||||
See \helpref{wxHtmlCell}{wxhtmlcell}.
|
||||
|
||||
\wxheading{Containers}
|
||||
|
||||
Container is kind of cell that may contain sub-cells. Its size depends
|
||||
on number and sizes of its sub-cells (and also depends on width of window).
|
||||
|
||||
See \helpref{wxHtmlContainerCell}{wxhtmlcontainercell},
|
||||
\helpref{wxHtmlCell::Layout}{wxhtmlcelllayout}.
|
||||
|
||||
\begin{comment}
|
||||
% Bitmap is corrupt!
|
||||
This image shows you cells and containers:
|
||||
|
||||
\helponly{\image{}{contbox.bmp}}
|
||||
\end{comment}
|
||||
\wxheading{Using Containers in Tag Handler}
|
||||
|
||||
\helpref{wxHtmlWinParser}{wxhtmlwinparser} provides a user-friendly way
|
||||
of managing containers. It is based on the idea of opening and closing containers.
|
||||
|
||||
Use \helpref{OpenContainer}{wxhtmlwinparseropencontainer} to open new
|
||||
a container {\it within an already opened container}. This new container is a
|
||||
{\it sub-container} of the old one. (If you want to create a new container with
|
||||
the same depth level you can call {\tt CloseContainer(); OpenContainer();}.)
|
||||
|
||||
Use \helpref{CloseContainer}{wxhtmlwinparserclosecontainer} to close the
|
||||
container. This doesn't create a new container with same depth level but
|
||||
it returns "control" to the parent container.
|
||||
|
||||
\begin{comment}
|
||||
% Bitmap corrupt!
|
||||
See explanation:
|
||||
|
||||
\helponly{\image{}{cont.bmp}}
|
||||
\end{comment}
|
||||
It is clear there must be same number of calls to
|
||||
OpenContainer as to CloseContainer...
|
||||
|
||||
\wxheading{Example}
|
||||
|
||||
This code creates a new paragraph (container at same depth level)
|
||||
with "Hello, world!":
|
||||
|
||||
\begin{verbatim}
|
||||
m_WParser -> CloseContainer();
|
||||
c = m_WParser -> OpenContainer();
|
||||
|
||||
m_WParser -> AddWord("Hello, ");
|
||||
m_WParser -> AddWord("world!");
|
||||
|
||||
m_WParser -> CloseContainer();
|
||||
m_WParser -> OpenContainer();
|
||||
\end{verbatim}
|
||||
|
||||
\begin{comment}
|
||||
% Bitmap corrupt!
|
||||
and here is image of the situation:
|
||||
|
||||
\helponly{\image{}{hello.bmp}}
|
||||
\end{comment}
|
||||
|
||||
You can see that there was opened container before running the code. We closed
|
||||
it, created our own container, then closed our container and opened
|
||||
new container. The result was that we had {\it same depth level} after
|
||||
executing. This is general rule that should be followed by tag handlers:
|
||||
leave depth level of containers unmodified (in other words, number of
|
||||
OpenContainer and CloseContainer calls should be same within \helpref{HandleTag}{wxhtmltaghandlerhandletag}'s body).
|
||||
|
||||
10
docs/latex/wx/htmlfilt.tex
Normal file
10
docs/latex/wx/htmlfilt.tex
Normal file
@@ -0,0 +1,10 @@
|
||||
\subsection{Input Filters}\label{filters}
|
||||
|
||||
The wxHTML library provides a mechanism for reading and displaying
|
||||
files of many different file formats.
|
||||
|
||||
\helpref{wxHtmlWindow::LoadPage}{wxhtmlwindowloadpage} can load not
|
||||
only HTML files but any known file. To make a file type known to wxHtmlWindow
|
||||
you must create a \helpref{wxHtmlFilter}{wxhtmlfilter} filter and
|
||||
register it using \helpref{wxHtmlWindow::AddFilter}{wxhtmlwindowaddfilter}.
|
||||
|
||||
146
docs/latex/wx/htmlhand.tex
Normal file
146
docs/latex/wx/htmlhand.tex
Normal file
@@ -0,0 +1,146 @@
|
||||
\subsection{Tag Handlers}\label{handlers}
|
||||
|
||||
The wxHTML library provides architecture of pluggable {\it tag handlers}.
|
||||
Tag handler is class that understands particular HTML tag (or tags) and is
|
||||
able to interpret it.
|
||||
|
||||
\helpref{wxHtmlWinParser}{wxhtmlwinparser} has static table of {\bf modules}.
|
||||
Each module contains one or more tag handlers. Each time a new wxHtmlWinParser
|
||||
object is constructed all modules are scanned and handlers are added
|
||||
to wxHtmlParser's list of available handlers (note: wxHtmlParser's list
|
||||
is non-static).
|
||||
|
||||
\wxheading{How it works}
|
||||
|
||||
Common tag handler's \helpref{HandleTag}{wxhtmltaghandlerhandletag} method
|
||||
works in four steps:
|
||||
|
||||
\begin{enumerate}\itemsep=0pt
|
||||
\item Save state of parent parser into local variables
|
||||
\item Change parser state according to tag's params
|
||||
\item Parse text between the tag and paired ending tag (if present)
|
||||
\item Restore original parser state
|
||||
\end{enumerate}
|
||||
|
||||
See \helpref{wxHtmlWinParser}{wxhtmlwinparser} for methods for modifying
|
||||
parser's state. In general you can do things like opening/closing containers,
|
||||
changing colors, fonts etc.
|
||||
|
||||
\wxheading{Providing own tag handlers}
|
||||
|
||||
You should create new .cpp file and place following lines into it:
|
||||
|
||||
\begin{verbatim}
|
||||
#include <mod_templ.h>
|
||||
#include <forcelink.h>
|
||||
FORCE_LINK_ME(yourmodulefilenamewithoutcpp)
|
||||
\end{verbatim}
|
||||
|
||||
Then you must define handlers and one module.
|
||||
|
||||
\wxheading{Tag handlers}
|
||||
|
||||
The handler is derived from \helpref{wxHtmlWinTagHandler}{wxhtmlwintaghandler}
|
||||
(or directly from \helpref{wxHtmlTagHandler}{wxhtmltaghandler})
|
||||
|
||||
You can use set of macros to define the handler (see src/html/m\_*.cpp files
|
||||
for details). Handler definition must start with {\bf TAG\_HANDLER\_BEGIN} macro
|
||||
and end with {\bf TAG\_HANDLER\_END} macro. I strongly recommend to have a look
|
||||
at {\it include/wxhtml/mod\_templ.h} file. Otherwise you won't understand
|
||||
the structure of macros. See macros reference:
|
||||
|
||||
{\bf TAG\_HANDLER\_BEGIN}({\it name}, {\it tags})
|
||||
|
||||
Starts handler definition. {\it name} is handler identifier (in fact
|
||||
part of class name), {\it tags} is string containing list of tags
|
||||
supported by this handler (in uppercase). This macro derives new class from
|
||||
wxHtmlWinTagHandler and implements it is
|
||||
\helpref{GetSupportedTags}{wxhtmltaghandlergetsupportedtags} method.
|
||||
|
||||
Example: TAG\_HANDLER\_BEGIN(FONTS, "B,I,U,T")
|
||||
|
||||
{\bf TAG\_HANDLER\_VARS}
|
||||
|
||||
This macro starts block of variables definitions. (Variables are identical
|
||||
to class attributes.) Example:
|
||||
|
||||
\begin{verbatim}
|
||||
TAG_HANDLER_BEGIN(VARS_ONLY, "CRAZYTAG")
|
||||
TAG_HANDLER_VARS
|
||||
int my_int_var;
|
||||
wxString something_else;
|
||||
TAG_HANDLER_END(VARS_ONLY)
|
||||
\end{verbatim}
|
||||
|
||||
This macro is used only in rare cases.
|
||||
|
||||
{\bf TAG\_HANDLER\_CONSTR}({\it name})
|
||||
|
||||
This macro supplies object constructor. {\it name} is same name as the one
|
||||
from TAG\_HANDLER\_BEGIN macro. Body of constructor follow after
|
||||
this macro (you must use { and } ). Example:
|
||||
|
||||
\begin{verbatim}
|
||||
TAG_HANDLER_BEGIN(VARS2, "CRAZYTAG")
|
||||
TAG_HANDLER_VARS
|
||||
int my_int_var;
|
||||
TAG_HANDLER_CONSTR(vars2)
|
||||
{ // !!!!!!
|
||||
my_int_var = 666;
|
||||
} // !!!!!!
|
||||
TAG_HANDLER_END(VARS2)
|
||||
\end{verbatim}
|
||||
|
||||
Never used in wxHTML :-)
|
||||
|
||||
{\bf TAG\_HANDLER\_PROC}({\it varib})
|
||||
|
||||
This is very important macro. It defines \helpref{HandleTag}{wxhtmltaghandlerhandletag}
|
||||
method. {\it varib} is name of parameter passed to the method, usually
|
||||
{\it tag}. Body of method follows after this macro.
|
||||
Note than you must use { and } ! Example:
|
||||
|
||||
\begin{verbatim}
|
||||
TAG_HANDLER_BEGIN(TITLE, "TITLE")
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
printf("TITLE found...\n");
|
||||
}
|
||||
TAG_HANDLER_END(TITLE)
|
||||
\end{verbatim}
|
||||
|
||||
{\bf TAG\_HANDLER\_END}({\it name})
|
||||
|
||||
Ends definition of tag handler {\it name}.
|
||||
|
||||
\wxheading{Tags Modules}
|
||||
|
||||
You can use set of 3 macros TAGS\_MODULE\_BEGIN, TAGS\_MODULE\_ADD and
|
||||
TAGS\_MODULE\_END to inherit new module from
|
||||
\helpref{wxHtmlTagsModule}{wxhtmltagsmodule} and to create instance of it.
|
||||
See macros reference:
|
||||
|
||||
{\bf TAGS\_MODULE\_BEGIN}({\it modname})
|
||||
|
||||
Begins module definition. {\it modname} is part of class name and must
|
||||
be unique.
|
||||
|
||||
{\bf TAGS\_MODULE\_ADD}({\it name})
|
||||
|
||||
Adds the handler to this module. {\it name} is the identifier from
|
||||
TAG\_HANDLER\_BEGIN.
|
||||
|
||||
{\bf TAGS\_MODULE\_END}({\it modname})
|
||||
|
||||
Ends the definition of module.
|
||||
|
||||
{\bf Example:}
|
||||
|
||||
\begin{verbatim}
|
||||
TAGS_MODULE_BEGIN(Examples)
|
||||
TAGS_MODULE_ADD(VARS_ONLY)
|
||||
TAGS_MODULE_ADD(VARS2)
|
||||
TAGS_MODULE_ADD(TITLE)
|
||||
TAGS_MODULE_END(Examples)
|
||||
\end{verbatim}
|
||||
|
||||
96
docs/latex/wx/htmlhlpf.tex
Normal file
96
docs/latex/wx/htmlhlpf.tex
Normal file
@@ -0,0 +1,96 @@
|
||||
\subsection{Help Files Format}\label{helpformat}
|
||||
|
||||
wxHTML library uses a reduced version of MS HTML Workshop format.
|
||||
Tex2RTF can produce these files when generating HTML, if you set {\bf htmlWorkshopFiles} to {\bf true} in
|
||||
your tex2rtf.ini file.
|
||||
|
||||
(See \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller} for help controller description.)
|
||||
|
||||
A {\bf book} consists of three files: header file, contents file and index file.
|
||||
You can make a regular zip archive of these files, plus the HTML and any image files,
|
||||
for wxHTML (or helpview) to read; and the .zip file can optionally be renamed to .htb.
|
||||
|
||||
\wxheading{Header file (.hhp)}
|
||||
|
||||
Header file must contain these lines (and may contain additional lines which are ignored) :
|
||||
|
||||
\begin{verbatim}
|
||||
Contents file=<filename.hhc>
|
||||
Index file=<filename.hhk>
|
||||
Title=<title of your book>
|
||||
Default topic=<default page to be displayed.htm>
|
||||
\end{verbatim}
|
||||
|
||||
All filenames (including the Default topic) are relative to the
|
||||
location of .hhp file.
|
||||
|
||||
{\bf Localization note:} In addition, .hhp file may contain line
|
||||
|
||||
\begin{verbatim}
|
||||
Charset=<rfc_charset>
|
||||
\end{verbatim}
|
||||
|
||||
which specifies what charset (e.g. "iso8859\_1") was used in contents
|
||||
and index files. Please note that this line is incompatible with
|
||||
MS HTML Help Workshop and it would either silently remove it or complain
|
||||
with some error. See also
|
||||
\helpref{Writing non-English applications}{nonenglishoverview}.
|
||||
|
||||
\wxheading{Contents file (.hhc)}
|
||||
|
||||
Contents file has HTML syntax and it can be parsed by regular HTML parser. It contains exactly one list
|
||||
({\tt <ul>}....{\tt </ul>} statement):
|
||||
|
||||
\begin{verbatim}
|
||||
<ul>
|
||||
|
||||
<li> <object type="text/sitemap">
|
||||
<param name="Name" value="@topic name@">
|
||||
<param name="ID" value=@numeric_id@>
|
||||
<param name="Local" value="@filename.htm@">
|
||||
</object>
|
||||
<li> <object type="text/sitemap">
|
||||
<param name="Name" value="@topic name@">
|
||||
<param name="ID" value=@numeric_id@>
|
||||
<param name="Local" value="@filename.htm@">
|
||||
</object>
|
||||
...
|
||||
|
||||
</ul>
|
||||
\end{verbatim}
|
||||
|
||||
You can modify value attributes of param tags. {\it topic name} is name of chapter/topic as is displayed in
|
||||
contents, {\it filename.htm} is HTML page name (relative to .hhp file) and {\it numeric\_id} is optional
|
||||
- it is used only when you use \helpref{wxHtmlHelpController::Display(int)}{wxhtmlhelpcontrollerdisplay}
|
||||
|
||||
Items in the list may be nested - one {\tt <li>} statement may contain a {\tt <ul>} sub-statement:
|
||||
|
||||
\begin{verbatim}
|
||||
<ul>
|
||||
|
||||
<li> <object type="text/sitemap">
|
||||
<param name="Name" value="Top node">
|
||||
<param name="Local" value="top.htm">
|
||||
</object>
|
||||
<ul>
|
||||
<li> <object type="text/sitemap">
|
||||
<param name="Name" value="subnode in topnode">
|
||||
<param name="Local" value="subnode1.htm">
|
||||
</object>
|
||||
...
|
||||
</ul>
|
||||
|
||||
<li> <object type="text/sitemap">
|
||||
<param name="Name" value="Another Top">
|
||||
<param name="Local" value="top2.htm">
|
||||
</object>
|
||||
...
|
||||
|
||||
</ul>
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{Index file (.hhk)}
|
||||
|
||||
Index files have same format as contents file except that ID params are ignored and sublists are {\bf not}
|
||||
allowed.
|
||||
|
||||
82
docs/latex/wx/htmllbox.tex
Normal file
82
docs/latex/wx/htmllbox.tex
Normal file
@@ -0,0 +1,82 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Name: htmllbox.tex
|
||||
%% Purpose: wxHtmlListBox documentation
|
||||
%% Author: Vadim Zeitlin
|
||||
%% Modified by:
|
||||
%% Created: 01.06.03
|
||||
%% RCS-ID: $Id$
|
||||
%% Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
%% License: wxWindows license
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{\class{wxHtmlListBox}}\label{wxhtmllistbox}
|
||||
|
||||
wxHtmlListBox is an implementation of \helpref{wxVListBox}{wxvlistbox} which
|
||||
shows HTML content in the listbox rows. This is still an abstract base class
|
||||
and you will need to derive your own class from it (see htlbox sample for the
|
||||
example) but you will only need to override a single
|
||||
\helpref{OnGetItem()}{wxhtmllistboxongetitem} function.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxVListBox}{wxvlistbox}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/htmllbox.h>
|
||||
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxHtmlListBox::wxHtmlListBox}\label{wxhtmllistboxwxhtmllistbox}
|
||||
|
||||
\func{}{wxHtmlListBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{size\_t }{countItems = 0}, \param{long }{style = 0}, \param{const wxString\& }{name = wxVListBoxNameStr}}
|
||||
|
||||
Normal constructor which calls \helpref{Create()}{wxhtmllistboxcreate}
|
||||
internally.
|
||||
|
||||
\func{}{wxHtmlListBox}{\void}
|
||||
|
||||
Default constructor, you must call \helpref{Create()}{wxhtmllistboxcreate}
|
||||
later.
|
||||
|
||||
|
||||
\membersection{wxHtmlListBox::\destruct{wxHtmlListBox}}\label{wxhtmllistboxdtor}
|
||||
|
||||
\func{}{\destruct{wxHtmlListBox}}{\void}
|
||||
|
||||
Destructor cleans up whatever resources we use.
|
||||
|
||||
|
||||
\membersection{wxHtmlListBox::Create}\label{wxhtmllistboxcreate}
|
||||
|
||||
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{size\_t }{countItems = 0}, \param{long }{style = 0}, \param{const wxString\& }{name = wxVListBoxNameStr}}
|
||||
|
||||
Creates the control and optionally sets the initial number of items in it
|
||||
(it may also be set or changed later with
|
||||
\helpref{SetItemCount()}{wxvlistboxsetitemcount}).
|
||||
|
||||
There are no special styles defined for wxHtmlListBox, in particular the
|
||||
wxListBox styles can not be used here.
|
||||
|
||||
Returns {\tt true} on success or {\tt false} if the control couldn't be created
|
||||
|
||||
|
||||
|
||||
\membersection{wxHtmlListBox::OnGetItem}\label{wxhtmllistboxongetitem}
|
||||
|
||||
\constfunc{wxString}{OnGetItem}{\param{size\_t }{n}}
|
||||
|
||||
This method must be implemented in the derived class and should return
|
||||
the body (i.e. without {\tt <html>} nor {\tt <body>} tags) of the HTML fragment
|
||||
for the given item.
|
||||
|
||||
|
||||
\membersection{wxHtmlListBox::OnGetItemMarkup}\label{wxhtmllistboxongetitemmarkup}
|
||||
|
||||
\constfunc{wxString}{OnGetItemMarkup}{\param{size\_t }{n}}
|
||||
|
||||
This function may be overridden to decorate HTML returned by
|
||||
\helpref{OnGetItem()}{wxhtmllistboxongetitem}.
|
||||
|
||||
13
docs/latex/wx/htmlprn.tex
Normal file
13
docs/latex/wx/htmlprn.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\subsection{HTML Printing}\label{printing}
|
||||
|
||||
The wxHTML library provides printing facilities with several levels of complexity.
|
||||
|
||||
The easiest way to print an HTML document is to use
|
||||
\helpref{wxHtmlEasyPrinting class}{wxhtmleasyprinting}. It lets you print HTML documents with only one
|
||||
command and you don't have to worry about deriving from the wxPrintout class at all. It is only a simple wrapper around the
|
||||
\helpref{wxHtmlPrintout}{wxhtmlprintout}, normal wxWindows printout class.
|
||||
|
||||
And finally there is the low level class \helpref{wxHtmlDCRenderer}{wxhtmldcrenderer} which you can use to
|
||||
render HTML into a rectangular area on any DC. It supports rendering into multiple rectangles with the same
|
||||
width. (The most common use of this is placing one rectangle on each page or printing into two columns.)
|
||||
|
||||
68
docs/latex/wx/htmlstrt.tex
Normal file
68
docs/latex/wx/htmlstrt.tex
Normal file
@@ -0,0 +1,68 @@
|
||||
\subsection{wxHTML quick start}\label{wxhtmlquickstart}
|
||||
|
||||
\wxheading{Displaying HMTL}
|
||||
|
||||
First of all, you must include <wx/wxhtml.h>.
|
||||
|
||||
Class \helpref{wxHtmlWindow}{wxhtmlwindow} (derived from wxScrolledWindow)
|
||||
is used to display HTML documents.
|
||||
It has two important methods: \helpref{LoadPage}{wxhtmlwindowloadpage}
|
||||
and \helpref{SetPage}{wxhtmlwindowsetpage}.
|
||||
LoadPage loads and displays HTML file while SetPage displays directly the
|
||||
passed {\bf string}. See the example:
|
||||
|
||||
\begin{verbatim}
|
||||
mywin -> LoadPage("test.htm");
|
||||
mywin -> SetPage("<html><body>"
|
||||
"<h1>Error</h1>"
|
||||
"Some error occurred :-H)"
|
||||
"</body></hmtl>");
|
||||
\end{verbatim}
|
||||
|
||||
I think the difference is quite clear.
|
||||
|
||||
\wxheading{Displaying Help}
|
||||
|
||||
See \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller}.
|
||||
|
||||
\wxheading{Setting up wxHtmlWindow}
|
||||
|
||||
Because wxHtmlWindow is derived from wxScrolledWindow and not from
|
||||
wxFrame, it doesn't have visible frame. But the user usually want to see
|
||||
the title of HTML page displayed somewhere and frame's titlebar is
|
||||
ideal place for it.
|
||||
|
||||
wxHtmlWindow provides 2 methods in order to handle this:
|
||||
\helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe} and
|
||||
\helpref{SetRelatedStatusBar}{wxhtmlwindowsetrelatedstatusbar}.
|
||||
See the example:
|
||||
|
||||
\begin{verbatim}
|
||||
html = new wxHtmlWindow(this);
|
||||
html -> SetRelatedFrame(this, "HTML : %%s");
|
||||
html -> SetRelatedStatusBar(0);
|
||||
\end{verbatim}
|
||||
|
||||
The first command associates html object with it is parent frame
|
||||
(this points to wxFrame object there) and sets format of title.
|
||||
Page title "Hello, world!" will be displayed as "HTML : Hello, world!"
|
||||
in this example.
|
||||
|
||||
The second command sets which frame's status bar should be used to display
|
||||
browser's messages (such as "Loading..." or "Done" or hypertext links).
|
||||
|
||||
\wxheading{Customizing wxHtmlWindow}
|
||||
|
||||
You can customize wxHtmlWindow by setting font size, font face and
|
||||
borders (space between border of window and displayed HTML). Related functions:
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
\item \helpref{SetFonts}{wxhtmlwindowsetfonts}
|
||||
\item \helpref{SetBorders}{wxhtmlwindowsetborders}
|
||||
\item \helpref{ReadCustomization}{wxhtmlwindowreadcustomization}
|
||||
\item \helpref{WriteCustomization}{wxhtmlwindowwritecustomization}
|
||||
\end{itemize}
|
||||
|
||||
The last two functions are used to store user customization info wxConfig stuff
|
||||
(for example in the registry under Windows, or in a dotfile under Unix).
|
||||
|
||||
148
docs/latex/wx/htmltags.tex
Normal file
148
docs/latex/wx/htmltags.tex
Normal file
@@ -0,0 +1,148 @@
|
||||
\subsection{Tags supported by wxHTML}\label{htmltagssupported}
|
||||
|
||||
wxHTML is not full implementation of HTML standard. Instead, it supports most common tags so that it
|
||||
is possible to display {\it simple} HTML documents with it. (For example it works fine with pages created
|
||||
in Netscape Composer or generated by tex2rtf).
|
||||
|
||||
Following tables list all tags known to wxHTML, together with supported parameters.
|
||||
A tag has general form of {\tt <tagname param\_1 param\_2 ... param\_n>} where param\_i is
|
||||
either {\tt paramname="paramvalue"} or {\tt paramname=paramvalue} - these two are equivalent. Unless stated
|
||||
otherwise, wxHTML is case-insensitive.
|
||||
|
||||
\wxheading{Table of common parameter values}
|
||||
|
||||
We will use these substitutions in tags descriptions:
|
||||
|
||||
\begin{verbatim}
|
||||
[alignment] CENTER
|
||||
LEFT
|
||||
RIGHT
|
||||
JUSTIFY
|
||||
|
||||
[v_alignment] TOP
|
||||
BOTTOM
|
||||
CENTER
|
||||
|
||||
[color] HTML 4.0-compliant colour specification
|
||||
|
||||
[fontsize] -2
|
||||
-1
|
||||
+0
|
||||
+1
|
||||
+2
|
||||
+3
|
||||
+4
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
|
||||
[pixels] integer value that represents dimension in pixels
|
||||
|
||||
[percent] i%
|
||||
where i is integer
|
||||
|
||||
[url] an URL
|
||||
|
||||
[string] text string
|
||||
|
||||
[coords] c(1),c(2),c(3),...,c(n)
|
||||
where c(i) is integer
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\wxheading{List of supported tags}
|
||||
|
||||
\begin{verbatim}
|
||||
|
||||
A NAME=[string]
|
||||
HREF=[url]
|
||||
TARGET=[target window spec]
|
||||
ADDRESS
|
||||
AREA SHAPE=POLY
|
||||
SHAPE=CIRCLE
|
||||
SHAPE=RECT
|
||||
COORDS=[coords]
|
||||
HREF=[url]
|
||||
B
|
||||
BIG
|
||||
BLOCKQUOTE
|
||||
BODY TEXT=[color]
|
||||
LINK=[color]
|
||||
BGCOLOR=[color]
|
||||
BR ALIGN=[alignment]
|
||||
CENTER
|
||||
CITE
|
||||
CODE
|
||||
DD
|
||||
DIV ALIGN=[alignment]
|
||||
DL
|
||||
DT
|
||||
EM
|
||||
FONT COLOR=[color]
|
||||
SIZE=[fontsize]
|
||||
FACE=[comma-separated list of facenames]
|
||||
HR ALIGN=[alignment]
|
||||
SIZE=[pixels]
|
||||
WIDTH=[percent|pixels]
|
||||
NOSHADE
|
||||
H1
|
||||
H2
|
||||
H3
|
||||
H4
|
||||
H5
|
||||
H6
|
||||
I
|
||||
IMG SRC=[url]
|
||||
WIDTH=[pixels]
|
||||
HEIGHT=[pixels]
|
||||
ALIGN=TEXTTOP
|
||||
ALIGN=CENTER
|
||||
ALIGN=ABSCENTER
|
||||
ALIGN=BOTTOM
|
||||
USEMAP=[url]
|
||||
KBD
|
||||
LI
|
||||
MAP NAME=[string]
|
||||
META HTTP-EQUIV="Content-Type"
|
||||
CONTENT=[string]
|
||||
OL
|
||||
P ALIGN=[alignment]
|
||||
PRE
|
||||
SAMP
|
||||
SMALL
|
||||
STRIKE
|
||||
STRONG
|
||||
TABLE ALIGN=[alignment]
|
||||
WIDTH=[percent|pixels]
|
||||
BORDER=[pixels]
|
||||
VALIGN=[v_alignment]
|
||||
BGCOLOR=[color]
|
||||
CELLSPACING=[pixels]
|
||||
CELLPADDING=[pixels]
|
||||
TD ALIGN=[alignment]
|
||||
VALIGN=[v_alignment]
|
||||
BGCOLOR=[color]
|
||||
WIDTH=[percent|pixels]
|
||||
COLSPAN=[pixels]
|
||||
ROWSPAN=[pixels]
|
||||
TH ALIGN=[alignment]
|
||||
VALIGN=[v_alignment]
|
||||
BGCOLOR=[color]
|
||||
WIDTH=[percent|pixels]
|
||||
COLSPAN=[pixels]
|
||||
ROWSPAN=[pixels]
|
||||
TITLE
|
||||
TR ALIGN=[alignment]
|
||||
VALIGN=[v_alignment]
|
||||
BGCOLOR=[color]
|
||||
TT
|
||||
U
|
||||
UL
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
267
docs/latex/wx/htparser.tex
Normal file
267
docs/latex/wx/htparser.tex
Normal file
@@ -0,0 +1,267 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlparser.tex at 14/Mar/99 20:13:37
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlParser}}\label{wxhtmlparser}
|
||||
|
||||
This class handles the {\bf generic} parsing of HTML document: it scans
|
||||
the document and divide it into blocks of tags (where one block
|
||||
consists of beginning and ending tag and of text between these
|
||||
two tags).
|
||||
|
||||
It is independent from wxHtmlWindow and can be used as stand-alone parser
|
||||
(Julian Smart's idea of speech-only HTML viewer or wget-like utility -
|
||||
see InetGet sample for example).
|
||||
|
||||
It uses system of tag handlers to parse the HTML document. Tag handlers
|
||||
are not statically shared by all instances but are created for each
|
||||
wxHtmlParser instance. The reason is that the handler may contain
|
||||
document-specific temporary data used during parsing (e.g. complicated
|
||||
structures like tables).
|
||||
|
||||
Typically the user calls only the \helpref{Parse}{wxhtmlparserparse} method.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
wxObject
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlpars.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Cells Overview}{cells},
|
||||
\helpref{Tag Handlers Overview}{handlers},
|
||||
\helpref{wxHtmlTag}{wxhtmltag}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlParser::wxHtmlParser}\label{wxhtmlparserwxhtmlparser}
|
||||
|
||||
\func{}{wxHtmlParser}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxHtmlParser::AddTag}\label{wxhtmlparseraddtag}
|
||||
|
||||
\func{void}{AddTag}{\param{const wxHtmlTag\& }{tag}}
|
||||
|
||||
This may (and may not) be overwritten in derived class.
|
||||
|
||||
This method is called each time new tag is about to be added.
|
||||
{\it tag} contains information about the tag. (See \helpref{wxHtmlTag}{wxhtmltag}
|
||||
for details.)
|
||||
|
||||
Default (wxHtmlParser) behaviour is this:
|
||||
First it finds a handler capable of handling this tag and then it calls
|
||||
handler's HandleTag method.
|
||||
|
||||
\membersection{wxHtmlParser::AddTagHandler}\label{wxhtmlparseraddtaghandler}
|
||||
|
||||
\func{virtual void}{AddTagHandler}{\param{wxHtmlTagHandler }{*handler}}
|
||||
|
||||
Adds handler to the internal list (\& hash table) of handlers. This
|
||||
method should not be called directly by user but rather by derived class'
|
||||
constructor.
|
||||
|
||||
This adds the handler to this {\bf instance} of wxHtmlParser, not to
|
||||
all objects of this class! (Static front-end to AddTagHandler is provided
|
||||
by wxHtmlWinParser).
|
||||
|
||||
All handlers are deleted on object deletion.
|
||||
|
||||
\membersection{wxHtmlParser::AddText}\label{wxhtmlparseraddword}
|
||||
|
||||
\func{virtual void}{AddWord}{\param{const char* }{txt}}
|
||||
|
||||
Must be overwritten in derived class.
|
||||
|
||||
This method is called by \helpref{DoParsing}{wxhtmlparserdoparsing}
|
||||
each time a part of text is parsed. {\it txt} is NOT only one word, it is
|
||||
substring of input. It is not formatted or preprocessed (so white spaces are
|
||||
unmodified).
|
||||
|
||||
\membersection{wxHtmlParser::DoParsing}\label{wxhtmlparserdoparsing}
|
||||
|
||||
\func{void}{DoParsing}{\param{int }{begin\_pos}, \param{int }{end\_pos}}
|
||||
|
||||
\func{void}{DoParsing}{\void}
|
||||
|
||||
Parses the m\_Source from begin\_pos to end\_pos-1.
|
||||
(in noparams version it parses whole m\_Source)
|
||||
|
||||
\membersection{wxHtmlParser::DoneParser}\label{wxhtmlparserdoneparser}
|
||||
|
||||
\func{virtual void}{DoneParser}{\void}
|
||||
|
||||
This must be called after DoParsing().
|
||||
|
||||
\membersection{wxHtmlParser::GetFS}\label{wxhtmlparsergetfs}
|
||||
|
||||
\constfunc{wxFileSystem*}{GetFS}{\void}
|
||||
|
||||
Returns pointer to the file system. Because each tag handler has
|
||||
reference to it is parent parser it can easily request the file by
|
||||
calling
|
||||
|
||||
\begin{verbatim}
|
||||
wxFSFile *f = m_Parser -> GetFS() -> OpenFile("image.jpg");
|
||||
\end{verbatim}
|
||||
|
||||
\membersection{wxHtmlParser::GetProduct}\label{wxhtmlparsergetproduct}
|
||||
|
||||
\func{virtual wxObject*}{GetProduct}{\void}
|
||||
|
||||
Returns product of parsing. Returned value is result of parsing
|
||||
of the document. The type of this result depends on internal
|
||||
representation in derived parser (but it must be derived from wxObject!).
|
||||
|
||||
See wxHtmlWinParser for details.
|
||||
|
||||
\membersection{wxHtmlParser::GetSource}\label{wxhtmlparsergetsource}
|
||||
|
||||
\func{wxString*}{GetSource}{\void}
|
||||
|
||||
Returns pointer to the source being parsed.
|
||||
|
||||
|
||||
\membersection{wxHtmlParser::InitParser}\label{wxhtmlparserinitparser}
|
||||
|
||||
\func{virtual void}{InitParser}{\param{const wxString\& }{source}}
|
||||
|
||||
Setups the parser for parsing the {\it source} string. (Should be overridden
|
||||
in derived class)
|
||||
|
||||
\membersection{wxHtmlParser::OpenURL}\label{wxhtmlparseropenurl}
|
||||
|
||||
\func{virtual wxFSFile*}{OpenURL}{\param{wxHtmlURLType }{type}, \param{const wxString\& }{url}}
|
||||
|
||||
Opens given URL and returns {\tt wxFSFile} object that can be used to read data
|
||||
from it. This method may return NULL in one of two cases: either the URL doesn't
|
||||
point to any valid resource or the URL is blocked by overridden implementation
|
||||
of {\it OpenURL} in derived class.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{type}{Indicates type of the resource. Is one of
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_URL\_PAGE}}{Opening a HTML page.}
|
||||
\twocolitem{{\bf wxHTML\_URL\_IMAGE}}{Opening an image.}
|
||||
\twocolitem{{\bf wxHTML\_URL\_OTHER}}{Opening a resource that doesn't fall into
|
||||
any other category.}
|
||||
\end{twocollist}}
|
||||
|
||||
\docparam{url}{URL being opened.}
|
||||
|
||||
\wxheading{Notes}
|
||||
|
||||
Always use this method in tag handlers instead of {\tt GetFS()->OpenFile()}
|
||||
because it can block the URL and is thus more secure.
|
||||
|
||||
Default behaviour is to call \helpref{wxHtmlWindow::OnOpeningURL}{wxhtmlwindowonopeningurl}
|
||||
of the associated wxHtmlWindow object (which may decide to block the URL or
|
||||
redirect it to another one),if there's any, and always open the URL if the
|
||||
parser is not used with wxHtmlWindow.
|
||||
|
||||
Returned {\tt wxFSFile} object is not guaranteed to point to {\it url}, it might
|
||||
have been redirected!
|
||||
|
||||
\membersection{wxHtmlParser::Parse}\label{wxhtmlparserparse}
|
||||
|
||||
\func{wxObject*}{Parse}{\param{const wxString\& }{source}}
|
||||
|
||||
Proceeds parsing of the document. This is end-user method. You can simply
|
||||
call it when you need to obtain parsed output (which is parser-specific)
|
||||
|
||||
The method does these things:
|
||||
|
||||
\begin{enumerate}\itemsep=0pt
|
||||
\item calls \helpref{InitParser(source)}{wxhtmlparserinitparser}
|
||||
\item calls \helpref{DoParsing}{wxhtmlparserdoparsing}
|
||||
\item calls \helpref{GetProduct}{wxhtmlparsergetproduct}
|
||||
\item calls \helpref{DoneParser}{wxhtmlparserdoneparser}
|
||||
\item returns value returned by GetProduct
|
||||
\end{enumerate}
|
||||
|
||||
You shouldn't use InitParser, DoParsing, GetProduct or DoneParser directly.
|
||||
|
||||
|
||||
|
||||
\membersection{wxHtmlParser::PushTagHandler}\label{wxhtmlparserpushtaghandler}
|
||||
|
||||
\func{void}{PushTagHandler}{\param{wxHtmlTagHandler* }{handler}, \param{wxString }{tags}}
|
||||
|
||||
Forces the handler to handle additional tags
|
||||
(not returned by \helpref{GetSupportedTags}{wxhtmltaghandlergetsupportedtags}).
|
||||
The handler should already be added to this parser.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{handler}{the handler}
|
||||
\docparam{tags}{List of tags (in same format as GetSupportedTags's return value). The parser
|
||||
will redirect these tags to {\it handler} (until call to \helpref{PopTagHandler}{wxhtmlparserpoptaghandler}). }
|
||||
|
||||
\wxheading{Example}
|
||||
|
||||
Imagine you want to parse following pseudo-html structure:
|
||||
|
||||
\begin{verbatim}
|
||||
<myitems>
|
||||
<param name="one" value="1">
|
||||
<param name="two" value="2">
|
||||
</myitems>
|
||||
|
||||
<execute>
|
||||
<param program="text.exe">
|
||||
</execute>
|
||||
\end{verbatim}
|
||||
|
||||
It is obvious that you cannot use only one tag handler for <param> tag.
|
||||
Instead you must use context-sensitive handlers for <param> inside <myitems>
|
||||
and <param> inside <execute>.
|
||||
|
||||
This is the preferred solution:
|
||||
|
||||
\begin{verbatim}
|
||||
TAG_HANDLER_BEGIN(MYITEM, "MYITEMS")
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
// ...something...
|
||||
|
||||
m_Parser -> PushTagHandler(this, "PARAM");
|
||||
ParseInner(tag);
|
||||
m_Parser -> PopTagHandler();
|
||||
|
||||
// ...something...
|
||||
}
|
||||
TAG_HANDLER_END(MYITEM)
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\membersection{wxHtmlParser::PopTagHandler}\label{wxhtmlparserpoptaghandler}
|
||||
|
||||
\func{void}{PopTagHandler}{\void}
|
||||
|
||||
Restores parser's state before last call to
|
||||
\helpref{PushTagHandler}{wxhtmlparserpushtaghandler}.
|
||||
|
||||
|
||||
\membersection{wxHtmlParser::SetFS}\label{wxhtmlparsersetfs}
|
||||
|
||||
\func{void}{SetFS}{\param{wxFileSystem }{*fs}}
|
||||
|
||||
Sets the virtual file system that will be used to request additional
|
||||
files. (For example {\tt <IMG>} tag handler requests wxFSFile with the
|
||||
image data.)
|
||||
|
||||
\membersection{wxHtmlParser::StopParsing}\label{wxhtmlparserstopparsing}
|
||||
|
||||
\func{void}{StopParsing}{\void}
|
||||
|
||||
Call this function to interrupt parsing from a tag handler. No more tags
|
||||
will be parsed afterward. This function may only be called from
|
||||
\helpref{wxHtmlParser::Parse}{wxhtmlparserparse} or any function called
|
||||
by it (i.e. from tag handlers).
|
||||
|
||||
106
docs/latex/wx/htprint.tex
Normal file
106
docs/latex/wx/htprint.tex
Normal file
@@ -0,0 +1,106 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmprint.h at 17/Oct/99 12:48:02
|
||||
%
|
||||
|
||||
|
||||
\section{\class{wxHtmlPrintout}}\label{wxhtmlprintout}
|
||||
|
||||
This class serves as printout class for HTML documents.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxPrintout}{wxprintout}
|
||||
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmprint.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxHtmlPrintout::wxHtmlPrintout}\label{wxhtmlprintoutwxhtmlprintout}
|
||||
|
||||
\func{}{wxHtmlPrintout}{\param{const wxString\& }{title = "Printout"}}
|
||||
|
||||
Constructor.
|
||||
|
||||
|
||||
\membersection{wxHtmlPrintout::SetFonts}\label{wxhtmlprintoutsetfonts}
|
||||
|
||||
\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}}
|
||||
|
||||
Sets fonts. See \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} for
|
||||
detailed description.
|
||||
|
||||
\membersection{wxHtmlPrintout::SetFooter}\label{wxhtmlprintoutsetfooter}
|
||||
|
||||
\func{void}{SetFooter}{\param{const wxString\& }{footer}, \param{int }{pg = wxPAGE\_ALL}}
|
||||
|
||||
Sets page footer.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{footer}{HTML text to be used as footer. You can use macros in it:
|
||||
\begin{itemize}
|
||||
\item @PAGENUM@ is replaced by page number
|
||||
\item @PAGESCNT@ is replaced by total number of pages
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}
|
||||
|
||||
|
||||
\membersection{wxHtmlPrintout::SetHeader}\label{wxhtmlprintoutsetheader}
|
||||
|
||||
\func{void}{SetHeader}{\param{const wxString\& }{header}, \param{int }{pg = wxPAGE\_ALL}}
|
||||
|
||||
Sets page header.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{header}{HTML text to be used as header. You can use macros in it:
|
||||
\begin{itemize}
|
||||
\item @PAGENUM@ is replaced by page number
|
||||
\item @PAGESCNT@ is replaced by total number of pages
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}
|
||||
|
||||
|
||||
\membersection{wxHtmlPrintout::SetHtmlFile}\label{wxhtmlprintoutsethtmlfile}
|
||||
|
||||
\func{void}{SetHtmlFile}{\param{const wxString\& }{htmlfile}}
|
||||
|
||||
Prepare the class for printing this HTML {\bf file}. The file may be located on
|
||||
any virtual file system or it may be normal file.
|
||||
|
||||
|
||||
|
||||
\membersection{wxHtmlPrintout::SetHtmlText}\label{wxhtmlprintoutsethtmltext}
|
||||
|
||||
\func{void}{SetHtmlText}{\param{const wxString\& }{html}, \param{const wxString\& }{basepath = wxEmptyString}, \param{bool }{isdir = true}}
|
||||
|
||||
Prepare the class for printing this HTML text.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{html}{HTML text. (NOT file!)}
|
||||
|
||||
\docparam{basepath}{base directory (html string would be stored there if it was in
|
||||
file). It is used to determine path for loading images, for example.}
|
||||
|
||||
\docparam{isdir}{false if basepath is filename, true if it is directory name
|
||||
(see \helpref{wxFileSystem}{wxfilesystem} for detailed explanation)}
|
||||
|
||||
|
||||
|
||||
\membersection{wxHtmlPrintout::SetMargins}\label{wxhtmlprintoutsetmargins}
|
||||
|
||||
\func{void}{SetMargins}{\param{float }{top = 25.2}, \param{float }{bottom = 25.2}, \param{float }{left = 25.2}, \param{float }{right = 25.2}, \param{float }{spaces = 5}}
|
||||
|
||||
Sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space
|
||||
between text and header and/or footer
|
||||
|
||||
194
docs/latex/wx/httag.tex
Normal file
194
docs/latex/wx/httag.tex
Normal file
@@ -0,0 +1,194 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmltag.tex at 14/Mar/99 20:13:37
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlTag}}\label{wxhtmltag}
|
||||
|
||||
This class represents a single HTML tag.
|
||||
It is used by \helpref{tag handlers}{handlers}.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
wxObject
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmltag.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlTag::wxHtmlTag}\label{wxhtmltagwxhtmltag}
|
||||
|
||||
\func{}{wxHtmlTag}{\param{const wxString\& }{source}, \param{int }{pos}, \param{int }{end\_pos}, \param{wxHtmlTagsCache* }{cache}}
|
||||
|
||||
Constructor. You will probably never have to construct a wxHtmlTag object
|
||||
yourself. Feel free to ignore the constructor parameters.
|
||||
Have a look at src/html/htmlpars.cpp if you're interested in creating it.
|
||||
|
||||
\membersection{wxHtmlTag::GetAllParams}\label{wxhtmltaggetallparams}
|
||||
|
||||
\constfunc{const wxString\&}{GetAllParams}{\void}
|
||||
|
||||
Returns a string containing all parameters.
|
||||
|
||||
Example : tag contains {\tt <FONT SIZE=+2 COLOR="\#000000">}. Call to
|
||||
tag.GetAllParams() would return {\tt SIZE=+2 COLOR="\#000000"}.
|
||||
|
||||
|
||||
\membersection{wxHtmlTag::GetBeginPos}\label{wxhtmltaggetbeginpos}
|
||||
|
||||
\constfunc{int}{GetBeginPos}{\void}
|
||||
|
||||
Returns beginning position of the text {\it between} this tag and paired
|
||||
ending tag.
|
||||
See explanation (returned position is marked with `|'):
|
||||
|
||||
\begin{verbatim}
|
||||
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|
||||
|
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\membersection{wxHtmlTag::GetEndPos1}\label{wxhtmltaggetendpos1}
|
||||
|
||||
\constfunc{int}{GetEndPos1}{\void}
|
||||
|
||||
Returns ending position of the text {\it between} this tag and paired
|
||||
ending tag.
|
||||
See explanation (returned position is marked with `|'):
|
||||
|
||||
\begin{verbatim}
|
||||
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|
||||
|
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\membersection{wxHtmlTag::GetEndPos2}\label{wxhtmltaggetendpos2}
|
||||
|
||||
\constfunc{int}{GetEndPos2}{\void}
|
||||
|
||||
Returns ending position 2 of the text {\it between} this tag and paired
|
||||
ending tag.
|
||||
See explanation (returned position is marked with `|'):
|
||||
|
||||
\begin{verbatim}
|
||||
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|
||||
|
|
||||
\end{verbatim}
|
||||
|
||||
\membersection{wxHtmlTag::GetName}\label{wxhtmltaggetname}
|
||||
|
||||
\constfunc{wxString}{GetName}{\void}
|
||||
|
||||
Returns tag's name. The name is always in uppercase and it doesn't contain
|
||||
'<' or '/' characters. (So the name of {\tt <FONT SIZE=+2>} tag is "FONT"
|
||||
and name of {\tt </table>} is "TABLE")
|
||||
|
||||
|
||||
\membersection{wxHtmlTag::GetParam}\label{wxhtmltaggetparam}
|
||||
|
||||
\constfunc{wxString}{GetParam}{\param{const wxString\& }{par}, \param{bool }{with\_commas = false}}
|
||||
|
||||
Returns the value of the parameter. You should check whether the
|
||||
parameter exists or not (use \helpref{HasParam}{wxhtmltaghasparam}) first.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{par}{The parameter's name.}
|
||||
|
||||
\docparam{with\_commas}{true if you want to get commas as well. See example.}
|
||||
|
||||
\wxheading{Example}
|
||||
|
||||
\begin{verbatim}
|
||||
...
|
||||
/* you have wxHtmlTag variable tag which is equal to
|
||||
HTML tag <FONT SIZE=+2 COLOR="#0000FF"> */
|
||||
dummy = tag.GetParam("SIZE");
|
||||
// dummy == "+2"
|
||||
dummy = tag.GetParam("COLOR");
|
||||
// dummy == "#0000FF"
|
||||
dummy = tag.GetParam("COLOR", true);
|
||||
// dummy == "\"#0000FF\"" -- see the difference!!
|
||||
\end{verbatim}
|
||||
|
||||
\membersection{wxHtmlTag::GetParamAsColour}\label{wxhtmltaggetparamascolour}
|
||||
|
||||
\constfunc{bool}{GetParamAsColour}{\param{const wxString\& }{par}, \param{wxColour *}{clr}}
|
||||
|
||||
Interprets tag parameter {\it par} as colour specification and saves its value
|
||||
into wxColour variable pointed by {\it clr}.
|
||||
|
||||
Returns true on success and false if {\it par} is not colour specification or
|
||||
if the tag has no such parameter.
|
||||
|
||||
\membersection{wxHtmlTag::GetParamAsInt}\label{wxhtmltaggetparamasint}
|
||||
|
||||
\constfunc{bool}{GetParamAsInt}{\param{const wxString\& }{par}, \param{int *}{value}}
|
||||
|
||||
Interprets tag parameter {\it par} as an integer and saves its value
|
||||
into int variable pointed by {\it value}.
|
||||
|
||||
Returns true on success and false if {\it par} is not an integer or
|
||||
if the tag has no such parameter.
|
||||
|
||||
\membersection{wxHtmlTag::HasEnding}\label{wxhtmltaghasending}
|
||||
|
||||
\constfunc{bool}{HasEnding}{\void}
|
||||
|
||||
Returns true if this tag is paired with ending tag, false otherwise.
|
||||
|
||||
See the example of HTML document:
|
||||
|
||||
\begin{verbatim}
|
||||
<html><body>
|
||||
Hello<p>
|
||||
How are you?
|
||||
<p align=center>This is centered...</p>
|
||||
Oops<br>Oooops!
|
||||
</body></html>
|
||||
\end{verbatim}
|
||||
|
||||
In this example tags HTML and BODY have ending tags, first P and BR
|
||||
doesn't have ending tag while the second P has. The third P tag (which
|
||||
is ending itself) of course doesn't have ending tag.
|
||||
|
||||
\membersection{wxHtmlTag::HasParam}\label{wxhtmltaghasparam}
|
||||
|
||||
\constfunc{bool}{HasParam}{\param{const wxString\& }{par}}
|
||||
|
||||
Returns true if the tag has a parameter of the given name.
|
||||
Example : {\tt <FONT SIZE=+2 COLOR="\#FF00FF">} has two parameters named
|
||||
"SIZE" and "COLOR".
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{par}{the parameter you're looking for.}
|
||||
|
||||
\membersection{wxHtmlTag::IsEnding}\label{wxhtmltagisending}
|
||||
|
||||
\constfunc{bool}{IsEnding}{\void}
|
||||
|
||||
Returns true if this tag is ending one.
|
||||
({\tt </FONT>} is ending tag, {\tt <FONT>} is not)
|
||||
|
||||
\membersection{wxHtmlTag::ScanParam}\label{wxhtmltagscanparam}
|
||||
|
||||
\constfunc{wxString}{ScanParam}{\param{const wxString\& }{par}, \param{const wxChar *}{format}, \param{void *}{value}}
|
||||
|
||||
This method scans the given parameter. Usage is exactly the same as sscanf's
|
||||
usage except that you don't pass a string but a parameter name as the first
|
||||
argument
|
||||
and you can only retrieve one value (i.e. you can use only one "\%" element
|
||||
in {\it format}).
|
||||
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{par}{The name of the tag you want to query}
|
||||
|
||||
\docparam{format}{scanf()-like format string.}
|
||||
|
||||
\docparam{value}{pointer to a variable to store the value in }
|
||||
|
||||
91
docs/latex/wx/httaghnd.tex
Normal file
91
docs/latex/wx/httaghnd.tex
Normal file
@@ -0,0 +1,91 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmltaghandler.tex at 18/Mar/99 19:20:29
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlTagHandler}}\label{wxhtmltaghandler}
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlpars.h>
|
||||
|
||||
\wxheading{See Also}
|
||||
|
||||
\helpref{Overview}{handlers},
|
||||
\helpref{wxHtmlTag}{wxhtmltag}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlTagHandler::m\_Parser}\label{wxhtmltaghandlermparser}
|
||||
|
||||
{\bf wxHtmlParser* m\_Parser}
|
||||
|
||||
This attribute is used to access parent parser. It is protected so that
|
||||
it can't be accessed by user but can be accessed from derived classes.
|
||||
|
||||
\membersection{wxHtmlTagHandler::wxHtmlTagHandler}\label{wxhtmltaghandlerwxhtmltaghandler}
|
||||
|
||||
\func{}{wxHtmlTagHandler}{\void}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxHtmlTagHandler::GetSupportedTags}\label{wxhtmltaghandlergetsupportedtags}
|
||||
|
||||
\func{virtual wxString}{GetSupportedTags}{\void}
|
||||
|
||||
Returns list of supported tags. The list is in uppercase and tags
|
||||
are delimited by ','. Example : {\tt "I,B,FONT,P" }
|
||||
|
||||
\membersection{wxHtmlTagHandler::HandleTag}\label{wxhtmltaghandlerhandletag}
|
||||
|
||||
\func{virtual bool}{HandleTag}{\param{const wxHtmlTag\& }{tag}}
|
||||
|
||||
This is the core method of each handler. It is called each time
|
||||
one of supported tags is detected. {\it tag} contains all necessary
|
||||
info (see \helpref{wxHtmlTag}{wxhtmltag} for details).
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
true if \helpref{ParseInner}{wxhtmltaghandlerparseinner} was called,
|
||||
false otherwise.
|
||||
|
||||
\wxheading{Example}
|
||||
|
||||
\begin{verbatim}
|
||||
bool MyHandler::HandleTag(const wxHtmlTag& tag)
|
||||
{
|
||||
...
|
||||
// change state of parser (e.g. set bold face)
|
||||
ParseInner(tag);
|
||||
...
|
||||
// restore original state of parser
|
||||
}
|
||||
\end{verbatim}
|
||||
|
||||
You shouldn't call ParseInner if the tag is not paired with an ending one.
|
||||
|
||||
\membersection{wxHtmlTagHandler::ParseInner}\label{wxhtmltaghandlerparseinner}
|
||||
|
||||
\func{void}{ParseInner}{\param{const wxHtmlTag\& }{tag}}
|
||||
|
||||
This method calls parser's \helpref{DoParsing}{wxhtmlparserdoparsing} method
|
||||
for the string between this tag and the paired ending tag:
|
||||
|
||||
\begin{verbatim}
|
||||
...<A HREF="x.htm">Hello, world!</A>...
|
||||
\end{verbatim}
|
||||
|
||||
In this example, a call to ParseInner (with {\it tag} pointing to A tag)
|
||||
will parse 'Hello, world!'.
|
||||
|
||||
\membersection{wxHtmlTagHandler::SetParser}\label{wxhtmltaghandlersetparser}
|
||||
|
||||
\func{virtual void}{SetParser}{\param{wxHtmlParser }{*parser}}
|
||||
|
||||
Assigns {\it parser} to this handler. Each {\bf instance} of handler
|
||||
is guaranteed to be called only from the parser.
|
||||
|
||||
43
docs/latex/wx/httagmod.tex
Normal file
43
docs/latex/wx/httagmod.tex
Normal file
@@ -0,0 +1,43 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmltagsmodule.tex at 14/Mar/99 20:13:37
|
||||
|
||||
\section{\class{wxHtmlTagsModule}}\label{wxhtmltagsmodule}
|
||||
|
||||
This class provides easy way of filling wxHtmlWinParser's table of
|
||||
tag handlers. It is used almost exclusively together with the set of
|
||||
\helpref{TAGS\_MODULE\_* macros}{handlers}
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxModule}{wxmodule}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/winpars.h>
|
||||
|
||||
\wxheading{See Also}
|
||||
|
||||
\helpref{Tag Handlers}{handlers},
|
||||
\helpref{wxHtmlTagHandler}{wxhtmltaghandler},
|
||||
\helpref{wxHtmlWinTagHandler}{wxhtmlwintaghandler},
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlTagsModule::FillHandlersTable}\label{wxhtmltagsmodulefillhandlerstable}
|
||||
|
||||
\func{virtual void}{FillHandlersTable}{\param{wxHtmlWinParser }{*parser}}
|
||||
|
||||
You must override this method. In most common case its body consists
|
||||
only of lines of the following type:
|
||||
|
||||
\begin{verbatim}
|
||||
parser -> AddTagHandler(new MyHandler);
|
||||
\end{verbatim}
|
||||
|
||||
I recommend using the {\bf TAGS\_MODULE\_*} macros.
|
||||
|
||||
\wxheading{Paremeters}
|
||||
|
||||
\docparam{parser}{Pointer to the parser that requested tables filling.}
|
||||
|
||||
70
docs/latex/wx/http.tex
Normal file
70
docs/latex/wx/http.tex
Normal file
@@ -0,0 +1,70 @@
|
||||
\section{\class{wxHTTP}}\label{wxhttp}
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxProtocol}{wxprotocol}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/protocol/http.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxSocketBase}{wxsocketbase}, \helpref{wxURL}{wxurl}
|
||||
|
||||
% ----------------------------------------------------------------------------
|
||||
% Members
|
||||
% ----------------------------------------------------------------------------
|
||||
|
||||
% ----------------------------------------------------------------------------
|
||||
\membersection{wxHTTP::GetInputStream}\label{wxhttpgetinputstream}
|
||||
|
||||
\func{wxInputStream *}{GetInputStream}{\param{const wxString\&}{ path}}
|
||||
|
||||
Creates a new input stream on the the specified path. You can use all except the seek
|
||||
functionality of wxStream. Seek isn't available on all streams. For example,
|
||||
http or ftp streams doesn't deal with it. Other functions like Tell and SeekI
|
||||
for this sort of stream.
|
||||
You will be notified when the EOF is reached by an error.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
You can know the size of the file you are getting using \helpref{wxStreamBase::GetSize()}{wxstreambasegetsize}.
|
||||
But there is a limitation: as HTTP servers aren't obliged to pass the size of
|
||||
the file, in some case, you will be returned 0xfffffff by GetSize(). In these
|
||||
cases, you should use the value returned by \helpref{wxInputStream::LastRead()}{wxinputstreamlastread}:
|
||||
this value will be 0 when the stream is finished.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
Returns the initialized stream. You will have to delete it yourself once you
|
||||
don't use it anymore. The destructor closes the network connection.
|
||||
The next time you will try to get a file the network connection will have
|
||||
to be reestablished: but you don't have to take care of this wxHTTP reestablishes it automatically.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxInputStream}{wxinputstream}
|
||||
|
||||
% ----------------------------------------------------------------------------
|
||||
|
||||
\membersection{wxHTTP::SetHeader}
|
||||
|
||||
\func{void}{SetHeader}{\param{const wxString\&}{ header}, \param{const wxString\&}{ h\_data}}
|
||||
|
||||
It sets data of a field to be sent during the next request to the HTTP server. The field
|
||||
name is specified by {\it header} and the content by {\it h\_data}.
|
||||
This is a low level function and it assumes that you know what you are doing.
|
||||
|
||||
\membersection{wxHTTP::GetHeader}
|
||||
|
||||
\func{wxString}{GetHeader}{\param{const wxString\&}{ header}}
|
||||
|
||||
Returns the data attached with a field whose name is specified by {\it header}.
|
||||
If the field doesn't exist, it will return an empty string and not a NULL string.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
The header is not case-sensitive: I mean that "CONTENT-TYPE" and "content-type"
|
||||
represent the same header.
|
||||
|
||||
37
docs/latex/wx/htwidget.tex
Normal file
37
docs/latex/wx/htwidget.tex
Normal file
@@ -0,0 +1,37 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlcell.h at 14/Apr/99 20:12:40
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlWidgetCell}}\label{wxhtmlwidgetcell}
|
||||
|
||||
wxHtmlWidgetCell is a class that provides a connection between HTML cells and widgets (an object derived
|
||||
from wxWindow). You can use it to display things like forms, input boxes etc. in an HTML window.
|
||||
|
||||
wxHtmlWidgetCell takes care of resizing and moving window.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxHtmlCell}{wxhtmlcell}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlcell.h>
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlWidgetCell::wxHtmlWidgetCell}\label{wxhtmlwidgetcellwxhtmlwidgetcell}
|
||||
|
||||
\func{}{wxHtmlWidgetCell}{\param{wxWindow* }{wnd}, \param{int }{w = 0}}
|
||||
|
||||
Constructor.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{wnd}{Connected window. It is parent window {\bf must} be the wxHtmlWindow object within
|
||||
which it is displayed!}
|
||||
|
||||
\docparam{w}{Floating width. If non-zero width of {\it wnd} window is adjusted so that it is
|
||||
always {\it w} percents of parent container's width. (For example w = 100 means that the window
|
||||
will always have same width as parent container)}
|
||||
|
||||
383
docs/latex/wx/htwindow.tex
Normal file
383
docs/latex/wx/htwindow.tex
Normal file
@@ -0,0 +1,383 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlwindow.tex at 14/Mar/99 20:13:37
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlWindow}}\label{wxhtmlwindow}
|
||||
|
||||
wxHtmlWindow is probably the only class you will directly use
|
||||
unless you want to do something special (like adding new tag
|
||||
handlers or MIME filters).
|
||||
|
||||
The purpose of this class is to display HTML pages (either local
|
||||
file or downloaded via HTTP protocol) in a window. The width
|
||||
of the window is constant - given in the constructor - and virtual height
|
||||
is changed dynamically depending on page size.
|
||||
Once the window is created you can set its content by calling
|
||||
\helpref{SetPage(text)}{wxhtmlwindowsetpage},
|
||||
\helpref{LoadPage(filename)}{wxhtmlwindowloadpage} or
|
||||
\helpref{LoadFile}{wxhtmlwindowloadfile}.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
wxHtmlWindow uses the \helpref{wxImage}{wximage} class for displaying images.
|
||||
Don't forget to initialize all image formats you need before loading any page!
|
||||
(See \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} and
|
||||
\helpref{wxImage::AddHandler}{wximageaddhandler}.)
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxScrolledWindow}{wxscrolledwindow}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/htmlwin.h>
|
||||
|
||||
\membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}
|
||||
|
||||
\func{}{wxHtmlWindow}{\void}
|
||||
|
||||
Default constructor.
|
||||
|
||||
\func{}{wxHtmlWindow}{\param{wxWindow }{*parent}, \param{wxWindowID }{id = -1}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxHW\_SCROLLBAR\_AUTO}, \param{const wxString\& }{name = "htmlWindow"}}
|
||||
|
||||
Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{style}{wxHW\_SCROLLBAR\_NEVER, or wxHW\_SCROLLBAR\_AUTO.
|
||||
Affects the appearance of vertical scrollbar in the window.}
|
||||
|
||||
\membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}
|
||||
|
||||
\func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}
|
||||
|
||||
Adds \helpref{input filter}{filters} to the static list of available
|
||||
filters. These filters are present by default:
|
||||
|
||||
\begin{itemize}\itemsep=0pt
|
||||
\item {\tt text/html} MIME type
|
||||
\item {\tt image/*} MIME types
|
||||
\item Plain Text filter (this filter is used if no other filter matches)
|
||||
\end{itemize}
|
||||
|
||||
\membersection{wxHtmlWindow::AppendToPage}\label{wxhtmlwindowappendtopage}
|
||||
|
||||
\func{bool}{AppendToPage}{\param{const wxString\& }{source}}
|
||||
|
||||
Appends HTML fragment to currently displayed text and refreshes the window.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{source}{HTML code fragment}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
false if an error occurred, true otherwise.
|
||||
|
||||
\membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}
|
||||
|
||||
\constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}
|
||||
|
||||
Returns pointer to the top-level container.
|
||||
|
||||
See also: \helpref{Cells Overview}{cells},
|
||||
\helpref{Printing Overview}{printing}
|
||||
|
||||
\membersection{wxHtmlWindow::GetOpenedAnchor}\label{wxhtmlwindowgetopenedanchor}
|
||||
|
||||
\func{wxString}{GetOpenedAnchor}{\void}
|
||||
|
||||
Returns anchor within currently opened page
|
||||
(see \helpref{GetOpenedPage}{wxhtmlwindowgetopenedpage}).
|
||||
If no page is opened or if the displayed page wasn't
|
||||
produced by call to LoadPage, empty string is returned.
|
||||
|
||||
|
||||
\membersection{wxHtmlWindow::GetOpenedPage}\label{wxhtmlwindowgetopenedpage}
|
||||
|
||||
\func{wxString}{GetOpenedPage}{\void}
|
||||
|
||||
Returns full location of the opened page. If no page is opened or if the displayed page wasn't
|
||||
produced by call to LoadPage, empty string is returned.
|
||||
|
||||
\membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle}
|
||||
|
||||
\func{wxString}{GetOpenedPageTitle}{\void}
|
||||
|
||||
Returns title of the opened page or wxEmptyString if current page does not contain {\tt <TITLE>} tag.
|
||||
|
||||
\membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}
|
||||
|
||||
\constfunc{wxFrame*}{GetRelatedFrame}{\void}
|
||||
|
||||
Returns the related frame.
|
||||
|
||||
\membersection{wxHtmlWindow::HistoryBack}\label{wxhtmlwindowhistoryback}
|
||||
|
||||
\func{bool}{HistoryBack}{\void}
|
||||
|
||||
Moves back to the previous page. (each page displayed using
|
||||
\helpref{LoadPage}{wxhtmlwindowloadpage} is stored in history list.)
|
||||
|
||||
\membersection{wxHtmlWindow::HistoryCanBack}\label{wxhtmlwindowhistorycanback}
|
||||
|
||||
\func{bool}{HistoryCanBack}{\void}
|
||||
|
||||
Returns true if it is possible to go back in the history (i.e. HistoryBack()
|
||||
won't fail).
|
||||
|
||||
\membersection{wxHtmlWindow::HistoryCanForward}\label{wxhtmlwindowhistorycanforward}
|
||||
|
||||
\func{bool}{HistoryCanForward}{\void}
|
||||
|
||||
Returns true if it is possible to go forward in the history (i.e. HistoryBack()
|
||||
won't fail).
|
||||
|
||||
|
||||
\membersection{wxHtmlWindow::HistoryClear}\label{wxhtmlwindowhistoryclear}
|
||||
|
||||
\func{void}{HistoryClear}{\void}
|
||||
|
||||
Clears history.
|
||||
|
||||
\membersection{wxHtmlWindow::HistoryForward}\label{wxhtmlwindowhistoryforward}
|
||||
|
||||
\func{bool}{HistoryForward}{\void}
|
||||
|
||||
Moves to next page in history.
|
||||
|
||||
\membersection{wxHtmlWindow::LoadFile}\label{wxhtmlwindowloadfile}
|
||||
|
||||
\func{virtual bool}{LoadFile}{\param{const wxFileName\& }{filename}}
|
||||
|
||||
Loads HTML page from file and displays it.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
false if an error occurred, true otherwise
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{LoadPage}{wxhtmlwindowloadpage}
|
||||
|
||||
\membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}
|
||||
|
||||
\func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}
|
||||
|
||||
Unlike SetPage this function first loads HTML page from {\it location}
|
||||
and then displays it. See example:
|
||||
|
||||
\begin{verbatim}
|
||||
htmlwin->LoadPage("help/myproject/index.htm");
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{location}{The address of document. See \helpref{wxFileSystem}{wxfilesystem} for details on address format and behaviour of "opener".}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
false if an error occurred, true otherwise
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{LoadFile}{wxhtmlwindowloadfile}
|
||||
|
||||
\membersection{wxHtmlWindow::OnCellClicked}\label{wxhtmlwindowoncellclicked}
|
||||
|
||||
\func{virtual void}{OnCellClicked}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}, \param{const wxMouseEvent\& }{event}}
|
||||
|
||||
This method is called when a mouse button is clicked inside wxHtmlWindow.
|
||||
The default behaviour is to call
|
||||
\helpref{OnLinkClicked}{wxhtmlwindowonlinkclicked} if the cell contains a
|
||||
hypertext link.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{cell}{The cell inside which the mouse was clicked, always a simple
|
||||
(i.e. non container) cell}
|
||||
|
||||
\docparam{x, y}{The logical coordinates of the click point}
|
||||
|
||||
\docparam{event}{The mouse event containing other information about the click}
|
||||
|
||||
\membersection{wxHtmlWindow::OnCellMouseHover}\label{wxhtmlwindowoncellmousehover}
|
||||
|
||||
\func{virtual void}{OnCellMouseHover}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}}
|
||||
|
||||
This method is called when a mouse moves over an HTML cell.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{cell}{The cell inside which the mouse is currently, always a simple
|
||||
(i.e. non container) cell}
|
||||
|
||||
\docparam{x, y}{The logical coordinates of the click point}
|
||||
|
||||
\membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}
|
||||
|
||||
\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
|
||||
|
||||
Called when user clicks on hypertext link. Default behaviour is to call
|
||||
\helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
|
||||
|
||||
Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
|
||||
|
||||
\membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}
|
||||
|
||||
\func{virtual wxHtmlOpeningStatus}{OnOpeningURL}{\param{wxHtmlURLType }{type},\param{const wxString\& }{url}, \param{wxString *}{redirect}}
|
||||
|
||||
Called when an URL is being opened (either when the user clicks on a link or
|
||||
an image is loaded). The URL will be opened only if OnOpeningURL returns
|
||||
{\tt wxHTML\_OPEN}. This method is called by
|
||||
\helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl}.
|
||||
You can override OnOpeningURL to selectively block some
|
||||
URLs (e.g. for security reasons) or to redirect them elsewhere. Default
|
||||
behaviour is to always return {\tt wxHTML\_OPEN}.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{type}{Indicates type of the resource. Is one of
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_URL\_PAGE}}{Opening a HTML page.}
|
||||
\twocolitem{{\bf wxHTML\_URL\_IMAGE}}{Opening an image.}
|
||||
\twocolitem{{\bf wxHTML\_URL\_OTHER}}{Opening a resource that doesn't fall into
|
||||
any other category.}
|
||||
\end{twocollist}}
|
||||
|
||||
\docparam{url}{URL being opened.}
|
||||
|
||||
\docparam{redirect}{Pointer to wxString variable that must be filled with an
|
||||
URL if OnOpeningURL returns {\tt wxHTML\_REDIRECT}.}
|
||||
|
||||
\wxheading{Return value}
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf wxHTML\_OPEN}}{Open the URL.}
|
||||
\twocolitem{{\bf wxHTML\_BLOCK}}{Deny access to the URL, \helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl} will return NULL.}
|
||||
\twocolitem{{\bf wxHTML\_REDIRECT}}{Don't open {\it url}, redirect to another
|
||||
URL. OnOpeningURL must fill {\it *redirect} with the new URL. OnOpeningURL will
|
||||
be called again on returned URL.}
|
||||
\end{twocollist}
|
||||
|
||||
\membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle}
|
||||
|
||||
\func{virtual void}{OnSetTitle}{\param{const wxString\& }{title}}
|
||||
|
||||
Called on parsing {\tt <TITLE>} tag.
|
||||
|
||||
|
||||
\membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization}
|
||||
|
||||
\func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
|
||||
|
||||
This reads custom settings from wxConfig. It uses the path 'path'
|
||||
if given, otherwise it saves info into currently selected path.
|
||||
The values are stored in sub-path {\tt wxHtmlWindow}
|
||||
|
||||
Read values: all things set by SetFonts, SetBorders.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{cfg}{wxConfig from which you want to read the configuration.}
|
||||
|
||||
\docparam{path}{Optional path in config tree. If not given current path is used.}
|
||||
|
||||
\membersection{wxHtmlWindow::SetBorders}\label{wxhtmlwindowsetborders}
|
||||
|
||||
\func{void}{SetBorders}{\param{int }{b}}
|
||||
|
||||
This function sets the space between border of window and HTML contents. See image:
|
||||
|
||||
\helponly{\image{}{border.bmp}}
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{b}{indentation from borders in pixels}
|
||||
|
||||
\membersection{wxHtmlWindow::SetFonts}\label{wxhtmlwindowsetfonts}
|
||||
|
||||
\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}}
|
||||
|
||||
This function sets font sizes and faces.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{normal\_face}{This is face name for normal (i.e. non-fixed) font.
|
||||
It can be either empty string (then the default face is chosen) or
|
||||
platform-specific face name. Examples are "helvetica" under Unix or
|
||||
"Times New Roman" under Windows.}
|
||||
|
||||
\docparam{fixed\_face}{The same thing for fixed face ( <TT>..</TT> )}
|
||||
|
||||
\docparam{sizes}{This is an array of 7 items of {\it int} type.
|
||||
The values represent size of font with HTML size from -2 to +4
|
||||
( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if {\it sizes}
|
||||
is NULL.}
|
||||
|
||||
\wxheading{Defaults}
|
||||
|
||||
Default font sizes are defined by constants wxHTML\_FONT\_SIZE\_1,
|
||||
wxHTML\_FONT\_SIZE\_2, ..., wxHTML\_FONT\_SIZE\_7. Note that they differ among
|
||||
platforms. Default face names are empty strings.
|
||||
|
||||
\membersection{wxHtmlWindow::SetPage}\label{wxhtmlwindowsetpage}
|
||||
|
||||
\func{bool}{SetPage}{\param{const wxString\& }{source}}
|
||||
|
||||
Sets HTML page and display it. This won't {\bf load} the page!!
|
||||
It will display the {\it source}. See example:
|
||||
|
||||
\begin{verbatim}
|
||||
htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
|
||||
\end{verbatim}
|
||||
|
||||
If you want to load a document from some location use
|
||||
\helpref{LoadPage}{wxhtmlwindowloadpage} instead.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{source}{The HTML document source to be displayed.}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
false if an error occurred, true otherwise.
|
||||
|
||||
\membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe}
|
||||
|
||||
\func{void}{SetRelatedFrame}{\param{wxFrame* }{frame}, \param{const wxString\& }{format}}
|
||||
|
||||
Sets the frame in which page title will be displayed. {\it format} is format of
|
||||
frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
|
||||
\%s is substituted with HTML page title.
|
||||
|
||||
\membersection{wxHtmlWindow::SetRelatedStatusBar}\label{wxhtmlwindowsetrelatedstatusbar}
|
||||
|
||||
\func{void}{SetRelatedStatusBar}{\param{int }{bar}}
|
||||
|
||||
{\bf After} calling \helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe},
|
||||
this sets statusbar slot where messages will be displayed.
|
||||
(Default is -1 = no messages.)
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{bar}{statusbar slot number (0..n)}
|
||||
|
||||
|
||||
\membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
|
||||
|
||||
\func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
|
||||
|
||||
Saves custom settings into wxConfig. It uses the path 'path'
|
||||
if given, otherwise it saves info into currently selected path.
|
||||
Regardless of whether the path is given or not, the function creates sub-path
|
||||
{\tt wxHtmlWindow}.
|
||||
|
||||
Saved values: all things set by SetFonts, SetBorders.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{cfg}{wxConfig to which you want to save the configuration.}
|
||||
|
||||
\docparam{path}{Optional path in config tree. If not given, the current path is used.}
|
||||
|
||||
31
docs/latex/wx/htwinhnd.tex
Normal file
31
docs/latex/wx/htwinhnd.tex
Normal file
@@ -0,0 +1,31 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlwintaghandler.tex at 14/Mar/99 20:13:37
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlWinTagHandler}}\label{wxhtmlwintaghandler}
|
||||
|
||||
This is basically wxHtmlTagHandler except that
|
||||
it is extended with protected member m\_WParser pointing to
|
||||
the wxHtmlWinParser object (value of this member is identical
|
||||
to wxHtmlParser's m\_Parser).
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxHtmlTagHandler}{wxhtmltaghandler}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/winpars.h>
|
||||
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlWinTagHandler::m\_WParser}\label{wxhtmlwintaghandlerwxhtmlwintaghandlermwparser}
|
||||
|
||||
{\bf wxHtmlWinParser* m\_WParser}
|
||||
|
||||
Value of this attribute is identical to value of m\_Parser. The only different
|
||||
is that m\_WParser points to wxHtmlWinParser object while m\_Parser
|
||||
points to wxHtmlParser object. (The same object, but overcast.)
|
||||
|
||||
298
docs/latex/wx/htwinprs.tex
Normal file
298
docs/latex/wx/htwinprs.tex
Normal file
@@ -0,0 +1,298 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% htmlwinparser.tex at 14/Mar/99 20:13:37
|
||||
%
|
||||
|
||||
\section{\class{wxHtmlWinParser}}\label{wxhtmlwinparser}
|
||||
|
||||
This class is derived from \helpref{wxHtmlParser}{wxhtmlparser} and
|
||||
its main goal is to parse HTML input so that it can be displayed in
|
||||
\helpref{wxHtmlWindow}{wxhtmlwindow}. It uses a special
|
||||
\helpref{wxHtmlWinTagHandler}{wxhtmlwintaghandler}.
|
||||
|
||||
\wxheading{Notes}
|
||||
|
||||
The product of parsing is a wxHtmlCell (resp. wxHtmlContainer) object.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxHtmlParser}{wxhtmlparser}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/html/winpars.h>
|
||||
|
||||
\wxheading{See Also}
|
||||
|
||||
\helpref{Handlers overview}{handlers}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxHtmlWinParser::wxHtmlWinParser}\label{wxhtmlwinparserwxhtmlwinparser}
|
||||
|
||||
\func{}{wxHtmlWinParser}{\void}
|
||||
|
||||
\func{}{wxHtmlWinParser}{\param{wxHtmlWindow }{*wnd}}
|
||||
|
||||
Constructor. Don't use the default one, use constructor with
|
||||
{\it wnd} parameter ({\it wnd} is pointer to associated \helpref{wxHtmlWindow}{wxhtmlwindow})
|
||||
|
||||
\membersection{wxHtmlWinParser::AddModule}\label{wxhtmlwinparseraddmodule}
|
||||
|
||||
\func{static void}{AddModule}{\param{wxHtmlTagsModule }{*module}}
|
||||
|
||||
Adds \helpref{module}{handlers} to the list of wxHtmlWinParser tag handler.
|
||||
|
||||
\membersection{wxHtmlWinParser::CloseContainer}\label{wxhtmlwinparserclosecontainer}
|
||||
|
||||
\func{wxHtmlContainerCell*}{CloseContainer}{\void}
|
||||
|
||||
Closes the container, sets actual container to the parent one
|
||||
and returns pointer to it (see \helpref{Overview}{cells}).
|
||||
|
||||
\membersection{wxHtmlWinParser::CreateCurrentFont}\label{wxhtmlwinparsercreatecurrentfont}
|
||||
|
||||
\func{virtual wxFont*}{CreateCurrentFont}{\void}
|
||||
|
||||
Creates font based on current setting (see
|
||||
\helpref{SetFontSize}{wxhtmlwinparsersetfontsize},
|
||||
\helpref{SetFontBold}{wxhtmlwinparsersetfontbold},
|
||||
\helpref{SetFontItalic}{wxhtmlwinparsersetfontitalic},
|
||||
\helpref{SetFontFixed}{wxhtmlwinparsersetfontfixed},
|
||||
\helpref{SetFontUnderlined}{wxhtmlwinparsersetfontunderlined})
|
||||
and returns pointer to it.
|
||||
If the font was already created only a pointer is returned.
|
||||
|
||||
|
||||
\membersection{wxHtmlWinParser::GetActualColor}\label{wxhtmlwinparsergetactualcolor}
|
||||
|
||||
\constfunc{const wxColour\&}{GetActualColor}{\void}
|
||||
|
||||
Returns actual text colour.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetAlign}\label{wxhtmlwinparsergetalign}
|
||||
|
||||
\constfunc{int}{GetAlign}{\void}
|
||||
|
||||
Returns default horizontal alignment.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetCharHeight}\label{wxhtmlwinparsergetcharheight}
|
||||
|
||||
\constfunc{int}{GetCharHeight}{\void}
|
||||
|
||||
Returns (average) char height in standard font. It is used as DC-independent metrics.
|
||||
|
||||
{\bf Note:} This function doesn't return the {\it actual} height. If you want to
|
||||
know the height of the current font, call {\tt GetDC -> GetCharHeight()}.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetCharWidth}\label{wxhtmlwinparsergetcharwidth}
|
||||
|
||||
\constfunc{int}{GetCharWidth}{\void}
|
||||
|
||||
Returns average char width in standard font. It is used as DC-independent metrics.
|
||||
|
||||
{\bf Note:} This function doesn't return the {\it actual} width. If you want to
|
||||
know the height of the current font, call {\tt GetDC -> GetCharWidth()}
|
||||
|
||||
\membersection{wxHtmlWinParser::GetContainer}\label{wxhtmlwinparsergetcontainer}
|
||||
|
||||
\constfunc{wxHtmlContainerCell*}{GetContainer}{\void}
|
||||
|
||||
Returns pointer to the currently opened container (see \helpref{Overview}{cells}).
|
||||
Common use:
|
||||
|
||||
\begin{verbatim}
|
||||
m_WParser -> GetContainer() -> InsertCell(new ...);
|
||||
\end{verbatim}
|
||||
|
||||
\membersection{wxHtmlWinParser::GetDC}\label{wxhtmlwinparsergetdc}
|
||||
|
||||
\func{wxDC*}{GetDC}{\void}
|
||||
|
||||
Returns pointer to the DC used during parsing.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetEncodingConverter}\label{wxhtmlwinparsergetencodingconverter}
|
||||
|
||||
\constfunc{wxEncodingConverter *}{GetEncodingConverter}{\void}
|
||||
|
||||
Returns \helpref{wxEncodingConverter}{wxencodingconverter} class used
|
||||
to do conversion between \helpref{input encoding}{wxhtmlwinparsergetinputencoding}
|
||||
and \helpref{output encoding}{wxhtmlwinparsergetoutputencoding}.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetFontBold}\label{wxhtmlwinparsergetfontbold}
|
||||
|
||||
\constfunc{int}{GetFontBold}{\void}
|
||||
|
||||
Returns true if actual font is bold, false otherwise.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetFontFace}\label{wxhtmlwinparsergetfontface}
|
||||
|
||||
\constfunc{wxString}{GetFontFace}{\void}
|
||||
|
||||
Returns actual font face name.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetFontFixed}\label{wxhtmlwinparsergetfontfixed}
|
||||
|
||||
\constfunc{int}{GetFontFixed}{\void}
|
||||
|
||||
Returns true if actual font is fixed face, false otherwise.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetFontItalic}\label{wxhtmlwinparsergetfontitalic}
|
||||
|
||||
\constfunc{int}{GetFontItalic}{\void}
|
||||
|
||||
Returns true if actual font is italic, false otherwise.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetFontSize}\label{wxhtmlwinparsergetfontsize}
|
||||
|
||||
\constfunc{int}{GetFontSize}{\void}
|
||||
|
||||
Returns actual font size (HTML size varies from -2 to +4)
|
||||
|
||||
\membersection{wxHtmlWinParser::GetFontUnderlined}\label{wxhtmlwinparsergetfontunderlined}
|
||||
|
||||
\constfunc{int}{GetFontUnderlined}{\void}
|
||||
|
||||
Returns true if actual font is underlined, false otherwise.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetInputEncoding}\label{wxhtmlwinparsergetinputencoding}
|
||||
|
||||
\constfunc{wxFontEncoding}{GetInputEncoding}{\void}
|
||||
|
||||
Returns input encoding.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetLink}\label{wxhtmlwinparsergetlink}
|
||||
|
||||
\constfunc{const wxHtmlLinkInfo\&}{GetLink}{\void}
|
||||
|
||||
Returns actual hypertext link. (This value has a non-empty
|
||||
\helpref{Href}{wxhtmllinkinfogethref} string
|
||||
if the parser is between {\tt <A>} and {\tt </A>} tags,
|
||||
wxEmptyString otherwise.)
|
||||
|
||||
\membersection{wxHtmlWinParser::GetLinkColor}\label{wxhtmlwinparsergetlinkcolor}
|
||||
|
||||
\constfunc{const wxColour\&}{GetLinkColor}{\void}
|
||||
|
||||
Returns the colour of hypertext link text.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetOutputEncoding}\label{wxhtmlwinparsergetoutputencoding}
|
||||
|
||||
\constfunc{wxFontEncoding}{GetOutputEncoding}{\void}
|
||||
|
||||
Returns output encoding, i.e. closest match to document's input encoding
|
||||
that is supported by operating system.
|
||||
|
||||
\membersection{wxHtmlWinParser::GetWindow}\label{wxhtmlwinparsergetwindow}
|
||||
|
||||
\func{wxHtmlWindow*}{GetWindow}{\void}
|
||||
|
||||
Returns associated window (wxHtmlWindow). This may be NULL! (You should always
|
||||
test if it is non-NULL. For example {\tt TITLE} handler sets window
|
||||
title only if some window is associated, otherwise it does nothing)
|
||||
|
||||
\membersection{wxHtmlWinParser::OpenContainer}\label{wxhtmlwinparseropencontainer}
|
||||
|
||||
\func{wxHtmlContainerCell*}{OpenContainer}{\void}
|
||||
|
||||
Opens new container and returns pointer to it (see \helpref{Overview}{cells}).
|
||||
|
||||
\membersection{wxHtmlWinParser::SetActualColor}\label{wxhtmlwinparsersetactualcolor}
|
||||
|
||||
\func{void}{SetActualColor}{\param{const wxColour\& }{clr}}
|
||||
|
||||
Sets actual text colour. Note: this DOESN'T change the colour!
|
||||
You must create \helpref{wxHtmlColourCell}{wxhtmlcolourcell} yourself.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetAlign}\label{wxhtmlwinparsersetalign}
|
||||
|
||||
\func{void}{SetAlign}{\param{int }{a}}
|
||||
|
||||
Sets default horizontal alignment (see
|
||||
\helpref{wxHtmlContainerCell::SetAlignHor}{wxhtmlcontainercellsetalignhor}.)
|
||||
Alignment of newly opened container is set to this value.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetContainer}\label{wxhtmlwinparsersetcontainer}
|
||||
|
||||
\func{wxHtmlContainerCell*}{SetContainer}{\param{wxHtmlContainerCell *}{c}}
|
||||
|
||||
Allows you to directly set opened container. This is not recommended - you should use OpenContainer
|
||||
wherever possible.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetDC}\label{wxhtmlwinparsersetdc}
|
||||
|
||||
\func{virtual void}{SetDC}{\param{wxDC }{*dc}, \param{double }{pixel\_scale = 1.0}}
|
||||
|
||||
Sets the DC. This must be called before \helpref{Parse}{wxhtmlparserparse}!
|
||||
{\it pixel\_scale} can be used when rendering to high-resolution
|
||||
DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in
|
||||
HTML are given in pixels -- e.g. image sizes. 300x300 image would be only one
|
||||
inch wide on typical printer. With pixel\_scale = 3.0 it would be 3 inches.)
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFontBold}\label{wxhtmlwinparsersetfontbold}
|
||||
|
||||
\func{void}{SetFontBold}{\param{int }{x}}
|
||||
|
||||
Sets bold flag of actualfont. {\it x} is either true of false.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFontFace}\label{wxhtmlwinparsersetfontface}
|
||||
|
||||
\func{void}{SetFontFace}{\param{const wxString\& }{face}}
|
||||
|
||||
Sets current font face to {\it face}. This affects either fixed size
|
||||
font or proportional, depending on context (whether the parser is
|
||||
inside {\tt <TT>} tag or not).
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFontFixed}\label{wxhtmlwinparsersetfontfixed}
|
||||
|
||||
\func{void}{SetFontFixed}{\param{int }{x}}
|
||||
|
||||
Sets fixed face flag of actualfont. {\it x} is either true of false.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFontItalic}\label{wxhtmlwinparsersetfontitalic}
|
||||
|
||||
\func{void}{SetFontItalic}{\param{int }{x}}
|
||||
|
||||
Sets italic flag of actualfont. {\it x} is either true of false.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFontSize}\label{wxhtmlwinparsersetfontsize}
|
||||
|
||||
\func{void}{SetFontSize}{\param{int }{s}}
|
||||
|
||||
Sets actual font size (HTML size varies from 1 to 7)
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFontUnderlined}\label{wxhtmlwinparsersetfontunderlined}
|
||||
|
||||
\func{void}{SetFontUnderlined}{\param{int }{x}}
|
||||
|
||||
Sets underlined flag of actualfont. {\it x} is either true of false.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetFonts}\label{wxhtmlwinparsersetfonts}
|
||||
|
||||
\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}}
|
||||
|
||||
Sets fonts. See \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} for
|
||||
detailed description.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetInputEncoding}\label{wxhtmlwinparsersetinputencoding}
|
||||
|
||||
\func{void}{SetInputEncoding}{\param{wxFontEncoding }{enc}}
|
||||
|
||||
Sets input encoding. The parser uses this information to build conversion
|
||||
tables from document's encoding to some encoding supported by operating
|
||||
system.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetLink}\label{wxhtmlwinparsersetlink}
|
||||
|
||||
\func{void}{SetLink}{\param{const wxHtmlLinkInfo\& }{link}}
|
||||
|
||||
Sets actual hypertext link. Empty link is represented
|
||||
by \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo} with {\it Href} equal
|
||||
to wxEmptyString.
|
||||
|
||||
\membersection{wxHtmlWinParser::SetLinkColor}\label{wxhtmlwinparsersetlinkcolor}
|
||||
|
||||
\func{void}{SetLinkColor}{\param{const wxColour\& }{clr}}
|
||||
|
||||
Sets colour of hypertext link.
|
||||
|
||||
73
include/wx/html/forcelnk.h
Normal file
73
include/wx/html/forcelnk.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: forcelnk.h
|
||||
// Purpose: see bellow
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
DESCRPITON:
|
||||
|
||||
mod_*.cpp files contain handlers for tags. These files are modules - they contain
|
||||
one wxTagModule class and it's OnInit() method is called from wxApp's init method.
|
||||
The module is called even if you only link it into the executable, so everything
|
||||
seems wonderful.
|
||||
|
||||
The problem is that we have these modules in LIBRARY and mod_*.cpp files contain
|
||||
no method nor class which is known out of the module. So the linker won't
|
||||
link these .o/.obj files into executable because it detected that it is not used
|
||||
by the program.
|
||||
|
||||
To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These
|
||||
macros are generic and are not limited to mod_*.cpp files. You may find them quite
|
||||
useful somewhere else...
|
||||
|
||||
How to use them:
|
||||
let's suppose you want to always link file foo.cpp and that you have module
|
||||
always.cpp that is certainly always linked (e.g. the one with main() function
|
||||
or htmlwin.cpp in wxHtml library).
|
||||
|
||||
Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere
|
||||
in always.cpp
|
||||
See mod_*.cpp and htmlwin.cpp for example :-)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _WX_FORCELNK_H_
|
||||
#define _WX_FORCELNK_H_
|
||||
|
||||
|
||||
|
||||
// This must be part of the module you want to force:
|
||||
#define FORCE_LINK_ME(module_name) \
|
||||
int _link_dummy_func_##module_name (); \
|
||||
int _link_dummy_func_##module_name () \
|
||||
{ \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
|
||||
// And this must be somewhere where it certainly will be linked:
|
||||
#define FORCE_LINK(module_name) \
|
||||
extern int _link_dummy_func_##module_name (); \
|
||||
static int _link_dummy_var_##module_name = \
|
||||
_link_dummy_func_##module_name ();
|
||||
|
||||
#define FORCE_WXHTML_MODULES() \
|
||||
FORCE_LINK(m_layout) \
|
||||
FORCE_LINK(m_fonts) \
|
||||
FORCE_LINK(m_image) \
|
||||
FORCE_LINK(m_list) \
|
||||
FORCE_LINK(m_dflist) \
|
||||
FORCE_LINK(m_pre) \
|
||||
FORCE_LINK(m_hline) \
|
||||
FORCE_LINK(m_links) \
|
||||
FORCE_LINK(m_tables) \
|
||||
FORCE_LINK(m_style)
|
||||
|
||||
|
||||
#endif // _WX_FORCELNK_H_
|
||||
108
include/wx/html/helpctrl.h
Normal file
108
include/wx/html/helpctrl.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: helpctrl.h
|
||||
// Purpose: wxHtmlHelpController
|
||||
// Notes: Based on htmlhelp.cpp, implementing a monolithic
|
||||
// HTML Help controller class, by Vaclav Slavik
|
||||
// Author: Harm van der Heijden and Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_HELPCTRL_H_
|
||||
#define _WX_HELPCTRL_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "helpctrl.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_WXHTML_HELP
|
||||
|
||||
#include "wx/html/helpfrm.h"
|
||||
#include "wx/helpbase.h"
|
||||
|
||||
#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
|
||||
|
||||
class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
|
||||
|
||||
public:
|
||||
wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE);
|
||||
virtual ~wxHtmlHelpController();
|
||||
|
||||
void SetTitleFormat(const wxString& format);
|
||||
void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
|
||||
bool AddBook(const wxString& book_url, bool show_wait_msg = FALSE);
|
||||
bool AddBook(const wxFileName& book_file, bool show_wait_msg = FALSE);
|
||||
|
||||
bool Display(const wxString& x);
|
||||
bool Display(int id);
|
||||
bool DisplayContents();
|
||||
bool DisplayIndex();
|
||||
bool KeywordSearch(const wxString& keyword);
|
||||
|
||||
wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
|
||||
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
|
||||
|
||||
// Assigns config object to the Ctrl. This config is then
|
||||
// used in subsequent calls to Read/WriteCustomization of both help
|
||||
// Ctrl and it's wxHtmlWindow
|
||||
virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
|
||||
virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
|
||||
|
||||
//// Backward compatibility with wxHelpController API
|
||||
|
||||
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); }
|
||||
virtual bool Initialize(const wxString& file);
|
||||
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
|
||||
virtual bool LoadFile(const wxString& file = wxT(""));
|
||||
virtual bool DisplaySection(int sectionNo);
|
||||
virtual bool DisplaySection(const wxString& section) { return Display(section); }
|
||||
virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
|
||||
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
|
||||
|
||||
virtual void SetFrameParameters(const wxString& title,
|
||||
const wxSize& size,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
bool newFrameEachTime = FALSE);
|
||||
/// Obtains the latest settings used by the help frame and the help
|
||||
/// frame.
|
||||
virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
|
||||
wxPoint *pos = NULL,
|
||||
bool *newFrameEachTime = NULL);
|
||||
|
||||
// Get direct access to help data:
|
||||
wxHtmlHelpData *GetHelpData() { return &m_helpData; }
|
||||
|
||||
virtual bool Quit() ;
|
||||
virtual void OnQuit() {};
|
||||
|
||||
void OnCloseFrame(wxCloseEvent& evt);
|
||||
|
||||
// Make the help controller's frame 'modal' if
|
||||
// needed
|
||||
void AddGrabIfNeeded();
|
||||
|
||||
protected:
|
||||
virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
|
||||
|
||||
virtual void CreateHelpWindow();
|
||||
virtual void DestroyHelpWindow();
|
||||
|
||||
wxHtmlHelpData m_helpData;
|
||||
wxHtmlHelpFrame* m_helpFrame;
|
||||
wxConfigBase * m_Config;
|
||||
wxString m_ConfigRoot;
|
||||
wxString m_titleFormat;
|
||||
int m_FrameStyle;
|
||||
// DECLARE_EVENT_TABLE()
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlHelpController)
|
||||
};
|
||||
|
||||
#endif // wxUSE_WXHTML_HELP
|
||||
|
||||
#endif // _WX_HELPCTRL_H_
|
||||
218
include/wx/html/helpdata.h
Normal file
218
include/wx/html/helpdata.h
Normal file
@@ -0,0 +1,218 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: helpdata.h
|
||||
// Purpose: wxHtmlHelpData
|
||||
// Notes: Based on htmlhelp.cpp, implementing a monolithic
|
||||
// HTML Help controller class, by Vaclav Slavik
|
||||
// Author: Harm van der Heijden and Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_HELPDATA_H_
|
||||
#define _WX_HELPDATA_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "helpdata.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/filesys.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/font.h"
|
||||
|
||||
class WXDLLEXPORT wxHtmlHelpData;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// helper classes & structs
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlBookRecord
|
||||
{
|
||||
public:
|
||||
wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
|
||||
const wxString& title, const wxString& start)
|
||||
{
|
||||
m_BookFile = bookfile;
|
||||
m_BasePath = basepath;
|
||||
m_Title = title;
|
||||
m_Start = start;
|
||||
// for debugging, give the contents index obvious default values
|
||||
m_ContentsStart = m_ContentsEnd = -1;
|
||||
}
|
||||
wxString GetBookFile() const { return m_BookFile; }
|
||||
wxString GetTitle() const { return m_Title; }
|
||||
wxString GetStart() const { return m_Start; }
|
||||
wxString GetBasePath() const { return m_BasePath; }
|
||||
/* SetContentsRange: store in the bookrecord where in the index/contents lists the
|
||||
* book's records are stored. This to facilitate searching in a specific book.
|
||||
* This code will have to be revised when loading/removing books becomes dynamic.
|
||||
* (as opposed to appending only)
|
||||
* Note that storing index range is pointless, because the index is alphab. sorted. */
|
||||
void SetContentsRange(int start, int end) { m_ContentsStart = start; m_ContentsEnd = end; }
|
||||
int GetContentsStart() const { return m_ContentsStart; }
|
||||
int GetContentsEnd() const { return m_ContentsEnd; }
|
||||
|
||||
void SetTitle(const wxString& title) { m_Title = title; }
|
||||
void SetBasePath(const wxString& path) { m_BasePath = path; }
|
||||
void SetStart(const wxString& start) { m_Start = start; }
|
||||
|
||||
// returns full filename of page (which is part of the book),
|
||||
// i.e. with book's basePath prepended. If page is already absolute
|
||||
// path, basePath is _not_ prepended.
|
||||
wxString GetFullPath(const wxString &page) const;
|
||||
|
||||
protected:
|
||||
wxString m_BookFile;
|
||||
wxString m_BasePath;
|
||||
wxString m_Title;
|
||||
wxString m_Start;
|
||||
int m_ContentsStart;
|
||||
int m_ContentsEnd;
|
||||
};
|
||||
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray);
|
||||
|
||||
|
||||
struct wxHtmlContentsItem
|
||||
{
|
||||
short int m_Level;
|
||||
int m_ID;
|
||||
wxChar* m_Name;
|
||||
wxChar* m_Page;
|
||||
wxHtmlBookRecord *m_Book;
|
||||
|
||||
// returns full filename of m_Page, i.e. with book's basePath prepended
|
||||
wxString GetFullPath() const { return m_Book->GetFullPath(m_Page); }
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// wxHtmlSearchEngine
|
||||
// This class takes input streams and scans them for occurence
|
||||
// of keyword(s)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlSearchEngine : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHtmlSearchEngine() : wxObject() {m_Keyword = NULL; }
|
||||
~wxHtmlSearchEngine() {if (m_Keyword) delete[] m_Keyword; }
|
||||
|
||||
// Sets the keyword we will be searching for
|
||||
virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only);
|
||||
|
||||
// Scans the stream for the keyword.
|
||||
// Returns TRUE if the stream contains keyword, fALSE otherwise
|
||||
virtual bool Scan(const wxFSFile& file);
|
||||
|
||||
private:
|
||||
wxChar *m_Keyword;
|
||||
bool m_CaseSensitive;
|
||||
bool m_WholeWords;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlSearchEngine)
|
||||
};
|
||||
|
||||
|
||||
// State information of a search action. I'd have prefered to make this a nested
|
||||
// class inside wxHtmlHelpData, but that's against coding standards :-(
|
||||
// Never construct this class yourself, obtain a copy from
|
||||
// wxHtmlHelpData::PrepareKeywordSearch(const wxString& key)
|
||||
class WXDLLEXPORT wxHtmlSearchStatus
|
||||
{
|
||||
public:
|
||||
// constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the
|
||||
// title of the book to search. By default, all books are searched.
|
||||
wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword,
|
||||
bool case_sensitive, bool whole_words_only,
|
||||
const wxString& book = wxEmptyString);
|
||||
bool Search(); // do the next iteration
|
||||
bool IsActive() { return m_Active; }
|
||||
int GetCurIndex() { return m_CurIndex; }
|
||||
int GetMaxIndex() { return m_MaxIndex; }
|
||||
const wxString& GetName() { return m_Name; }
|
||||
wxHtmlContentsItem* GetContentsItem() { return m_ContentsItem; }
|
||||
|
||||
private:
|
||||
wxHtmlHelpData* m_Data;
|
||||
wxHtmlSearchEngine m_Engine;
|
||||
wxString m_Keyword, m_Name;
|
||||
wxChar *m_LastPage;
|
||||
wxHtmlContentsItem* m_ContentsItem;
|
||||
bool m_Active; // search is not finished
|
||||
int m_CurIndex; // where we are now
|
||||
int m_MaxIndex; // number of files we search
|
||||
// For progress bar: 100*curindex/maxindex = % complete
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlSearchStatus)
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxHtmlHelpData : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlHelpData)
|
||||
friend class wxHtmlSearchStatus;
|
||||
|
||||
public:
|
||||
wxHtmlHelpData();
|
||||
~wxHtmlHelpData();
|
||||
|
||||
// Sets directory where temporary files are stored.
|
||||
// These temp files are index & contents file in binary (much faster to read)
|
||||
// form. These files are NOT deleted on program's exit.
|
||||
void SetTempDir(const wxString& path);
|
||||
|
||||
// Adds new book. 'book' is location of .htb file (stands for "html book").
|
||||
// See documentation for details on its format.
|
||||
// Returns success.
|
||||
bool AddBook(const wxString& book);
|
||||
bool AddBookParam(const wxFSFile& bookfile,
|
||||
wxFontEncoding encoding,
|
||||
const wxString& title, const wxString& contfile,
|
||||
const wxString& indexfile = wxEmptyString,
|
||||
const wxString& deftopic = wxEmptyString,
|
||||
const wxString& path = wxEmptyString);
|
||||
|
||||
// Some accessing stuff:
|
||||
|
||||
// returns URL of page on basis of (file)name
|
||||
wxString FindPageByName(const wxString& page);
|
||||
// returns URL of page on basis of MS id
|
||||
wxString FindPageById(int id);
|
||||
|
||||
const wxHtmlBookRecArray& GetBookRecArray() { return m_BookRecords; }
|
||||
wxHtmlContentsItem* GetContents() { return m_Contents; }
|
||||
int GetContentsCnt() { return m_ContentsCnt; }
|
||||
wxHtmlContentsItem* GetIndex() { return m_Index; }
|
||||
int GetIndexCnt() { return m_IndexCnt; }
|
||||
|
||||
protected:
|
||||
wxString m_TempPath;
|
||||
|
||||
wxHtmlBookRecArray m_BookRecords;
|
||||
// each book has one record in this array:
|
||||
wxHtmlContentsItem* m_Contents;
|
||||
int m_ContentsCnt;
|
||||
wxHtmlContentsItem* m_Index; // list of all available books and pages.
|
||||
int m_IndexCnt; // list of index items
|
||||
|
||||
protected:
|
||||
// Imports .hhp files (MS HTML Help Workshop)
|
||||
bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys,
|
||||
const wxString& indexfile, const wxString& contentsfile);
|
||||
// Reads binary book
|
||||
bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f);
|
||||
// Writes binary book
|
||||
bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f);
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlHelpData)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
239
include/wx/html/helpfrm.h
Normal file
239
include/wx/html/helpfrm.h
Normal file
@@ -0,0 +1,239 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: helpfrm.h
|
||||
// Purpose: wxHtmlHelpFrame
|
||||
// Notes: Based on htmlhelp.cpp, implementing a monolithic
|
||||
// HTML Help controller class, by Vaclav Slavik
|
||||
// Author: Harm van der Heijden and Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_HELPFRM_H_
|
||||
#define _WX_HELPFRM_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "helpfrm.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_WXHTML_HELP
|
||||
|
||||
#include "wx/html/helpdata.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/config.h"
|
||||
#include "wx/splitter.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/listbox.h"
|
||||
#include "wx/choice.h"
|
||||
#include "wx/combobox.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/html/htmprint.h"
|
||||
|
||||
class WXDLLEXPORT wxButton;
|
||||
class WXDLLEXPORT wxTextCtrl;
|
||||
|
||||
|
||||
// style flags for the Help Frame
|
||||
#define wxHF_TOOLBAR 0x0001
|
||||
#define wxHF_CONTENTS 0x0002
|
||||
#define wxHF_INDEX 0x0004
|
||||
#define wxHF_SEARCH 0x0008
|
||||
#define wxHF_BOOKMARKS 0x0010
|
||||
#define wxHF_OPEN_FILES 0x0020
|
||||
#define wxHF_PRINT 0x0040
|
||||
#define wxHF_FLAT_TOOLBAR 0x0080
|
||||
#define wxHF_MERGE_BOOKS 0x0100
|
||||
#define wxHF_ICONS_BOOK 0x0200
|
||||
#define wxHF_ICONS_BOOK_CHAPTER 0x0400
|
||||
#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default
|
||||
#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \
|
||||
wxHF_INDEX | wxHF_SEARCH | \
|
||||
wxHF_BOOKMARKS | wxHF_PRINT)
|
||||
//compatibility:
|
||||
#define wxHF_OPENFILES wxHF_OPEN_FILES
|
||||
#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR
|
||||
#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE
|
||||
|
||||
|
||||
struct wxHtmlHelpFrameCfg
|
||||
{
|
||||
int x, y, w, h;
|
||||
long sashpos;
|
||||
bool navig_on;
|
||||
};
|
||||
|
||||
|
||||
class WXDLLEXPORT wxHelpControllerBase;
|
||||
|
||||
class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame)
|
||||
|
||||
public:
|
||||
wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); }
|
||||
wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID,
|
||||
const wxString& title = wxEmptyString,
|
||||
int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL);
|
||||
bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString,
|
||||
int style = wxHF_DEFAULT_STYLE);
|
||||
~wxHtmlHelpFrame();
|
||||
|
||||
wxHtmlHelpData* GetData() { return m_Data; }
|
||||
wxHelpControllerBase* GetController() const { return m_helpController; }
|
||||
void SetController(wxHelpControllerBase* controller) { m_helpController = controller; }
|
||||
|
||||
// Sets format of title of the frame. Must contain exactly one "%s"
|
||||
// (for title of displayed HTML page)
|
||||
void SetTitleFormat(const wxString& format);
|
||||
|
||||
// Displays page x. If not found it will offect the user a choice of
|
||||
// searching books.
|
||||
// Looking for the page runs in these steps:
|
||||
// 1. try to locate file named x (if x is for example "doc/howto.htm")
|
||||
// 2. try to open starting page of book x
|
||||
// 3. try to find x in contents (if x is for example "How To ...")
|
||||
// 4. try to find x in index (if x is for example "How To ...")
|
||||
bool Display(const wxString& x);
|
||||
|
||||
// Alternative version that works with numeric ID.
|
||||
// (uses extension to MS format, <param name="ID" value=id>, see docs)
|
||||
bool Display(const int id);
|
||||
|
||||
// Displays help window and focuses contents.
|
||||
bool DisplayContents();
|
||||
|
||||
// Displays help window and focuses index.
|
||||
bool DisplayIndex();
|
||||
|
||||
// Searches for keyword. Returns TRUE and display page if found, return
|
||||
// FALSE otherwise
|
||||
// Syntax of keyword is Altavista-like:
|
||||
// * words are separated by spaces
|
||||
// (but "\"hello world\"" is only one world "hello world")
|
||||
// * word may be pretended by + or -
|
||||
// (+ : page must contain the word ; - : page can't contain the word)
|
||||
// * if there is no + or - before the word, + is default
|
||||
bool KeywordSearch(const wxString& keyword);
|
||||
|
||||
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString)
|
||||
{
|
||||
m_Config = config;
|
||||
m_ConfigRoot = rootpath;
|
||||
ReadCustomization(config, rootpath);
|
||||
}
|
||||
|
||||
// Saves custom settings into cfg config. it will use the path 'path'
|
||||
// if given, otherwise it will save info into currently selected path.
|
||||
// saved values : things set by SetFonts, SetBorders.
|
||||
void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
|
||||
void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
|
||||
|
||||
// call this to let wxHtmlHelpFrame know page changed
|
||||
void NotifyPageChanged();
|
||||
|
||||
// Refreshes Contents and Index tabs
|
||||
void RefreshLists();
|
||||
|
||||
protected:
|
||||
void Init(wxHtmlHelpData* data = NULL);
|
||||
|
||||
// Adds items to m_Contents tree control
|
||||
void CreateContents();
|
||||
|
||||
// Adds items to m_IndexList
|
||||
void CreateIndex();
|
||||
|
||||
// Add books to search choice panel
|
||||
void CreateSearch();
|
||||
|
||||
// Add custom buttons to toolbar
|
||||
virtual void AddToolbarButtons(wxToolBar *toolBar, int style);
|
||||
|
||||
// Displays options dialog (fonts etc.)
|
||||
virtual void OptionsDialog();
|
||||
|
||||
void OnToolbar(wxCommandEvent& event);
|
||||
void OnContentsSel(wxTreeEvent& event);
|
||||
void OnIndexSel(wxCommandEvent& event);
|
||||
void OnIndexFind(wxCommandEvent& event);
|
||||
void OnIndexAll(wxCommandEvent& event);
|
||||
void OnSearchSel(wxCommandEvent& event);
|
||||
void OnSearch(wxCommandEvent& event);
|
||||
void OnBookmarksSel(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
#ifdef __WXMAC__
|
||||
void OnClose(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
#endif
|
||||
|
||||
// Images:
|
||||
enum {
|
||||
IMG_Book = 0,
|
||||
IMG_Folder,
|
||||
IMG_Page
|
||||
};
|
||||
|
||||
protected:
|
||||
wxHtmlHelpData* m_Data;
|
||||
bool m_DataCreated; // m_Data created by frame, or supplied?
|
||||
wxString m_TitleFormat; // title of the help frame
|
||||
// below are various pointers to GUI components
|
||||
wxHtmlWindow *m_HtmlWin;
|
||||
wxSplitterWindow *m_Splitter;
|
||||
wxPanel *m_NavigPan;
|
||||
wxNotebook *m_NavigNotebook;
|
||||
wxTreeCtrl *m_ContentsBox;
|
||||
wxTextCtrl *m_IndexText;
|
||||
wxButton *m_IndexButton;
|
||||
wxButton *m_IndexButtonAll;
|
||||
wxListBox *m_IndexList;
|
||||
wxTextCtrl *m_SearchText;
|
||||
wxButton *m_SearchButton;
|
||||
wxListBox *m_SearchList;
|
||||
wxChoice *m_SearchChoice;
|
||||
wxStaticText *m_IndexCountInfo;
|
||||
wxCheckBox *m_SearchCaseSensitive;
|
||||
wxCheckBox *m_SearchWholeWords;
|
||||
|
||||
wxComboBox *m_Bookmarks;
|
||||
wxArrayString m_BookmarksNames, m_BookmarksPages;
|
||||
|
||||
wxHtmlHelpFrameCfg m_Cfg;
|
||||
|
||||
wxConfigBase *m_Config;
|
||||
wxString m_ConfigRoot;
|
||||
|
||||
// pagenumbers of controls in notebook (usually 0,1,2)
|
||||
int m_ContentsPage;
|
||||
int m_IndexPage;
|
||||
int m_SearchPage;
|
||||
|
||||
// lists of available fonts (used in options dialog)
|
||||
wxArrayString *m_NormalFonts, *m_FixedFonts;
|
||||
int m_FontSize; // 0,1,2 = small,medium,big
|
||||
wxString m_NormalFace, m_FixedFace;
|
||||
|
||||
bool m_UpdateContents;
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
wxHtmlEasyPrinting *m_Printer;
|
||||
#endif
|
||||
wxHashTable *m_PagesHash;
|
||||
wxHelpControllerBase* m_helpController;
|
||||
|
||||
int m_hfStyle;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlHelpFrame)
|
||||
};
|
||||
|
||||
#endif // wxUSE_WXHTML_HELP
|
||||
|
||||
#endif
|
||||
382
include/wx/html/htmlcell.h
Normal file
382
include/wx/html/htmlcell.h
Normal file
@@ -0,0 +1,382 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlcell.h
|
||||
// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser
|
||||
// as a basic visual element of HTML page
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLCELL_H_
|
||||
#define _WX_HTMLCELL_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmlcell.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/html/htmltag.h"
|
||||
#include "wx/html/htmldefs.h"
|
||||
#include "wx/window.h"
|
||||
|
||||
|
||||
class WXDLLEXPORT wxHtmlLinkInfo;
|
||||
class WXDLLEXPORT wxHtmlCell;
|
||||
class WXDLLEXPORT wxHtmlContainerCell;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlCell
|
||||
// Internal data structure. It represents fragments of parsed HTML
|
||||
// page - a word, picture, table, horizontal line and so on.
|
||||
// It is used by wxHtmlWindow to represent HTML page in memory.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class WXDLLEXPORT wxHtmlCell : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHtmlCell();
|
||||
virtual ~wxHtmlCell();
|
||||
|
||||
void SetParent(wxHtmlContainerCell *p) {m_Parent = p;}
|
||||
wxHtmlContainerCell *GetParent() const {return m_Parent;}
|
||||
|
||||
int GetPosX() const {return m_PosX;}
|
||||
int GetPosY() const {return m_PosY;}
|
||||
int GetWidth() const {return m_Width;}
|
||||
int GetHeight() const {return m_Height;}
|
||||
int GetDescent() const {return m_Descent;}
|
||||
|
||||
const wxString& GetId() const { return m_id; }
|
||||
void SetId(const wxString& id) { m_id = id; }
|
||||
|
||||
// returns the link associated with this cell. The position is position within
|
||||
// the cell so it varies from 0 to m_Width, from 0 to m_Height
|
||||
virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, int WXUNUSED(y) = 0) const
|
||||
{ return m_Link; }
|
||||
|
||||
// members access methods
|
||||
wxHtmlCell *GetNext() const {return m_Next;}
|
||||
|
||||
// members writing methods
|
||||
virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;}
|
||||
void SetLink(const wxHtmlLinkInfo& link);
|
||||
void SetNext(wxHtmlCell *cell) {m_Next = cell;}
|
||||
|
||||
// 1. adjust cell's width according to the fact that maximal possible width is w.
|
||||
// (this has sense when working with horizontal lines, tables etc.)
|
||||
// 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) members)
|
||||
// = place items to fit window, according to the width w
|
||||
virtual void Layout(int w);
|
||||
|
||||
// renders the cell
|
||||
virtual void Draw(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2)) {}
|
||||
|
||||
// proceed drawing actions in case the cell is not visible (scrolled out of screen).
|
||||
// This is needed to change fonts, colors and so on
|
||||
virtual void DrawInvisible(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y)) {}
|
||||
|
||||
// This method returns pointer to the FIRST cell for that
|
||||
// the condition
|
||||
// is true. It first checks if the condition is true for this
|
||||
// cell and then calls m_Next->Find(). (Note: it checks
|
||||
// all subcells if the cell is container)
|
||||
// Condition is unique condition identifier (see htmldefs.h)
|
||||
// (user-defined condition IDs should start from 10000)
|
||||
// and param is optional parameter
|
||||
// Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news");
|
||||
// returns pointer to anchor news
|
||||
virtual const wxHtmlCell* Find(int condition, const void* param) const;
|
||||
|
||||
// This function is called when mouse button is clicked over the cell.
|
||||
//
|
||||
// Parent is pointer to wxHtmlWindow that generated the event
|
||||
// HINT: if this handling is not enough for you you should use
|
||||
// wxHtmlWidgetCell
|
||||
virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
|
||||
|
||||
// This method used to adjust pagebreak position. The parameter is
|
||||
// variable that contains y-coordinate of page break (= horizontal line that
|
||||
// should not be crossed by words, images etc.). If this cell cannot be divided
|
||||
// into two pieces (each one on another page) then it moves the pagebreak
|
||||
// few pixels up.
|
||||
//
|
||||
// Returned value : true if pagebreak was modified, false otherwise
|
||||
// Usage : while (container->AdjustPagebreak(&p)) {}
|
||||
virtual bool AdjustPagebreak(int *pagebreak, int *known_pagebreaks = NULL, int number_of_pages = 0) const;
|
||||
|
||||
// Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default
|
||||
// is true - the cell can be split on two pages
|
||||
void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; }
|
||||
|
||||
// Returns y-coordinates that contraint the cell, i.e. left is highest
|
||||
// and right lowest coordinate such that the cell lays between then.
|
||||
// Note: this method does not return meaningful values if you haven't
|
||||
// called Layout() before!
|
||||
virtual void GetHorizontalConstraints(int *left, int *right) const;
|
||||
|
||||
// Returns true for simple == terminal cells, i.e. not composite ones.
|
||||
// This if for internal usage only and may disappear in future versions!
|
||||
virtual bool IsTerminalCell() const { return TRUE; }
|
||||
|
||||
// Find the terminal cell inside this cell at the given position (relative
|
||||
// to this cell)
|
||||
//
|
||||
// Returns NULL if not found
|
||||
virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y) const;
|
||||
|
||||
protected:
|
||||
wxHtmlCell *m_Next;
|
||||
// pointer to the next cell
|
||||
wxHtmlContainerCell *m_Parent;
|
||||
// pointer to parent cell
|
||||
long m_Width, m_Height, m_Descent;
|
||||
// dimensions of fragment
|
||||
// m_Descent is used to position text&images..
|
||||
long m_PosX, m_PosY;
|
||||
// position where the fragment is drawn
|
||||
wxHtmlLinkInfo *m_Link;
|
||||
// destination address if this fragment is hypertext link, NULL otherwise
|
||||
bool m_CanLiveOnPagebreak;
|
||||
// true if this cell can be placed on pagebreak, false otherwise
|
||||
wxString m_id;
|
||||
// unique identifier of the cell, generated from "id" property of tags
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlCell)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Inherited cells:
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlWordCell
|
||||
// Single word in input stream.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlWordCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlWordCell(const wxString& word, wxDC& dc);
|
||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
|
||||
protected:
|
||||
wxString m_Word;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlContainerCell
|
||||
// Container - it contains other cells. Basic of layout algorithm.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlContainerCell(wxHtmlContainerCell *parent);
|
||||
~wxHtmlContainerCell();
|
||||
|
||||
virtual void Layout(int w);
|
||||
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
||||
virtual bool AdjustPagebreak(int *pagebreak, int *known_pagebreaks = NULL, int number_of_pages = 0) const;
|
||||
|
||||
// insert cell at the end of m_Cells list
|
||||
void InsertCell(wxHtmlCell *cell);
|
||||
|
||||
// sets horizontal/vertical alignment
|
||||
void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;}
|
||||
int GetAlignHor() const {return m_AlignHor;}
|
||||
void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;}
|
||||
int GetAlignVer() const {return m_AlignVer;}
|
||||
|
||||
// sets left-border indentation. units is one of wxHTML_UNITS_* constants
|
||||
// what is combination of wxHTML_INDENT_*
|
||||
void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
|
||||
// returns the indentation. ind is one of wxHTML_INDENT_* constants
|
||||
int GetIndent(int ind) const;
|
||||
// returns type of value returned by GetIndent(ind)
|
||||
int GetIndentUnits(int ind) const;
|
||||
|
||||
// sets alignment info based on given tag's params
|
||||
void SetAlign(const wxHtmlTag& tag);
|
||||
// sets floating width adjustment
|
||||
// (examples : 32 percent of parent container,
|
||||
// -15 pixels percent (this means 100 % - 15 pixels)
|
||||
void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;}
|
||||
void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0);
|
||||
// sets minimal height of this container.
|
||||
void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;}
|
||||
|
||||
void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = TRUE; m_BkColour = clr;}
|
||||
// returns background colour (of wxNullColour if none set), so that widgets can
|
||||
// adapt to it:
|
||||
wxColour GetBackgroundColour();
|
||||
void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = TRUE; m_BorderColour1 = clr1, m_BorderColour2 = clr2;}
|
||||
virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const;
|
||||
virtual const wxHtmlCell* Find(int condition, const void* param) const;
|
||||
virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
|
||||
virtual void GetHorizontalConstraints(int *left, int *right) const;
|
||||
|
||||
// returns pointer to the first cell in container or NULL
|
||||
wxHtmlCell* GetFirstCell() const {return m_Cells;}
|
||||
|
||||
// see comment in wxHtmlCell about this method
|
||||
virtual bool IsTerminalCell() const { return FALSE; }
|
||||
|
||||
virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y) const;
|
||||
|
||||
protected:
|
||||
int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom;
|
||||
// indentation of subcells. There is always m_Indent pixels
|
||||
// big space between given border of the container and the subcells
|
||||
// it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels
|
||||
int m_MinHeight, m_MinHeightAlign;
|
||||
// minimal height.
|
||||
wxHtmlCell *m_Cells, *m_LastCell;
|
||||
// internal cells, m_Cells points to the first of them, m_LastCell to the last one.
|
||||
// (LastCell is needed only to speed-up InsertCell)
|
||||
int m_AlignHor, m_AlignVer;
|
||||
// alignment horizontal and vertical (left, center, right)
|
||||
int m_WidthFloat, m_WidthFloatUnits;
|
||||
// width float is used in adjustWidth
|
||||
bool m_UseBkColour;
|
||||
wxColour m_BkColour;
|
||||
// background color of this container
|
||||
bool m_UseBorder;
|
||||
wxColour m_BorderColour1, m_BorderColour2;
|
||||
// borders color of this container
|
||||
int m_LastLayout;
|
||||
// if != -1 then call to Layout may be no-op
|
||||
// if previous call to Layout has same argument
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlContainerCell)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlColourCell
|
||||
// Color changer.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlColourCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
|
||||
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
||||
|
||||
protected:
|
||||
wxColour m_Colour;
|
||||
unsigned m_Flags;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFontCell
|
||||
// Sets actual font used for text rendering
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlFontCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); }
|
||||
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
||||
|
||||
protected:
|
||||
wxFont m_Font;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlwidgetCell
|
||||
// This cell is connected with wxWindow object
|
||||
// You can use it to insert windows into HTML page
|
||||
// (buttons, input boxes etc.)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
// !!! wnd must have correct parent!
|
||||
// if w != 0 then the m_Wnd has 'floating' width - it adjust
|
||||
// it's width according to parent container's width
|
||||
// (w is percent of parent's width)
|
||||
wxHtmlWidgetCell(wxWindow *wnd, int w = 0);
|
||||
~wxHtmlWidgetCell() { m_Wnd->Destroy(); }
|
||||
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
virtual void DrawInvisible(wxDC& dc, int x, int y);
|
||||
virtual void Layout(int w);
|
||||
|
||||
protected:
|
||||
wxWindow* m_Wnd;
|
||||
int m_WidthFloat;
|
||||
// width float is used in adjustWidth (it is in percents)
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlWidgetCell)
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlLinkInfo
|
||||
// Internal data structure. It represents hypertext link
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlLinkInfo : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHtmlLinkInfo() : wxObject()
|
||||
{ m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; }
|
||||
wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject()
|
||||
{ m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; }
|
||||
wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject()
|
||||
{ m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
|
||||
m_Cell = l.m_Cell; }
|
||||
wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l)
|
||||
{ m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event;
|
||||
m_Cell = l.m_Cell; return *this; }
|
||||
|
||||
void SetEvent(const wxMouseEvent *e) { m_Event = e; }
|
||||
void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; }
|
||||
|
||||
wxString GetHref() const { return m_Href; }
|
||||
wxString GetTarget() const { return m_Target; }
|
||||
const wxMouseEvent* GetEvent() const { return m_Event; }
|
||||
const wxHtmlCell* GetHtmlCell() const { return m_Cell; }
|
||||
|
||||
private:
|
||||
wxString m_Href, m_Target;
|
||||
const wxMouseEvent *m_Event;
|
||||
const wxHtmlCell *m_Cell;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // wxUSE_HTML
|
||||
|
||||
#endif // _WX_HTMLCELL_H_
|
||||
|
||||
157
include/wx/html/htmldefs.h
Normal file
157
include/wx/html/htmldefs.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmldefs.h
|
||||
// Purpose: constants for wxhtml library
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLDEFS_H_
|
||||
#define _WX_HTMLDEFS_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// ALIGNMENTS
|
||||
// Describes alignment of text etc. in containers
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#define wxHTML_ALIGN_LEFT 0x0000
|
||||
#define wxHTML_ALIGN_RIGHT 0x0002
|
||||
#define wxHTML_ALIGN_JUSTIFY 0x0010
|
||||
|
||||
#define wxHTML_ALIGN_TOP 0x0004
|
||||
#define wxHTML_ALIGN_BOTTOM 0x0008
|
||||
|
||||
#define wxHTML_ALIGN_CENTER 0x0001
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// COLOR MODES
|
||||
// Used by wxHtmlColourCell to determine clr of what is changing
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#define wxHTML_CLR_FOREGROUND 0x0001
|
||||
#define wxHTML_CLR_BACKGROUND 0x0002
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// UNITS
|
||||
// Used to specify units
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#define wxHTML_UNITS_PIXELS 0x0001
|
||||
#define wxHTML_UNITS_PERCENT 0x0002
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// INDENTS
|
||||
// Used to specify indetation relatives
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#define wxHTML_INDENT_LEFT 0x0010
|
||||
#define wxHTML_INDENT_RIGHT 0x0020
|
||||
#define wxHTML_INDENT_TOP 0x0040
|
||||
#define wxHTML_INDENT_BOTTOM 0x0080
|
||||
|
||||
#define wxHTML_INDENT_HORIZONTAL wxHTML_INDENT_LEFT | wxHTML_INDENT_RIGHT
|
||||
#define wxHTML_INDENT_VERTICAL wxHTML_INDENT_TOP | wxHTML_INDENT_BOTTOM
|
||||
#define wxHTML_INDENT_ALL wxHTML_INDENT_VERTICAL | wxHTML_INDENT_HORIZONTAL
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// FIND CONDITIONS
|
||||
// Identifiers of wxHtmlCell's Find() conditions
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#define wxHTML_COND_ISANCHOR 1
|
||||
// Finds the anchor of 'param' name (pointer to wxString).
|
||||
|
||||
#define wxHTML_COND_ISIMAGEMAP 2
|
||||
// Finds imagemap of 'param' name (pointer to wxString).
|
||||
// (used exclusively by m_image.cpp)
|
||||
|
||||
#define wxHTML_COND_USER 10000
|
||||
// User-defined conditions should start from this number
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// INTERNALS
|
||||
// wxHTML internal constants
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#define wxHTML_SCROLL_STEP 16
|
||||
/* size of one scroll step of wxHtmlWindow in pixels */
|
||||
#define wxHTML_BUFLEN 1024
|
||||
/* size of temporary buffer used during parsing */
|
||||
#define wxHTML_REALLOC_STEP 32
|
||||
/* steps of array reallocation */
|
||||
#define wxHTML_PRINT_MAX_PAGES 999
|
||||
/* maximum number of pages printable via html printing */
|
||||
|
||||
|
||||
/* default font sizes */
|
||||
#ifdef __WXMSW__
|
||||
#define wxHTML_FONT_SIZE_1 7
|
||||
#define wxHTML_FONT_SIZE_2 8
|
||||
#define wxHTML_FONT_SIZE_3 10
|
||||
#define wxHTML_FONT_SIZE_4 12
|
||||
#define wxHTML_FONT_SIZE_5 16
|
||||
#define wxHTML_FONT_SIZE_6 22
|
||||
#define wxHTML_FONT_SIZE_7 30
|
||||
#elif defined(__WXMAC__)
|
||||
#define wxHTML_FONT_SIZE_1 9
|
||||
#define wxHTML_FONT_SIZE_2 12
|
||||
#define wxHTML_FONT_SIZE_3 14
|
||||
#define wxHTML_FONT_SIZE_4 18
|
||||
#define wxHTML_FONT_SIZE_5 24
|
||||
#define wxHTML_FONT_SIZE_6 30
|
||||
#define wxHTML_FONT_SIZE_7 36
|
||||
#else
|
||||
#define wxHTML_FONT_SIZE_1 10
|
||||
#define wxHTML_FONT_SIZE_2 12
|
||||
#define wxHTML_FONT_SIZE_3 14
|
||||
#define wxHTML_FONT_SIZE_4 16
|
||||
#define wxHTML_FONT_SIZE_5 19
|
||||
#define wxHTML_FONT_SIZE_6 24
|
||||
#define wxHTML_FONT_SIZE_7 32
|
||||
#endif
|
||||
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2
|
||||
|
||||
#define HTML_ALIGN_LEFT wxHTML_ALIGN_LEFT
|
||||
#define HTML_ALIGN_RIGHT wxHTML_ALIGN_RIGHT
|
||||
#define HTML_ALIGN_TOP wxHTML_ALIGN_TOP
|
||||
#define HTML_ALIGN_BOTTOM wxHTML_ALIGN_BOTTOM
|
||||
#define HTML_ALIGN_CENTER wxHTML_ALIGN_CENTER
|
||||
#define HTML_CLR_FOREGROUND wxHTML_CLR_FOREGROUND
|
||||
#define HTML_CLR_BACKGROUND wxHTML_CLR_BACKGROUND
|
||||
#define HTML_UNITS_PIXELS wxHTML_UNITS_PIXELS
|
||||
#define HTML_UNITS_PERCENT wxHTML_UNITS_PERCENT
|
||||
#define HTML_INDENT_LEFT wxHTML_INDENT_LEFT
|
||||
#define HTML_INDENT_RIGHT wxHTML_INDENT_RIGHT
|
||||
#define HTML_INDENT_TOP wxHTML_INDENT_TOP
|
||||
#define HTML_INDENT_BOTTOM wxHTML_INDENT_BOTTOM
|
||||
#define HTML_INDENT_HORIZONTAL wxHTML_INDENT_HORIZONTAL
|
||||
#define HTML_INDENT_VERTICAL wxHTML_INDENT_VERTICAL
|
||||
#define HTML_INDENT_ALL wxHTML_INDENT_ALL
|
||||
#define HTML_COND_ISANCHOR wxHTML_COND_ISANCHOR
|
||||
#define HTML_COND_ISIMAGEMAP wxHTML_COND_ISIMAGEMAP
|
||||
#define HTML_COND_USER wxHTML_COND_USER
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
87
include/wx/html/htmlfilt.h
Normal file
87
include/wx/html/htmlfilt.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlfilt.h
|
||||
// Purpose: filters
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLFILT_H_
|
||||
#define _WX_HTMLFILT_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmlfilt.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/filesys.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFilter
|
||||
// This class is input filter. It can "translate" files
|
||||
// in non-HTML format to HTML format
|
||||
// interface to access certain
|
||||
// kinds of files (HTPP, FTP, local, tar.gz etc..)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlFilter : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxHtmlFilter)
|
||||
|
||||
public:
|
||||
wxHtmlFilter() : wxObject() {}
|
||||
virtual ~wxHtmlFilter() {}
|
||||
|
||||
// returns TRUE if this filter is able to open&read given file
|
||||
virtual bool CanRead(const wxFSFile& file) const = 0;
|
||||
|
||||
// Reads given file and returns HTML document.
|
||||
// Returns empty string if opening failed
|
||||
virtual wxString ReadFile(const wxFSFile& file) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFilterPlainText
|
||||
// This filter is used as default filter if no other can
|
||||
// be used (= uknown type of file). It is used by
|
||||
// wxHtmlWindow itself.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class WXDLLEXPORT wxHtmlFilterPlainText : public wxHtmlFilter
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText)
|
||||
|
||||
public:
|
||||
virtual bool CanRead(const wxFSFile& file) const;
|
||||
virtual wxString ReadFile(const wxFSFile& file) const;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFilterHTML
|
||||
// filter for text/html
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlFilterHTML : public wxHtmlFilter
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML)
|
||||
|
||||
public:
|
||||
virtual bool CanRead(const wxFSFile& file) const;
|
||||
virtual wxString ReadFile(const wxFSFile& file) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // wxUSE_HTML
|
||||
|
||||
#endif // _WX_HTMLFILT_H_
|
||||
|
||||
278
include/wx/html/htmlpars.h
Normal file
278
include/wx/html/htmlpars.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlpars.h
|
||||
// Purpose: wxHtmlParser class (generic parser)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLPARS_H_
|
||||
#define _WX_HTMLPARS_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmlpars.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/html/htmltag.h"
|
||||
#include "wx/filesys.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/fontenc.h"
|
||||
|
||||
class WXDLLEXPORT wxMBConv;
|
||||
class WXDLLEXPORT wxHtmlParser;
|
||||
class WXDLLEXPORT wxHtmlTagHandler;
|
||||
class WXDLLEXPORT wxHtmlEntitiesParser;
|
||||
|
||||
class wxHtmlTextPieces;
|
||||
class wxHtmlParserState;
|
||||
|
||||
|
||||
enum wxHtmlURLType
|
||||
{
|
||||
wxHTML_URL_PAGE,
|
||||
wxHTML_URL_IMAGE,
|
||||
wxHTML_URL_OTHER
|
||||
};
|
||||
|
||||
// This class handles generic parsing of HTML document : it scans
|
||||
// the document and divide it into blocks of tags (where one block
|
||||
// consists of starting and ending tag and of text between these
|
||||
// 2 tags.
|
||||
class WXDLLEXPORT wxHtmlParser : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxHtmlParser)
|
||||
|
||||
public:
|
||||
wxHtmlParser();
|
||||
virtual ~wxHtmlParser();
|
||||
|
||||
// Sets the class which will be used for opening files
|
||||
void SetFS(wxFileSystem *fs) { m_FS = fs; }
|
||||
|
||||
wxFileSystem* GetFS() const { return m_FS; }
|
||||
|
||||
// Opens file if the parser is allowed to open given URL (may be forbidden
|
||||
// for security reasons)
|
||||
virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
|
||||
|
||||
// You can simply call this method when you need parsed output.
|
||||
// This method does these things:
|
||||
// 1. call InitParser(source);
|
||||
// 2. call DoParsing();
|
||||
// 3. call GetProduct(); (it's return value is then returned)
|
||||
// 4. call DoneParser();
|
||||
wxObject* Parse(const wxString& source);
|
||||
|
||||
// Sets the source. This must be called before running Parse() method.
|
||||
virtual void InitParser(const wxString& source);
|
||||
// This must be called after Parse().
|
||||
virtual void DoneParser();
|
||||
|
||||
// May be called during parsing to immediately return from Parse().
|
||||
virtual void StopParsing() { m_stopParsing = TRUE; }
|
||||
|
||||
// Parses the m_Source from begin_pos to end_pos-1.
|
||||
// (in noparams version it parses whole m_Source)
|
||||
void DoParsing(int begin_pos, int end_pos);
|
||||
void DoParsing();
|
||||
|
||||
// Returns pointer to the tag at parser's current position
|
||||
wxHtmlTag *GetCurrentTag() const { return m_CurTag; }
|
||||
|
||||
// Returns product of parsing
|
||||
// Returned value is result of parsing of the part. The type of this result
|
||||
// depends on internal representation in derived parser
|
||||
// (see wxHtmlWinParser for details).
|
||||
virtual wxObject* GetProduct() = 0;
|
||||
|
||||
// adds handler to the list & hash table of handlers.
|
||||
virtual void AddTagHandler(wxHtmlTagHandler *handler);
|
||||
|
||||
// Forces the handler to handle additional tags (not returned by GetSupportedTags).
|
||||
// The handler should already be in use by this parser.
|
||||
// Example: you want to parse following pseudo-html structure:
|
||||
// <myitems>
|
||||
// <it name="one" value="1">
|
||||
// <it name="two" value="2">
|
||||
// </myitems>
|
||||
// <it> This last it has different meaning, we don't want it to be parsed by myitems handler!
|
||||
// handler can handle only 'myitems' (e.g. it's GetSupportedTags returns "MYITEMS")
|
||||
// you can call PushTagHandler(handler, "IT") when you find <myitems>
|
||||
// and call PopTagHandler() when you find </myitems>
|
||||
void PushTagHandler(wxHtmlTagHandler *handler, wxString tags);
|
||||
|
||||
// Restores state before last call to PushTagHandler
|
||||
void PopTagHandler();
|
||||
|
||||
wxString* GetSource() {return &m_Source;}
|
||||
void SetSource(const wxString& src);
|
||||
|
||||
// Sets HTML source and remebers current parser's state so that it can
|
||||
// later be restored. This is useful for on-line modifications of
|
||||
// HTML source (for example, <pre> handler replaces spaces with
|
||||
// and newlines with <br>)
|
||||
virtual void SetSourceAndSaveState(const wxString& src);
|
||||
// Restores parser's state from stack or returns FALSE if the stack is
|
||||
// empty
|
||||
virtual bool RestoreState();
|
||||
|
||||
// Parses HTML string 'markup' and extracts charset info from <meta> tag
|
||||
// if present. Returns empty string if the tag is missing.
|
||||
// For wxHTML's internal use.
|
||||
static wxString ExtractCharsetInformation(const wxString& markup);
|
||||
|
||||
protected:
|
||||
// DOM structure
|
||||
void CreateDOMTree();
|
||||
void DestroyDOMTree();
|
||||
void CreateDOMSubTree(wxHtmlTag *cur,
|
||||
int begin_pos, int end_pos,
|
||||
wxHtmlTagsCache *cache);
|
||||
|
||||
// Adds text to the output.
|
||||
// This is called from Parse() and must be overriden in derived classes.
|
||||
// txt is not guaranteed to be only one word. It is largest continuous part of text
|
||||
// (= not broken by tags)
|
||||
// NOTE : using char* because of speed improvements
|
||||
virtual void AddText(const wxChar* txt) = 0;
|
||||
|
||||
// Adds tag and proceeds it. Parse() may (and usually is) called from this method.
|
||||
// This is called from Parse() and may be overriden.
|
||||
// Default behavior is that it looks for proper handler in m_Handlers. The tag is
|
||||
// ignored if no hander is found.
|
||||
// Derived class is *responsible* for filling in m_Handlers table.
|
||||
virtual void AddTag(const wxHtmlTag& tag);
|
||||
|
||||
// Returns entity parser object, used to substitute HTML &entities;
|
||||
wxHtmlEntitiesParser *GetEntitiesParser() const { return m_entitiesParser; }
|
||||
|
||||
protected:
|
||||
// DOM tree:
|
||||
wxHtmlTag *m_CurTag;
|
||||
wxHtmlTag *m_Tags;
|
||||
wxHtmlTextPieces *m_TextPieces;
|
||||
size_t m_CurTextPiece;
|
||||
|
||||
wxString m_Source;
|
||||
|
||||
wxHtmlParserState *m_SavedStates;
|
||||
|
||||
// handlers that handle particular tags. The table is accessed by
|
||||
// key = tag's name.
|
||||
// This attribute MUST be filled by derived class otherwise it would
|
||||
// be empty and no tags would be recognized
|
||||
// (see wxHtmlWinParser for details about filling it)
|
||||
// m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.)
|
||||
// it may (and often does) contain more references to one object
|
||||
// m_HandlersList is list of all handlers and it is guaranteed to contain
|
||||
// only one reference to each handler instance.
|
||||
wxList m_HandlersList;
|
||||
wxHashTable m_HandlersHash;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlParser)
|
||||
|
||||
// class for opening files (file system)
|
||||
wxFileSystem *m_FS;
|
||||
// handlers stack used by PushTagHandler and PopTagHandler
|
||||
wxList *m_HandlersStack;
|
||||
|
||||
// entity parse
|
||||
wxHtmlEntitiesParser *m_entitiesParser;
|
||||
|
||||
// flag indicating that the parser should stop
|
||||
bool m_stopParsing;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// This class (and derived classes) cooperates with wxHtmlParser.
|
||||
// Each recognized tag is passed to handler which is capable
|
||||
// of handling it. Each tag is handled in 3 steps:
|
||||
// 1. Handler will modifies state of parser
|
||||
// (using it's public methods)
|
||||
// 2. Parser parses source between starting and ending tag
|
||||
// 3. Handler restores original state of the parser
|
||||
class WXDLLEXPORT wxHtmlTagHandler : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxHtmlTagHandler)
|
||||
|
||||
public:
|
||||
wxHtmlTagHandler() : wxObject () { m_Parser = NULL; }
|
||||
|
||||
// Sets the parser.
|
||||
// NOTE : each _instance_ of handler is guaranteed to be called
|
||||
// only by one parser. This means you don't have to care about
|
||||
// reentrancy.
|
||||
virtual void SetParser(wxHtmlParser *parser)
|
||||
{ m_Parser = parser; }
|
||||
|
||||
// Returns list of supported tags. The list is in uppercase and
|
||||
// tags are delimited by ','.
|
||||
// Example : "I,B,FONT,P"
|
||||
// is capable of handling italic, bold, font and paragraph tags
|
||||
virtual wxString GetSupportedTags() = 0;
|
||||
|
||||
// This is hadling core method. It does all the Steps 1-3.
|
||||
// To process step 2, you can call ParseInner()
|
||||
// returned value : TRUE if it called ParseInner(),
|
||||
// FALSE etherwise
|
||||
virtual bool HandleTag(const wxHtmlTag& tag) = 0;
|
||||
|
||||
protected:
|
||||
// parses input between beginning and ending tag.
|
||||
// m_Parser must be set.
|
||||
void ParseInner(const wxHtmlTag& tag)
|
||||
{ m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); }
|
||||
|
||||
wxHtmlParser *m_Parser;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlTagHandler)
|
||||
};
|
||||
|
||||
|
||||
// This class is used to parse HTML entities in strings. It can handle
|
||||
// both named entities and &#xxxx entries where xxxx is Unicode code.
|
||||
class WXDLLEXPORT wxHtmlEntitiesParser : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlEntitiesParser)
|
||||
|
||||
public:
|
||||
wxHtmlEntitiesParser();
|
||||
virtual ~wxHtmlEntitiesParser();
|
||||
|
||||
// Sets encoding of output string.
|
||||
// Has no effect if wxUSE_WCHAR_T==0 or wxUSE_UNICODE==1
|
||||
void SetEncoding(wxFontEncoding encoding);
|
||||
|
||||
// Parses entities in input and replaces them with respective characters
|
||||
// (with respect to output encoding)
|
||||
wxString Parse(const wxString& input);
|
||||
|
||||
// Returns character for given entity or 0 if the enity is unknown
|
||||
wxChar GetEntityChar(const wxString& entity);
|
||||
|
||||
// Returns character that represents given Unicode code
|
||||
#if wxUSE_UNICODE
|
||||
wxChar GetCharForCode(unsigned code) { return (wxChar)code; }
|
||||
#else
|
||||
wxChar GetCharForCode(unsigned code);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
|
||||
wxMBConv *m_conv;
|
||||
wxFontEncoding m_encoding;
|
||||
#endif
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlEntitiesParser)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_HTMLPARS_H_
|
||||
64
include/wx/html/htmlproc.h
Normal file
64
include/wx/html/htmlproc.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlprep.h
|
||||
// Purpose: HTML processor
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLPREP_H_
|
||||
#define _WX_HTMLPREP_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmlproc.h"
|
||||
// (implementation is in htmlwin.cpp, there's no htmlprep.cpp!)
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
// Priority of preprocessor in the chain. The higher, the earlier it is used
|
||||
enum
|
||||
{
|
||||
wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this
|
||||
// priority
|
||||
wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals
|
||||
};
|
||||
|
||||
// Classes derived from this class serve as simple text processors for
|
||||
// wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered
|
||||
// processors before displaying it, thus allowing for on-the-fly
|
||||
// modifications of the markup.
|
||||
|
||||
class WXDLLEXPORT wxHtmlProcessor : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxHtmlProcessor)
|
||||
|
||||
public:
|
||||
wxHtmlProcessor() : wxObject(), m_enabled(TRUE) {}
|
||||
virtual ~wxHtmlProcessor() {}
|
||||
|
||||
// Process input text and return processed result
|
||||
virtual wxString Process(const wxString& text) const = 0;
|
||||
|
||||
// Return priority value of this processor. The higher, the sooner
|
||||
// is the processor applied to the text.
|
||||
virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; }
|
||||
|
||||
// Enable/disable the processor. wxHtmlWindow won't use a disabled
|
||||
// processor even if it is in its processors queue.
|
||||
virtual void Enable(bool enable = TRUE) { m_enabled = enable; }
|
||||
bool IsEnabled() const { return m_enabled; }
|
||||
|
||||
protected:
|
||||
bool m_enabled;
|
||||
};
|
||||
|
||||
#endif // wxUSE_HTML
|
||||
|
||||
#endif // _WX_HTMLPROC_H_
|
||||
158
include/wx/html/htmltag.h
Normal file
158
include/wx/html/htmltag.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmltag.h
|
||||
// Purpose: wxHtmlTag class (represents single tag)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLTAG_H_
|
||||
#define _WX_HTMLTAG_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmltag.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/object.h"
|
||||
|
||||
class WXDLLEXPORT wxColour;
|
||||
class WXDLLEXPORT wxHtmlEntitiesParser;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlTagsCache
|
||||
// - internal wxHTML class, do not use!
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct wxHtmlCacheItem;
|
||||
|
||||
class WXDLLEXPORT wxHtmlTagsCache : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlTagsCache)
|
||||
|
||||
private:
|
||||
wxHtmlCacheItem *m_Cache;
|
||||
int m_CacheSize;
|
||||
int m_CachePos;
|
||||
|
||||
public:
|
||||
wxHtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;}
|
||||
wxHtmlTagsCache(const wxString& source);
|
||||
~wxHtmlTagsCache() {free(m_Cache);}
|
||||
|
||||
// Finds parameters for tag starting at at and fills the variables
|
||||
void QueryTag(int at, int* end1, int* end2);
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlTagsCache)
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlTag
|
||||
// This represents single tag. It is used as internal structure
|
||||
// by wxHtmlParser.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlTag : public wxObject
|
||||
{
|
||||
DECLARE_CLASS(wxHtmlTag)
|
||||
|
||||
protected:
|
||||
// constructs wxHtmlTag object based on HTML tag.
|
||||
// The tag begins (with '<' character) at position pos in source
|
||||
// end_pos is position where parsing ends (usually end of document)
|
||||
wxHtmlTag(wxHtmlTag *parent,
|
||||
const wxString& source, int pos, int end_pos,
|
||||
wxHtmlTagsCache *cache,
|
||||
wxHtmlEntitiesParser *entParser);
|
||||
friend class wxHtmlParser;
|
||||
public:
|
||||
~wxHtmlTag();
|
||||
|
||||
wxHtmlTag *GetParent() const {return m_Parent;}
|
||||
wxHtmlTag *GetFirstSibling() const;
|
||||
wxHtmlTag *GetLastSibling() const;
|
||||
wxHtmlTag *GetChildren() const { return m_FirstChild; }
|
||||
wxHtmlTag *GetPreviousSibling() const { return m_Prev; }
|
||||
wxHtmlTag *GetNextSibling() const {return m_Next; }
|
||||
// Return next tag, as if tree had been flattened
|
||||
wxHtmlTag *GetNextTag() const;
|
||||
|
||||
// Returns tag's name in uppercase.
|
||||
inline wxString GetName() const {return m_Name;}
|
||||
|
||||
// Returns TRUE if the tag has given parameter. Parameter
|
||||
// should always be in uppercase.
|
||||
// Example : <IMG SRC="test.jpg"> HasParam("SRC") returns TRUE
|
||||
bool HasParam(const wxString& par) const;
|
||||
|
||||
// Returns value of the param. Value is in uppercase unless it is
|
||||
// enclosed with "
|
||||
// Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
|
||||
// <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
|
||||
// (or ("WhaT.jpg") if with_commas == TRUE)
|
||||
wxString GetParam(const wxString& par, bool with_commas = FALSE) const;
|
||||
|
||||
// Convenience functions:
|
||||
bool GetParamAsColour(const wxString& par, wxColour *clr) const;
|
||||
bool GetParamAsInt(const wxString& par, int *clr) const;
|
||||
|
||||
// Scans param like scanf() functions family does.
|
||||
// Example : ScanParam("COLOR", "\"#%X\"", &clr);
|
||||
// This is always with with_commas=FALSE
|
||||
// Returns number of scanned values
|
||||
// (like sscanf() does)
|
||||
// NOTE: unlike scanf family, this function only accepts
|
||||
// *one* parameter !
|
||||
int ScanParam(const wxString& par, const wxChar *format, void *param) const;
|
||||
|
||||
// Returns string containing all params.
|
||||
wxString GetAllParams() const;
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
// return TRUE if this is ending tag (</something>) or FALSE
|
||||
// if it isn't (<something>)
|
||||
inline bool IsEnding() const {return FALSE;}
|
||||
#endif
|
||||
|
||||
// return TRUE if this there is matching ending tag
|
||||
inline bool HasEnding() const {return m_End1 >= 0;}
|
||||
|
||||
// returns beginning position of _internal_ block of text
|
||||
// See explanation (returned value is marked with *):
|
||||
// bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
|
||||
inline int GetBeginPos() const {return m_Begin;}
|
||||
// returns ending position of _internal_ block of text.
|
||||
// bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
|
||||
inline int GetEndPos1() const {return m_End1;}
|
||||
// returns end position 2 :
|
||||
// bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
|
||||
inline int GetEndPos2() const {return m_End2;}
|
||||
|
||||
private:
|
||||
wxString m_Name;
|
||||
int m_Begin, m_End1, m_End2;
|
||||
wxArrayString m_ParamNames, m_ParamValues;
|
||||
|
||||
// DOM tree relations:
|
||||
wxHtmlTag *m_Next;
|
||||
wxHtmlTag *m_Prev;
|
||||
wxHtmlTag *m_FirstChild, *m_LastChild;
|
||||
wxHtmlTag *m_Parent;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlTag)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_HTMLTAG_H_
|
||||
|
||||
284
include/wx/html/htmlwin.h
Normal file
284
include/wx/html/htmlwin.h
Normal file
@@ -0,0 +1,284 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlwin.h
|
||||
// Purpose: wxHtmlWindow class for parsing & displaying HTML
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_HTMLWIN_H_
|
||||
#define _WX_HTMLWIN_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmlwin.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/scrolwin.h"
|
||||
#include "wx/config.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "wx/html/winpars.h"
|
||||
#include "wx/html/htmlcell.h"
|
||||
#include "wx/filesys.h"
|
||||
#include "wx/html/htmlfilt.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
class wxHtmlProcessor;
|
||||
class wxHtmlWinModule;
|
||||
class wxHtmlHistoryArray;
|
||||
class wxHtmlProcessorList;
|
||||
|
||||
|
||||
// wxHtmlWindow flags:
|
||||
#define wxHW_SCROLLBAR_NEVER 0x0002
|
||||
#define wxHW_SCROLLBAR_AUTO 0x0004
|
||||
|
||||
// enums for wxHtmlWindow::OnOpeningURL
|
||||
enum wxHtmlOpeningStatus
|
||||
{
|
||||
wxHTML_OPEN,
|
||||
wxHTML_BLOCK,
|
||||
wxHTML_REDIRECT
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlWindow
|
||||
// (This is probably the only class you will directly use.)
|
||||
// Purpose of this class is to display HTML page (either local
|
||||
// file or downloaded via HTTP protocol) in a window. Width
|
||||
// of window is constant - given in constructor - virtual height
|
||||
// is changed dynamicly depending on page size.
|
||||
// Once the window is created you can set it's content by calling
|
||||
// SetPage(text) or LoadPage(filename).
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
|
||||
friend class wxHtmlWinModule;
|
||||
|
||||
public:
|
||||
wxHtmlWindow() { Init(); }
|
||||
wxHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_AUTO,
|
||||
const wxString& name = wxT("htmlWindow"))
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
~wxHtmlWindow();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_AUTO,
|
||||
const wxString& name = wxT("htmlWindow"));
|
||||
|
||||
// Set HTML page and display it. !! source is HTML document itself,
|
||||
// it is NOT address/filename of HTML document. If you want to
|
||||
// specify document location, use LoadPage() istead
|
||||
// Return value : FALSE if an error occured, TRUE otherwise
|
||||
bool SetPage(const wxString& source);
|
||||
|
||||
// Append to current page
|
||||
bool AppendToPage(const wxString& source);
|
||||
|
||||
// Load HTML page from given location. Location can be either
|
||||
// a) /usr/wxGTK2/docs/html/wx.htm
|
||||
// b) http://www.somewhere.uk/document.htm
|
||||
// c) ftp://ftp.somesite.cz/pub/something.htm
|
||||
// In case there is no prefix (http:,ftp:), the method
|
||||
// will try to find it itself (1. local file, then http or ftp)
|
||||
// After the page is loaded, the method calls SetPage() to display it.
|
||||
// Note : you can also use path relative to previously loaded page
|
||||
// Return value : same as SetPage
|
||||
virtual bool LoadPage(const wxString& location);
|
||||
|
||||
// Loads HTML page from file
|
||||
bool LoadFile(const wxFileName& filename);
|
||||
|
||||
// Returns full location of opened page
|
||||
wxString GetOpenedPage() const {return m_OpenedPage;}
|
||||
// Returns anchor within opened page
|
||||
wxString GetOpenedAnchor() const {return m_OpenedAnchor;}
|
||||
// Returns <TITLE> of opened page or empty string otherwise
|
||||
wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;}
|
||||
|
||||
// Sets frame in which page title will be displayed. Format is format of
|
||||
// frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
|
||||
void SetRelatedFrame(wxFrame* frame, const wxString& format);
|
||||
wxFrame* GetRelatedFrame() const {return m_RelatedFrame;}
|
||||
|
||||
// After(!) calling SetRelatedFrame, this sets statusbar slot where messages
|
||||
// will be displayed. Default is -1 = no messages.
|
||||
void SetRelatedStatusBar(int bar);
|
||||
|
||||
// Sets fonts to be used when displaying HTML page.
|
||||
void SetFonts(wxString normal_face, wxString fixed_face,
|
||||
const int *sizes = NULL);
|
||||
|
||||
// Sets space between text and window borders.
|
||||
void SetBorders(int b) {m_Borders = b;}
|
||||
|
||||
// Saves custom settings into cfg config. it will use the path 'path'
|
||||
// if given, otherwise it will save info into currently selected path.
|
||||
// saved values : things set by SetFonts, SetBorders.
|
||||
virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
|
||||
// ...
|
||||
virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
|
||||
|
||||
// Goes to previous/next page (in browsing history)
|
||||
// Returns TRUE if successful, FALSE otherwise
|
||||
bool HistoryBack();
|
||||
bool HistoryForward();
|
||||
bool HistoryCanBack();
|
||||
bool HistoryCanForward();
|
||||
// Resets history
|
||||
void HistoryClear();
|
||||
|
||||
// Returns pointer to conteiners/cells structure.
|
||||
// It should be used ONLY when printing
|
||||
wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;}
|
||||
|
||||
// Adds input filter
|
||||
static void AddFilter(wxHtmlFilter *filter);
|
||||
|
||||
// Returns a pointer to the parser.
|
||||
wxHtmlWinParser *GetParser() const { return m_Parser; }
|
||||
|
||||
// Adds HTML processor to this instance of wxHtmlWindow:
|
||||
void AddProcessor(wxHtmlProcessor *processor);
|
||||
// Adds HTML processor to wxHtmlWindow class as whole:
|
||||
static void AddGlobalProcessor(wxHtmlProcessor *processor);
|
||||
|
||||
// what would we do with it?
|
||||
virtual bool AcceptsFocusFromKeyboard() const { return FALSE; }
|
||||
|
||||
// -- Callbacks --
|
||||
|
||||
// Sets the title of the window
|
||||
// (depending on the information passed to SetRelatedFrame() method)
|
||||
virtual void OnSetTitle(const wxString& title);
|
||||
|
||||
// Called when the mouse hovers over a cell: (x, y) are logical coords
|
||||
// Default behaviour is to do nothing at all
|
||||
virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
|
||||
|
||||
// Called when user clicks on a cell. Default behavior is to call
|
||||
// OnLinkClicked() if this cell corresponds to a hypertext link
|
||||
virtual void OnCellClicked(wxHtmlCell *cell,
|
||||
wxCoord x, wxCoord y,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
// Called when user clicked on hypertext link. Default behavior is to
|
||||
// call LoadPage(loc)
|
||||
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
|
||||
|
||||
// Called when wxHtmlWindow wants to fetch data from an URL (e.g. when
|
||||
// loading a page or loading an image). The data are downloaded if and only if
|
||||
// OnOpeningURL returns TRUE. If OnOpeningURL returns wxHTML_REDIRECT,
|
||||
// it must set *redirect to the new URL
|
||||
virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type),
|
||||
const wxString& WXUNUSED(url),
|
||||
wxString *WXUNUSED(redirect)) const
|
||||
{ return wxHTML_OPEN; }
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
// Scrolls to anchor of this name. (Anchor is #news
|
||||
// or #features etc. it is part of address sometimes:
|
||||
// http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news)
|
||||
// Return value : TRUE if anchor exists, FALSE otherwise
|
||||
bool ScrollToAnchor(const wxString& anchor);
|
||||
|
||||
// Prepares layout (= fill m_PosX, m_PosY for fragments) based on
|
||||
// actual size of window. This method also setup scrollbars
|
||||
void CreateLayout();
|
||||
|
||||
void OnDraw(wxDC& dc);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Returns new filter (will be stored into m_DefaultFilter variable)
|
||||
virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
|
||||
|
||||
// cleans static variables
|
||||
static void CleanUpStatics();
|
||||
|
||||
protected:
|
||||
// This is pointer to the first cell in parsed data.
|
||||
// (Note: the first cell is usually top one = all other cells are sub-cells of this one)
|
||||
wxHtmlContainerCell *m_Cell;
|
||||
// parser which is used to parse HTML input.
|
||||
// Each wxHtmlWindow has it's own parser because sharing one global
|
||||
// parser would be problematic (because of reentrancy)
|
||||
wxHtmlWinParser *m_Parser;
|
||||
// contains name of actualy opened page or empty string if no page opened
|
||||
wxString m_OpenedPage;
|
||||
// contains name of current anchor within m_OpenedPage
|
||||
wxString m_OpenedAnchor;
|
||||
// contains title of actualy opened page or empty string if no <TITLE> tag
|
||||
wxString m_OpenedPageTitle;
|
||||
// class for opening files (file system)
|
||||
wxFileSystem* m_FS;
|
||||
|
||||
wxFrame *m_RelatedFrame;
|
||||
wxString m_TitleFormat;
|
||||
// frame in which page title should be displayed & number of it's statusbar
|
||||
// reserved for usage with this html window
|
||||
int m_RelatedStatusBar;
|
||||
|
||||
// borders (free space between text and window borders)
|
||||
// defaults to 10 pixels.
|
||||
int m_Borders;
|
||||
|
||||
int m_Style;
|
||||
|
||||
private:
|
||||
// a flag indicated if mouse moved
|
||||
// (if TRUE we will try to change cursor in last call to OnIdle)
|
||||
bool m_tmpMouseMoved;
|
||||
// contains last link name
|
||||
wxHtmlLinkInfo *m_tmpLastLink;
|
||||
// contains the last (terminal) cell which contained the mouse
|
||||
wxHtmlCell *m_tmpLastCell;
|
||||
// if >0 contents of the window is not redrawn
|
||||
// (in order to avoid ugly blinking)
|
||||
int m_tmpCanDrawLocks;
|
||||
|
||||
// list of HTML filters
|
||||
static wxList m_Filters;
|
||||
// this filter is used when no filter is able to read some file
|
||||
static wxHtmlFilter *m_DefaultFilter;
|
||||
|
||||
static wxCursor *s_cur_hand;
|
||||
static wxCursor *s_cur_arrow;
|
||||
|
||||
wxHtmlHistoryArray *m_History;
|
||||
// browser history
|
||||
int m_HistoryPos;
|
||||
// if this FLAG is false, items are not added to history
|
||||
bool m_HistoryOn;
|
||||
|
||||
// html processors array:
|
||||
wxHtmlProcessorList *m_Processors;
|
||||
static wxHtmlProcessorList *m_GlobalProcessors;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlWindow)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_HTMLWIN_H_
|
||||
|
||||
258
include/wx/html/htmprint.h
Normal file
258
include/wx/html/htmprint.h
Normal file
@@ -0,0 +1,258 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmprint.h
|
||||
// Purpose: html printing classes
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 25/09/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_HTMPRINT_H_
|
||||
#define _WX_HTMPRINT_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "htmprint.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
#include "wx/html/winpars.h"
|
||||
|
||||
#include "wx/print.h"
|
||||
#include "wx/printdlg.h"
|
||||
|
||||
#include <limits.h> // INT_MAX
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlDCRenderer
|
||||
// This class is capable of rendering HTML into specified
|
||||
// portion of DC
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlDCRenderer : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHtmlDCRenderer();
|
||||
~wxHtmlDCRenderer();
|
||||
|
||||
// Following 3 methods *must* be called before any call to Render:
|
||||
|
||||
// Assign DC to this render
|
||||
void SetDC(wxDC *dc, double pixel_scale = 1.0);
|
||||
|
||||
// Sets size of output rectangle, in pixels. Note that you *can't* change
|
||||
// width of the rectangle between calls to Render! (You can freely change height.)
|
||||
void SetSize(int width, int height);
|
||||
|
||||
// Sets the text to be displayed.
|
||||
// Basepath is base directory (html string would be stored there if it was in
|
||||
// file). It is used to determine path for loading images, for example.
|
||||
// isdir is FALSE if basepath is filename, TRUE if it is directory name
|
||||
// (see wxFileSystem for detailed explanation)
|
||||
void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = TRUE);
|
||||
|
||||
// Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = NULL);
|
||||
|
||||
// [x,y] is position of upper-left corner of printing rectangle (see SetSize)
|
||||
// from is y-coordinate of the very first visible cell
|
||||
// to is y-coordinate of the next following page break, if any
|
||||
// Returned value is y coordinate of first cell than didn't fit onto page.
|
||||
// Use this value as 'from' in next call to Render in order to print multiple pages
|
||||
// document
|
||||
// If dont_render is TRUE then nothing is rendered into DC and it only counts
|
||||
// pixels and return y coord of the next page
|
||||
//
|
||||
// known_pagebreaks and number_of_pages are used only when counting pages;
|
||||
// otherwise, their default values should be used. Their purpose is to
|
||||
// support pagebreaks using a subset of CSS2's <DIV>. The <DIV> handler
|
||||
// needs to know what pagebreaks have already been set so that it doesn't
|
||||
// set the same pagebreak twice.
|
||||
//
|
||||
// CAUTION! Render() changes DC's user scale and does NOT restore it!
|
||||
int Render(int x, int y, int from = 0, int dont_render = FALSE, int to = INT_MAX,
|
||||
int *known_pagebreaks = NULL, int number_of_pages = 0);
|
||||
|
||||
// returns total height of the html document
|
||||
// (compare Render's return value with this)
|
||||
int GetTotalHeight();
|
||||
|
||||
private:
|
||||
wxDC *m_DC;
|
||||
wxHtmlWinParser *m_Parser;
|
||||
wxFileSystem *m_FS;
|
||||
wxHtmlContainerCell *m_Cells;
|
||||
int m_MaxWidth, m_Width, m_Height;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlDCRenderer)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
wxPAGE_ODD,
|
||||
wxPAGE_EVEN,
|
||||
wxPAGE_ALL
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlPrintout
|
||||
// This class is derived from standard wxWindows printout class
|
||||
// and is used to print HTML documents.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class WXDLLEXPORT wxHtmlPrintout : public wxPrintout
|
||||
{
|
||||
public:
|
||||
wxHtmlPrintout(const wxString& title = wxT("Printout"));
|
||||
~wxHtmlPrintout();
|
||||
|
||||
void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = TRUE);
|
||||
// prepares the class for printing this html document.
|
||||
// Must be called before using the class, in fact just after constructor
|
||||
//
|
||||
// basepath is base directory (html string would be stored there if it was in
|
||||
// file). It is used to determine path for loading images, for example.
|
||||
// isdir is FALSE if basepath is filename, TRUE if it is directory name
|
||||
// (see wxFileSystem for detailed explanation)
|
||||
|
||||
void SetHtmlFile(const wxString &htmlfile);
|
||||
// same as SetHtmlText except that it takes regular file as the parameter
|
||||
|
||||
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
|
||||
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
|
||||
// sets header/footer for the document. The argument is interpreted as HTML document.
|
||||
// You can use macros in it:
|
||||
// @PAGENUM@ is replaced by page number
|
||||
// @PAGESCNT@ is replaced by total number of pages
|
||||
//
|
||||
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
||||
// You can set different header/footer for odd and even pages
|
||||
|
||||
// Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = NULL);
|
||||
|
||||
void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2,
|
||||
float spaces = 5);
|
||||
// sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space
|
||||
// between text and header and/or footer
|
||||
|
||||
// wxPrintout stuff:
|
||||
bool OnPrintPage(int page);
|
||||
bool HasPage(int page);
|
||||
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
|
||||
bool OnBeginDocument(int startPage, int endPage);
|
||||
|
||||
private:
|
||||
|
||||
void RenderPage(wxDC *dc, int page);
|
||||
// renders one page into dc
|
||||
wxString TranslateHeader(const wxString& instr, int page);
|
||||
// substitute @PAGENUM@ and @PAGESCNT@ by real values
|
||||
void CountPages();
|
||||
// counts pages and fills m_NumPages and m_PageBreaks
|
||||
|
||||
|
||||
private:
|
||||
int m_NumPages;
|
||||
int m_PageBreaks[wxHTML_PRINT_MAX_PAGES];
|
||||
|
||||
wxString m_Document, m_BasePath;
|
||||
bool m_BasePathIsDir;
|
||||
wxString m_Headers[2], m_Footers[2];
|
||||
|
||||
int m_HeaderHeight, m_FooterHeight;
|
||||
wxHtmlDCRenderer *m_Renderer, *m_RendererHdr;
|
||||
float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlPrintout)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlEasyPrinting
|
||||
// This class provides very simple interface to printing
|
||||
// architecture. It allows you to print HTML documents only
|
||||
// with very few commands.
|
||||
//
|
||||
// Note : do not create this class on stack only.
|
||||
// You should create an instance on app startup and
|
||||
// use this instance for all printing. Why? The class
|
||||
// stores page&printer settings in it.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxFrame *parent_frame = NULL);
|
||||
~wxHtmlEasyPrinting();
|
||||
|
||||
bool PreviewFile(const wxString &htmlfile);
|
||||
bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
||||
// Preview file / html-text for printing
|
||||
// (and offers printing)
|
||||
// basepath is base directory for opening subsequent files (e.g. from <img> tag)
|
||||
|
||||
bool PrintFile(const wxString &htmlfile);
|
||||
bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
|
||||
// Print file / html-text w/o preview
|
||||
|
||||
void PrinterSetup();
|
||||
void PageSetup();
|
||||
// pop up printer or page setup dialog
|
||||
|
||||
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
|
||||
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
|
||||
// sets header/footer for the document. The argument is interpreted as HTML document.
|
||||
// You can use macros in it:
|
||||
// @PAGENUM@ is replaced by page number
|
||||
// @PAGESCNT@ is replaced by total number of pages
|
||||
//
|
||||
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
||||
// You can set different header/footer for odd and even pages
|
||||
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = 0);
|
||||
// Sets fonts to be used when displaying HTML page. (if size null then default sizes used)
|
||||
|
||||
wxPrintData *GetPrintData() {return m_PrintData;}
|
||||
wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}
|
||||
// return page setting data objects.
|
||||
// (You can set their parameters.)
|
||||
|
||||
protected:
|
||||
virtual wxHtmlPrintout *CreatePrintout();
|
||||
virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
|
||||
virtual bool DoPrint(wxHtmlPrintout *printout);
|
||||
|
||||
private:
|
||||
wxPrintData *m_PrintData;
|
||||
wxPageSetupDialogData *m_PageSetupData;
|
||||
wxString m_Name;
|
||||
int m_FontsSizesArr[7];
|
||||
int *m_FontsSizes;
|
||||
wxString m_FontFaceFixed, m_FontFaceNormal;
|
||||
wxString m_Headers[2], m_Footers[2];
|
||||
wxFrame *m_Frame;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlEasyPrinting)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#endif // _WX_HTMPRINT_H_
|
||||
|
||||
84
include/wx/html/m_templ.h
Normal file
84
include/wx/html/m_templ.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_templ.h
|
||||
// Purpose: Modules template file
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
DESCRIPTION:
|
||||
This is set of macros for easier writing of tag handlers. How to use it?
|
||||
See mod_fonts.cpp for example...
|
||||
|
||||
Attention! This is quite strange C++ bastard. Before using it,
|
||||
I STRONGLY recommend reading and understanding these macros!!
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _WX_M_TEMPL_H_
|
||||
#define _WX_M_TEMPL_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/html/winpars.h"
|
||||
|
||||
#define TAG_HANDLER_BEGIN(name,tags) \
|
||||
class HTML_Handler_##name : public wxHtmlWinTagHandler \
|
||||
{ \
|
||||
public: \
|
||||
wxString GetSupportedTags() {return wxT(tags);}
|
||||
|
||||
|
||||
|
||||
#define TAG_HANDLER_VARS \
|
||||
private:
|
||||
|
||||
#define TAG_HANDLER_CONSTR(name) \
|
||||
public: \
|
||||
HTML_Handler_##name () : wxHtmlWinTagHandler()
|
||||
|
||||
|
||||
#define TAG_HANDLER_PROC(varib) \
|
||||
public: \
|
||||
bool HandleTag(const wxHtmlTag& varib)
|
||||
|
||||
|
||||
|
||||
#define TAG_HANDLER_END(name) \
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#define TAGS_MODULE_BEGIN(name) \
|
||||
class HTML_Module##name : public wxHtmlTagsModule \
|
||||
{ \
|
||||
DECLARE_DYNAMIC_CLASS(HTML_Module##name ) \
|
||||
public: \
|
||||
void FillHandlersTable(wxHtmlWinParser *parser) \
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
#define TAGS_MODULE_ADD(handler) \
|
||||
parser->AddTagHandler(new HTML_Handler_##handler);
|
||||
|
||||
|
||||
|
||||
|
||||
#define TAGS_MODULE_END(name) \
|
||||
} \
|
||||
}; \
|
||||
IMPLEMENT_DYNAMIC_CLASS(HTML_Module##name , wxHtmlTagsModule)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
252
include/wx/html/winpars.h
Normal file
252
include/wx/html/winpars.h
Normal file
@@ -0,0 +1,252 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: winpars.h
|
||||
// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_WINPARS_H_
|
||||
#define _WX_WINPARS_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "winpars.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/module.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/html/htmlpars.h"
|
||||
#include "wx/html/htmlcell.h"
|
||||
#include "wx/encconv.h"
|
||||
|
||||
class WXDLLEXPORT wxHtmlWindow;
|
||||
class WXDLLEXPORT wxHtmlWinParser;
|
||||
class WXDLLEXPORT wxHtmlWinTagHandler;
|
||||
class WXDLLEXPORT wxHtmlTagsModule;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlWinParser
|
||||
// This class is derived from wxHtmlParser and its mail goal
|
||||
// is to parse HTML input so that it can be displayed in
|
||||
// wxHtmlWindow. It uses special wxHtmlWinTagHandler.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
|
||||
{
|
||||
friend class wxHtmlWindow;
|
||||
|
||||
public:
|
||||
wxHtmlWinParser(wxHtmlWindow *wnd = NULL);
|
||||
~wxHtmlWinParser();
|
||||
|
||||
virtual void InitParser(const wxString& source);
|
||||
virtual void DoneParser();
|
||||
virtual wxObject* GetProduct();
|
||||
|
||||
virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
|
||||
|
||||
// Set's the DC used for parsing. If SetDC() is not called,
|
||||
// parsing won't proceed
|
||||
virtual void SetDC(wxDC *dc, double pixel_scale = 1.0)
|
||||
{ m_DC = dc; m_PixelScale = pixel_scale; }
|
||||
|
||||
wxDC *GetDC() {return m_DC;}
|
||||
double GetPixelScale() {return m_PixelScale;}
|
||||
int GetCharHeight() const {return m_CharHeight;}
|
||||
int GetCharWidth() const {return m_CharWidth;}
|
||||
|
||||
// NOTE : these functions do _not_ return _actual_
|
||||
// height/width. They return h/w of default font
|
||||
// for this DC. If you want actual values, call
|
||||
// GetDC()->GetChar...()
|
||||
|
||||
// returns associated wxWindow
|
||||
wxHtmlWindow *GetWindow() {return m_Window;}
|
||||
|
||||
// Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = NULL);
|
||||
|
||||
// Adds tags module. see wxHtmlTagsModule for details.
|
||||
static void AddModule(wxHtmlTagsModule *module);
|
||||
|
||||
static void RemoveModule(wxHtmlTagsModule *module);
|
||||
|
||||
// parsing-related methods. These methods are called by tag handlers:
|
||||
|
||||
// Returns pointer to actual container. Common use in tag handler is :
|
||||
// m_WParser->GetContainer()->InsertCell(new ...);
|
||||
wxHtmlContainerCell *GetContainer() const {return m_Container;}
|
||||
|
||||
// opens new container. This container is sub-container of opened
|
||||
// container. Sets GetContainer to newly created container
|
||||
// and returns it.
|
||||
wxHtmlContainerCell *OpenContainer();
|
||||
|
||||
// works like OpenContainer except that new container is not created
|
||||
// but c is used. You can use this to directly set actual container
|
||||
wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
|
||||
|
||||
// closes the container and sets actual Container to upper-level
|
||||
// container
|
||||
wxHtmlContainerCell *CloseContainer();
|
||||
|
||||
int GetFontSize() const {return m_FontSize;}
|
||||
void SetFontSize(int s);
|
||||
int GetFontBold() const {return m_FontBold;}
|
||||
void SetFontBold(int x) {m_FontBold = x;}
|
||||
int GetFontItalic() const {return m_FontItalic;}
|
||||
void SetFontItalic(int x) {m_FontItalic = x;}
|
||||
int GetFontUnderlined() const {return m_FontUnderlined;}
|
||||
void SetFontUnderlined(int x) {m_FontUnderlined = x;}
|
||||
int GetFontFixed() const {return m_FontFixed;}
|
||||
void SetFontFixed(int x) {m_FontFixed = x;}
|
||||
wxString GetFontFace() const {return GetFontFixed() ? m_FontFaceFixed : m_FontFaceNormal;}
|
||||
void SetFontFace(const wxString& face);
|
||||
|
||||
int GetAlign() const {return m_Align;}
|
||||
void SetAlign(int a) {m_Align = a;}
|
||||
const wxColour& GetLinkColor() const { return m_LinkColor; }
|
||||
void SetLinkColor(const wxColour& clr) { m_LinkColor = clr; }
|
||||
const wxColour& GetActualColor() const { return m_ActualColor; }
|
||||
void SetActualColor(const wxColour& clr) { m_ActualColor = clr ;}
|
||||
const wxHtmlLinkInfo& GetLink() const { return m_Link; }
|
||||
void SetLink(const wxHtmlLinkInfo& link);
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
void SetInputEncoding(wxFontEncoding enc);
|
||||
wxFontEncoding GetInputEncoding() const { return m_InputEnc; }
|
||||
wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; }
|
||||
wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; }
|
||||
#endif
|
||||
|
||||
// creates font depending on m_Font* members.
|
||||
virtual wxFont* CreateCurrentFont();
|
||||
|
||||
protected:
|
||||
virtual void AddText(const wxChar* txt);
|
||||
|
||||
private:
|
||||
bool m_tmpLastWasSpace;
|
||||
wxChar *m_tmpStrBuf;
|
||||
size_t m_tmpStrBufSize;
|
||||
// temporary variables used by AddText
|
||||
wxHtmlWindow *m_Window;
|
||||
// window we're parsing for
|
||||
double m_PixelScale;
|
||||
wxDC *m_DC;
|
||||
// Device Context we're parsing for
|
||||
static wxList m_Modules;
|
||||
// list of tags modules (see wxHtmlTagsModule for details)
|
||||
// This list is used to initialize m_Handlers member.
|
||||
|
||||
wxHtmlContainerCell *m_Container;
|
||||
// actual container. See Open/CloseContainer for details.
|
||||
|
||||
int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not TRUE,FALSE but 1,0, we need it for indexing
|
||||
int m_FontSize; /* -2 to +4, 0 is default */
|
||||
wxColour m_LinkColor;
|
||||
wxColour m_ActualColor;
|
||||
// basic font parameters.
|
||||
wxHtmlLinkInfo m_Link;
|
||||
// actual hypertext link or empty string
|
||||
bool m_UseLink;
|
||||
// TRUE if m_Link is not empty
|
||||
long m_CharHeight, m_CharWidth;
|
||||
// average height of normal-sized text
|
||||
int m_Align;
|
||||
// actual alignment
|
||||
|
||||
wxFont* m_FontsTable[2][2][2][2][7];
|
||||
wxString m_FontsFacesTable[2][2][2][2][7];
|
||||
#if !wxUSE_UNICODE
|
||||
wxFontEncoding m_FontsEncTable[2][2][2][2][7];
|
||||
#endif
|
||||
// table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off
|
||||
// state of these flags (from left to right):
|
||||
// [bold][italic][underlined][fixed_size]
|
||||
// last index is font size : from 0 to 6 (remapped from html sizes 1 to 7)
|
||||
// Note : this table covers all possible combinations of fonts, but not
|
||||
// all of them are used, so many items in table are usually NULL.
|
||||
int m_FontsSizes[7];
|
||||
wxString m_FontFaceFixed, m_FontFaceNormal;
|
||||
// html font sizes and faces of fixed and proportional fonts
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlWinParser)
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
wxFontEncoding m_InputEnc, m_OutputEnc;
|
||||
// I/O font encodings
|
||||
wxEncodingConverter *m_EncConv;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlWinTagHandler
|
||||
// This is basicly wxHtmlTagHandler except
|
||||
// it is extended with protected member m_Parser pointing to
|
||||
// the wxHtmlWinParser object
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlWinTagHandler : public wxHtmlTagHandler
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler)
|
||||
|
||||
public:
|
||||
wxHtmlWinTagHandler() : wxHtmlTagHandler() {};
|
||||
|
||||
virtual void SetParser(wxHtmlParser *parser) {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;};
|
||||
|
||||
protected:
|
||||
wxHtmlWinParser *m_WParser; // same as m_Parser, but overcasted
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlWinTagHandler)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlTagsModule
|
||||
// This is basic of dynamic tag handlers binding.
|
||||
// The class provides methods for filling parser's handlers
|
||||
// hash table.
|
||||
// (See documentation for details)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxHtmlTagsModule : public wxModule
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlTagsModule)
|
||||
|
||||
public:
|
||||
wxHtmlTagsModule() : wxModule() {};
|
||||
|
||||
virtual bool OnInit();
|
||||
virtual void OnExit();
|
||||
|
||||
// This is called by wxHtmlWinParser.
|
||||
// The method must simply call parser->AddTagHandler(new <handler_class_name>);
|
||||
// for each handler
|
||||
virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _WX_WINPARS_H_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
331
src/html/helpctrl.cpp
Normal file
331
src/html/helpctrl.cpp
Normal file
@@ -0,0 +1,331 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: helpctrl.cpp
|
||||
// Purpose: wxHtmlHelpController
|
||||
// Notes: Based on htmlhelp.cpp, implementing a monolithic
|
||||
// HTML Help controller class, by Vaclav Slavik
|
||||
// Author: Harm van der Heijden and Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "helpctrl.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_WXHTML_HELP
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#include "wx/intl.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/html/helpctrl.h"
|
||||
#include "wx/busyinfo.h"
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// for the hack in AddGrabIfNeeded()
|
||||
#include "wx/dialog.h"
|
||||
#endif // __WXGTK__
|
||||
|
||||
#if wxUSE_HELP
|
||||
#include "wx/tipwin.h"
|
||||
#endif
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase)
|
||||
|
||||
wxHtmlHelpController::wxHtmlHelpController(int style)
|
||||
{
|
||||
m_helpFrame = NULL;
|
||||
m_Config = NULL;
|
||||
m_ConfigRoot = wxEmptyString;
|
||||
m_titleFormat = _("Help: %s");
|
||||
m_FrameStyle = style;
|
||||
}
|
||||
|
||||
wxHtmlHelpController::~wxHtmlHelpController()
|
||||
{
|
||||
if (m_Config)
|
||||
WriteCustomization(m_Config, m_ConfigRoot);
|
||||
if (m_helpFrame)
|
||||
DestroyHelpWindow();
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlHelpController::DestroyHelpWindow()
|
||||
{
|
||||
//if (m_Config) WriteCustomization(m_Config, m_ConfigRoot);
|
||||
if (m_helpFrame)
|
||||
m_helpFrame->Destroy();
|
||||
}
|
||||
|
||||
void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt)
|
||||
{
|
||||
evt.Skip();
|
||||
|
||||
OnQuit();
|
||||
|
||||
m_helpFrame->SetController((wxHelpControllerBase*) NULL);
|
||||
m_helpFrame = NULL;
|
||||
}
|
||||
|
||||
void wxHtmlHelpController::SetTitleFormat(const wxString& title)
|
||||
{
|
||||
m_titleFormat = title;
|
||||
if (m_helpFrame)
|
||||
m_helpFrame->SetTitleFormat(title);
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlHelpController::AddBook(const wxFileName& book_file, bool show_wait_msg)
|
||||
{
|
||||
return AddBook(wxFileSystem::FileNameToURL(book_file), show_wait_msg);
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
|
||||
{
|
||||
wxBusyCursor cur;
|
||||
#if wxUSE_BUSYINFO
|
||||
wxBusyInfo* busy = NULL;
|
||||
wxString info;
|
||||
if (show_wait_msg)
|
||||
{
|
||||
info.Printf(_("Adding book %s"), book.c_str());
|
||||
busy = new wxBusyInfo(info);
|
||||
}
|
||||
#endif
|
||||
bool retval = m_helpData.AddBook(book);
|
||||
#if wxUSE_BUSYINFO
|
||||
if (show_wait_msg)
|
||||
delete busy;
|
||||
#endif
|
||||
if (m_helpFrame)
|
||||
m_helpFrame->RefreshLists();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlHelpFrame *wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data)
|
||||
{
|
||||
return new wxHtmlHelpFrame(data);
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlHelpController::CreateHelpWindow()
|
||||
{
|
||||
if (m_helpFrame)
|
||||
{
|
||||
m_helpFrame->Raise();
|
||||
return ;
|
||||
}
|
||||
|
||||
if (m_Config == NULL)
|
||||
{
|
||||
m_Config = wxConfigBase::Get(FALSE);
|
||||
if (m_Config != NULL)
|
||||
m_ConfigRoot = _T("wxWindows/wxHtmlHelpController");
|
||||
}
|
||||
|
||||
m_helpFrame = CreateHelpFrame(&m_helpData);
|
||||
m_helpFrame->SetController(this);
|
||||
|
||||
if (m_Config)
|
||||
m_helpFrame->UseConfig(m_Config, m_ConfigRoot);
|
||||
|
||||
m_helpFrame->Create(NULL, wxID_HTML_HELPFRAME, wxEmptyString, m_FrameStyle);
|
||||
m_helpFrame->SetTitleFormat(m_titleFormat);
|
||||
m_helpFrame->Show(TRUE);
|
||||
}
|
||||
|
||||
void wxHtmlHelpController::ReadCustomization(wxConfigBase* cfg, const wxString& path)
|
||||
{
|
||||
/* should not be called by the user; call UseConfig, and the controller
|
||||
* will do the rest */
|
||||
if (m_helpFrame && cfg)
|
||||
m_helpFrame->ReadCustomization(cfg, path);
|
||||
}
|
||||
|
||||
void wxHtmlHelpController::WriteCustomization(wxConfigBase* cfg, const wxString& path)
|
||||
{
|
||||
/* typically called by the controllers OnCloseFrame handler */
|
||||
if (m_helpFrame && cfg)
|
||||
m_helpFrame->WriteCustomization(cfg, path);
|
||||
}
|
||||
|
||||
void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootpath)
|
||||
{
|
||||
m_Config = config;
|
||||
m_ConfigRoot = rootpath;
|
||||
if (m_helpFrame) m_helpFrame->UseConfig(config, rootpath);
|
||||
ReadCustomization(config, rootpath);
|
||||
}
|
||||
|
||||
//// Backward compatibility with wxHelpController API
|
||||
|
||||
bool wxHtmlHelpController::Initialize(const wxString& file)
|
||||
{
|
||||
wxString dir, filename, ext;
|
||||
wxSplitPath(file, & dir, & filename, & ext);
|
||||
|
||||
if (!dir.IsEmpty())
|
||||
dir = dir + wxFILE_SEP_PATH;
|
||||
|
||||
// Try to find a suitable file
|
||||
wxString actualFilename = dir + filename + wxString(wxT(".zip"));
|
||||
if (!wxFileExists(actualFilename))
|
||||
{
|
||||
actualFilename = dir + filename + wxString(wxT(".htb"));
|
||||
if (!wxFileExists(actualFilename))
|
||||
{
|
||||
actualFilename = dir + filename + wxString(wxT(".hhp"));
|
||||
if (!wxFileExists(actualFilename))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return AddBook(wxFileName(actualFilename));
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::LoadFile(const wxString& WXUNUSED(file))
|
||||
{
|
||||
// Don't reload the file or we'll have it appear again, presumably.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::DisplaySection(int sectionNo)
|
||||
{
|
||||
return Display(sectionNo);
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::DisplayTextPopup(const wxString& text, const wxPoint& WXUNUSED(pos))
|
||||
{
|
||||
#if wxUSE_TIPWINDOW
|
||||
static wxTipWindow* s_tipWindow = NULL;
|
||||
|
||||
if (s_tipWindow)
|
||||
{
|
||||
// Prevent s_tipWindow being nulled in OnIdle,
|
||||
// thereby removing the chance for the window to be closed by ShowHelp
|
||||
s_tipWindow->SetTipWindowPtr(NULL);
|
||||
s_tipWindow->Close();
|
||||
}
|
||||
s_tipWindow = NULL;
|
||||
|
||||
if ( !text.empty() )
|
||||
{
|
||||
s_tipWindow = new wxTipWindow(wxTheApp->GetTopWindow(), text, 100, & s_tipWindow);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif // wxUSE_TIPWINDOW
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxHtmlHelpController::SetFrameParameters(const wxString& title,
|
||||
const wxSize& size,
|
||||
const wxPoint& pos,
|
||||
bool WXUNUSED(newFrameEachTime))
|
||||
{
|
||||
SetTitleFormat(title);
|
||||
if (m_helpFrame)
|
||||
{
|
||||
m_helpFrame->SetSize(pos.x, pos.y, size.x, size.y);
|
||||
}
|
||||
}
|
||||
|
||||
wxFrame* wxHtmlHelpController::GetFrameParameters(wxSize *size,
|
||||
wxPoint *pos,
|
||||
bool *newFrameEachTime)
|
||||
{
|
||||
if (newFrameEachTime)
|
||||
(* newFrameEachTime) = FALSE;
|
||||
if (size && m_helpFrame)
|
||||
(* size) = m_helpFrame->GetSize();
|
||||
if (pos && m_helpFrame)
|
||||
(* pos) = m_helpFrame->GetPosition();
|
||||
return m_helpFrame;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::Quit()
|
||||
{
|
||||
DestroyHelpWindow();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Make the help controller's frame 'modal' if
|
||||
// needed
|
||||
void wxHtmlHelpController::AddGrabIfNeeded()
|
||||
{
|
||||
// So far, wxGTK only
|
||||
#ifdef __WXGTK__
|
||||
bool needGrab = FALSE;
|
||||
|
||||
// Check if there are any modal windows present,
|
||||
// in which case we need to add a grab.
|
||||
for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
{
|
||||
wxWindow *win = node->GetData();
|
||||
wxDialog *dialog = wxDynamicCast(win, wxDialog);
|
||||
|
||||
if (dialog && dialog->IsModal())
|
||||
needGrab = TRUE;
|
||||
}
|
||||
|
||||
if (needGrab && m_helpFrame)
|
||||
m_helpFrame->AddGrab();
|
||||
#endif // __WXGTK__
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::Display(const wxString& x)
|
||||
{
|
||||
CreateHelpWindow();
|
||||
bool success = m_helpFrame->Display(x);
|
||||
AddGrabIfNeeded();
|
||||
return success;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::Display(int id)
|
||||
{
|
||||
CreateHelpWindow();
|
||||
bool success = m_helpFrame->Display(id);
|
||||
AddGrabIfNeeded();
|
||||
return success;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::DisplayContents()
|
||||
{
|
||||
CreateHelpWindow();
|
||||
bool success = m_helpFrame->DisplayContents();
|
||||
AddGrabIfNeeded();
|
||||
return success;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::DisplayIndex()
|
||||
{
|
||||
CreateHelpWindow();
|
||||
bool success = m_helpFrame->DisplayIndex();
|
||||
AddGrabIfNeeded();
|
||||
return success;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpController::KeywordSearch(const wxString& keyword)
|
||||
{
|
||||
CreateHelpWindow();
|
||||
bool success = m_helpFrame->KeywordSearch(keyword);
|
||||
AddGrabIfNeeded();
|
||||
return success;
|
||||
}
|
||||
|
||||
#endif // wxUSE_WXHTML_HELP
|
||||
|
||||
881
src/html/helpdata.cpp
Normal file
881
src/html/helpdata.cpp
Normal file
@@ -0,0 +1,881 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: helpdata.cpp
|
||||
// Purpose: wxHtmlHelpData
|
||||
// Notes: Based on htmlhelp.cpp, implementing a monolithic
|
||||
// HTML Help controller class, by Vaclav Slavik
|
||||
// Author: Harm van der Heijden and Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "helpdata.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "wx/html/helpdata.h"
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/busyinfo.h"
|
||||
#include "wx/encconv.h"
|
||||
#include "wx/fontmap.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/html/htmlpars.h"
|
||||
#include "wx/html/htmldefs.h"
|
||||
#include "wx/html/htmlfilt.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(wxHtmlBookRecArray)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// static helper functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reads one line, stores it into buf and returns pointer to new line or NULL.
|
||||
static const wxChar* ReadLine(const wxChar *line, wxChar *buf, size_t bufsize)
|
||||
{
|
||||
wxChar *writeptr = buf;
|
||||
wxChar *endptr = buf + bufsize - 1;
|
||||
const wxChar *readptr = line;
|
||||
|
||||
while (*readptr != 0 && *readptr != _T('\r') && *readptr != _T('\n') &&
|
||||
writeptr != endptr)
|
||||
*(writeptr++) = *(readptr++);
|
||||
*writeptr = 0;
|
||||
while (*readptr == _T('\r') || *readptr == _T('\n'))
|
||||
readptr++;
|
||||
if (*readptr == 0)
|
||||
return NULL;
|
||||
else
|
||||
return readptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" int LINKAGEMODE
|
||||
wxHtmlHelpIndexCompareFunc(const void *a, const void *b)
|
||||
{
|
||||
return wxStricmp(((wxHtmlContentsItem*)a)->m_Name, ((wxHtmlContentsItem*)b)->m_Name);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HP_Parser
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class HP_Parser : public wxHtmlParser
|
||||
{
|
||||
public:
|
||||
wxObject* GetProduct() { return NULL; }
|
||||
protected:
|
||||
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HP_TagHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class HP_TagHandler : public wxHtmlTagHandler
|
||||
{
|
||||
private:
|
||||
wxString m_Name, m_Page;
|
||||
int m_Level;
|
||||
int m_ID;
|
||||
int m_Index;
|
||||
wxHtmlContentsItem *m_Items;
|
||||
int m_ItemsCnt;
|
||||
wxHtmlBookRecord *m_Book;
|
||||
|
||||
public:
|
||||
HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler()
|
||||
{ m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString;
|
||||
m_Level = 0; m_ID = -1; }
|
||||
wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
|
||||
bool HandleTag(const wxHtmlTag& tag);
|
||||
void WriteOut(wxHtmlContentsItem*& array, int& size);
|
||||
void ReadIn(wxHtmlContentsItem* array, int size);
|
||||
|
||||
DECLARE_NO_COPY_CLASS(HP_TagHandler)
|
||||
};
|
||||
|
||||
|
||||
bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
|
||||
{
|
||||
if (tag.GetName() == wxT("UL"))
|
||||
{
|
||||
m_Level++;
|
||||
ParseInner(tag);
|
||||
m_Level--;
|
||||
return TRUE;
|
||||
}
|
||||
else if (tag.GetName() == wxT("OBJECT"))
|
||||
{
|
||||
m_Name = m_Page = wxEmptyString;
|
||||
ParseInner(tag);
|
||||
|
||||
#if 0
|
||||
if (!m_Page.IsEmpty())
|
||||
/* Valid HHW's file may contain only two object tags:
|
||||
|
||||
<OBJECT type="text/site properties">
|
||||
<param name="ImageType" value="Folder">
|
||||
</OBJECT>
|
||||
|
||||
or
|
||||
|
||||
<OBJECT type="text/sitemap">
|
||||
<param name="Name" value="main page">
|
||||
<param name="Local" value="another.htm">
|
||||
</OBJECT>
|
||||
|
||||
We're interested in the latter. !m_Page.IsEmpty() is valid
|
||||
condition because text/site properties does not contain Local param
|
||||
*/
|
||||
#endif
|
||||
if (tag.GetParam(wxT("TYPE")) == wxT("text/sitemap"))
|
||||
{
|
||||
if (m_ItemsCnt % wxHTML_REALLOC_STEP == 0)
|
||||
m_Items = (wxHtmlContentsItem*) realloc(m_Items,
|
||||
(m_ItemsCnt + wxHTML_REALLOC_STEP) *
|
||||
sizeof(wxHtmlContentsItem));
|
||||
|
||||
m_Items[m_ItemsCnt].m_Level = m_Level;
|
||||
m_Items[m_ItemsCnt].m_ID = m_ID;
|
||||
m_Items[m_ItemsCnt].m_Page = new wxChar[m_Page.Length() + 1];
|
||||
wxStrcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str());
|
||||
m_Items[m_ItemsCnt].m_Name = new wxChar [m_Name.Length() + 1];
|
||||
wxStrcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str());
|
||||
m_Items[m_ItemsCnt].m_Book = m_Book;
|
||||
m_ItemsCnt++;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{ // "PARAM"
|
||||
if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name"))
|
||||
m_Name = tag.GetParam(wxT("VALUE"));
|
||||
if (tag.GetParam(wxT("NAME")) == wxT("Local"))
|
||||
m_Page = tag.GetParam(wxT("VALUE"));
|
||||
if (tag.GetParam(wxT("NAME")) == wxT("ID"))
|
||||
tag.GetParamAsInt(wxT("VALUE"), &m_ID);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HP_TagHandler::WriteOut(wxHtmlContentsItem*& array, int& size)
|
||||
{
|
||||
array = m_Items;
|
||||
size = m_ItemsCnt;
|
||||
m_Items = NULL;
|
||||
m_ItemsCnt = 0;
|
||||
}
|
||||
|
||||
void HP_TagHandler::ReadIn(wxHtmlContentsItem* array, int size)
|
||||
{
|
||||
m_Items = array;
|
||||
m_ItemsCnt = size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlHelpData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxString wxHtmlBookRecord::GetFullPath(const wxString &page) const
|
||||
{
|
||||
if (wxIsAbsolutePath(page))
|
||||
return page;
|
||||
else
|
||||
return m_BasePath + page;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpData, wxObject)
|
||||
|
||||
wxHtmlHelpData::wxHtmlHelpData()
|
||||
{
|
||||
m_TempPath = wxEmptyString;
|
||||
|
||||
m_Contents = NULL;
|
||||
m_ContentsCnt = 0;
|
||||
m_Index = NULL;
|
||||
m_IndexCnt = 0;
|
||||
}
|
||||
|
||||
wxHtmlHelpData::~wxHtmlHelpData()
|
||||
{
|
||||
int i;
|
||||
|
||||
m_BookRecords.Empty();
|
||||
if (m_Contents)
|
||||
{
|
||||
for (i = 0; i < m_ContentsCnt; i++)
|
||||
{
|
||||
delete[] m_Contents[i].m_Page;
|
||||
delete[] m_Contents[i].m_Name;
|
||||
}
|
||||
free(m_Contents);
|
||||
}
|
||||
if (m_Index)
|
||||
{
|
||||
for (i = 0; i < m_IndexCnt; i++)
|
||||
{
|
||||
delete[] m_Index[i].m_Page;
|
||||
delete[] m_Index[i].m_Name;
|
||||
}
|
||||
free(m_Index);
|
||||
}
|
||||
}
|
||||
|
||||
bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, const wxString& indexfile, const wxString& contentsfile)
|
||||
{
|
||||
wxFSFile *f;
|
||||
wxHtmlFilterHTML filter;
|
||||
wxString buf;
|
||||
wxString string;
|
||||
|
||||
HP_Parser parser;
|
||||
HP_TagHandler *handler = new HP_TagHandler(book);
|
||||
parser.AddTagHandler(handler);
|
||||
|
||||
f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
|
||||
if (f)
|
||||
{
|
||||
buf.clear();
|
||||
buf = filter.ReadFile(*f);
|
||||
delete f;
|
||||
handler->ReadIn(m_Contents, m_ContentsCnt);
|
||||
parser.Parse(buf);
|
||||
handler->WriteOut(m_Contents, m_ContentsCnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str());
|
||||
}
|
||||
|
||||
f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) );
|
||||
if (f)
|
||||
{
|
||||
buf.clear();
|
||||
buf = filter.ReadFile(*f);
|
||||
delete f;
|
||||
handler->ReadIn(m_Index, m_IndexCnt);
|
||||
parser.Parse(buf);
|
||||
handler->WriteOut(m_Index, m_IndexCnt);
|
||||
}
|
||||
else if (!indexfile.IsEmpty())
|
||||
{
|
||||
wxLogError(_("Cannot open index file: %s"), indexfile.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline static void CacheWriteInt32(wxOutputStream *f, wxInt32 value)
|
||||
{
|
||||
wxInt32 x = wxINT32_SWAP_ON_BE(value);
|
||||
f->Write(&x, sizeof(x));
|
||||
}
|
||||
|
||||
inline static wxInt32 CacheReadInt32(wxInputStream *f)
|
||||
{
|
||||
wxInt32 x;
|
||||
f->Read(&x, sizeof(x));
|
||||
return wxINT32_SWAP_ON_BE(x);
|
||||
}
|
||||
|
||||
inline static void CacheWriteString(wxOutputStream *f, const wxChar *str)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
wxWX2MBbuf mbstr(wxConvUTF8.cWX2MB(str));
|
||||
#else
|
||||
const wxChar *mbstr = str;
|
||||
#endif
|
||||
size_t len = strlen(mbstr)+1;
|
||||
CacheWriteInt32(f, len);
|
||||
f->Write(mbstr, len);
|
||||
}
|
||||
|
||||
inline static wxChar* CacheReadString(wxInputStream *f)
|
||||
{
|
||||
char *str;
|
||||
size_t len = (size_t)CacheReadInt32(f);
|
||||
str = new char[len];
|
||||
f->Read(str, len);
|
||||
#if !wxUSE_UNICODE
|
||||
return str;
|
||||
#else
|
||||
wxMB2WXbuf wxstr(wxConvUTF8.cMB2WX(str));
|
||||
wxChar *outstr = new wxChar[wxStrlen(wxstr)+1];
|
||||
wxStrcpy(outstr, wxstr);
|
||||
return outstr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define CURRENT_CACHED_BOOK_VERSION 4
|
||||
|
||||
// Additional flags to detect incompatibilities of the runtime environment:
|
||||
#define CACHED_BOOK_FORMAT_FLAGS \
|
||||
(wxUSE_UNICODE << 0)
|
||||
|
||||
|
||||
bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
|
||||
{
|
||||
int i, st;
|
||||
wxInt32 version;
|
||||
|
||||
/* load header - version info : */
|
||||
version = CacheReadInt32(f);
|
||||
|
||||
if (version != CURRENT_CACHED_BOOK_VERSION)
|
||||
{
|
||||
// NB: We can just silently return FALSE here and don't worry about
|
||||
// it anymore, because AddBookParam will load the MS project in
|
||||
// absence of (properly versioned) .cached file and automatically
|
||||
// create new .cached file immediately afterward.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CacheReadInt32(f) != CACHED_BOOK_FORMAT_FLAGS)
|
||||
return FALSE;
|
||||
|
||||
/* load contents : */
|
||||
st = m_ContentsCnt;
|
||||
m_ContentsCnt += CacheReadInt32(f);
|
||||
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents,
|
||||
(m_ContentsCnt / wxHTML_REALLOC_STEP + 1) *
|
||||
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
|
||||
for (i = st; i < m_ContentsCnt; i++)
|
||||
{
|
||||
m_Contents[i].m_Level = CacheReadInt32(f);
|
||||
m_Contents[i].m_ID = CacheReadInt32(f);
|
||||
m_Contents[i].m_Name = CacheReadString(f);
|
||||
m_Contents[i].m_Page = CacheReadString(f);
|
||||
m_Contents[i].m_Book = book;
|
||||
}
|
||||
|
||||
/* load index : */
|
||||
st = m_IndexCnt;
|
||||
m_IndexCnt += CacheReadInt32(f);
|
||||
m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / wxHTML_REALLOC_STEP + 1) *
|
||||
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
|
||||
for (i = st; i < m_IndexCnt; i++)
|
||||
{
|
||||
m_Index[i].m_Name = CacheReadString(f);
|
||||
m_Index[i].m_Page = CacheReadString(f);
|
||||
m_Index[i].m_Book = book;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
|
||||
{
|
||||
int i;
|
||||
wxInt32 cnt;
|
||||
|
||||
/* save header - version info : */
|
||||
CacheWriteInt32(f, CURRENT_CACHED_BOOK_VERSION);
|
||||
CacheWriteInt32(f, CACHED_BOOK_FORMAT_FLAGS);
|
||||
|
||||
/* save contents : */
|
||||
for (cnt = 0, i = 0; i < m_ContentsCnt; i++)
|
||||
if (m_Contents[i].m_Book == book && m_Contents[i].m_Level > 0)
|
||||
cnt++;
|
||||
CacheWriteInt32(f, cnt);
|
||||
|
||||
for (i = 0; i < m_ContentsCnt; i++)
|
||||
{
|
||||
if (m_Contents[i].m_Book != book || m_Contents[i].m_Level == 0)
|
||||
continue;
|
||||
CacheWriteInt32(f, m_Contents[i].m_Level);
|
||||
CacheWriteInt32(f, m_Contents[i].m_ID);
|
||||
CacheWriteString(f, m_Contents[i].m_Name);
|
||||
CacheWriteString(f, m_Contents[i].m_Page);
|
||||
}
|
||||
|
||||
/* save index : */
|
||||
for (cnt = 0, i = 0; i < m_IndexCnt; i++)
|
||||
if (m_Index[i].m_Book == book && m_Index[i].m_Level > 0)
|
||||
cnt++;
|
||||
CacheWriteInt32(f, cnt);
|
||||
|
||||
for (i = 0; i < m_IndexCnt; i++)
|
||||
{
|
||||
if (m_Index[i].m_Book != book || m_Index[i].m_Level == 0)
|
||||
continue;
|
||||
CacheWriteString(f, m_Index[i].m_Name);
|
||||
CacheWriteString(f, m_Index[i].m_Page);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlHelpData::SetTempDir(const wxString& path)
|
||||
{
|
||||
if (path == wxEmptyString) m_TempPath = path;
|
||||
else
|
||||
{
|
||||
if (wxIsAbsolutePath(path)) m_TempPath = path;
|
||||
else m_TempPath = wxGetCwd() + _T("/") + path;
|
||||
|
||||
if (m_TempPath[m_TempPath.Length() - 1] != _T('/'))
|
||||
m_TempPath << _T('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static wxString SafeFileName(const wxString& s)
|
||||
{
|
||||
wxString res(s);
|
||||
res.Replace(wxT("#"), wxT("_"));
|
||||
res.Replace(wxT(":"), wxT("_"));
|
||||
res.Replace(wxT("\\"), wxT("_"));
|
||||
res.Replace(wxT("/"), wxT("_"));
|
||||
return res;
|
||||
}
|
||||
|
||||
bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile,
|
||||
wxFontEncoding encoding,
|
||||
const wxString& title, const wxString& contfile,
|
||||
const wxString& indexfile, const wxString& deftopic,
|
||||
const wxString& path)
|
||||
{
|
||||
wxFileSystem fsys;
|
||||
wxFSFile *fi;
|
||||
wxHtmlBookRecord *bookr;
|
||||
|
||||
int IndexOld = m_IndexCnt,
|
||||
ContentsOld = m_ContentsCnt;
|
||||
|
||||
if (!path.IsEmpty())
|
||||
fsys.ChangePathTo(path, TRUE);
|
||||
|
||||
size_t booksCnt = m_BookRecords.GetCount();
|
||||
for (size_t i = 0; i < booksCnt; i++)
|
||||
{
|
||||
if ( m_BookRecords[i].GetBookFile() == bookfile.GetLocation() )
|
||||
return TRUE; // book is (was) loaded
|
||||
}
|
||||
|
||||
bookr = new wxHtmlBookRecord(bookfile.GetLocation(), fsys.GetPath(), title, deftopic);
|
||||
|
||||
if (m_ContentsCnt % wxHTML_REALLOC_STEP == 0)
|
||||
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
|
||||
m_Contents[m_ContentsCnt].m_Level = 0;
|
||||
m_Contents[m_ContentsCnt].m_ID = 0;
|
||||
m_Contents[m_ContentsCnt].m_Page = new wxChar[deftopic.Length() + 1];
|
||||
wxStrcpy(m_Contents[m_ContentsCnt].m_Page, deftopic.c_str());
|
||||
m_Contents[m_ContentsCnt].m_Name = new wxChar [title.Length() + 1];
|
||||
wxStrcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str());
|
||||
m_Contents[m_ContentsCnt].m_Book = bookr;
|
||||
|
||||
// store the contents index for later
|
||||
int cont_start = m_ContentsCnt++;
|
||||
|
||||
// Try to find cached binary versions:
|
||||
// 1. save file as book, but with .hhp.cached extension
|
||||
// 2. same as 1. but in temp path
|
||||
// 3. otherwise or if cache load failed, load it from MS.
|
||||
|
||||
fi = fsys.OpenFile(bookfile.GetLocation() + wxT(".cached"));
|
||||
|
||||
if (fi == NULL ||
|
||||
#if wxUSE_DATETIME
|
||||
fi->GetModificationTime() < bookfile.GetModificationTime() ||
|
||||
#endif // wxUSE_DATETIME
|
||||
!LoadCachedBook(bookr, fi->GetStream()))
|
||||
{
|
||||
if (fi != NULL) delete fi;
|
||||
fi = fsys.OpenFile(m_TempPath + wxFileNameFromPath(bookfile.GetLocation()) + wxT(".cached"));
|
||||
if (m_TempPath == wxEmptyString || fi == NULL ||
|
||||
#if wxUSE_DATETIME
|
||||
fi->GetModificationTime() < bookfile.GetModificationTime() ||
|
||||
#endif // wxUSE_DATETIME
|
||||
!LoadCachedBook(bookr, fi->GetStream()))
|
||||
{
|
||||
LoadMSProject(bookr, fsys, indexfile, contfile);
|
||||
if (m_TempPath != wxEmptyString)
|
||||
{
|
||||
wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath +
|
||||
SafeFileName(wxFileNameFromPath(bookfile.GetLocation())) + wxT(".cached"));
|
||||
SaveCachedBook(bookr, outs);
|
||||
delete outs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fi != NULL) delete fi;
|
||||
|
||||
// Now store the contents range
|
||||
bookr->SetContentsRange(cont_start, m_ContentsCnt);
|
||||
|
||||
// Convert encoding, if neccessary:
|
||||
if (encoding != wxFONTENCODING_SYSTEM)
|
||||
{
|
||||
wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(encoding);
|
||||
if (a.GetCount() != 0 && a[0] != encoding)
|
||||
{
|
||||
int i;
|
||||
wxEncodingConverter conv;
|
||||
conv.Init(encoding, a[0]);
|
||||
|
||||
for (i = IndexOld; i < m_IndexCnt; i++)
|
||||
conv.Convert(m_Index[i].m_Name);
|
||||
for (i = ContentsOld; i < m_ContentsCnt; i++)
|
||||
conv.Convert(m_Contents[i].m_Name);
|
||||
}
|
||||
}
|
||||
|
||||
m_BookRecords.Add(bookr);
|
||||
if (m_IndexCnt > 0)
|
||||
qsort(m_Index, m_IndexCnt, sizeof(wxHtmlContentsItem), wxHtmlHelpIndexCompareFunc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlHelpData::AddBook(const wxString& book)
|
||||
{
|
||||
if (book.Right(4).Lower() == wxT(".zip") ||
|
||||
book.Right(4).Lower() == wxT(".htb") /*html book*/)
|
||||
{
|
||||
wxFileSystem fsys;
|
||||
wxString s;
|
||||
bool rt = FALSE;
|
||||
|
||||
s = fsys.FindFirst(book + wxT("#zip:") + wxT("*.hhp"), wxFILE);
|
||||
while (!s.IsEmpty())
|
||||
{
|
||||
if (AddBook(s)) rt = TRUE;
|
||||
s = fsys.FindNext();
|
||||
}
|
||||
|
||||
return rt;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFSFile *fi;
|
||||
wxFileSystem fsys;
|
||||
|
||||
wxString title = _("noname"),
|
||||
safetitle,
|
||||
start = wxEmptyString,
|
||||
contents = wxEmptyString,
|
||||
index = wxEmptyString,
|
||||
charset = wxEmptyString;
|
||||
|
||||
fi = fsys.OpenFile(book);
|
||||
if (fi == NULL)
|
||||
{
|
||||
wxLogError(_("Cannot open HTML help book: %s"), book.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
fsys.ChangePathTo(book);
|
||||
|
||||
const wxChar *lineptr;
|
||||
wxChar linebuf[300];
|
||||
wxString tmp;
|
||||
wxHtmlFilterPlainText filter;
|
||||
tmp = filter.ReadFile(*fi);
|
||||
lineptr = tmp.c_str();
|
||||
|
||||
do
|
||||
{
|
||||
lineptr = ReadLine(lineptr, linebuf, 300);
|
||||
|
||||
for (wxChar *ch = linebuf; *ch != wxT('\0') && *ch != wxT('='); ch++)
|
||||
*ch = tolower(*ch);
|
||||
|
||||
if (wxStrstr(linebuf, _T("title=")) == linebuf)
|
||||
title = linebuf + wxStrlen(_T("title="));
|
||||
if (wxStrstr(linebuf, _T("default topic=")) == linebuf)
|
||||
start = linebuf + wxStrlen(_T("default topic="));
|
||||
if (wxStrstr(linebuf, _T("index file=")) == linebuf)
|
||||
index = linebuf + wxStrlen(_T("index file="));
|
||||
if (wxStrstr(linebuf, _T("contents file=")) == linebuf)
|
||||
contents = linebuf + wxStrlen(_T("contents file="));
|
||||
if (wxStrstr(linebuf, _T("charset=")) == linebuf)
|
||||
charset = linebuf + wxStrlen(_T("charset="));
|
||||
} while (lineptr != NULL);
|
||||
|
||||
wxFontEncoding enc;
|
||||
if (charset == wxEmptyString) enc = wxFONTENCODING_SYSTEM;
|
||||
else enc = wxFontMapper::Get()->CharsetToEncoding(charset);
|
||||
bool rtval = AddBookParam(*fi, enc,
|
||||
title, contents, index, start, fsys.GetPath());
|
||||
delete fi;
|
||||
return rtval;
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxHtmlHelpData::FindPageByName(const wxString& x)
|
||||
{
|
||||
int cnt;
|
||||
int i;
|
||||
wxFileSystem fsys;
|
||||
wxFSFile *f;
|
||||
wxString url(wxEmptyString);
|
||||
|
||||
/* 1. try to open given file: */
|
||||
|
||||
cnt = m_BookRecords.GetCount();
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
f = fsys.OpenFile(m_BookRecords[i].GetFullPath(x));
|
||||
if (f)
|
||||
{
|
||||
url = m_BookRecords[i].GetFullPath(x);
|
||||
delete f;
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 2. try to find a book: */
|
||||
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
if (m_BookRecords[i].GetTitle() == x)
|
||||
{
|
||||
url = m_BookRecords[i].GetFullPath(m_BookRecords[i].GetStart());
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
/* 3. try to find in contents: */
|
||||
|
||||
cnt = m_ContentsCnt;
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
if (wxStrcmp(m_Contents[i].m_Name, x) == 0)
|
||||
{
|
||||
url = m_Contents[i].GetFullPath();
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 4. try to find in index: */
|
||||
|
||||
cnt = m_IndexCnt;
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
if (wxStrcmp(m_Index[i].m_Name, x) == 0)
|
||||
{
|
||||
url = m_Index[i].GetFullPath();
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
wxString wxHtmlHelpData::FindPageById(int id)
|
||||
{
|
||||
int i;
|
||||
wxString url(wxEmptyString);
|
||||
|
||||
for (i = 0; i < m_ContentsCnt; i++)
|
||||
{
|
||||
if (m_Contents[i].m_ID == id)
|
||||
{
|
||||
url = m_Contents[i].GetFullPath();
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// wxHtmlSearchStatus functions
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& keyword,
|
||||
bool case_sensitive, bool whole_words_only,
|
||||
const wxString& book)
|
||||
{
|
||||
m_Data = data;
|
||||
m_Keyword = keyword;
|
||||
wxHtmlBookRecord* bookr = NULL;
|
||||
if (book != wxEmptyString)
|
||||
{
|
||||
// we have to search in a specific book. Find it first
|
||||
int i, cnt = data->m_BookRecords.GetCount();
|
||||
for (i = 0; i < cnt; i++)
|
||||
if (data->m_BookRecords[i].GetTitle() == book)
|
||||
{
|
||||
bookr = &(data->m_BookRecords[i]);
|
||||
m_CurIndex = bookr->GetContentsStart();
|
||||
m_MaxIndex = bookr->GetContentsEnd();
|
||||
break;
|
||||
}
|
||||
// check; we won't crash if the book doesn't exist, but it's Bad Anyway.
|
||||
wxASSERT(bookr);
|
||||
}
|
||||
if (! bookr)
|
||||
{
|
||||
// no book specified; search all books
|
||||
m_CurIndex = 0;
|
||||
m_MaxIndex = m_Data->m_ContentsCnt;
|
||||
}
|
||||
m_Engine.LookFor(keyword, case_sensitive, whole_words_only);
|
||||
m_Active = (m_CurIndex < m_MaxIndex);
|
||||
m_LastPage = NULL;
|
||||
}
|
||||
|
||||
bool wxHtmlSearchStatus::Search()
|
||||
{
|
||||
wxFSFile *file;
|
||||
int i = m_CurIndex; // shortcut
|
||||
bool found = FALSE;
|
||||
wxChar *thepage;
|
||||
|
||||
if (!m_Active)
|
||||
{
|
||||
// sanity check. Illegal use, but we'll try to prevent a crash anyway
|
||||
wxASSERT(m_Active);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_Name = wxEmptyString;
|
||||
m_ContentsItem = NULL;
|
||||
thepage = m_Data->m_Contents[i].m_Page;
|
||||
|
||||
m_Active = (++m_CurIndex < m_MaxIndex);
|
||||
// check if it is same page with different anchor:
|
||||
if (m_LastPage != NULL)
|
||||
{
|
||||
wxChar *p1, *p2;
|
||||
for (p1 = thepage, p2 = m_LastPage;
|
||||
*p1 != 0 && *p1 != _T('#') && *p1 == *p2; p1++, p2++) {}
|
||||
|
||||
m_LastPage = thepage;
|
||||
|
||||
if (*p1 == 0 || *p1 == _T('#'))
|
||||
return FALSE;
|
||||
}
|
||||
else m_LastPage = thepage;
|
||||
|
||||
wxFileSystem fsys;
|
||||
file = fsys.OpenFile(m_Data->m_Contents[i].m_Book->GetFullPath(thepage));
|
||||
if (file)
|
||||
{
|
||||
if (m_Engine.Scan(*file))
|
||||
{
|
||||
m_Name = m_Data->m_Contents[i].m_Name;
|
||||
m_ContentsItem = m_Data->m_Contents + i;
|
||||
found = TRUE;
|
||||
}
|
||||
delete file;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlSearchEngine
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
void wxHtmlSearchEngine::LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only)
|
||||
{
|
||||
m_CaseSensitive = case_sensitive;
|
||||
m_WholeWords = whole_words_only;
|
||||
if (m_Keyword) delete[] m_Keyword;
|
||||
m_Keyword = new wxChar[keyword.Length() + 1];
|
||||
wxStrcpy(m_Keyword, keyword.c_str());
|
||||
|
||||
if (!m_CaseSensitive)
|
||||
{
|
||||
for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
|
||||
{
|
||||
if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
|
||||
m_Keyword[i] += wxT('a') - wxT('A');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline bool WHITESPACE(wxChar c)
|
||||
{
|
||||
return c == _T(' ') || c == _T('\n') || c == _T('\r') || c == _T('\t');
|
||||
}
|
||||
|
||||
bool wxHtmlSearchEngine::Scan(const wxFSFile& file)
|
||||
{
|
||||
wxASSERT_MSG(m_Keyword != NULL, wxT("wxHtmlSearchEngine::LookFor must be called before scanning!"));
|
||||
|
||||
int i, j;
|
||||
int wrd = wxStrlen(m_Keyword);
|
||||
bool found = FALSE;
|
||||
wxHtmlFilterHTML filter;
|
||||
wxString tmp = filter.ReadFile(file);
|
||||
int lng = tmp.length();
|
||||
const wxChar *buf = tmp.c_str();
|
||||
|
||||
if (!m_CaseSensitive)
|
||||
for (i = 0; i < lng; i++)
|
||||
tmp[(size_t)i] = (wxChar)wxTolower(tmp[(size_t)i]);
|
||||
|
||||
if (m_WholeWords)
|
||||
{
|
||||
for (i = 0; i < lng - wrd; i++)
|
||||
{
|
||||
if (WHITESPACE(buf[i])) continue;
|
||||
j = 0;
|
||||
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
|
||||
if (j == wrd && WHITESPACE(buf[i + j])) { found = TRUE; break; }
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (i = 0; i < lng - wrd; i++)
|
||||
{
|
||||
j = 0;
|
||||
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
|
||||
if (j == wrd) { found = TRUE; break; }
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
1560
src/html/helpfrm.cpp
Normal file
1560
src/html/helpfrm.cpp
Normal file
File diff suppressed because it is too large
Load Diff
728
src/html/htmlcell.cpp
Normal file
728
src/html/htmlcell.cpp
Normal file
@@ -0,0 +1,728 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlcell.cpp
|
||||
// Purpose: wxHtmlCell - basic element of HTML output
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "htmlcell.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/brush.h"
|
||||
#include "wx/colour.h"
|
||||
#include "wx/dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxHtmlCell::wxHtmlCell() : wxObject()
|
||||
{
|
||||
m_Next = NULL;
|
||||
m_Parent = NULL;
|
||||
m_Width = m_Height = m_Descent = 0;
|
||||
m_CanLiveOnPagebreak = TRUE;
|
||||
m_Link = NULL;
|
||||
}
|
||||
|
||||
wxHtmlCell::~wxHtmlCell()
|
||||
{
|
||||
delete m_Link;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxHtmlLinkInfo *lnk = GetLink(x, y);
|
||||
if (lnk != NULL)
|
||||
{
|
||||
wxHtmlLinkInfo lnk2(*lnk);
|
||||
lnk2.SetEvent(&event);
|
||||
lnk2.SetHtmlCell(this);
|
||||
|
||||
// note : this cast is legal because parent is *always* wxHtmlWindow
|
||||
wxStaticCast(parent, wxHtmlWindow)->OnLinkClicked(lnk2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlCell::AdjustPagebreak(int *pagebreak, int* WXUNUSED(known_pagebreaks), int WXUNUSED(number_of_pages)) const
|
||||
{
|
||||
if ((!m_CanLiveOnPagebreak) &&
|
||||
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
|
||||
{
|
||||
*pagebreak = m_PosY;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
if (m_Link) delete m_Link;
|
||||
m_Link = NULL;
|
||||
if (link.GetHref() != wxEmptyString)
|
||||
m_Link = new wxHtmlLinkInfo(link);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlCell::Layout(int WXUNUSED(w))
|
||||
{
|
||||
SetPos(0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlCell::GetHorizontalConstraints(int *left, int *right) const
|
||||
{
|
||||
if (left)
|
||||
*left = m_PosX;
|
||||
if (right)
|
||||
*right = m_PosX + m_Width;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const wxHtmlCell* wxHtmlCell::Find(int WXUNUSED(condition), const void* WXUNUSED(param)) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
wxHtmlCell *wxHtmlCell::FindCellByPos(wxCoord x, wxCoord y) const
|
||||
{
|
||||
if ( x >= 0 && x < m_Width && y >= 0 && y < m_Height )
|
||||
return wxConstCast(this, wxHtmlCell);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlWordCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
|
||||
{
|
||||
m_Word = word;
|
||||
dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
|
||||
SetCanLiveOnPagebreak(FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWordCell::Draw(wxDC& dc, int x, int y, int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlContainerCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCell()
|
||||
{
|
||||
m_Cells = m_LastCell = NULL;
|
||||
m_Parent = parent;
|
||||
if (m_Parent) m_Parent->InsertCell(this);
|
||||
m_AlignHor = wxHTML_ALIGN_LEFT;
|
||||
m_AlignVer = wxHTML_ALIGN_BOTTOM;
|
||||
m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
|
||||
m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT;
|
||||
m_UseBkColour = FALSE;
|
||||
m_UseBorder = FALSE;
|
||||
m_MinHeight = 0;
|
||||
m_MinHeightAlign = wxHTML_ALIGN_TOP;
|
||||
m_LastLayout = -1;
|
||||
}
|
||||
|
||||
wxHtmlContainerCell::~wxHtmlContainerCell()
|
||||
{
|
||||
wxHtmlCell *cell = m_Cells;
|
||||
while ( cell )
|
||||
{
|
||||
wxHtmlCell *cellNext = cell->GetNext();
|
||||
delete cell;
|
||||
cell = cellNext;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::SetIndent(int i, int what, int units)
|
||||
{
|
||||
int val = (units == wxHTML_UNITS_PIXELS) ? i : -i;
|
||||
if (what & wxHTML_INDENT_LEFT) m_IndentLeft = val;
|
||||
if (what & wxHTML_INDENT_RIGHT) m_IndentRight = val;
|
||||
if (what & wxHTML_INDENT_TOP) m_IndentTop = val;
|
||||
if (what & wxHTML_INDENT_BOTTOM) m_IndentBottom = val;
|
||||
m_LastLayout = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int wxHtmlContainerCell::GetIndent(int ind) const
|
||||
{
|
||||
if (ind & wxHTML_INDENT_LEFT) return m_IndentLeft;
|
||||
else if (ind & wxHTML_INDENT_RIGHT) return m_IndentRight;
|
||||
else if (ind & wxHTML_INDENT_TOP) return m_IndentTop;
|
||||
else if (ind & wxHTML_INDENT_BOTTOM) return m_IndentBottom;
|
||||
else return -1; /* BUG! Should not be called... */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int wxHtmlContainerCell::GetIndentUnits(int ind) const
|
||||
{
|
||||
bool p = FALSE;
|
||||
if (ind & wxHTML_INDENT_LEFT) p = m_IndentLeft < 0;
|
||||
else if (ind & wxHTML_INDENT_RIGHT) p = m_IndentRight < 0;
|
||||
else if (ind & wxHTML_INDENT_TOP) p = m_IndentTop < 0;
|
||||
else if (ind & wxHTML_INDENT_BOTTOM) p = m_IndentBottom < 0;
|
||||
if (p) return wxHTML_UNITS_PERCENT;
|
||||
else return wxHTML_UNITS_PIXELS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak, int* known_pagebreaks, int number_of_pages) const
|
||||
{
|
||||
if (!m_CanLiveOnPagebreak)
|
||||
return wxHtmlCell::AdjustPagebreak(pagebreak, known_pagebreaks, number_of_pages);
|
||||
|
||||
else
|
||||
{
|
||||
wxHtmlCell *c = GetFirstCell();
|
||||
bool rt = FALSE;
|
||||
int pbrk = *pagebreak - m_PosY;
|
||||
|
||||
while (c)
|
||||
{
|
||||
if (c->AdjustPagebreak(&pbrk, known_pagebreaks, number_of_pages))
|
||||
rt = TRUE;
|
||||
c = c->GetNext();
|
||||
}
|
||||
if (rt)
|
||||
*pagebreak = pbrk + m_PosY;
|
||||
return rt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::Layout(int w)
|
||||
{
|
||||
wxHtmlCell::Layout(w);
|
||||
|
||||
if (m_LastLayout == w) return;
|
||||
|
||||
// VS: Any attempt to layout with negative or zero width leads to hell,
|
||||
// but we can't ignore such attempts completely, since it sometimes
|
||||
// happen (e.g. when trying how small a table can be). The best thing we
|
||||
// can do is to set the width of child cells to zero
|
||||
if (w < 1)
|
||||
{
|
||||
m_Width = 0;
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
cell->Layout(0);
|
||||
// this does two things: it recursively calls this code on all
|
||||
// child contrainers and resets children's position to (0,0)
|
||||
return;
|
||||
}
|
||||
|
||||
wxHtmlCell *cell = m_Cells, *line = m_Cells;
|
||||
long xpos = 0, ypos = m_IndentTop;
|
||||
int xdelta = 0, ybasicpos = 0, ydiff;
|
||||
int s_width, s_indent;
|
||||
int ysizeup = 0, ysizedown = 0;
|
||||
int MaxLineWidth = 0;
|
||||
int xcnt = 0;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
WIDTH ADJUSTING :
|
||||
|
||||
*/
|
||||
|
||||
if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
|
||||
{
|
||||
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
|
||||
else m_Width = m_WidthFloat * w / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
|
||||
else m_Width = m_WidthFloat;
|
||||
}
|
||||
|
||||
if (m_Cells)
|
||||
{
|
||||
int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
|
||||
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
cell->Layout(m_Width - (l + r));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
LAYOUTING :
|
||||
|
||||
*/
|
||||
|
||||
// adjust indentation:
|
||||
s_indent = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
|
||||
s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
|
||||
|
||||
// my own layouting:
|
||||
while (cell != NULL)
|
||||
{
|
||||
switch (m_AlignVer)
|
||||
{
|
||||
case wxHTML_ALIGN_TOP : ybasicpos = 0; break;
|
||||
case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
|
||||
case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
|
||||
}
|
||||
ydiff = cell->GetHeight() + ybasicpos;
|
||||
|
||||
if (cell->GetDescent() + ydiff > ysizedown) ysizedown = cell->GetDescent() + ydiff;
|
||||
if (ybasicpos + cell->GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell->GetDescent());
|
||||
|
||||
cell->SetPos(xpos, ybasicpos + cell->GetDescent());
|
||||
xpos += cell->GetWidth();
|
||||
cell = cell->GetNext();
|
||||
xcnt++;
|
||||
|
||||
// force new line if occured:
|
||||
if ((cell == NULL) || (xpos + cell->GetWidth() > s_width))
|
||||
{
|
||||
if (xpos > MaxLineWidth) MaxLineWidth = xpos;
|
||||
if (ysizeup < 0) ysizeup = 0;
|
||||
if (ysizedown < 0) ysizedown = 0;
|
||||
switch (m_AlignHor) {
|
||||
case wxHTML_ALIGN_LEFT :
|
||||
case wxHTML_ALIGN_JUSTIFY :
|
||||
xdelta = 0;
|
||||
break;
|
||||
case wxHTML_ALIGN_RIGHT :
|
||||
xdelta = 0 + (s_width - xpos);
|
||||
break;
|
||||
case wxHTML_ALIGN_CENTER :
|
||||
xdelta = 0 + (s_width - xpos) / 2;
|
||||
break;
|
||||
}
|
||||
if (xdelta < 0) xdelta = 0;
|
||||
xdelta += s_indent;
|
||||
|
||||
ypos += ysizeup;
|
||||
|
||||
if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL)
|
||||
while (line != cell)
|
||||
{
|
||||
line->SetPos(line->GetPosX() + xdelta,
|
||||
ypos + line->GetPosY());
|
||||
line = line->GetNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
int counter = 0;
|
||||
int step = (s_width - xpos);
|
||||
if (step < 0) step = 0;
|
||||
xcnt--;
|
||||
if (xcnt > 0) while (line != cell)
|
||||
{
|
||||
line->SetPos(line->GetPosX() + s_indent +
|
||||
(counter++ * step / xcnt),
|
||||
ypos + line->GetPosY());
|
||||
line = line->GetNext();
|
||||
}
|
||||
xcnt++;
|
||||
}
|
||||
|
||||
ypos += ysizedown;
|
||||
xpos = xcnt = 0;
|
||||
ysizeup = ysizedown = 0;
|
||||
line = cell;
|
||||
}
|
||||
}
|
||||
|
||||
// setup height & width, depending on container layout:
|
||||
m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
|
||||
|
||||
if (m_Height < m_MinHeight)
|
||||
{
|
||||
if (m_MinHeightAlign != wxHTML_ALIGN_TOP)
|
||||
{
|
||||
int diff = m_MinHeight - m_Height;
|
||||
if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
|
||||
cell = m_Cells;
|
||||
while (cell)
|
||||
{
|
||||
cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff);
|
||||
cell = cell->GetNext();
|
||||
}
|
||||
}
|
||||
m_Height = m_MinHeight;
|
||||
}
|
||||
|
||||
MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
|
||||
if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;
|
||||
|
||||
m_LastLayout = w;
|
||||
}
|
||||
|
||||
|
||||
#define mMin(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define mMax(a, b) (((a) < (b)) ? (b) : (a))
|
||||
|
||||
void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
||||
{
|
||||
// container visible, draw it:
|
||||
if ((y + m_PosY <= view_y2) && (y + m_PosY + m_Height > view_y1))
|
||||
{
|
||||
if (m_UseBkColour)
|
||||
{
|
||||
wxBrush myb = wxBrush(m_BkColour, wxSOLID);
|
||||
|
||||
int real_y1 = mMax(y + m_PosY, view_y1);
|
||||
int real_y2 = mMin(y + m_PosY + m_Height - 1, view_y2);
|
||||
|
||||
dc.SetBrush(myb);
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
|
||||
}
|
||||
|
||||
if (m_UseBorder)
|
||||
{
|
||||
wxPen mypen1(m_BorderColour1, 1, wxSOLID);
|
||||
wxPen mypen2(m_BorderColour2, 1, wxSOLID);
|
||||
|
||||
dc.SetPen(mypen1);
|
||||
dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX, y + m_PosY + m_Height - 1);
|
||||
dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX + m_Width, y + m_PosY);
|
||||
dc.SetPen(mypen2);
|
||||
dc.DrawLine(x + m_PosX + m_Width - 1, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
|
||||
dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width, y + m_PosY + m_Height - 1);
|
||||
}
|
||||
|
||||
if (m_Cells)
|
||||
{
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
cell->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
|
||||
}
|
||||
}
|
||||
// container invisible, just proceed font+color changing:
|
||||
else
|
||||
{
|
||||
if (m_Cells)
|
||||
{
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
cell->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
|
||||
{
|
||||
if (m_Cells)
|
||||
{
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
cell->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxColour wxHtmlContainerCell::GetBackgroundColour()
|
||||
{
|
||||
if (m_UseBkColour)
|
||||
return m_BkColour;
|
||||
else
|
||||
return wxNullColour;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
|
||||
{
|
||||
wxHtmlCell *cell = FindCellByPos(x, y);
|
||||
|
||||
// VZ: I don't know if we should pass absolute or relative coords to
|
||||
// wxHtmlCell::GetLink()? As the base class version just ignores them
|
||||
// anyhow, it hardly matters right now but should still be clarified
|
||||
return cell ? cell->GetLink(x, y) : NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
|
||||
{
|
||||
if (!m_Cells) m_Cells = m_LastCell = f;
|
||||
else
|
||||
{
|
||||
m_LastCell->SetNext(f);
|
||||
m_LastCell = f;
|
||||
if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext();
|
||||
}
|
||||
f->SetParent(this);
|
||||
m_LastLayout = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
|
||||
{
|
||||
if (tag.HasParam(wxT("ALIGN")))
|
||||
{
|
||||
wxString alg = tag.GetParam(wxT("ALIGN"));
|
||||
alg.MakeUpper();
|
||||
if (alg == wxT("CENTER"))
|
||||
SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||
else if (alg == wxT("LEFT"))
|
||||
SetAlignHor(wxHTML_ALIGN_LEFT);
|
||||
else if (alg == wxT("JUSTIFY"))
|
||||
SetAlignHor(wxHTML_ALIGN_JUSTIFY);
|
||||
else if (alg == wxT("RIGHT"))
|
||||
SetAlignHor(wxHTML_ALIGN_RIGHT);
|
||||
m_LastLayout = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
|
||||
{
|
||||
if (tag.HasParam(wxT("WIDTH")))
|
||||
{
|
||||
int wdi;
|
||||
wxString wd = tag.GetParam(wxT("WIDTH"));
|
||||
|
||||
if (wd[wd.Length()-1] == wxT('%'))
|
||||
{
|
||||
wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
|
||||
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxSscanf(wd.c_str(), wxT("%i"), &wdi);
|
||||
SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
|
||||
}
|
||||
m_LastLayout = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const
|
||||
{
|
||||
if (m_Cells)
|
||||
{
|
||||
const wxHtmlCell *r = NULL;
|
||||
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
{
|
||||
r = cell->Find(condition, param);
|
||||
if (r) return r;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y) const
|
||||
{
|
||||
for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
|
||||
{
|
||||
int cx = cell->GetPosX(),
|
||||
cy = cell->GetPosY();
|
||||
|
||||
if ( (cx <= x) && (cx + cell->GetWidth() > x) &&
|
||||
(cy <= y) && (cy + cell->GetHeight() > y) )
|
||||
{
|
||||
return cell->FindCellByPos(x - cx, y - cy);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
|
||||
{
|
||||
wxHtmlCell *cell = FindCellByPos(x, y);
|
||||
if ( cell )
|
||||
cell->OnMouseClick(parent, x, y, event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlContainerCell::GetHorizontalConstraints(int *left, int *right) const
|
||||
{
|
||||
int cleft = m_PosX + m_Width, cright = m_PosX; // worst case
|
||||
int l, r;
|
||||
|
||||
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||
{
|
||||
cell->GetHorizontalConstraints(&l, &r);
|
||||
if (l < cleft)
|
||||
cleft = l;
|
||||
if (r > cright)
|
||||
cright = r;
|
||||
}
|
||||
|
||||
cleft -= (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
|
||||
cright += (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
|
||||
|
||||
if (left)
|
||||
*left = cleft;
|
||||
if (right)
|
||||
*right = cright;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlColourCell
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
void wxHtmlColourCell::Draw(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
if (m_Flags & wxHTML_CLR_FOREGROUND)
|
||||
dc.SetTextForeground(m_Colour);
|
||||
if (m_Flags & wxHTML_CLR_BACKGROUND)
|
||||
{
|
||||
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
||||
dc.SetTextBackground(m_Colour);
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlColourCell::DrawInvisible(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y))
|
||||
{
|
||||
if (m_Flags & wxHTML_CLR_FOREGROUND)
|
||||
dc.SetTextForeground(m_Colour);
|
||||
if (m_Flags & wxHTML_CLR_BACKGROUND)
|
||||
{
|
||||
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
||||
dc.SetTextBackground(m_Colour);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFontCell
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
void wxHtmlFontCell::Draw(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
dc.SetFont(m_Font);
|
||||
}
|
||||
|
||||
void wxHtmlFontCell::DrawInvisible(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y))
|
||||
{
|
||||
dc.SetFont(m_Font);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlWidgetCell
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow *wnd, int w)
|
||||
{
|
||||
int sx, sy;
|
||||
m_Wnd = wnd;
|
||||
m_Wnd->GetSize(&sx, &sy);
|
||||
m_Width = sx, m_Height = sy;
|
||||
m_WidthFloat = w;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWidgetCell::Draw(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
int absx = 0, absy = 0, stx, sty;
|
||||
wxHtmlCell *c = this;
|
||||
|
||||
while (c)
|
||||
{
|
||||
absx += c->GetPosX();
|
||||
absy += c->GetPosY();
|
||||
c = c->GetParent();
|
||||
}
|
||||
|
||||
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
|
||||
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWidgetCell::DrawInvisible(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y))
|
||||
{
|
||||
int absx = 0, absy = 0, stx, sty;
|
||||
wxHtmlCell *c = this;
|
||||
|
||||
while (c)
|
||||
{
|
||||
absx += c->GetPosX();
|
||||
absy += c->GetPosY();
|
||||
c = c->GetParent();
|
||||
}
|
||||
|
||||
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
|
||||
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWidgetCell::Layout(int w)
|
||||
{
|
||||
if (m_WidthFloat != 0)
|
||||
{
|
||||
m_Width = (w * m_WidthFloat) / 100;
|
||||
m_Wnd->SetSize(m_Width, m_Height);
|
||||
}
|
||||
|
||||
wxHtmlCell::Layout(w);
|
||||
}
|
||||
|
||||
#endif
|
||||
229
src/html/htmlfilt.cpp
Normal file
229
src/html/htmlfilt.cpp
Normal file
@@ -0,0 +1,229 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlfilt.cpp
|
||||
// Purpose: wxHtmlFilter - input filter for translating into HTML format
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "htmlfilt.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/strconv.h"
|
||||
#include "wx/html/htmlfilt.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
|
||||
// utility function: read a wxString from a wxInputStream
|
||||
static void ReadString(wxString& str, wxInputStream* s, wxMBConv& conv)
|
||||
{
|
||||
size_t streamSize = s->GetSize();
|
||||
|
||||
if (streamSize == ~(size_t)0)
|
||||
{
|
||||
const size_t bufSize = 4095;
|
||||
char buffer[bufSize+1];
|
||||
size_t lastRead;
|
||||
|
||||
do
|
||||
{
|
||||
s->Read(buffer, bufSize);
|
||||
lastRead = s->LastRead();
|
||||
buffer[lastRead] = 0;
|
||||
str.Append(wxString(buffer, conv));
|
||||
}
|
||||
while (lastRead == bufSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* src = new char[streamSize+1];
|
||||
s->Read(src, streamSize);
|
||||
src[streamSize] = 0;
|
||||
str = wxString(src, conv);
|
||||
delete[] src;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
There is code for several default filters:
|
||||
|
||||
*/
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxHtmlFilter, wxObject)
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFilterPlainText
|
||||
// filter for text/plain or uknown
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterPlainText, wxHtmlFilter)
|
||||
|
||||
bool wxHtmlFilterPlainText::CanRead(const wxFSFile& WXUNUSED(file)) const
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const
|
||||
{
|
||||
wxInputStream *s = file.GetStream();
|
||||
wxString doc, doc2;
|
||||
|
||||
if (s == NULL) return wxEmptyString;
|
||||
ReadString(doc, s, wxConvISO8859_1);
|
||||
|
||||
doc.Replace(wxT("&"), wxT("&"), TRUE);
|
||||
doc.Replace(wxT("<"), wxT("<"), TRUE);
|
||||
doc.Replace(wxT(">"), wxT(">"), TRUE);
|
||||
doc2 = wxT("<HTML><BODY><PRE>\n") + doc + wxT("\n</PRE></BODY></HTML>");
|
||||
return doc2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFilterImage
|
||||
// filter for image/*
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlFilterImage : public wxHtmlFilter
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlFilterImage)
|
||||
|
||||
public:
|
||||
virtual bool CanRead(const wxFSFile& file) const;
|
||||
virtual wxString ReadFile(const wxFSFile& file) const;
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterImage, wxHtmlFilter)
|
||||
|
||||
|
||||
|
||||
bool wxHtmlFilterImage::CanRead(const wxFSFile& file) const
|
||||
{
|
||||
return (file.GetMimeType().Left(6) == wxT("image/"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxString wxHtmlFilterImage::ReadFile(const wxFSFile& file) const
|
||||
{
|
||||
wxString res = wxT("<HTML><BODY><IMG SRC=\"") + file.GetLocation() + wxT("\"></BODY></HTML>");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlFilterHTML
|
||||
// filter for text/html
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterHTML, wxHtmlFilter)
|
||||
|
||||
bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const
|
||||
{
|
||||
// return (file.GetMimeType() == "text/html");
|
||||
// This is true in most case but some page can return:
|
||||
// "text/html; char-encoding=...."
|
||||
// So we use Find instead
|
||||
return (file.GetMimeType().Find(wxT("text/html")) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
|
||||
{
|
||||
wxInputStream *s = file.GetStream();
|
||||
wxString doc;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str());
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
// NB: We convert input file to wchar_t here in Unicode mode, based on
|
||||
// either Content-Type header or <meta> tags. In ANSI mode, we don't
|
||||
// do it as it is done by wxHtmlParser (for this reason, we add <meta>
|
||||
// tag if we used Content-Type header).
|
||||
#if wxUSE_UNICODE
|
||||
int charsetPos;
|
||||
if ((charsetPos = file.GetMimeType().Find(_T("; charset="))) != wxNOT_FOUND)
|
||||
{
|
||||
wxString charset = file.GetMimeType().Mid(charsetPos + 10);
|
||||
wxCSConv conv(charset);
|
||||
ReadString(doc, s, conv);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString tmpdoc;
|
||||
ReadString(tmpdoc, s, wxConvISO8859_1);
|
||||
wxString charset = wxHtmlParser::ExtractCharsetInformation(tmpdoc);
|
||||
if (charset.empty())
|
||||
doc = tmpdoc;
|
||||
else
|
||||
{
|
||||
wxCSConv conv(charset);
|
||||
doc = wxString(tmpdoc.mb_str(wxConvISO8859_1), conv);
|
||||
}
|
||||
}
|
||||
#else // !wxUSE_UNICODE
|
||||
ReadString(doc, s, wxConvLibc);
|
||||
// add meta tag if we obtained this through http:
|
||||
if (!file.GetMimeType().empty())
|
||||
{
|
||||
wxString hdr;
|
||||
wxString mime = file.GetMimeType();
|
||||
hdr.Printf(_T("<meta http-equiv=\"Content-Type\" content=\"%s\">"), mime.c_str());
|
||||
return hdr+doc;
|
||||
}
|
||||
#endif
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///// Module:
|
||||
|
||||
class wxHtmlFilterModule : public wxModule
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlFilterModule)
|
||||
|
||||
public:
|
||||
virtual bool OnInit()
|
||||
{
|
||||
wxHtmlWindow::AddFilter(new wxHtmlFilterHTML);
|
||||
wxHtmlWindow::AddFilter(new wxHtmlFilterImage);
|
||||
return TRUE;
|
||||
}
|
||||
virtual void OnExit() {}
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterModule, wxModule)
|
||||
|
||||
#endif
|
||||
900
src/html/htmlpars.cpp
Normal file
900
src/html/htmlpars.cpp
Normal file
@@ -0,0 +1,900 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlpars.cpp
|
||||
// Purpose: wxHtmlParser class (generic parser)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "htmlpars.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/url.h"
|
||||
#include "wx/fontmap.h"
|
||||
#include "wx/html/htmldefs.h"
|
||||
#include "wx/html/htmlpars.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/arrimpl.cpp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlParser helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlTextPiece
|
||||
{
|
||||
public:
|
||||
wxHtmlTextPiece(int pos, int lng) : m_pos(pos), m_lng(lng) {}
|
||||
int m_pos, m_lng;
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces);
|
||||
WX_DEFINE_OBJARRAY(wxHtmlTextPieces);
|
||||
|
||||
class wxHtmlParserState
|
||||
{
|
||||
public:
|
||||
wxHtmlTag *m_curTag;
|
||||
wxHtmlTag *m_tags;
|
||||
wxHtmlTextPieces *m_textPieces;
|
||||
int m_curTextPiece;
|
||||
wxString m_source;
|
||||
wxHtmlParserState *m_nextState;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlParser
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxHtmlParser,wxObject)
|
||||
|
||||
wxHtmlParser::wxHtmlParser()
|
||||
: wxObject(), m_HandlersHash(wxKEY_STRING),
|
||||
m_FS(NULL), m_HandlersStack(NULL)
|
||||
{
|
||||
m_entitiesParser = new wxHtmlEntitiesParser;
|
||||
m_Tags = NULL;
|
||||
m_CurTag = NULL;
|
||||
m_TextPieces = NULL;
|
||||
m_CurTextPiece = 0;
|
||||
m_SavedStates = NULL;
|
||||
}
|
||||
|
||||
wxHtmlParser::~wxHtmlParser()
|
||||
{
|
||||
while (RestoreState()) {}
|
||||
DestroyDOMTree();
|
||||
|
||||
delete m_HandlersStack;
|
||||
m_HandlersHash.Clear();
|
||||
m_HandlersList.DeleteContents(TRUE);
|
||||
m_HandlersList.Clear();
|
||||
delete m_entitiesParser;
|
||||
}
|
||||
|
||||
wxObject* wxHtmlParser::Parse(const wxString& source)
|
||||
{
|
||||
InitParser(source);
|
||||
DoParsing();
|
||||
wxObject *result = GetProduct();
|
||||
DoneParser();
|
||||
return result;
|
||||
}
|
||||
|
||||
void wxHtmlParser::InitParser(const wxString& source)
|
||||
{
|
||||
SetSource(source);
|
||||
m_stopParsing = FALSE;
|
||||
}
|
||||
|
||||
void wxHtmlParser::DoneParser()
|
||||
{
|
||||
DestroyDOMTree();
|
||||
}
|
||||
|
||||
void wxHtmlParser::SetSource(const wxString& src)
|
||||
{
|
||||
DestroyDOMTree();
|
||||
m_Source = src;
|
||||
CreateDOMTree();
|
||||
m_CurTag = NULL;
|
||||
m_CurTextPiece = 0;
|
||||
}
|
||||
|
||||
void wxHtmlParser::CreateDOMTree()
|
||||
{
|
||||
wxHtmlTagsCache cache(m_Source);
|
||||
m_TextPieces = new wxHtmlTextPieces;
|
||||
CreateDOMSubTree(NULL, 0, m_Source.Length(), &cache);
|
||||
m_CurTextPiece = 0;
|
||||
}
|
||||
|
||||
extern bool wxIsCDATAElement(const wxChar *tag);
|
||||
|
||||
void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
|
||||
int begin_pos, int end_pos,
|
||||
wxHtmlTagsCache *cache)
|
||||
{
|
||||
if (end_pos <= begin_pos) return;
|
||||
|
||||
wxChar c;
|
||||
int i = begin_pos;
|
||||
int textBeginning = begin_pos;
|
||||
|
||||
// If the tag contains CDATA text, we include the text between beginning
|
||||
// and ending tag verbosely. Setting i=end_pos will skip to the very
|
||||
// end of this function where text piece is added, bypassing any child
|
||||
// tags parsing (CDATA element can't have child elements by definition):
|
||||
if (cur != NULL && wxIsCDATAElement(cur->GetName().c_str()))
|
||||
{
|
||||
i = end_pos;
|
||||
}
|
||||
|
||||
while (i < end_pos)
|
||||
{
|
||||
c = m_Source.GetChar(i);
|
||||
|
||||
if (c == wxT('<'))
|
||||
{
|
||||
// add text to m_TextPieces:
|
||||
if (i - textBeginning > 0)
|
||||
m_TextPieces->Add(
|
||||
wxHtmlTextPiece(textBeginning, i - textBeginning));
|
||||
|
||||
// if it is a comment, skip it:
|
||||
if (i < end_pos-6 && m_Source.GetChar(i+1) == wxT('!') &&
|
||||
m_Source.GetChar(i+2) == wxT('-') &&
|
||||
m_Source.GetChar(i+3) == wxT('-'))
|
||||
{
|
||||
// Comments begin with "<!--" and end with "--[ \t\r\n]*>"
|
||||
// according to HTML 4.0
|
||||
int dashes = 0;
|
||||
i += 4;
|
||||
while (i < end_pos)
|
||||
{
|
||||
c = m_Source.GetChar(i++);
|
||||
if ((c == wxT(' ') || c == wxT('\n') ||
|
||||
c == wxT('\r') || c == wxT('\t')) && dashes >= 2) {}
|
||||
else if (c == wxT('>') && dashes >= 2)
|
||||
{
|
||||
textBeginning = i;
|
||||
break;
|
||||
}
|
||||
else if (c == wxT('-'))
|
||||
dashes++;
|
||||
else
|
||||
dashes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// add another tag to the tree:
|
||||
else if (i < end_pos-1 && m_Source.GetChar(i+1) != wxT('/'))
|
||||
{
|
||||
wxHtmlTag *chd;
|
||||
if (cur)
|
||||
chd = new wxHtmlTag(cur, m_Source,
|
||||
i, end_pos, cache, m_entitiesParser);
|
||||
else
|
||||
{
|
||||
chd = new wxHtmlTag(NULL, m_Source,
|
||||
i, end_pos, cache, m_entitiesParser);
|
||||
if (!m_Tags)
|
||||
{
|
||||
// if this is the first tag to be created make the root
|
||||
// m_Tags point to it:
|
||||
m_Tags = chd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there is already a root tag add this tag as
|
||||
// the last sibling:
|
||||
chd->m_Prev = m_Tags->GetLastSibling();
|
||||
chd->m_Prev->m_Next = chd;
|
||||
}
|
||||
}
|
||||
|
||||
if (chd->HasEnding())
|
||||
{
|
||||
CreateDOMSubTree(chd,
|
||||
chd->GetBeginPos(), chd->GetEndPos1(),
|
||||
cache);
|
||||
i = chd->GetEndPos2();
|
||||
}
|
||||
else
|
||||
i = chd->GetBeginPos();
|
||||
|
||||
textBeginning = i;
|
||||
}
|
||||
|
||||
// ... or skip ending tag:
|
||||
else
|
||||
{
|
||||
while (i < end_pos && m_Source.GetChar(i) != wxT('>')) i++;
|
||||
textBeginning = i+1;
|
||||
}
|
||||
}
|
||||
else i++;
|
||||
}
|
||||
|
||||
// add remaining text to m_TextPieces:
|
||||
if (end_pos - textBeginning > 0)
|
||||
m_TextPieces->Add(
|
||||
wxHtmlTextPiece(textBeginning, end_pos - textBeginning));
|
||||
}
|
||||
|
||||
void wxHtmlParser::DestroyDOMTree()
|
||||
{
|
||||
wxHtmlTag *t1, *t2;
|
||||
t1 = m_Tags;
|
||||
while (t1)
|
||||
{
|
||||
t2 = t1->GetNextSibling();
|
||||
delete t1;
|
||||
t1 = t2;
|
||||
}
|
||||
m_Tags = m_CurTag = NULL;
|
||||
|
||||
delete m_TextPieces;
|
||||
m_TextPieces = NULL;
|
||||
}
|
||||
|
||||
void wxHtmlParser::DoParsing()
|
||||
{
|
||||
m_CurTag = m_Tags;
|
||||
m_CurTextPiece = 0;
|
||||
DoParsing(0, m_Source.Length());
|
||||
}
|
||||
|
||||
void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
|
||||
{
|
||||
if (end_pos <= begin_pos) return;
|
||||
|
||||
wxHtmlTextPieces& pieces = *m_TextPieces;
|
||||
size_t piecesCnt = pieces.GetCount();
|
||||
|
||||
while (begin_pos < end_pos)
|
||||
{
|
||||
while (m_CurTag && m_CurTag->GetBeginPos() < begin_pos)
|
||||
m_CurTag = m_CurTag->GetNextTag();
|
||||
while (m_CurTextPiece < piecesCnt &&
|
||||
pieces[m_CurTextPiece].m_pos < begin_pos)
|
||||
m_CurTextPiece++;
|
||||
|
||||
if (m_CurTextPiece < piecesCnt &&
|
||||
(!m_CurTag ||
|
||||
pieces[m_CurTextPiece].m_pos < m_CurTag->GetBeginPos()))
|
||||
{
|
||||
// Add text:
|
||||
AddText(GetEntitiesParser()->Parse(
|
||||
m_Source.Mid(pieces[m_CurTextPiece].m_pos,
|
||||
pieces[m_CurTextPiece].m_lng)));
|
||||
begin_pos = pieces[m_CurTextPiece].m_pos +
|
||||
pieces[m_CurTextPiece].m_lng;
|
||||
m_CurTextPiece++;
|
||||
}
|
||||
else if (m_CurTag)
|
||||
{
|
||||
// Add tag:
|
||||
if (m_CurTag)
|
||||
{
|
||||
if (m_CurTag->HasEnding())
|
||||
begin_pos = m_CurTag->GetEndPos2();
|
||||
else
|
||||
begin_pos = m_CurTag->GetBeginPos();
|
||||
}
|
||||
wxHtmlTag *t = m_CurTag;
|
||||
m_CurTag = m_CurTag->GetNextTag();
|
||||
AddTag(*t);
|
||||
if (m_stopParsing)
|
||||
return;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlParser::AddTag(const wxHtmlTag& tag)
|
||||
{
|
||||
wxHtmlTagHandler *h;
|
||||
bool inner = FALSE;
|
||||
|
||||
h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
|
||||
if (h)
|
||||
{
|
||||
inner = h->HandleTag(tag);
|
||||
if (m_stopParsing)
|
||||
return;
|
||||
}
|
||||
if (!inner)
|
||||
{
|
||||
if (tag.HasEnding())
|
||||
DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlParser::AddTagHandler(wxHtmlTagHandler *handler)
|
||||
{
|
||||
wxString s(handler->GetSupportedTags());
|
||||
wxStringTokenizer tokenizer(s, wxT(", "));
|
||||
|
||||
while (tokenizer.HasMoreTokens())
|
||||
m_HandlersHash.Put(tokenizer.GetNextToken(), handler);
|
||||
|
||||
if (m_HandlersList.IndexOf(handler) == wxNOT_FOUND)
|
||||
m_HandlersList.Append(handler);
|
||||
|
||||
handler->SetParser(this);
|
||||
}
|
||||
|
||||
void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
|
||||
{
|
||||
wxStringTokenizer tokenizer(tags, wxT(", "));
|
||||
wxString key;
|
||||
|
||||
if (m_HandlersStack == NULL)
|
||||
{
|
||||
m_HandlersStack = new wxList;
|
||||
m_HandlersStack->DeleteContents(TRUE);
|
||||
}
|
||||
|
||||
m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
|
||||
|
||||
while (tokenizer.HasMoreTokens())
|
||||
{
|
||||
key = tokenizer.GetNextToken();
|
||||
m_HandlersHash.Delete(key);
|
||||
m_HandlersHash.Put(key, handler);
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlParser::PopTagHandler()
|
||||
{
|
||||
wxNode *first;
|
||||
|
||||
if (m_HandlersStack == NULL ||
|
||||
(first = m_HandlersStack->GetFirst()) == NULL)
|
||||
{
|
||||
wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
|
||||
return;
|
||||
}
|
||||
m_HandlersHash = *((wxHashTable*) first->GetData());
|
||||
m_HandlersStack->DeleteNode(first);
|
||||
}
|
||||
|
||||
void wxHtmlParser::SetSourceAndSaveState(const wxString& src)
|
||||
{
|
||||
wxHtmlParserState *s = new wxHtmlParserState;
|
||||
|
||||
s->m_curTag = m_CurTag;
|
||||
s->m_tags = m_Tags;
|
||||
s->m_textPieces = m_TextPieces;
|
||||
s->m_curTextPiece = m_CurTextPiece;
|
||||
s->m_source = m_Source;
|
||||
|
||||
s->m_nextState = m_SavedStates;
|
||||
m_SavedStates = s;
|
||||
|
||||
m_CurTag = NULL;
|
||||
m_Tags = NULL;
|
||||
m_TextPieces = NULL;
|
||||
m_CurTextPiece = 0;
|
||||
m_Source = wxEmptyString;
|
||||
|
||||
SetSource(src);
|
||||
}
|
||||
|
||||
bool wxHtmlParser::RestoreState()
|
||||
{
|
||||
if (!m_SavedStates) return FALSE;
|
||||
|
||||
DestroyDOMTree();
|
||||
|
||||
wxHtmlParserState *s = m_SavedStates;
|
||||
m_SavedStates = s->m_nextState;
|
||||
|
||||
m_CurTag = s->m_curTag;
|
||||
m_Tags = s->m_tags;
|
||||
m_TextPieces = s->m_textPieces;
|
||||
m_CurTextPiece = s->m_curTextPiece;
|
||||
m_Source = s->m_source;
|
||||
|
||||
delete s;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlTagHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxHtmlTagHandler,wxObject)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlEntitiesParser
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlEntitiesParser,wxObject)
|
||||
|
||||
wxHtmlEntitiesParser::wxHtmlEntitiesParser()
|
||||
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
|
||||
: m_conv(NULL), m_encoding(wxFONTENCODING_SYSTEM)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
wxHtmlEntitiesParser::~wxHtmlEntitiesParser()
|
||||
{
|
||||
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
|
||||
delete m_conv;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxHtmlEntitiesParser::SetEncoding(wxFontEncoding encoding)
|
||||
{
|
||||
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
|
||||
if (encoding == m_encoding)
|
||||
return;
|
||||
|
||||
delete m_conv;
|
||||
|
||||
m_encoding = encoding;
|
||||
if (m_encoding == wxFONTENCODING_SYSTEM)
|
||||
m_conv = NULL;
|
||||
else
|
||||
m_conv = new wxCSConv(wxFontMapper::GetEncodingName(m_encoding));
|
||||
#else
|
||||
(void) encoding;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString wxHtmlEntitiesParser::Parse(const wxString& input)
|
||||
{
|
||||
const wxChar *c, *last;
|
||||
const wxChar *in_str = input.c_str();
|
||||
wxString output;
|
||||
|
||||
output.reserve(input.length());
|
||||
|
||||
for (c = in_str, last = in_str; *c != wxT('\0'); c++)
|
||||
{
|
||||
if (*c == wxT('&'))
|
||||
{
|
||||
if (c - last > 0)
|
||||
output.append(last, c - last);
|
||||
if (++c == wxT('\0')) break;
|
||||
|
||||
wxString entity;
|
||||
const wxChar *ent_s = c;
|
||||
wxChar entity_char;
|
||||
|
||||
for (; (*c >= wxT('a') && *c <= wxT('z')) ||
|
||||
(*c >= wxT('A') && *c <= wxT('Z')) ||
|
||||
(*c >= wxT('0') && *c <= wxT('9')) ||
|
||||
*c == wxT('_') || *c == wxT('#'); c++) {}
|
||||
entity.append(ent_s, c - ent_s);
|
||||
if (*c != wxT(';')) c--;
|
||||
last = c+1;
|
||||
entity_char = GetEntityChar(entity);
|
||||
if (entity_char)
|
||||
output << entity_char;
|
||||
else
|
||||
{
|
||||
output.append(ent_s-1, c-ent_s+2);
|
||||
wxLogDebug(wxT("Unrecognized HTML entity: '%s'"), entity.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*last != wxT('\0'))
|
||||
output.append(last);
|
||||
return output;
|
||||
}
|
||||
|
||||
struct wxHtmlEntityInfo
|
||||
{
|
||||
const wxChar *name;
|
||||
unsigned code;
|
||||
};
|
||||
|
||||
extern "C" int LINKAGEMODE wxHtmlEntityCompare(const void *key, const void *item)
|
||||
{
|
||||
return wxStrcmp((wxChar*)key, ((wxHtmlEntityInfo*)item)->name);
|
||||
}
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
wxChar wxHtmlEntitiesParser::GetCharForCode(unsigned code)
|
||||
{
|
||||
#if wxUSE_WCHAR_T
|
||||
char buf[2];
|
||||
wchar_t wbuf[2];
|
||||
wbuf[0] = (wchar_t)code;
|
||||
wbuf[1] = 0;
|
||||
wxMBConv *conv = m_conv ? m_conv : &wxConvLocal;
|
||||
if (conv->WC2MB(buf, wbuf, 2) == (size_t)-1)
|
||||
return '?';
|
||||
return buf[0];
|
||||
#else
|
||||
return (code < 256) ? (wxChar)code : '?';
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity)
|
||||
{
|
||||
unsigned code = 0;
|
||||
|
||||
if (entity[0] == wxT('#'))
|
||||
{
|
||||
const wxChar *ent_s = entity.c_str();
|
||||
const wxChar *format;
|
||||
|
||||
if (ent_s[1] == wxT('x') || ent_s[1] == wxT('X'))
|
||||
{
|
||||
format = wxT("%x");
|
||||
ent_s++;
|
||||
}
|
||||
else
|
||||
format = wxT("%u");
|
||||
ent_s++;
|
||||
|
||||
if (wxSscanf(ent_s, format, &code) != 1)
|
||||
code = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
static wxHtmlEntityInfo substitutions[] = {
|
||||
{ wxT("AElig"),198 },
|
||||
{ wxT("Aacute"),193 },
|
||||
{ wxT("Acirc"),194 },
|
||||
{ wxT("Agrave"),192 },
|
||||
{ wxT("Alpha"),913 },
|
||||
{ wxT("Aring"),197 },
|
||||
{ wxT("Atilde"),195 },
|
||||
{ wxT("Auml"),196 },
|
||||
{ wxT("Beta"),914 },
|
||||
{ wxT("Ccedil"),199 },
|
||||
{ wxT("Chi"),935 },
|
||||
{ wxT("Dagger"),8225 },
|
||||
{ wxT("Delta"),916 },
|
||||
{ wxT("ETH"),208 },
|
||||
{ wxT("Eacute"),201 },
|
||||
{ wxT("Ecirc"),202 },
|
||||
{ wxT("Egrave"),200 },
|
||||
{ wxT("Epsilon"),917 },
|
||||
{ wxT("Eta"),919 },
|
||||
{ wxT("Euml"),203 },
|
||||
{ wxT("Gamma"),915 },
|
||||
{ wxT("Iacute"),205 },
|
||||
{ wxT("Icirc"),206 },
|
||||
{ wxT("Igrave"),204 },
|
||||
{ wxT("Iota"),921 },
|
||||
{ wxT("Iuml"),207 },
|
||||
{ wxT("Kappa"),922 },
|
||||
{ wxT("Lambda"),923 },
|
||||
{ wxT("Mu"),924 },
|
||||
{ wxT("Ntilde"),209 },
|
||||
{ wxT("Nu"),925 },
|
||||
{ wxT("OElig"),338 },
|
||||
{ wxT("Oacute"),211 },
|
||||
{ wxT("Ocirc"),212 },
|
||||
{ wxT("Ograve"),210 },
|
||||
{ wxT("Omega"),937 },
|
||||
{ wxT("Omicron"),927 },
|
||||
{ wxT("Oslash"),216 },
|
||||
{ wxT("Otilde"),213 },
|
||||
{ wxT("Ouml"),214 },
|
||||
{ wxT("Phi"),934 },
|
||||
{ wxT("Pi"),928 },
|
||||
{ wxT("Prime"),8243 },
|
||||
{ wxT("Psi"),936 },
|
||||
{ wxT("Rho"),929 },
|
||||
{ wxT("Scaron"),352 },
|
||||
{ wxT("Sigma"),931 },
|
||||
{ wxT("THORN"),222 },
|
||||
{ wxT("Tau"),932 },
|
||||
{ wxT("Theta"),920 },
|
||||
{ wxT("Uacute"),218 },
|
||||
{ wxT("Ucirc"),219 },
|
||||
{ wxT("Ugrave"),217 },
|
||||
{ wxT("Upsilon"),933 },
|
||||
{ wxT("Uuml"),220 },
|
||||
{ wxT("Xi"),926 },
|
||||
{ wxT("Yacute"),221 },
|
||||
{ wxT("Yuml"),376 },
|
||||
{ wxT("Zeta"),918 },
|
||||
{ wxT("aacute"),225 },
|
||||
{ wxT("acirc"),226 },
|
||||
{ wxT("acute"),180 },
|
||||
{ wxT("aelig"),230 },
|
||||
{ wxT("agrave"),224 },
|
||||
{ wxT("alefsym"),8501 },
|
||||
{ wxT("alpha"),945 },
|
||||
{ wxT("amp"),38 },
|
||||
{ wxT("and"),8743 },
|
||||
{ wxT("ang"),8736 },
|
||||
{ wxT("aring"),229 },
|
||||
{ wxT("asymp"),8776 },
|
||||
{ wxT("atilde"),227 },
|
||||
{ wxT("auml"),228 },
|
||||
{ wxT("bdquo"),8222 },
|
||||
{ wxT("beta"),946 },
|
||||
{ wxT("brvbar"),166 },
|
||||
{ wxT("bull"),8226 },
|
||||
{ wxT("cap"),8745 },
|
||||
{ wxT("ccedil"),231 },
|
||||
{ wxT("cedil"),184 },
|
||||
{ wxT("cent"),162 },
|
||||
{ wxT("chi"),967 },
|
||||
{ wxT("circ"),710 },
|
||||
{ wxT("clubs"),9827 },
|
||||
{ wxT("cong"),8773 },
|
||||
{ wxT("copy"),169 },
|
||||
{ wxT("crarr"),8629 },
|
||||
{ wxT("cup"),8746 },
|
||||
{ wxT("curren"),164 },
|
||||
{ wxT("dArr"),8659 },
|
||||
{ wxT("dagger"),8224 },
|
||||
{ wxT("darr"),8595 },
|
||||
{ wxT("deg"),176 },
|
||||
{ wxT("delta"),948 },
|
||||
{ wxT("diams"),9830 },
|
||||
{ wxT("divide"),247 },
|
||||
{ wxT("eacute"),233 },
|
||||
{ wxT("ecirc"),234 },
|
||||
{ wxT("egrave"),232 },
|
||||
{ wxT("empty"),8709 },
|
||||
{ wxT("emsp"),8195 },
|
||||
{ wxT("ensp"),8194 },
|
||||
{ wxT("epsilon"),949 },
|
||||
{ wxT("equiv"),8801 },
|
||||
{ wxT("eta"),951 },
|
||||
{ wxT("eth"),240 },
|
||||
{ wxT("euml"),235 },
|
||||
{ wxT("euro"),8364 },
|
||||
{ wxT("exist"),8707 },
|
||||
{ wxT("fnof"),402 },
|
||||
{ wxT("forall"),8704 },
|
||||
{ wxT("frac12"),189 },
|
||||
{ wxT("frac14"),188 },
|
||||
{ wxT("frac34"),190 },
|
||||
{ wxT("frasl"),8260 },
|
||||
{ wxT("gamma"),947 },
|
||||
{ wxT("ge"),8805 },
|
||||
{ wxT("gt"),62 },
|
||||
{ wxT("hArr"),8660 },
|
||||
{ wxT("harr"),8596 },
|
||||
{ wxT("hearts"),9829 },
|
||||
{ wxT("hellip"),8230 },
|
||||
{ wxT("iacute"),237 },
|
||||
{ wxT("icirc"),238 },
|
||||
{ wxT("iexcl"),161 },
|
||||
{ wxT("igrave"),236 },
|
||||
{ wxT("image"),8465 },
|
||||
{ wxT("infin"),8734 },
|
||||
{ wxT("int"),8747 },
|
||||
{ wxT("iota"),953 },
|
||||
{ wxT("iquest"),191 },
|
||||
{ wxT("isin"),8712 },
|
||||
{ wxT("iuml"),239 },
|
||||
{ wxT("kappa"),954 },
|
||||
{ wxT("lArr"),8656 },
|
||||
{ wxT("lambda"),955 },
|
||||
{ wxT("lang"),9001 },
|
||||
{ wxT("laquo"),171 },
|
||||
{ wxT("larr"),8592 },
|
||||
{ wxT("lceil"),8968 },
|
||||
{ wxT("ldquo"),8220 },
|
||||
{ wxT("le"),8804 },
|
||||
{ wxT("lfloor"),8970 },
|
||||
{ wxT("lowast"),8727 },
|
||||
{ wxT("loz"),9674 },
|
||||
{ wxT("lrm"),8206 },
|
||||
{ wxT("lsaquo"),8249 },
|
||||
{ wxT("lsquo"),8216 },
|
||||
{ wxT("lt"),60 },
|
||||
{ wxT("macr"),175 },
|
||||
{ wxT("mdash"),8212 },
|
||||
{ wxT("micro"),181 },
|
||||
{ wxT("middot"),183 },
|
||||
{ wxT("minus"),8722 },
|
||||
{ wxT("mu"),956 },
|
||||
{ wxT("nabla"),8711 },
|
||||
{ wxT("nbsp"),160 },
|
||||
{ wxT("ndash"),8211 },
|
||||
{ wxT("ne"),8800 },
|
||||
{ wxT("ni"),8715 },
|
||||
{ wxT("not"),172 },
|
||||
{ wxT("notin"),8713 },
|
||||
{ wxT("nsub"),8836 },
|
||||
{ wxT("ntilde"),241 },
|
||||
{ wxT("nu"),957 },
|
||||
{ wxT("oacute"),243 },
|
||||
{ wxT("ocirc"),244 },
|
||||
{ wxT("oelig"),339 },
|
||||
{ wxT("ograve"),242 },
|
||||
{ wxT("oline"),8254 },
|
||||
{ wxT("omega"),969 },
|
||||
{ wxT("omicron"),959 },
|
||||
{ wxT("oplus"),8853 },
|
||||
{ wxT("or"),8744 },
|
||||
{ wxT("ordf"),170 },
|
||||
{ wxT("ordm"),186 },
|
||||
{ wxT("oslash"),248 },
|
||||
{ wxT("otilde"),245 },
|
||||
{ wxT("otimes"),8855 },
|
||||
{ wxT("ouml"),246 },
|
||||
{ wxT("para"),182 },
|
||||
{ wxT("part"),8706 },
|
||||
{ wxT("permil"),8240 },
|
||||
{ wxT("perp"),8869 },
|
||||
{ wxT("phi"),966 },
|
||||
{ wxT("pi"),960 },
|
||||
{ wxT("piv"),982 },
|
||||
{ wxT("plusmn"),177 },
|
||||
{ wxT("pound"),163 },
|
||||
{ wxT("prime"),8242 },
|
||||
{ wxT("prod"),8719 },
|
||||
{ wxT("prop"),8733 },
|
||||
{ wxT("psi"),968 },
|
||||
{ wxT("quot"),34 },
|
||||
{ wxT("rArr"),8658 },
|
||||
{ wxT("radic"),8730 },
|
||||
{ wxT("rang"),9002 },
|
||||
{ wxT("raquo"),187 },
|
||||
{ wxT("rarr"),8594 },
|
||||
{ wxT("rceil"),8969 },
|
||||
{ wxT("rdquo"),8221 },
|
||||
{ wxT("real"),8476 },
|
||||
{ wxT("reg"),174 },
|
||||
{ wxT("rfloor"),8971 },
|
||||
{ wxT("rho"),961 },
|
||||
{ wxT("rlm"),8207 },
|
||||
{ wxT("rsaquo"),8250 },
|
||||
{ wxT("rsquo"),8217 },
|
||||
{ wxT("sbquo"),8218 },
|
||||
{ wxT("scaron"),353 },
|
||||
{ wxT("sdot"),8901 },
|
||||
{ wxT("sect"),167 },
|
||||
{ wxT("shy"),173 },
|
||||
{ wxT("sigma"),963 },
|
||||
{ wxT("sigmaf"),962 },
|
||||
{ wxT("sim"),8764 },
|
||||
{ wxT("spades"),9824 },
|
||||
{ wxT("sub"),8834 },
|
||||
{ wxT("sube"),8838 },
|
||||
{ wxT("sum"),8721 },
|
||||
{ wxT("sup"),8835 },
|
||||
{ wxT("sup1"),185 },
|
||||
{ wxT("sup2"),178 },
|
||||
{ wxT("sup3"),179 },
|
||||
{ wxT("supe"),8839 },
|
||||
{ wxT("szlig"),223 },
|
||||
{ wxT("tau"),964 },
|
||||
{ wxT("there4"),8756 },
|
||||
{ wxT("theta"),952 },
|
||||
{ wxT("thetasym"),977 },
|
||||
{ wxT("thinsp"),8201 },
|
||||
{ wxT("thorn"),254 },
|
||||
{ wxT("tilde"),732 },
|
||||
{ wxT("times"),215 },
|
||||
{ wxT("trade"),8482 },
|
||||
{ wxT("uArr"),8657 },
|
||||
{ wxT("uacute"),250 },
|
||||
{ wxT("uarr"),8593 },
|
||||
{ wxT("ucirc"),251 },
|
||||
{ wxT("ugrave"),249 },
|
||||
{ wxT("uml"),168 },
|
||||
{ wxT("upsih"),978 },
|
||||
{ wxT("upsilon"),965 },
|
||||
{ wxT("uuml"),252 },
|
||||
{ wxT("weierp"),8472 },
|
||||
{ wxT("xi"),958 },
|
||||
{ wxT("yacute"),253 },
|
||||
{ wxT("yen"),165 },
|
||||
{ wxT("yuml"),255 },
|
||||
{ wxT("zeta"),950 },
|
||||
{ wxT("zwj"),8205 },
|
||||
{ wxT("zwnj"),8204 },
|
||||
{NULL, 0}};
|
||||
static size_t substitutions_cnt = 0;
|
||||
|
||||
if (substitutions_cnt == 0)
|
||||
while (substitutions[substitutions_cnt].code != 0)
|
||||
substitutions_cnt++;
|
||||
|
||||
wxHtmlEntityInfo *info;
|
||||
info = (wxHtmlEntityInfo*) bsearch(entity.c_str(), substitutions,
|
||||
substitutions_cnt,
|
||||
sizeof(wxHtmlEntityInfo),
|
||||
wxHtmlEntityCompare);
|
||||
if (info)
|
||||
code = info->code;
|
||||
}
|
||||
|
||||
if (code == 0)
|
||||
return 0;
|
||||
else
|
||||
return GetCharForCode(code);
|
||||
}
|
||||
|
||||
wxFSFile *wxHtmlParser::OpenURL(wxHtmlURLType WXUNUSED(type),
|
||||
const wxString& url) const
|
||||
{
|
||||
return GetFS()->OpenFile(url);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlParser::ExtractCharsetInformation
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxMetaTagParser : public wxHtmlParser
|
||||
{
|
||||
public:
|
||||
wxObject* GetProduct() { return NULL; }
|
||||
protected:
|
||||
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
|
||||
};
|
||||
|
||||
class wxMetaTagHandler : public wxHtmlTagHandler
|
||||
{
|
||||
public:
|
||||
wxMetaTagHandler(wxString *retval) : wxHtmlTagHandler(), m_retval(retval) {}
|
||||
wxString GetSupportedTags() { return wxT("META,BODY"); }
|
||||
bool HandleTag(const wxHtmlTag& tag);
|
||||
|
||||
private:
|
||||
wxString *m_retval;
|
||||
};
|
||||
|
||||
bool wxMetaTagHandler::HandleTag(const wxHtmlTag& tag)
|
||||
{
|
||||
if (tag.GetName() == _T("BODY"))
|
||||
{
|
||||
m_Parser->StopParsing();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (tag.HasParam(_T("HTTP-EQUIV")) &&
|
||||
tag.GetParam(_T("HTTP-EQUIV")) == _T("Content-Type") &&
|
||||
tag.HasParam(_T("CONTENT")))
|
||||
{
|
||||
wxString content = tag.GetParam(_T("CONTENT"));
|
||||
if (content.Left(19) == _T("text/html; charset="))
|
||||
{
|
||||
*m_retval = content.Mid(19);
|
||||
m_Parser->StopParsing();
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*static*/
|
||||
wxString wxHtmlParser::ExtractCharsetInformation(const wxString& markup)
|
||||
{
|
||||
wxString charset;
|
||||
wxMetaTagParser parser;
|
||||
parser.AddTagHandler(new wxMetaTagHandler(&charset));
|
||||
parser.Parse(markup);
|
||||
return charset;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
497
src/html/htmltag.cpp
Normal file
497
src/html/htmltag.cpp
Normal file
@@ -0,0 +1,497 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmltag.cpp
|
||||
// Purpose: wxHtmlTag class (represents single tag)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "htmltag.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/html/htmltag.h"
|
||||
#include "wx/html/htmlpars.h"
|
||||
#include "wx/colour.h"
|
||||
#include <stdio.h> // for vsscanf
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlTagsCache
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct wxHtmlCacheItem
|
||||
{
|
||||
// this is "pos" value passed to wxHtmlTag's constructor.
|
||||
// it is position of '<' character of the tag
|
||||
int Key;
|
||||
|
||||
// end positions for the tag:
|
||||
// end1 is '<' of ending tag,
|
||||
// end2 is '>' or both are
|
||||
// -1 if there is no ending tag for this one...
|
||||
// or -2 if this is ending tag </...>
|
||||
int End1, End2;
|
||||
|
||||
// name of this tag
|
||||
wxChar *Name;
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_CLASS(wxHtmlTagsCache,wxObject)
|
||||
|
||||
#define CACHE_INCREMENT 64
|
||||
|
||||
bool wxIsCDATAElement(const wxChar *tag)
|
||||
{
|
||||
return (wxStrcmp(tag, _T("SCRIPT")) == 0) ||
|
||||
(wxStrcmp(tag, _T("STYLE")) == 0);
|
||||
}
|
||||
|
||||
wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
||||
{
|
||||
const wxChar *src = source.c_str();
|
||||
int tg, stpos;
|
||||
int lng = source.Length();
|
||||
wxChar tagBuffer[256];
|
||||
|
||||
m_Cache = NULL;
|
||||
m_CacheSize = 0;
|
||||
m_CachePos = 0;
|
||||
|
||||
int pos = 0;
|
||||
while (pos < lng)
|
||||
{
|
||||
if (src[pos] == wxT('<')) // tag found:
|
||||
{
|
||||
if (m_CacheSize % CACHE_INCREMENT == 0)
|
||||
m_Cache = (wxHtmlCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(wxHtmlCacheItem));
|
||||
tg = m_CacheSize++;
|
||||
m_Cache[tg].Key = stpos = pos++;
|
||||
|
||||
int i;
|
||||
for ( i = 0;
|
||||
pos < lng && i < (int)WXSIZEOF(tagBuffer) - 1 &&
|
||||
src[pos] != wxT('>') && !wxIsspace(src[pos]);
|
||||
i++, pos++ )
|
||||
{
|
||||
tagBuffer[i] = wxToupper(src[pos]);
|
||||
}
|
||||
tagBuffer[i] = _T('\0');
|
||||
|
||||
m_Cache[tg].Name = new wxChar[i+1];
|
||||
memcpy(m_Cache[tg].Name, tagBuffer, (i+1)*sizeof(wxChar));
|
||||
|
||||
while (pos < lng && src[pos] != wxT('>')) pos++;
|
||||
|
||||
if (src[stpos+1] == wxT('/')) // ending tag:
|
||||
{
|
||||
m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
|
||||
// find matching begin tag:
|
||||
for (i = tg; i >= 0; i--)
|
||||
if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, tagBuffer+1) == 0))
|
||||
{
|
||||
m_Cache[i].End1 = stpos;
|
||||
m_Cache[i].End2 = pos + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
|
||||
|
||||
if (wxIsCDATAElement(tagBuffer))
|
||||
{
|
||||
// find next matching tag
|
||||
int tag_len = wxStrlen(tagBuffer);
|
||||
while (pos < lng)
|
||||
{
|
||||
// find the ending tag
|
||||
while (pos + 1 < lng &&
|
||||
(src[pos] != '<' || src[pos+1] != '/'))
|
||||
++pos;
|
||||
if (src[pos] == '<')
|
||||
++pos;
|
||||
|
||||
// see if it matches
|
||||
int match_pos = 0;
|
||||
while (pos < lng && match_pos < tag_len && src[pos] != '>' && src[pos] != '<') {
|
||||
if (wxToupper(src[pos]) == tagBuffer[match_pos]) {
|
||||
++match_pos;
|
||||
}
|
||||
else if (src[pos] == wxT(' ') || src[pos] == wxT('\n') ||
|
||||
src[pos] == wxT('\r') || src[pos] == wxT('\t')) {
|
||||
// need to skip over these
|
||||
}
|
||||
else {
|
||||
match_pos = 0;
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
|
||||
// found a match
|
||||
if (match_pos == tag_len) {
|
||||
pos = pos - tag_len - 3;
|
||||
stpos = pos;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
// ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
|
||||
for (int i = 0; i < m_CacheSize; i++)
|
||||
{
|
||||
delete[] m_Cache[i].Name;
|
||||
m_Cache[i].Name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2)
|
||||
{
|
||||
if (m_Cache == NULL) return;
|
||||
if (m_Cache[m_CachePos].Key != at)
|
||||
{
|
||||
int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
|
||||
do
|
||||
{
|
||||
m_CachePos += delta;
|
||||
}
|
||||
while (m_Cache[m_CachePos].Key != at);
|
||||
}
|
||||
*end1 = m_Cache[m_CachePos].End1;
|
||||
*end2 = m_Cache[m_CachePos].End2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlTag
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxHtmlTag,wxObject)
|
||||
|
||||
wxHtmlTag::wxHtmlTag(wxHtmlTag *parent,
|
||||
const wxString& source, int pos, int end_pos,
|
||||
wxHtmlTagsCache *cache,
|
||||
wxHtmlEntitiesParser *entParser) : wxObject()
|
||||
{
|
||||
/* Setup DOM relations */
|
||||
|
||||
m_Next = NULL;
|
||||
m_FirstChild = m_LastChild = NULL;
|
||||
m_Parent = parent;
|
||||
if (parent)
|
||||
{
|
||||
m_Prev = m_Parent->m_LastChild;
|
||||
if (m_Prev == NULL)
|
||||
m_Parent->m_FirstChild = this;
|
||||
else
|
||||
m_Prev->m_Next = this;
|
||||
m_Parent->m_LastChild = this;
|
||||
}
|
||||
else
|
||||
m_Prev = NULL;
|
||||
|
||||
/* Find parameters and their values: */
|
||||
|
||||
int i;
|
||||
wxChar c;
|
||||
|
||||
// fill-in name, params and begin pos:
|
||||
i = pos+1;
|
||||
|
||||
// find tag's name and convert it to uppercase:
|
||||
while ((i < end_pos) &&
|
||||
((c = source[i++]) != wxT(' ') && c != wxT('\r') &&
|
||||
c != wxT('\n') && c != wxT('\t') &&
|
||||
c != wxT('>')))
|
||||
{
|
||||
if ((c >= wxT('a')) && (c <= wxT('z')))
|
||||
c -= (wxT('a') - wxT('A'));
|
||||
m_Name << c;
|
||||
}
|
||||
|
||||
// if the tag has parameters, read them and "normalize" them,
|
||||
// i.e. convert to uppercase, replace whitespaces by spaces and
|
||||
// remove whitespaces around '=':
|
||||
if (source[i-1] != wxT('>'))
|
||||
{
|
||||
#define IS_WHITE(c) (c == wxT(' ') || c == wxT('\r') || \
|
||||
c == wxT('\n') || c == wxT('\t'))
|
||||
wxString pname, pvalue;
|
||||
wxChar quote;
|
||||
enum
|
||||
{
|
||||
ST_BEFORE_NAME = 1,
|
||||
ST_NAME,
|
||||
ST_BEFORE_EQ,
|
||||
ST_BEFORE_VALUE,
|
||||
ST_VALUE
|
||||
} state;
|
||||
|
||||
quote = 0;
|
||||
state = ST_BEFORE_NAME;
|
||||
while (i < end_pos)
|
||||
{
|
||||
c = source[i++];
|
||||
|
||||
if (c == wxT('>') && !(state == ST_VALUE && quote != 0))
|
||||
{
|
||||
if (state == ST_BEFORE_EQ || state == ST_NAME)
|
||||
{
|
||||
m_ParamNames.Add(pname);
|
||||
m_ParamValues.Add(wxEmptyString);
|
||||
}
|
||||
else if (state == ST_VALUE && quote == 0)
|
||||
{
|
||||
m_ParamNames.Add(pname);
|
||||
if (entParser)
|
||||
m_ParamValues.Add(entParser->Parse(pvalue));
|
||||
else
|
||||
m_ParamValues.Add(pvalue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (state)
|
||||
{
|
||||
case ST_BEFORE_NAME:
|
||||
if (!IS_WHITE(c))
|
||||
{
|
||||
pname = c;
|
||||
state = ST_NAME;
|
||||
}
|
||||
break;
|
||||
case ST_NAME:
|
||||
if (IS_WHITE(c))
|
||||
state = ST_BEFORE_EQ;
|
||||
else if (c == wxT('='))
|
||||
state = ST_BEFORE_VALUE;
|
||||
else
|
||||
pname << c;
|
||||
break;
|
||||
case ST_BEFORE_EQ:
|
||||
if (c == wxT('='))
|
||||
state = ST_BEFORE_VALUE;
|
||||
else if (!IS_WHITE(c))
|
||||
{
|
||||
m_ParamNames.Add(pname);
|
||||
m_ParamValues.Add(wxEmptyString);
|
||||
pname = c;
|
||||
state = ST_NAME;
|
||||
}
|
||||
break;
|
||||
case ST_BEFORE_VALUE:
|
||||
if (!IS_WHITE(c))
|
||||
{
|
||||
if (c == wxT('"') || c == wxT('\''))
|
||||
quote = c, pvalue = wxEmptyString;
|
||||
else
|
||||
quote = 0, pvalue = c;
|
||||
state = ST_VALUE;
|
||||
}
|
||||
break;
|
||||
case ST_VALUE:
|
||||
if ((quote != 0 && c == quote) ||
|
||||
(quote == 0 && IS_WHITE(c)))
|
||||
{
|
||||
m_ParamNames.Add(pname);
|
||||
if (quote == 0)
|
||||
{
|
||||
// VS: backward compatibility, no real reason,
|
||||
// but wxHTML code relies on this... :(
|
||||
pvalue.MakeUpper();
|
||||
}
|
||||
if (entParser)
|
||||
m_ParamValues.Add(entParser->Parse(pvalue));
|
||||
else
|
||||
m_ParamValues.Add(pvalue);
|
||||
state = ST_BEFORE_NAME;
|
||||
}
|
||||
else
|
||||
pvalue << c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#undef IS_WHITE
|
||||
}
|
||||
m_Begin = i;
|
||||
|
||||
cache->QueryTag(pos, &m_End1, &m_End2);
|
||||
if (m_End1 > end_pos) m_End1 = end_pos;
|
||||
if (m_End2 > end_pos) m_End2 = end_pos;
|
||||
}
|
||||
|
||||
wxHtmlTag::~wxHtmlTag()
|
||||
{
|
||||
wxHtmlTag *t1, *t2;
|
||||
t1 = m_FirstChild;
|
||||
while (t1)
|
||||
{
|
||||
t2 = t1->GetNextSibling();
|
||||
delete t1;
|
||||
t1 = t2;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxHtmlTag::HasParam(const wxString& par) const
|
||||
{
|
||||
return (m_ParamNames.Index(par, FALSE) != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
|
||||
{
|
||||
int index = m_ParamNames.Index(par, FALSE);
|
||||
if (index == wxNOT_FOUND)
|
||||
return wxEmptyString;
|
||||
if (with_commas)
|
||||
{
|
||||
// VS: backward compatibility, seems to be never used by wxHTML...
|
||||
wxString s;
|
||||
s << wxT('"') << m_ParamValues[index] << wxT('"');
|
||||
return s;
|
||||
}
|
||||
else
|
||||
return m_ParamValues[index];
|
||||
}
|
||||
|
||||
int wxHtmlTag::ScanParam(const wxString& par,
|
||||
const wxChar *format,
|
||||
void *param) const
|
||||
{
|
||||
wxString parval = GetParam(par);
|
||||
return wxSscanf(parval, format, param);
|
||||
}
|
||||
|
||||
bool wxHtmlTag::GetParamAsColour(const wxString& par, wxColour *clr) const
|
||||
{
|
||||
wxString str = GetParam(par);
|
||||
|
||||
if (str.IsEmpty()) return FALSE;
|
||||
if (str.GetChar(0) == wxT('#'))
|
||||
{
|
||||
unsigned long tmp;
|
||||
if (ScanParam(par, wxT("#%lX"), &tmp) != 1)
|
||||
return FALSE;
|
||||
*clr = wxColour((unsigned char)((tmp & 0xFF0000) >> 16),
|
||||
(unsigned char)((tmp & 0x00FF00) >> 8),
|
||||
(unsigned char)(tmp & 0x0000FF));
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle colours defined in HTML 4.0:
|
||||
#define HTML_COLOUR(name,r,g,b) \
|
||||
if (str.IsSameAs(wxT(name), FALSE)) \
|
||||
{ *clr = wxColour(r,g,b); return TRUE; }
|
||||
HTML_COLOUR("black", 0x00,0x00,0x00)
|
||||
HTML_COLOUR("silver", 0xC0,0xC0,0xC0)
|
||||
HTML_COLOUR("gray", 0x80,0x80,0x80)
|
||||
HTML_COLOUR("white", 0xFF,0xFF,0xFF)
|
||||
HTML_COLOUR("maroon", 0x80,0x00,0x00)
|
||||
HTML_COLOUR("red", 0xFF,0x00,0x00)
|
||||
HTML_COLOUR("purple", 0x80,0x00,0x80)
|
||||
HTML_COLOUR("fuchsia", 0xFF,0x00,0xFF)
|
||||
HTML_COLOUR("green", 0x00,0x80,0x00)
|
||||
HTML_COLOUR("lime", 0x00,0xFF,0x00)
|
||||
HTML_COLOUR("olive", 0x80,0x80,0x00)
|
||||
HTML_COLOUR("yellow", 0xFF,0xFF,0x00)
|
||||
HTML_COLOUR("navy", 0x00,0x00,0x80)
|
||||
HTML_COLOUR("blue", 0x00,0x00,0xFF)
|
||||
HTML_COLOUR("teal", 0x00,0x80,0x80)
|
||||
HTML_COLOUR("aqua", 0x00,0xFF,0xFF)
|
||||
#undef HTML_COLOUR
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxHtmlTag::GetParamAsInt(const wxString& par, int *clr) const
|
||||
{
|
||||
if (!HasParam(par)) return FALSE;
|
||||
long i;
|
||||
bool succ = GetParam(par).ToLong(&i);
|
||||
*clr = (int)i;
|
||||
return succ;
|
||||
}
|
||||
|
||||
wxString wxHtmlTag::GetAllParams() const
|
||||
{
|
||||
// VS: this function is for backward compatiblity only,
|
||||
// never used by wxHTML
|
||||
wxString s;
|
||||
size_t cnt = m_ParamNames.GetCount();
|
||||
for (size_t i = 0; i < cnt; i++)
|
||||
{
|
||||
s << m_ParamNames[i];
|
||||
s << wxT('=');
|
||||
if (m_ParamValues[i].Find(wxT('"')) != wxNOT_FOUND)
|
||||
s << wxT('\'') << m_ParamValues[i] << wxT('\'');
|
||||
else
|
||||
s << wxT('"') << m_ParamValues[i] << wxT('"');
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
wxHtmlTag *wxHtmlTag::GetFirstSibling() const
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->m_FirstChild;
|
||||
else
|
||||
{
|
||||
wxHtmlTag *cur = (wxHtmlTag*)this;
|
||||
while (cur->m_Prev)
|
||||
cur = cur->m_Prev;
|
||||
return cur;
|
||||
}
|
||||
}
|
||||
|
||||
wxHtmlTag *wxHtmlTag::GetLastSibling() const
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->m_LastChild;
|
||||
else
|
||||
{
|
||||
wxHtmlTag *cur = (wxHtmlTag*)this;
|
||||
while (cur->m_Next)
|
||||
cur = cur->m_Next;
|
||||
return cur;
|
||||
}
|
||||
}
|
||||
|
||||
wxHtmlTag *wxHtmlTag::GetNextTag() const
|
||||
{
|
||||
if (m_FirstChild) return m_FirstChild;
|
||||
if (m_Next) return m_Next;
|
||||
wxHtmlTag *cur = m_Parent;
|
||||
if (!cur) return NULL;
|
||||
while (cur->m_Parent && !cur->m_Next)
|
||||
cur = cur->m_Parent;
|
||||
return cur->m_Next;
|
||||
}
|
||||
|
||||
#endif
|
||||
798
src/html/htmlwin.cpp
Normal file
798
src/html/htmlwin.cpp
Normal file
@@ -0,0 +1,798 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmlwin.cpp
|
||||
// Purpose: wxHtmlWindow class for parsing & displaying HTML (implementation)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "htmlwin.h"
|
||||
#pragma implementation "htmlproc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/frame.h"
|
||||
#endif
|
||||
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/html/htmlproc.h"
|
||||
#include "wx/list.h"
|
||||
|
||||
#include "wx/arrimpl.cpp"
|
||||
#include "wx/listimpl.cpp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlHistoryItem
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// item of history list
|
||||
class WXDLLEXPORT wxHtmlHistoryItem
|
||||
{
|
||||
public:
|
||||
wxHtmlHistoryItem(const wxString& p, const wxString& a) {m_Page = p, m_Anchor = a, m_Pos = 0;}
|
||||
int GetPos() const {return m_Pos;}
|
||||
void SetPos(int p) {m_Pos = p;}
|
||||
const wxString& GetPage() const {return m_Page;}
|
||||
const wxString& GetAnchor() const {return m_Anchor;}
|
||||
|
||||
private:
|
||||
wxString m_Page;
|
||||
wxString m_Anchor;
|
||||
int m_Pos;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// our private arrays:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray);
|
||||
WX_DEFINE_OBJARRAY(wxHtmlHistoryArray);
|
||||
|
||||
WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList);
|
||||
WX_DEFINE_LIST(wxHtmlProcessorList);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
void wxHtmlWindow::Init()
|
||||
{
|
||||
m_tmpMouseMoved = FALSE;
|
||||
m_tmpLastLink = NULL;
|
||||
m_tmpLastCell = NULL;
|
||||
m_tmpCanDrawLocks = 0;
|
||||
m_FS = new wxFileSystem();
|
||||
m_RelatedStatusBar = -1;
|
||||
m_RelatedFrame = NULL;
|
||||
m_TitleFormat = wxT("%s");
|
||||
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
|
||||
m_Cell = NULL;
|
||||
m_Parser = new wxHtmlWinParser(this);
|
||||
m_Parser->SetFS(m_FS);
|
||||
m_HistoryPos = -1;
|
||||
m_HistoryOn = TRUE;
|
||||
m_History = new wxHtmlHistoryArray;
|
||||
m_Processors = NULL;
|
||||
m_Style = 0;
|
||||
SetBorders(10);
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name)
|
||||
{
|
||||
if (!wxScrolledWindow::Create(parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL, name))
|
||||
return FALSE;
|
||||
|
||||
m_Style = style;
|
||||
SetPage(wxT("<html><body></body></html>"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
wxHtmlWindow::~wxHtmlWindow()
|
||||
{
|
||||
HistoryClear();
|
||||
|
||||
if (m_Cell) delete m_Cell;
|
||||
|
||||
delete m_Parser;
|
||||
delete m_FS;
|
||||
delete m_History;
|
||||
delete m_Processors;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::SetRelatedFrame(wxFrame* frame, const wxString& format)
|
||||
{
|
||||
m_RelatedFrame = frame;
|
||||
m_TitleFormat = format;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::SetRelatedStatusBar(int bar)
|
||||
{
|
||||
m_RelatedStatusBar = bar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes)
|
||||
{
|
||||
wxString op = m_OpenedPage;
|
||||
|
||||
m_Parser->SetFonts(normal_face, fixed_face, sizes);
|
||||
// fonts changed => contents invalid, so reload the page:
|
||||
SetPage(wxT("<html><body></body></html>"));
|
||||
if (!op.IsEmpty()) LoadPage(op);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlWindow::SetPage(const wxString& source)
|
||||
{
|
||||
wxString newsrc(source);
|
||||
|
||||
// pass HTML through registered processors:
|
||||
if (m_Processors || m_GlobalProcessors)
|
||||
{
|
||||
wxHtmlProcessorList::Node *nodeL, *nodeG;
|
||||
int prL, prG;
|
||||
|
||||
nodeL = (m_Processors) ? m_Processors->GetFirst() : NULL;
|
||||
nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : NULL;
|
||||
|
||||
// VS: there are two lists, global and local, both of them sorted by
|
||||
// priority. Since we have to go through _both_ lists with
|
||||
// decreasing priority, we "merge-sort" the lists on-line by
|
||||
// processing that one of the two heads that has higher priority
|
||||
// in every iteration
|
||||
while (nodeL || nodeG)
|
||||
{
|
||||
prL = (nodeL) ? nodeL->GetData()->GetPriority() : -1;
|
||||
prG = (nodeG) ? nodeG->GetData()->GetPriority() : -1;
|
||||
if (prL > prG)
|
||||
{
|
||||
if (nodeL->GetData()->IsEnabled())
|
||||
newsrc = nodeL->GetData()->Process(newsrc);
|
||||
nodeL = nodeL->GetNext();
|
||||
}
|
||||
else // prL <= prG
|
||||
{
|
||||
if (nodeG->GetData()->IsEnabled())
|
||||
newsrc = nodeG->GetData()->Process(newsrc);
|
||||
nodeG = nodeG->GetNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ...and run the parser on it:
|
||||
wxClientDC *dc = new wxClientDC(this);
|
||||
dc->SetMapMode(wxMM_TEXT);
|
||||
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
|
||||
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
|
||||
m_Parser->SetDC(dc);
|
||||
if (m_Cell)
|
||||
{
|
||||
delete m_Cell;
|
||||
m_Cell = NULL;
|
||||
}
|
||||
m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc);
|
||||
delete dc;
|
||||
m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
|
||||
m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||
CreateLayout();
|
||||
if (m_tmpCanDrawLocks == 0)
|
||||
Refresh();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::AppendToPage(const wxString& source)
|
||||
{
|
||||
return SetPage(*(GetParser()->GetSource()) + source);
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::LoadPage(const wxString& location)
|
||||
{
|
||||
wxBusyCursor busyCursor;
|
||||
|
||||
wxFSFile *f;
|
||||
bool rt_val;
|
||||
bool needs_refresh = FALSE;
|
||||
|
||||
m_tmpCanDrawLocks++;
|
||||
if (m_HistoryOn && (m_HistoryPos != -1))
|
||||
{
|
||||
// store scroll position into history item:
|
||||
int x, y;
|
||||
GetViewStart(&x, &y);
|
||||
(*m_History)[m_HistoryPos].SetPos(y);
|
||||
}
|
||||
|
||||
if (location[0] == wxT('#'))
|
||||
{
|
||||
// local anchor:
|
||||
wxString anch = location.Mid(1) /*1 to end*/;
|
||||
m_tmpCanDrawLocks--;
|
||||
rt_val = ScrollToAnchor(anch);
|
||||
m_tmpCanDrawLocks++;
|
||||
}
|
||||
else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage)
|
||||
{
|
||||
wxString anch = location.AfterFirst(wxT('#'));
|
||||
m_tmpCanDrawLocks--;
|
||||
rt_val = ScrollToAnchor(anch);
|
||||
m_tmpCanDrawLocks++;
|
||||
}
|
||||
else if (location.Find(wxT('#')) != wxNOT_FOUND &&
|
||||
(m_FS->GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage)
|
||||
{
|
||||
wxString anch = location.AfterFirst(wxT('#'));
|
||||
m_tmpCanDrawLocks--;
|
||||
rt_val = ScrollToAnchor(anch);
|
||||
m_tmpCanDrawLocks++;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
needs_refresh = TRUE;
|
||||
// load&display it:
|
||||
if (m_RelatedStatusBar != -1)
|
||||
{
|
||||
m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
|
||||
Refresh(FALSE);
|
||||
}
|
||||
|
||||
f = m_Parser->OpenURL(wxHTML_URL_PAGE, location);
|
||||
|
||||
// try to interpret 'location' as filename instead of URL:
|
||||
if (f == NULL)
|
||||
{
|
||||
wxFileName fn(location);
|
||||
wxString location2 = wxFileSystem::FileNameToURL(fn);
|
||||
f = m_Parser->OpenURL(wxHTML_URL_PAGE, location2);
|
||||
}
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
|
||||
m_tmpCanDrawLocks--;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
wxNode *node;
|
||||
wxString src = wxEmptyString;
|
||||
|
||||
if (m_RelatedStatusBar != -1)
|
||||
{
|
||||
wxString msg = _("Loading : ") + location;
|
||||
m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
|
||||
Refresh(FALSE);
|
||||
}
|
||||
|
||||
node = m_Filters.GetFirst();
|
||||
while (node)
|
||||
{
|
||||
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
|
||||
if (h->CanRead(*f))
|
||||
{
|
||||
src = h->ReadFile(*f);
|
||||
break;
|
||||
}
|
||||
node = node->GetNext();
|
||||
}
|
||||
if (src == wxEmptyString)
|
||||
{
|
||||
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
|
||||
src = m_DefaultFilter->ReadFile(*f);
|
||||
}
|
||||
|
||||
m_FS->ChangePathTo(f->GetLocation());
|
||||
rt_val = SetPage(src);
|
||||
m_OpenedPage = f->GetLocation();
|
||||
if (f->GetAnchor() != wxEmptyString)
|
||||
{
|
||||
ScrollToAnchor(f->GetAnchor());
|
||||
}
|
||||
|
||||
delete f;
|
||||
|
||||
if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(_("Done"), m_RelatedStatusBar);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_HistoryOn) // add this page to history there:
|
||||
{
|
||||
int c = m_History->GetCount() - (m_HistoryPos + 1);
|
||||
|
||||
if (m_HistoryPos < 0 ||
|
||||
(*m_History)[m_HistoryPos].GetPage() != m_OpenedPage ||
|
||||
(*m_History)[m_HistoryPos].GetAnchor() != m_OpenedAnchor)
|
||||
{
|
||||
m_HistoryPos++;
|
||||
for (int i = 0; i < c; i++)
|
||||
m_History->RemoveAt(m_HistoryPos);
|
||||
m_History->Add(new wxHtmlHistoryItem(m_OpenedPage, m_OpenedAnchor));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_OpenedPageTitle == wxEmptyString)
|
||||
OnSetTitle(wxFileNameFromPath(m_OpenedPage));
|
||||
|
||||
if (needs_refresh)
|
||||
{
|
||||
m_tmpCanDrawLocks--;
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
m_tmpCanDrawLocks--;
|
||||
|
||||
return rt_val;
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlWindow::LoadFile(const wxFileName& filename)
|
||||
{
|
||||
wxString url = wxFileSystem::FileNameToURL(filename);
|
||||
return LoadPage(url);
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
|
||||
{
|
||||
const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
|
||||
if (!c)
|
||||
{
|
||||
wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();
|
||||
Scroll(-1, y / wxHTML_SCROLL_STEP);
|
||||
m_OpenedAnchor = anchor;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWindow::OnSetTitle(const wxString& title)
|
||||
{
|
||||
if (m_RelatedFrame)
|
||||
{
|
||||
wxString tit;
|
||||
tit.Printf(m_TitleFormat, title.c_str());
|
||||
m_RelatedFrame->SetTitle(tit);
|
||||
}
|
||||
m_OpenedPageTitle = title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::CreateLayout()
|
||||
{
|
||||
int ClientWidth, ClientHeight;
|
||||
|
||||
if (!m_Cell) return;
|
||||
|
||||
if (m_Style & wxHW_SCROLLBAR_NEVER)
|
||||
{
|
||||
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
|
||||
GetClientSize(&ClientWidth, &ClientHeight);
|
||||
m_Cell->Layout(ClientWidth);
|
||||
}
|
||||
|
||||
else {
|
||||
GetClientSize(&ClientWidth, &ClientHeight);
|
||||
m_Cell->Layout(ClientWidth);
|
||||
if (ClientHeight < m_Cell->GetHeight() + GetCharHeight())
|
||||
{
|
||||
SetScrollbars(
|
||||
wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
|
||||
m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
|
||||
(m_Cell->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
|
||||
/*cheat: top-level frag is always container*/);
|
||||
}
|
||||
else /* we fit into window, no need for scrollbars */
|
||||
{
|
||||
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
|
||||
GetClientSize(&ClientWidth, &ClientHeight);
|
||||
m_Cell->Layout(ClientWidth); // ...and relayout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
|
||||
{
|
||||
wxString oldpath;
|
||||
wxString tmp;
|
||||
int p_fontsizes[7];
|
||||
wxString p_fff, p_ffn;
|
||||
|
||||
if (path != wxEmptyString)
|
||||
{
|
||||
oldpath = cfg->GetPath();
|
||||
cfg->SetPath(path);
|
||||
}
|
||||
|
||||
m_Borders = cfg->Read(wxT("wxHtmlWindow/Borders"), m_Borders);
|
||||
p_fff = cfg->Read(wxT("wxHtmlWindow/FontFaceFixed"), m_Parser->m_FontFaceFixed);
|
||||
p_ffn = cfg->Read(wxT("wxHtmlWindow/FontFaceNormal"), m_Parser->m_FontFaceNormal);
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
|
||||
p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]);
|
||||
}
|
||||
SetFonts(p_ffn, p_fff, p_fontsizes);
|
||||
|
||||
if (path != wxEmptyString)
|
||||
cfg->SetPath(oldpath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
|
||||
{
|
||||
wxString oldpath;
|
||||
wxString tmp;
|
||||
|
||||
if (path != wxEmptyString)
|
||||
{
|
||||
oldpath = cfg->GetPath();
|
||||
cfg->SetPath(path);
|
||||
}
|
||||
|
||||
cfg->Write(wxT("wxHtmlWindow/Borders"), (long) m_Borders);
|
||||
cfg->Write(wxT("wxHtmlWindow/FontFaceFixed"), m_Parser->m_FontFaceFixed);
|
||||
cfg->Write(wxT("wxHtmlWindow/FontFaceNormal"), m_Parser->m_FontFaceNormal);
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
|
||||
cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
|
||||
}
|
||||
|
||||
if (path != wxEmptyString)
|
||||
cfg->SetPath(oldpath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlWindow::HistoryBack()
|
||||
{
|
||||
wxString a, l;
|
||||
|
||||
if (m_HistoryPos < 1) return FALSE;
|
||||
|
||||
// store scroll position into history item:
|
||||
int x, y;
|
||||
GetViewStart(&x, &y);
|
||||
(*m_History)[m_HistoryPos].SetPos(y);
|
||||
|
||||
// go to previous position:
|
||||
m_HistoryPos--;
|
||||
|
||||
l = (*m_History)[m_HistoryPos].GetPage();
|
||||
a = (*m_History)[m_HistoryPos].GetAnchor();
|
||||
m_HistoryOn = FALSE;
|
||||
m_tmpCanDrawLocks++;
|
||||
if (a == wxEmptyString) LoadPage(l);
|
||||
else LoadPage(l + wxT("#") + a);
|
||||
m_HistoryOn = TRUE;
|
||||
m_tmpCanDrawLocks--;
|
||||
Scroll(0, (*m_History)[m_HistoryPos].GetPos());
|
||||
Refresh();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::HistoryCanBack()
|
||||
{
|
||||
if (m_HistoryPos < 1) return FALSE;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlWindow::HistoryForward()
|
||||
{
|
||||
wxString a, l;
|
||||
|
||||
if (m_HistoryPos == -1) return FALSE;
|
||||
if (m_HistoryPos >= (int)m_History->GetCount() - 1)return FALSE;
|
||||
|
||||
m_OpenedPage = wxEmptyString; // this will disable adding new entry into history in LoadPage()
|
||||
|
||||
m_HistoryPos++;
|
||||
l = (*m_History)[m_HistoryPos].GetPage();
|
||||
a = (*m_History)[m_HistoryPos].GetAnchor();
|
||||
m_HistoryOn = FALSE;
|
||||
m_tmpCanDrawLocks++;
|
||||
if (a == wxEmptyString) LoadPage(l);
|
||||
else LoadPage(l + wxT("#") + a);
|
||||
m_HistoryOn = TRUE;
|
||||
m_tmpCanDrawLocks--;
|
||||
Scroll(0, (*m_History)[m_HistoryPos].GetPos());
|
||||
Refresh();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::HistoryCanForward()
|
||||
{
|
||||
if (m_HistoryPos == -1) return FALSE;
|
||||
if (m_HistoryPos >= (int)m_History->GetCount() - 1)return FALSE;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWindow::HistoryClear()
|
||||
{
|
||||
m_History->Empty();
|
||||
m_HistoryPos = -1;
|
||||
}
|
||||
|
||||
void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
|
||||
{
|
||||
if (!m_Processors)
|
||||
{
|
||||
m_Processors = new wxHtmlProcessorList;
|
||||
m_Processors->DeleteContents(TRUE);
|
||||
}
|
||||
wxHtmlProcessorList::Node *node;
|
||||
|
||||
for (node = m_Processors->GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
if (processor->GetPriority() > node->GetData()->GetPriority())
|
||||
{
|
||||
m_Processors->Insert(node, processor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_Processors->Append(processor);
|
||||
}
|
||||
|
||||
/*static */ void wxHtmlWindow::AddGlobalProcessor(wxHtmlProcessor *processor)
|
||||
{
|
||||
if (!m_GlobalProcessors)
|
||||
{
|
||||
m_GlobalProcessors = new wxHtmlProcessorList;
|
||||
m_GlobalProcessors->DeleteContents(TRUE);
|
||||
}
|
||||
wxHtmlProcessorList::Node *node;
|
||||
|
||||
for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
if (processor->GetPriority() > node->GetData()->GetPriority())
|
||||
{
|
||||
m_GlobalProcessors->Insert(node, processor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_GlobalProcessors->Append(processor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxList wxHtmlWindow::m_Filters;
|
||||
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
|
||||
wxCursor *wxHtmlWindow::s_cur_hand = NULL;
|
||||
wxCursor *wxHtmlWindow::s_cur_arrow = NULL;
|
||||
wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
|
||||
|
||||
void wxHtmlWindow::CleanUpStatics()
|
||||
{
|
||||
wxDELETE(m_DefaultFilter);
|
||||
m_Filters.DeleteContents(TRUE);
|
||||
m_Filters.Clear();
|
||||
wxDELETE(m_GlobalProcessors);
|
||||
wxDELETE(s_cur_hand);
|
||||
wxDELETE(s_cur_arrow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::AddFilter(wxHtmlFilter *filter)
|
||||
{
|
||||
m_Filters.Append(filter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
LoadPage(link.GetHref());
|
||||
}
|
||||
|
||||
void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell,
|
||||
wxCoord x, wxCoord y,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxCHECK_RET( cell, _T("can't be called with NULL cell") );
|
||||
|
||||
cell->OnMouseClick(this, x, y, event);
|
||||
}
|
||||
|
||||
void wxHtmlWindow::OnCellMouseHover(wxHtmlCell * WXUNUSED(cell),
|
||||
wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
|
||||
{
|
||||
// do nothing here
|
||||
}
|
||||
|
||||
void wxHtmlWindow::OnDraw(wxDC& dc)
|
||||
{
|
||||
if (m_tmpCanDrawLocks > 0 || m_Cell == NULL) return;
|
||||
|
||||
int x, y;
|
||||
wxRect rect = GetUpdateRegion().GetBox();
|
||||
|
||||
dc.SetMapMode(wxMM_TEXT);
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
GetViewStart(&x, &y);
|
||||
|
||||
m_Cell->Draw(dc, 0, 0,
|
||||
y * wxHTML_SCROLL_STEP + rect.GetTop(),
|
||||
y * wxHTML_SCROLL_STEP + rect.GetBottom());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
wxScrolledWindow::OnSize(event);
|
||||
CreateLayout();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
{
|
||||
m_tmpMouseMoved = TRUE;
|
||||
|
||||
if (event.ButtonDown())
|
||||
{
|
||||
SetFocus();
|
||||
if ( m_Cell )
|
||||
{
|
||||
int sx, sy;
|
||||
GetViewStart(&sx, &sy);
|
||||
sx *= wxHTML_SCROLL_STEP;
|
||||
sy *= wxHTML_SCROLL_STEP;
|
||||
|
||||
wxPoint pos = event.GetPosition();
|
||||
pos.x += sx;
|
||||
pos.y += sy;
|
||||
|
||||
wxHtmlCell *cell = m_Cell->FindCellByPos(pos.x, pos.y);
|
||||
|
||||
// VZ: is it possible that we don't find anything at all?
|
||||
// VS: yes. FindCellByPos returns terminal cell and
|
||||
// containers may have empty borders
|
||||
if ( cell )
|
||||
OnCellClicked(cell, pos.x, pos.y, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||
{
|
||||
if (s_cur_hand == NULL)
|
||||
{
|
||||
s_cur_hand = new wxCursor(wxCURSOR_HAND);
|
||||
s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
|
||||
}
|
||||
|
||||
if (m_tmpMouseMoved && (m_Cell != NULL))
|
||||
{
|
||||
int sx, sy;
|
||||
GetViewStart(&sx, &sy);
|
||||
sx *= wxHTML_SCROLL_STEP;
|
||||
sy *= wxHTML_SCROLL_STEP;
|
||||
|
||||
int x, y;
|
||||
wxGetMousePosition(&x, &y);
|
||||
ScreenToClient(&x, &y);
|
||||
x += sx;
|
||||
y += sy;
|
||||
|
||||
wxHtmlCell *cell = m_Cell->FindCellByPos(x, y);
|
||||
if ( cell != m_tmpLastCell )
|
||||
{
|
||||
wxHtmlLinkInfo *lnk = cell ? cell->GetLink(x, y) : NULL;
|
||||
|
||||
if (lnk != m_tmpLastLink)
|
||||
{
|
||||
if (lnk == NULL)
|
||||
{
|
||||
SetCursor(*s_cur_arrow);
|
||||
if (m_RelatedStatusBar != -1)
|
||||
m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursor(*s_cur_hand);
|
||||
if (m_RelatedStatusBar != -1)
|
||||
m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
|
||||
}
|
||||
m_tmpLastLink = lnk;
|
||||
}
|
||||
|
||||
m_tmpLastCell = cell;
|
||||
}
|
||||
else // mouse moved but stayed in the same cell
|
||||
{
|
||||
if ( cell )
|
||||
OnCellMouseHover(cell, x, y);
|
||||
}
|
||||
|
||||
m_tmpMouseMoved = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxHtmlProcessor,wxObject)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
|
||||
EVT_SIZE(wxHtmlWindow::OnSize)
|
||||
EVT_LEFT_DOWN(wxHtmlWindow::OnMouseEvent)
|
||||
EVT_RIGHT_DOWN(wxHtmlWindow::OnMouseEvent)
|
||||
EVT_MOTION(wxHtmlWindow::OnMouseEvent)
|
||||
EVT_IDLE(wxHtmlWindow::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// A module to allow initialization/cleanup
|
||||
// without calling these functions from app.cpp or from
|
||||
// the user's application.
|
||||
|
||||
class wxHtmlWinModule: public wxModule
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlWinModule)
|
||||
public:
|
||||
wxHtmlWinModule() : wxModule() {}
|
||||
bool OnInit() { return TRUE; }
|
||||
void OnExit() { wxHtmlWindow::CleanUpStatics(); }
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule)
|
||||
|
||||
|
||||
// This hack forces the linker to always link in m_* files
|
||||
// (wxHTML doesn't work without handlers from these files)
|
||||
#include "wx/html/forcelnk.h"
|
||||
FORCE_WXHTML_MODULES()
|
||||
|
||||
#endif
|
||||
633
src/html/htmprint.cpp
Normal file
633
src/html/htmprint.cpp
Normal file
@@ -0,0 +1,633 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: htmprint.cpp
|
||||
// Purpose: html printing classes
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 25/09/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vaclav Slavik, 1999
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "htmprint.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/dc.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS
|
||||
|
||||
#include "wx/dc.h"
|
||||
#include "wx/print.h"
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/html/htmprint.h"
|
||||
#include "wx/wxhtml.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlDCRenderer
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
wxHtmlDCRenderer::wxHtmlDCRenderer() : wxObject()
|
||||
{
|
||||
m_DC = NULL;
|
||||
m_Width = m_Height = 0;
|
||||
m_Cells = NULL;
|
||||
m_Parser = new wxHtmlWinParser(NULL);
|
||||
m_FS = new wxFileSystem();
|
||||
m_Parser->SetFS(m_FS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlDCRenderer::~wxHtmlDCRenderer()
|
||||
{
|
||||
if (m_Cells) delete m_Cells;
|
||||
if (m_Parser) delete m_Parser;
|
||||
if (m_FS) delete m_FS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlDCRenderer::SetDC(wxDC *dc, double pixel_scale)
|
||||
{
|
||||
m_DC = dc;
|
||||
m_Parser->SetDC(m_DC, pixel_scale);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlDCRenderer::SetSize(int width, int height)
|
||||
{
|
||||
m_Width = width;
|
||||
m_Height = height;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepath, bool isdir)
|
||||
{
|
||||
if (m_DC == NULL) return;
|
||||
|
||||
if (m_Cells != NULL) delete m_Cells;
|
||||
|
||||
m_FS->ChangePathTo(basepath, isdir);
|
||||
m_Cells = (wxHtmlContainerCell*) m_Parser->Parse(html);
|
||||
m_Cells->SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
|
||||
m_Cells->Layout(m_Width);
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlDCRenderer::SetFonts(wxString normal_face, wxString fixed_face,
|
||||
const int *sizes)
|
||||
{
|
||||
m_Parser->SetFonts(normal_face, fixed_face, sizes);
|
||||
if (m_DC == NULL && m_Cells != NULL) m_Cells->Layout(m_Width);
|
||||
}
|
||||
|
||||
|
||||
int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render, int to, int *known_pagebreaks, int number_of_pages)
|
||||
{
|
||||
int pbreak, hght;
|
||||
|
||||
if (m_Cells == NULL || m_DC == NULL) return 0;
|
||||
|
||||
pbreak = (int)(from + m_Height);
|
||||
while (m_Cells->AdjustPagebreak(&pbreak, known_pagebreaks, number_of_pages)) {}
|
||||
hght = pbreak - from;
|
||||
if(to < hght)
|
||||
hght = to;
|
||||
|
||||
if (!dont_render)
|
||||
{
|
||||
m_DC->SetBrush(*wxWHITE_BRUSH);
|
||||
|
||||
m_DC->SetClippingRegion(x, y, m_Width, hght);
|
||||
m_Cells->Draw(*m_DC,
|
||||
x, (y - from),
|
||||
y, pbreak + (y /*- from*/));
|
||||
m_DC->DestroyClippingRegion();
|
||||
}
|
||||
|
||||
if (pbreak < m_Cells->GetHeight()) return pbreak;
|
||||
else return GetTotalHeight();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int wxHtmlDCRenderer::GetTotalHeight()
|
||||
{
|
||||
if (m_Cells) return m_Cells->GetHeight();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlPrintout
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
wxHtmlPrintout::wxHtmlPrintout(const wxString& title) : wxPrintout(title)
|
||||
{
|
||||
m_Renderer = new wxHtmlDCRenderer;
|
||||
m_RendererHdr = new wxHtmlDCRenderer;
|
||||
m_NumPages = wxHTML_PRINT_MAX_PAGES;
|
||||
m_Document = m_BasePath = wxEmptyString; m_BasePathIsDir = TRUE;
|
||||
m_Headers[0] = m_Headers[1] = wxEmptyString;
|
||||
m_Footers[0] = m_Footers[1] = wxEmptyString;
|
||||
m_HeaderHeight = m_FooterHeight = 0;
|
||||
SetMargins(); // to default values
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlPrintout::~wxHtmlPrintout()
|
||||
{
|
||||
delete m_Renderer;
|
||||
delete m_RendererHdr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
|
||||
{
|
||||
int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
|
||||
float ppmm_h, ppmm_v;
|
||||
|
||||
if (!wxPrintout::OnBeginDocument(startPage, endPage)) return FALSE;
|
||||
|
||||
GetPageSizePixels(&pageWidth, &pageHeight);
|
||||
GetPageSizeMM(&mm_w, &mm_h);
|
||||
ppmm_h = (float)pageWidth / mm_w;
|
||||
ppmm_v = (float)pageHeight / mm_h;
|
||||
|
||||
int ppiPrinterX, ppiPrinterY;
|
||||
GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
|
||||
int ppiScreenX, ppiScreenY;
|
||||
GetPPIScreen(&ppiScreenX, &ppiScreenY);
|
||||
|
||||
wxDisplaySize(&scr_w, &scr_h);
|
||||
GetDC()->GetSize(&dc_w, &dc_h);
|
||||
|
||||
GetDC()->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
|
||||
|
||||
/* prepare headers/footers renderer: */
|
||||
|
||||
m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
|
||||
m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
|
||||
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
|
||||
if (m_Headers[0] != wxEmptyString)
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
|
||||
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
|
||||
}
|
||||
else if (m_Headers[1] != wxEmptyString)
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
|
||||
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
|
||||
}
|
||||
if (m_Footers[0] != wxEmptyString)
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
|
||||
m_FooterHeight = m_RendererHdr->GetTotalHeight();
|
||||
}
|
||||
else if (m_Footers[1] != wxEmptyString)
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
|
||||
m_FooterHeight = m_RendererHdr->GetTotalHeight();
|
||||
}
|
||||
|
||||
/* prepare main renderer: */
|
||||
m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
|
||||
m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
|
||||
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) -
|
||||
m_FooterHeight - m_HeaderHeight -
|
||||
((m_HeaderHeight == 0) ? 0 : m_MarginSpace * ppmm_v) -
|
||||
((m_FooterHeight == 0) ? 0 : m_MarginSpace * ppmm_v)
|
||||
));
|
||||
m_Renderer->SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
|
||||
CountPages();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlPrintout::OnPrintPage(int page)
|
||||
{
|
||||
wxDC *dc = GetDC();
|
||||
if (dc)
|
||||
{
|
||||
if (HasPage(page))
|
||||
RenderPage(dc, page);
|
||||
return TRUE;
|
||||
}
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
|
||||
{
|
||||
*minPage = 1;
|
||||
*maxPage = wxHTML_PRINT_MAX_PAGES;
|
||||
*selPageFrom = 1;
|
||||
*selPageTo = wxHTML_PRINT_MAX_PAGES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlPrintout::HasPage(int pageNum)
|
||||
{
|
||||
return (pageNum >= 1 && pageNum <= m_NumPages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::SetHtmlText(const wxString& html, const wxString &basepath, bool isdir)
|
||||
{
|
||||
m_Document = html;
|
||||
m_BasePath = basepath;
|
||||
m_BasePathIsDir = isdir;
|
||||
}
|
||||
|
||||
void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
|
||||
{
|
||||
wxFileSystem fs;
|
||||
wxFSFile *ff = fs.OpenFile(htmlfile);
|
||||
|
||||
if (ff == NULL)
|
||||
{
|
||||
wxLogError(htmlfile + _(": file does not exist!"));
|
||||
return;
|
||||
}
|
||||
|
||||
wxHtmlFilterHTML filter;
|
||||
wxString doc = filter.ReadFile(*ff);
|
||||
|
||||
SetHtmlText(doc, htmlfile, FALSE);
|
||||
delete ff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::SetHeader(const wxString& header, int pg)
|
||||
{
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
|
||||
m_Headers[0] = header;
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
|
||||
m_Headers[1] = header;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::SetFooter(const wxString& footer, int pg)
|
||||
{
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
|
||||
m_Footers[0] = footer;
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
|
||||
m_Footers[1] = footer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::CountPages()
|
||||
{
|
||||
wxBusyCursor wait;
|
||||
int pageWidth, pageHeight, mm_w, mm_h;
|
||||
float ppmm_h, ppmm_v;
|
||||
|
||||
GetPageSizePixels(&pageWidth, &pageHeight);
|
||||
GetPageSizeMM(&mm_w, &mm_h);
|
||||
ppmm_h = (float)pageWidth / mm_w;
|
||||
ppmm_v = (float)pageHeight / mm_h;
|
||||
|
||||
int pos = 0;
|
||||
|
||||
m_NumPages = 0;
|
||||
|
||||
m_PageBreaks[0] = 0;
|
||||
do
|
||||
{
|
||||
pos = m_Renderer->Render((int)( ppmm_h * m_MarginLeft),
|
||||
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
|
||||
pos, TRUE, INT_MAX, m_PageBreaks, m_NumPages);
|
||||
m_PageBreaks[++m_NumPages] = pos;
|
||||
} while (pos < m_Renderer->GetTotalHeight());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
|
||||
{
|
||||
wxBusyCursor wait;
|
||||
|
||||
int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
|
||||
float ppmm_h, ppmm_v;
|
||||
|
||||
GetPageSizePixels(&pageWidth, &pageHeight);
|
||||
GetPageSizeMM(&mm_w, &mm_h);
|
||||
ppmm_h = (float)pageWidth / mm_w;
|
||||
ppmm_v = (float)pageHeight / mm_h;
|
||||
wxDisplaySize(&scr_w, &scr_h);
|
||||
dc->GetSize(&dc_w, &dc_h);
|
||||
|
||||
int ppiPrinterX, ppiPrinterY;
|
||||
GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
|
||||
int ppiScreenX, ppiScreenY;
|
||||
GetPPIScreen(&ppiScreenX, &ppiScreenY);
|
||||
|
||||
dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
|
||||
|
||||
m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
|
||||
|
||||
dc->SetBackgroundMode(wxTRANSPARENT);
|
||||
|
||||
m_Renderer->Render((int) (ppmm_h * m_MarginLeft),
|
||||
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
|
||||
m_PageBreaks[page-1], FALSE, m_PageBreaks[page]-m_PageBreaks[page-1]);
|
||||
|
||||
m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
|
||||
if (m_Headers[page % 2] != wxEmptyString)
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
|
||||
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
|
||||
}
|
||||
if (m_Footers[page % 2] != wxEmptyString)
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
|
||||
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page)
|
||||
{
|
||||
wxString r = instr;
|
||||
wxString num;
|
||||
|
||||
num.Printf(wxT("%i"), page);
|
||||
r.Replace(wxT("@PAGENUM@"), num);
|
||||
|
||||
num.Printf(wxT("%i"), m_NumPages);
|
||||
r.Replace(wxT("@PAGESCNT@"), num);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::SetMargins(float top, float bottom, float left, float right, float spaces)
|
||||
{
|
||||
m_MarginTop = top;
|
||||
m_MarginBottom = bottom;
|
||||
m_MarginLeft = left;
|
||||
m_MarginRight = right;
|
||||
m_MarginSpace = spaces;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void wxHtmlPrintout::SetFonts(wxString normal_face, wxString fixed_face,
|
||||
const int *sizes)
|
||||
{
|
||||
m_Renderer->SetFonts(normal_face, fixed_face, sizes);
|
||||
m_RendererHdr->SetFonts(normal_face, fixed_face, sizes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxHtmlEasyPrinting
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxFrame *parent_frame)
|
||||
{
|
||||
m_Frame = parent_frame;
|
||||
m_Name = name;
|
||||
m_PrintData = new wxPrintData;
|
||||
m_PageSetupData = new wxPageSetupDialogData;
|
||||
m_Headers[0] = m_Headers[1] = m_Footers[0] = m_Footers[1] = wxEmptyString;
|
||||
|
||||
m_PageSetupData->EnableMargins(TRUE);
|
||||
m_PageSetupData->SetMarginTopLeft(wxPoint(25, 25));
|
||||
m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25));
|
||||
|
||||
SetFonts(wxEmptyString, wxEmptyString, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlEasyPrinting::~wxHtmlEasyPrinting()
|
||||
{
|
||||
delete m_PrintData;
|
||||
delete m_PageSetupData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile)
|
||||
{
|
||||
wxHtmlPrintout *p1 = CreatePrintout();
|
||||
p1->SetHtmlFile(htmlfile);
|
||||
wxHtmlPrintout *p2 = CreatePrintout();
|
||||
p2->SetHtmlFile(htmlfile);
|
||||
return DoPreview(p1, p2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath)
|
||||
{
|
||||
wxHtmlPrintout *p1 = CreatePrintout();
|
||||
p1->SetHtmlText(htmltext, basepath, TRUE);
|
||||
wxHtmlPrintout *p2 = CreatePrintout();
|
||||
p2->SetHtmlText(htmltext, basepath, TRUE);
|
||||
return DoPreview(p1, p2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile)
|
||||
{
|
||||
wxHtmlPrintout *p = CreatePrintout();
|
||||
p->SetHtmlFile(htmlfile);
|
||||
bool ret = DoPrint(p);
|
||||
delete p;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath)
|
||||
{
|
||||
wxHtmlPrintout *p = CreatePrintout();
|
||||
p->SetHtmlText(htmltext, basepath, TRUE);
|
||||
bool ret = DoPrint(p);
|
||||
delete p;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2)
|
||||
{
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxPrintDialogData printDialogData(*m_PrintData);
|
||||
wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
|
||||
if (!preview->Ok())
|
||||
{
|
||||
delete preview;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame,
|
||||
m_Name + _(" Preview"),
|
||||
wxPoint(100, 100), wxSize(650, 500));
|
||||
frame->Centre(wxBOTH);
|
||||
frame->Initialize();
|
||||
frame->Show(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout)
|
||||
{
|
||||
wxPrintDialogData printDialogData(*m_PrintData);
|
||||
wxPrinter printer(&printDialogData);
|
||||
|
||||
if (!printer.Print(m_Frame, printout, TRUE))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
(*m_PrintData) = printer.GetPrintDialogData().GetPrintData();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlEasyPrinting::PrinterSetup()
|
||||
{
|
||||
wxPrintDialogData printDialogData(*m_PrintData);
|
||||
wxPrintDialog printerDialog(m_Frame, &printDialogData);
|
||||
|
||||
printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
||||
|
||||
if (printerDialog.ShowModal() == wxID_OK)
|
||||
(*m_PrintData) = printerDialog.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlEasyPrinting::PageSetup()
|
||||
{
|
||||
if (!m_PrintData->Ok())
|
||||
{
|
||||
wxLogError(_("There was a problem during page setup: you may need to set a default printer."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_PageSetupData->SetPrintData(*m_PrintData);
|
||||
wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
|
||||
|
||||
if (pageSetupDialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
(*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
||||
(*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlEasyPrinting::SetHeader(const wxString& header, int pg)
|
||||
{
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
|
||||
m_Headers[0] = header;
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
|
||||
m_Headers[1] = header;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlEasyPrinting::SetFooter(const wxString& footer, int pg)
|
||||
{
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
|
||||
m_Footers[0] = footer;
|
||||
if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
|
||||
m_Footers[1] = footer;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlEasyPrinting::SetFonts(wxString normal_face, wxString fixed_face,
|
||||
const int *sizes)
|
||||
{
|
||||
m_FontFaceNormal = normal_face;
|
||||
m_FontFaceFixed = fixed_face;
|
||||
|
||||
if (sizes)
|
||||
{
|
||||
m_FontsSizes = m_FontsSizesArr;
|
||||
for (int i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i];
|
||||
}
|
||||
else
|
||||
m_FontsSizes = NULL;
|
||||
}
|
||||
|
||||
|
||||
wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout()
|
||||
{
|
||||
wxHtmlPrintout *p = new wxHtmlPrintout(m_Name);
|
||||
|
||||
p->SetFonts(m_FontFaceNormal, m_FontFaceFixed, m_FontsSizes);
|
||||
|
||||
p->SetHeader(m_Headers[0], wxPAGE_EVEN);
|
||||
p->SetHeader(m_Headers[1], wxPAGE_ODD);
|
||||
p->SetFooter(m_Footers[0], wxPAGE_EVEN);
|
||||
p->SetFooter(m_Footers[1], wxPAGE_ODD);
|
||||
|
||||
p->SetMargins(m_PageSetupData->GetMarginTopLeft().y,
|
||||
m_PageSetupData->GetMarginBottomRight().y,
|
||||
m_PageSetupData->GetMarginTopLeft().x,
|
||||
m_PageSetupData->GetMarginBottomRight().x);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// This hack forces the linker to always link in m_* files
|
||||
// (wxHTML doesn't work without handlers from these files)
|
||||
#include "wx/html/forcelnk.h"
|
||||
FORCE_WXHTML_MODULES()
|
||||
|
||||
#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE
|
||||
90
src/html/m_dflist.cpp
Normal file
90
src/html/m_dflist.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_dflist.cpp
|
||||
// Purpose: wxHtml module for definition lists (DL,DT,DD)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
|
||||
FORCE_LINK_ME(m_dflist)
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD" )
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
|
||||
if (tag.GetName() == wxT("DL"))
|
||||
{
|
||||
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (tag.GetName() == wxT("DT"))
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
c->SetAlignHor(wxHTML_ALIGN_LEFT);
|
||||
c->SetMinHeight(m_WParser->GetCharHeight());
|
||||
return FALSE;
|
||||
}
|
||||
else // "DD"
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(DEFLIST)
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(DefinitionList)
|
||||
|
||||
TAGS_MODULE_ADD(DEFLIST)
|
||||
|
||||
TAGS_MODULE_END(DefinitionList)
|
||||
|
||||
#endif
|
||||
321
src/html/m_fonts.cpp
Normal file
321
src/html/m_fonts.cpp
Normal file
@@ -0,0 +1,321 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_fonts.cpp
|
||||
// Purpose: wxHtml module for fonts & colors of fonts
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
#include "wx/fontenum.h"
|
||||
#include "wx/tokenzr.h"
|
||||
|
||||
FORCE_LINK_ME(m_fonts)
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(FONT, "FONT" )
|
||||
|
||||
TAG_HANDLER_VARS
|
||||
wxArrayString m_Faces;
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxColour oldclr = m_WParser->GetActualColor();
|
||||
int oldsize = m_WParser->GetFontSize();
|
||||
wxString oldface = m_WParser->GetFontFace();
|
||||
|
||||
if (tag.HasParam(wxT("COLOR")))
|
||||
{
|
||||
wxColour clr;
|
||||
if (tag.GetParamAsColour(wxT("COLOR"), &clr))
|
||||
{
|
||||
m_WParser->SetActualColor(clr);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
|
||||
}
|
||||
}
|
||||
|
||||
if (tag.HasParam(wxT("SIZE")))
|
||||
{
|
||||
int tmp = 0;
|
||||
wxChar c = tag.GetParam(wxT("SIZE")).GetChar(0);
|
||||
if (tag.GetParamAsInt(wxT("SIZE"), &tmp))
|
||||
{
|
||||
if (c == wxT('+') || c == wxT('-'))
|
||||
m_WParser->SetFontSize(oldsize+tmp);
|
||||
else
|
||||
m_WParser->SetFontSize(tmp);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
}
|
||||
}
|
||||
|
||||
if (tag.HasParam(wxT("FACE")))
|
||||
{
|
||||
if (m_Faces.GetCount() == 0)
|
||||
{
|
||||
wxFontEnumerator enu;
|
||||
enu.EnumerateFacenames();
|
||||
m_Faces = *enu.GetFacenames();
|
||||
}
|
||||
wxStringTokenizer tk(tag.GetParam(wxT("FACE")), wxT(","));
|
||||
int index;
|
||||
|
||||
while (tk.HasMoreTokens())
|
||||
{
|
||||
if ((index = m_Faces.Index(tk.GetNextToken(), FALSE)) != wxNOT_FOUND)
|
||||
{
|
||||
m_WParser->SetFontFace(m_Faces[index]);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
if (oldface != m_WParser->GetFontFace())
|
||||
{
|
||||
m_WParser->SetFontFace(oldface);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
}
|
||||
if (oldsize != m_WParser->GetFontSize())
|
||||
{
|
||||
m_WParser->SetFontSize(oldsize);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
}
|
||||
if (oldclr != m_WParser->GetActualColor())
|
||||
{
|
||||
m_WParser->SetActualColor(oldclr);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(FONT)
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(FACES_U, "U,STRIKE")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int underlined = m_WParser->GetFontUnderlined();
|
||||
|
||||
m_WParser->SetFontUnderlined(TRUE);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetFontUnderlined(underlined);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(FACES_U)
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(FACES_B, "B,STRONG")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int bold = m_WParser->GetFontBold();
|
||||
|
||||
m_WParser->SetFontBold(TRUE);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetFontBold(bold);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(FACES_B)
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(FACES_I, "I,EM,CITE,ADDRESS")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int italic = m_WParser->GetFontItalic();
|
||||
|
||||
m_WParser->SetFontItalic(TRUE);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetFontItalic(italic);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(FACES_I)
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(FACES_TT, "TT,CODE,KBD,SAMP")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int fixed = m_WParser->GetFontFixed();
|
||||
|
||||
m_WParser->SetFontFixed(TRUE);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetFontFixed(fixed);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(FACES_TT)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int old_size, old_b, old_i, old_u, old_f, old_al;
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
old_size = m_WParser->GetFontSize();
|
||||
old_b = m_WParser->GetFontBold();
|
||||
old_i = m_WParser->GetFontItalic();
|
||||
old_u = m_WParser->GetFontUnderlined();
|
||||
old_f = m_WParser->GetFontFixed();
|
||||
old_al = m_WParser->GetAlign();
|
||||
|
||||
m_WParser->SetFontBold(TRUE);
|
||||
m_WParser->SetFontItalic(FALSE);
|
||||
m_WParser->SetFontUnderlined(FALSE);
|
||||
m_WParser->SetFontFixed(FALSE);
|
||||
|
||||
if (tag.GetName() == wxT("H1"))
|
||||
m_WParser->SetFontSize(7);
|
||||
else if (tag.GetName() == wxT("H2"))
|
||||
m_WParser->SetFontSize(6);
|
||||
else if (tag.GetName() == wxT("H3"))
|
||||
m_WParser->SetFontSize(5);
|
||||
else if (tag.GetName() == wxT("H4"))
|
||||
{
|
||||
m_WParser->SetFontSize(5);
|
||||
m_WParser->SetFontItalic(TRUE);
|
||||
m_WParser->SetFontBold(FALSE);
|
||||
}
|
||||
else if (tag.GetName() == wxT("H5"))
|
||||
m_WParser->SetFontSize(4);
|
||||
else if (tag.GetName() == wxT("H6"))
|
||||
{
|
||||
m_WParser->SetFontSize(4);
|
||||
m_WParser->SetFontItalic(TRUE);
|
||||
m_WParser->SetFontBold(FALSE);
|
||||
}
|
||||
|
||||
c = m_WParser->GetContainer();
|
||||
if (c->GetFirstCell())
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
c = m_WParser->GetContainer();
|
||||
}
|
||||
c = m_WParser->GetContainer();
|
||||
|
||||
c->SetAlign(tag);
|
||||
c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
m_WParser->SetAlign(c->GetAlignHor());
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetFontSize(old_size);
|
||||
m_WParser->SetFontBold(old_b);
|
||||
m_WParser->SetFontItalic(old_i);
|
||||
m_WParser->SetFontUnderlined(old_u);
|
||||
m_WParser->SetFontFixed(old_f);
|
||||
m_WParser->SetAlign(old_al);
|
||||
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
c = m_WParser->GetContainer();
|
||||
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(Hx)
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(BIGSMALL, "BIG,SMALL")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int oldsize = m_WParser->GetFontSize();
|
||||
int sz = (tag.GetName() == wxT("BIG")) ? +1 : -1;
|
||||
|
||||
m_WParser->SetFontSize(sz);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetFontSize(oldsize);
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(BIGSMALL)
|
||||
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Fonts)
|
||||
|
||||
TAGS_MODULE_ADD(FONT)
|
||||
TAGS_MODULE_ADD(FACES_U)
|
||||
TAGS_MODULE_ADD(FACES_I)
|
||||
TAGS_MODULE_ADD(FACES_B)
|
||||
TAGS_MODULE_ADD(FACES_TT)
|
||||
TAGS_MODULE_ADD(Hx)
|
||||
TAGS_MODULE_ADD(BIGSMALL)
|
||||
|
||||
TAGS_MODULE_END(Fonts)
|
||||
|
||||
|
||||
#endif
|
||||
110
src/html/m_hline.cpp
Normal file
110
src/html/m_hline.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_hline.cpp
|
||||
// Purpose: wxHtml module for horizontal line (HR tag)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/brush.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
|
||||
FORCE_LINK_ME(m_hline)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlLineCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlLineCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlLineCell(int size, bool shading) : wxHtmlCell() {m_Height = size; m_HasShading = shading;}
|
||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
void Layout(int w)
|
||||
{ m_Width = w; wxHtmlCell::Layout(w); }
|
||||
|
||||
private:
|
||||
// Should we draw 3-D shading or not
|
||||
bool m_HasShading;
|
||||
};
|
||||
|
||||
|
||||
void wxHtmlLineCell::Draw(wxDC& dc, int x, int y, int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
wxBrush mybrush(wxT("GREY"), (m_HasShading) ? wxTRANSPARENT : wxSOLID);
|
||||
wxPen mypen(wxT("GREY"), 1, wxSOLID);
|
||||
dc.SetBrush(mybrush);
|
||||
dc.SetPen(mypen);
|
||||
dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The list handler:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(HR, "HR")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxHtmlContainerCell *c;
|
||||
int sz;
|
||||
bool HasShading;
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
|
||||
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL);
|
||||
c->SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||
c->SetAlign(tag);
|
||||
c->SetWidthFloat(tag);
|
||||
sz = 1;
|
||||
tag.GetParamAsInt(wxT("SIZE"), &sz);
|
||||
HasShading = !(tag.HasParam(wxT("NOSHADE")));
|
||||
c->InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser->GetPixelScale()), HasShading));
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(HR)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(HLine)
|
||||
|
||||
TAGS_MODULE_ADD(HR)
|
||||
|
||||
TAGS_MODULE_END(HLine)
|
||||
|
||||
#endif
|
||||
692
src/html/m_image.cpp
Normal file
692
src/html/m_image.cpp
Normal file
@@ -0,0 +1,692 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_image.cpp
|
||||
// Purpose: wxHtml module for displaying images
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik, Joel Lucsy
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/dc.h"
|
||||
#include "wx/scrolwin.h"
|
||||
#include "wx/timer.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "wx/gifdecod.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/artprov.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
FORCE_LINK_ME(m_image)
|
||||
|
||||
|
||||
|
||||
|
||||
WX_DECLARE_OBJARRAY(int, CoordArray);
|
||||
#include "wx/arrimpl.cpp" // this is a magic incantation which must be done!
|
||||
WX_DEFINE_OBJARRAY(CoordArray);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlImageMapAreaCell
|
||||
// 0-width, 0-height cell that represents single area in imagemap
|
||||
// (it's GetLink is called from wxHtmlImageCell's)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlImageMapAreaCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
enum celltype { CIRCLE, RECT, POLY };
|
||||
protected:
|
||||
CoordArray coords;
|
||||
celltype type;
|
||||
int radius;
|
||||
public:
|
||||
wxHtmlImageMapAreaCell( celltype t, wxString &coords, double pixel_scale = 1.0);
|
||||
virtual wxHtmlLinkInfo *GetLink( int x = 0, int y = 0 ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype t, wxString &incoords, double pixel_scale )
|
||||
{
|
||||
int i;
|
||||
wxString x = incoords, y;
|
||||
|
||||
type = t;
|
||||
while ((i = x.Find( ',' )) != -1)
|
||||
{
|
||||
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
|
||||
x = x.Mid( i + 1 );
|
||||
}
|
||||
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.c_str())) );
|
||||
}
|
||||
|
||||
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case RECT:
|
||||
{
|
||||
int l, t, r, b;
|
||||
|
||||
l = coords[ 0 ];
|
||||
t = coords[ 1 ];
|
||||
r = coords[ 2 ];
|
||||
b = coords[ 3 ];
|
||||
if (x >= l && x <= r && y >= t && y <= b)
|
||||
{
|
||||
return m_Link;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CIRCLE:
|
||||
{
|
||||
int l, t, r;
|
||||
double d;
|
||||
|
||||
l = coords[ 0 ];
|
||||
t = coords[ 1 ];
|
||||
r = coords[ 2 ];
|
||||
d = sqrt( (double) (((x - l) * (x - l)) + ((y - t) * (y - t))) );
|
||||
if (d < (double)r)
|
||||
{
|
||||
return m_Link;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case POLY:
|
||||
{
|
||||
if (coords.GetCount() >= 6)
|
||||
{
|
||||
int intersects = 0;
|
||||
int wherex = x;
|
||||
int wherey = y;
|
||||
int totalv = coords.GetCount() / 2;
|
||||
int totalc = totalv * 2;
|
||||
int xval = coords[totalc - 2];
|
||||
int yval = coords[totalc - 1];
|
||||
int end = totalc;
|
||||
int pointer = 1;
|
||||
|
||||
if ((yval >= wherey) != (coords[pointer] >= wherey))
|
||||
{
|
||||
if ((xval >= wherex) == (coords[0] >= wherex))
|
||||
{
|
||||
intersects += (xval >= wherex) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
intersects += ((xval - (yval - wherey) *
|
||||
(coords[0] - xval) /
|
||||
(coords[pointer] - yval)) >= wherex) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
while (pointer < end)
|
||||
{
|
||||
yval = coords[pointer];
|
||||
pointer += 2;
|
||||
if (yval >= wherey)
|
||||
{
|
||||
while ((pointer < end) && (coords[pointer] >= wherey))
|
||||
{
|
||||
pointer += 2;
|
||||
}
|
||||
if (pointer >= end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ((coords[pointer - 3] >= wherex) ==
|
||||
(coords[pointer - 1] >= wherex)) {
|
||||
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
intersects +=
|
||||
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
|
||||
(coords[pointer - 1] - coords[pointer - 3]) /
|
||||
(coords[pointer] - coords[pointer - 2])) >= wherex) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((pointer < end) && (coords[pointer] < wherey))
|
||||
{
|
||||
pointer += 2;
|
||||
}
|
||||
if (pointer >= end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ((coords[pointer - 3] >= wherex) ==
|
||||
(coords[pointer - 1] >= wherex))
|
||||
{
|
||||
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
intersects +=
|
||||
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
|
||||
(coords[pointer - 1] - coords[pointer - 3]) /
|
||||
(coords[pointer] - coords[pointer - 2])) >= wherex) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((intersects & 1) != 0)
|
||||
{
|
||||
return m_Link;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_Next)
|
||||
{
|
||||
wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next;
|
||||
return a->GetLink( x, y );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlImageMapCell
|
||||
// 0-width, 0-height cell that represents map from imagemaps
|
||||
// it is always placed before wxHtmlImageMapAreaCells
|
||||
// It responds to Find(wxHTML_COND_ISIMAGEMAP)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class wxHtmlImageMapCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlImageMapCell( wxString &name );
|
||||
protected:
|
||||
wxString m_Name;
|
||||
public:
|
||||
virtual wxHtmlLinkInfo *GetLink( int x = 0, int y = 0 ) const;
|
||||
virtual const wxHtmlCell *Find( int cond, const void *param ) const;
|
||||
};
|
||||
|
||||
|
||||
wxHtmlImageMapCell::wxHtmlImageMapCell( wxString &name )
|
||||
{
|
||||
m_Name = name ;
|
||||
}
|
||||
|
||||
wxHtmlLinkInfo *wxHtmlImageMapCell::GetLink( int x, int y ) const
|
||||
{
|
||||
wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next;
|
||||
if (a)
|
||||
return a->GetLink( x, y );
|
||||
return wxHtmlCell::GetLink( x, y );
|
||||
}
|
||||
|
||||
const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const
|
||||
{
|
||||
if (cond == wxHTML_COND_ISIMAGEMAP)
|
||||
{
|
||||
if (m_Name == *((wxString*)(param)))
|
||||
return this;
|
||||
}
|
||||
return wxHtmlCell::Find(cond, param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxHtmlImageCell
|
||||
// Image/bitmap
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlImageCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlImageCell(wxWindow *window,
|
||||
wxFSFile *input, int w = -1, int h = -1,
|
||||
double scale = 1.0, int align = wxHTML_ALIGN_BOTTOM,
|
||||
const wxString& mapname = wxEmptyString);
|
||||
~wxHtmlImageCell();
|
||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
virtual wxHtmlLinkInfo *GetLink(int x = 0, int y = 0) const;
|
||||
|
||||
void SetImage(const wxImage& img);
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
void AdvanceAnimation(wxTimer *timer);
|
||||
virtual void Layout(int w);
|
||||
#endif
|
||||
|
||||
private:
|
||||
wxBitmap *m_bitmap;
|
||||
int m_bmpW, m_bmpH;
|
||||
bool m_showFrame:1;
|
||||
wxScrolledWindow *m_window;
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
wxGIFDecoder *m_gifDecoder;
|
||||
wxTimer *m_gifTimer;
|
||||
int m_physX, m_physY;
|
||||
#endif
|
||||
double m_scale;
|
||||
wxHtmlImageMapCell *m_imageMap;
|
||||
wxString m_mapName;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlImageCell)
|
||||
};
|
||||
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
class wxGIFTimer : public wxTimer
|
||||
{
|
||||
public:
|
||||
wxGIFTimer(wxHtmlImageCell *cell) : m_cell(cell) {}
|
||||
virtual void Notify()
|
||||
{
|
||||
m_cell->AdvanceAnimation(this);
|
||||
}
|
||||
|
||||
private:
|
||||
wxHtmlImageCell *m_cell;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxGIFTimer)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxHtmlImageCell
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
wxHtmlImageCell::wxHtmlImageCell(wxWindow *window, wxFSFile *input,
|
||||
int w, int h, double scale, int align,
|
||||
const wxString& mapname) : wxHtmlCell()
|
||||
{
|
||||
m_window = window ? wxStaticCast(window, wxScrolledWindow) : NULL;
|
||||
m_scale = scale;
|
||||
m_showFrame = FALSE;
|
||||
m_bitmap = NULL;
|
||||
m_bmpW = w;
|
||||
m_bmpH = h;
|
||||
m_imageMap = NULL;
|
||||
m_mapName = mapname;
|
||||
SetCanLiveOnPagebreak(FALSE);
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
m_gifDecoder = NULL;
|
||||
m_gifTimer = NULL;
|
||||
m_physX = m_physY = -1;
|
||||
#endif
|
||||
|
||||
if ( m_bmpW && m_bmpH )
|
||||
{
|
||||
if ( input )
|
||||
{
|
||||
wxInputStream *s = input->GetStream();
|
||||
|
||||
if ( s )
|
||||
{
|
||||
bool readImg = TRUE;
|
||||
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
if ( (input->GetLocation().Matches(wxT("*.gif")) ||
|
||||
input->GetLocation().Matches(wxT("*.GIF"))) && m_window )
|
||||
{
|
||||
m_gifDecoder = new wxGIFDecoder(s, TRUE);
|
||||
if ( m_gifDecoder->ReadGIF() == wxGIF_OK )
|
||||
{
|
||||
wxImage img;
|
||||
if ( m_gifDecoder->ConvertToImage(&img) )
|
||||
SetImage(img);
|
||||
|
||||
readImg = FALSE;
|
||||
|
||||
if ( m_gifDecoder->IsAnimation() )
|
||||
{
|
||||
m_gifTimer = new wxGIFTimer(this);
|
||||
m_gifTimer->Start(m_gifDecoder->GetDelay(), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxDELETE(m_gifDecoder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxDELETE(m_gifDecoder);
|
||||
}
|
||||
}
|
||||
|
||||
if ( readImg )
|
||||
#endif // wxUSE_GIF && wxUSE_TIMER
|
||||
{
|
||||
wxImage image(*s, wxBITMAP_TYPE_ANY);
|
||||
if ( image.Ok() )
|
||||
SetImage(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // input==NULL, use "broken image" bitmap
|
||||
{
|
||||
if ( m_bmpW == -1 && m_bmpH == -1 )
|
||||
{
|
||||
m_bmpW = 29;
|
||||
m_bmpH = 31;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_showFrame = TRUE;
|
||||
if ( m_bmpW == -1 ) m_bmpW = 31;
|
||||
if ( m_bmpH == -1 ) m_bmpH = 33;
|
||||
}
|
||||
m_bitmap =
|
||||
new wxBitmap(wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
|
||||
}
|
||||
}
|
||||
//else: ignore the 0-sized images used sometimes on the Web pages
|
||||
|
||||
m_Width = (int)(scale * (double)m_bmpW);
|
||||
m_Height = (int)(scale * (double)m_bmpH);
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case wxHTML_ALIGN_TOP :
|
||||
m_Descent = m_Height;
|
||||
break;
|
||||
case wxHTML_ALIGN_CENTER :
|
||||
m_Descent = m_Height / 2;
|
||||
break;
|
||||
case wxHTML_ALIGN_BOTTOM :
|
||||
default :
|
||||
m_Descent = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlImageCell::SetImage(const wxImage& img)
|
||||
{
|
||||
if ( img.Ok() )
|
||||
{
|
||||
delete m_bitmap;
|
||||
|
||||
int ww, hh;
|
||||
ww = img.GetWidth();
|
||||
hh = img.GetHeight();
|
||||
|
||||
if ( m_bmpW == -1 )
|
||||
m_bmpW = ww;
|
||||
if ( m_bmpH == -1 )
|
||||
m_bmpH = hh;
|
||||
|
||||
if ((m_bmpW != ww) || (m_bmpH != hh))
|
||||
{
|
||||
wxImage img2 = img.Scale(m_bmpW, m_bmpH);
|
||||
m_bitmap = new wxBitmap(img2);
|
||||
}
|
||||
else
|
||||
m_bitmap = new wxBitmap(img);
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
void wxHtmlImageCell::AdvanceAnimation(wxTimer *timer)
|
||||
{
|
||||
wxImage img;
|
||||
|
||||
m_gifDecoder->GoNextFrame(TRUE);
|
||||
|
||||
if ( m_physX == -1 )
|
||||
{
|
||||
m_physX = m_physY = 0;
|
||||
for (wxHtmlCell *cell = this; cell; cell = cell->GetParent())
|
||||
{
|
||||
m_physX += cell->GetPosX();
|
||||
m_physY += cell->GetPosY();
|
||||
}
|
||||
}
|
||||
|
||||
int x, y;
|
||||
m_window->CalcScrolledPosition(m_physX, m_physY, &x, &y);
|
||||
wxRect rect(x, y, m_Width, m_Height);
|
||||
|
||||
if ( m_window->GetClientRect().Intersects(rect) &&
|
||||
m_gifDecoder->ConvertToImage(&img) )
|
||||
{
|
||||
if ( (int)m_gifDecoder->GetWidth() != m_Width ||
|
||||
(int)m_gifDecoder->GetHeight() != m_Height ||
|
||||
m_gifDecoder->GetLeft() != 0 || m_gifDecoder->GetTop() != 0 )
|
||||
{
|
||||
wxBitmap bmp(img);
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(*m_bitmap);
|
||||
dc.DrawBitmap(bmp, m_gifDecoder->GetLeft(), m_gifDecoder->GetTop());
|
||||
}
|
||||
else
|
||||
SetImage(img);
|
||||
m_window->Refresh(img.HasMask(), &rect);
|
||||
}
|
||||
|
||||
timer->Start(m_gifDecoder->GetDelay(), TRUE);
|
||||
}
|
||||
|
||||
void wxHtmlImageCell::Layout(int w)
|
||||
{
|
||||
wxHtmlCell::Layout(w);
|
||||
m_physX = m_physY = -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
wxHtmlImageCell::~wxHtmlImageCell()
|
||||
{
|
||||
delete m_bitmap;
|
||||
#if wxUSE_GIF && wxUSE_TIMER
|
||||
delete m_gifTimer;
|
||||
delete m_gifDecoder;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
if ( m_showFrame )
|
||||
{
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
|
||||
x++, y++;
|
||||
}
|
||||
if ( m_bitmap )
|
||||
{
|
||||
double us_x, us_y;
|
||||
dc.GetUserScale(&us_x, &us_y);
|
||||
dc.SetUserScale(us_x * m_scale, us_y * m_scale);
|
||||
|
||||
dc.DrawBitmap(*m_bitmap, (int) ((x + m_PosX) / m_scale),
|
||||
(int) ((y + m_PosY) / m_scale), TRUE);
|
||||
dc.SetUserScale(us_x, us_y);
|
||||
}
|
||||
}
|
||||
|
||||
wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
|
||||
{
|
||||
if (m_mapName.IsEmpty())
|
||||
return wxHtmlCell::GetLink( x, y );
|
||||
if (!m_imageMap)
|
||||
{
|
||||
wxHtmlContainerCell *p, *op;
|
||||
op = p = GetParent();
|
||||
while (p)
|
||||
{
|
||||
op = p;
|
||||
p = p->GetParent();
|
||||
}
|
||||
p = op;
|
||||
wxHtmlCell *cell = (wxHtmlCell*)p->Find(wxHTML_COND_ISIMAGEMAP,
|
||||
(const void*)(&m_mapName));
|
||||
if (!cell)
|
||||
{
|
||||
((wxString&)m_mapName).Clear();
|
||||
return wxHtmlCell::GetLink( x, y );
|
||||
}
|
||||
{ // dirty hack, ask Joel why he fills m_ImageMap in this place
|
||||
// THE problem is that we're in const method and we can't modify m_ImageMap
|
||||
wxHtmlImageMapCell **cx = (wxHtmlImageMapCell**)(&m_imageMap);
|
||||
*cx = (wxHtmlImageMapCell*)cell;
|
||||
}
|
||||
}
|
||||
return m_imageMap->GetLink(x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// tag handler
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
if (tag.GetName() == wxT("IMG"))
|
||||
{
|
||||
if (tag.HasParam(wxT("SRC")))
|
||||
{
|
||||
int w = -1, h = -1;
|
||||
int al;
|
||||
wxFSFile *str;
|
||||
wxString tmp = tag.GetParam(wxT("SRC"));
|
||||
wxString mn = wxEmptyString;
|
||||
|
||||
str = m_WParser->OpenURL(wxHTML_URL_IMAGE, tmp);
|
||||
|
||||
if (tag.HasParam(wxT("WIDTH")))
|
||||
tag.GetParamAsInt(wxT("WIDTH"), &w);
|
||||
if (tag.HasParam(wxT("HEIGHT")))
|
||||
tag.GetParamAsInt(wxT("HEIGHT"), &h);
|
||||
al = wxHTML_ALIGN_BOTTOM;
|
||||
if (tag.HasParam(wxT("ALIGN")))
|
||||
{
|
||||
wxString alstr = tag.GetParam(wxT("ALIGN"));
|
||||
alstr.MakeUpper(); // for the case alignment was in ".."
|
||||
if (alstr == wxT("TEXTTOP"))
|
||||
al = wxHTML_ALIGN_TOP;
|
||||
else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER")))
|
||||
al = wxHTML_ALIGN_CENTER;
|
||||
}
|
||||
if (tag.HasParam(wxT("USEMAP")))
|
||||
{
|
||||
mn = tag.GetParam( wxT("USEMAP") );
|
||||
if (mn.GetChar(0) == wxT('#'))
|
||||
{
|
||||
mn = mn.Mid( 1 );
|
||||
}
|
||||
}
|
||||
wxHtmlImageCell *cel = new wxHtmlImageCell(
|
||||
m_WParser->GetWindow(),
|
||||
str, w, h,
|
||||
m_WParser->GetPixelScale(),
|
||||
al, mn);
|
||||
cel->SetLink(m_WParser->GetLink());
|
||||
cel->SetId(tag.GetParam(wxT("id"))); // may be empty
|
||||
m_WParser->GetContainer()->InsertCell(cel);
|
||||
if (str)
|
||||
delete str;
|
||||
}
|
||||
}
|
||||
if (tag.GetName() == wxT("MAP"))
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
if (tag.HasParam(wxT("NAME")))
|
||||
{
|
||||
wxString tmp = tag.GetParam(wxT("NAME"));
|
||||
wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
|
||||
m_WParser->GetContainer()->InsertCell( cel );
|
||||
}
|
||||
ParseInner( tag );
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
if (tag.GetName() == wxT("AREA"))
|
||||
{
|
||||
if (tag.HasParam(wxT("SHAPE")))
|
||||
{
|
||||
wxString tmp = tag.GetParam(wxT("SHAPE"));
|
||||
wxString coords = wxEmptyString;
|
||||
tmp.MakeUpper();
|
||||
wxHtmlImageMapAreaCell *cel = NULL;
|
||||
if (tag.HasParam(wxT("COORDS")))
|
||||
{
|
||||
coords = tag.GetParam(wxT("COORDS"));
|
||||
}
|
||||
if (tmp == wxT("POLY"))
|
||||
{
|
||||
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() );
|
||||
}
|
||||
else if (tmp == wxT("CIRCLE"))
|
||||
{
|
||||
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser->GetPixelScale() );
|
||||
}
|
||||
else if (tmp == wxT("RECT"))
|
||||
{
|
||||
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser->GetPixelScale() );
|
||||
}
|
||||
if (cel != NULL && tag.HasParam(wxT("HREF")))
|
||||
{
|
||||
wxString tmp = tag.GetParam(wxT("HREF"));
|
||||
wxString target = wxEmptyString;
|
||||
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
|
||||
cel->SetLink( wxHtmlLinkInfo(tmp, target));
|
||||
}
|
||||
if (cel != NULL) m_WParser->GetContainer()->InsertCell( cel );
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(IMG)
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Image)
|
||||
|
||||
TAGS_MODULE_ADD(IMG)
|
||||
|
||||
TAGS_MODULE_END(Image)
|
||||
|
||||
|
||||
#endif
|
||||
369
src/html/m_layout.cpp
Normal file
369
src/html/m_layout.cpp
Normal file
@@ -0,0 +1,369 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_layout.cpp
|
||||
// Purpose: wxHtml module for basic paragraphs/layout handling
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include "wx/html/htmlwin.h"
|
||||
|
||||
FORCE_LINK_ME(m_layout)
|
||||
|
||||
|
||||
#include <stdlib.h> // bsearch()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlPageBreakCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Since html isn't a page-layout language, it doesn't support page
|
||||
// page breaks directly--that requires CSS2 support. But a page-break
|
||||
// facility is handy, and has been requested more than once on the
|
||||
// mailing lists. This wxHtml tag handler implements just enough of
|
||||
// CSS2 to support a page break by recognizing only
|
||||
// <div style="page-break-before:always">
|
||||
//
|
||||
// wxHtml maintains page breaks in wxHtmlPrintout::m_PageBreaks. The
|
||||
// tag handler below adds appropriate offsets to that array member.
|
||||
// wxHtmlDCRenderer::Render() accesses that array and makes a new page
|
||||
// begin after each page-break tag.
|
||||
|
||||
// The page-break handler does all its work in AdjustPagebreak(). For
|
||||
// all tag handlers, that function adjusts the page-break position.
|
||||
// For other tags, it determines whether the html element can fit on
|
||||
// the remainder of the page; if it cannot fit, but must not be split,
|
||||
// then the function moves the page break provided in the argument up,
|
||||
// and returns 'true' to inform the caller that the argument was
|
||||
// modified.
|
||||
//
|
||||
// Due to its special purpose, the page-break facility differs from
|
||||
// other tags. It takes up no space, but it behaves as though there is
|
||||
// never enough room to fit it on the remainder of the page--it always
|
||||
// forces a page break. Therefore, unlike other elements that trigger
|
||||
// a page break, it would never 'fit' on the following page either.
|
||||
// Therefore it's necessary to compare each pagebreak candidate to the
|
||||
// array wxHtmlPrintout::m_PageBreaks of pagebreaks already set, and
|
||||
// set a new one only if it's not in that array.
|
||||
|
||||
class WXDLLEXPORT wxHtmlPageBreakCell : public wxHtmlCell
|
||||
{
|
||||
public:
|
||||
wxHtmlPageBreakCell() {}
|
||||
|
||||
bool AdjustPagebreak(int* pagebreak, int* known_pagebreaks = NULL, int number_of_pages = 0) const;
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlPageBreakCell)
|
||||
};
|
||||
|
||||
// Comparison routine for bsearch into an int* array of pagebreaks.
|
||||
static int integer_compare(void const* i0, void const* i1)
|
||||
{
|
||||
return *(int*)i0 - *(int*)i1;
|
||||
}
|
||||
|
||||
bool wxHtmlPageBreakCell::AdjustPagebreak(int* pagebreak, int* known_pagebreaks, int number_of_pages) const
|
||||
{
|
||||
// When we are counting pages, 'known_pagebreaks' is non-NULL.
|
||||
// That's the only time we change 'pagebreak'. Otherwise, pages
|
||||
// were already counted, 'known_pagebreaks' is NULL, and we don't
|
||||
// do anything except return FALSE.
|
||||
//
|
||||
// We also simply return FALSE if the 'pagebreak' argument is
|
||||
// less than (vertically above) or the same as the current
|
||||
// vertical position. Otherwise we'd be setting a pagebreak above
|
||||
// the current cell, which is incorrect, or duplicating a
|
||||
// pagebreak that has already been set.
|
||||
if(NULL == known_pagebreaks || *pagebreak <= m_PosY)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// m_PosY is only the vertical offset from the parent. The pagebreak
|
||||
// required here is the total page offset, so m_PosY must be added
|
||||
// to the parent's offset and height.
|
||||
int total_height = m_PosY + GetParent()->GetPosY() + GetParent()->GetHeight();
|
||||
|
||||
// Search the array of pagebreaks to see whether we've already set
|
||||
// a pagebreak here. The standard bsearch() function is appropriate
|
||||
// because the array of pagebreaks through known_pagebreaks[number_of_pages]
|
||||
// is known to be sorted in strictly increasing order. '1 + number_of_pages'
|
||||
// is used as a bsearch() argument because the array contains a leading
|
||||
// zero plus one element for each page.
|
||||
int* where = (int*) bsearch(&total_height, known_pagebreaks,
|
||||
1 + number_of_pages, sizeof(int),
|
||||
integer_compare);
|
||||
// Add a pagebreak only if there isn't one already set here.
|
||||
if(NULL != where)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pagebreak = m_PosY;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
TAG_HANDLER_BEGIN(P, "P")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
m_WParser->GetContainer()->SetAlign(tag);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(P)
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(BR, "BR")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int al = m_WParser->GetContainer()->GetAlignHor();
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
c->SetAlignHor(al);
|
||||
c->SetAlign(tag);
|
||||
c->SetMinHeight(m_WParser->GetCharHeight());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(BR)
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(CENTER, "CENTER")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
int old = m_WParser->GetAlign();
|
||||
wxHtmlContainerCell *c = m_WParser->GetContainer();
|
||||
|
||||
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
||||
if (c->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
else
|
||||
c->SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||
|
||||
if (tag.HasEnding())
|
||||
{
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetAlign(old);
|
||||
if (c->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
else
|
||||
c->SetAlignHor(old);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(CENTER)
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(DIV, "DIV")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
if(tag.HasParam(wxT("STYLE")))
|
||||
{
|
||||
if(tag.GetParam(wxT("STYLE")).IsSameAs(wxT("PAGE-BREAK-BEFORE:ALWAYS"), FALSE))
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer()->InsertCell(new wxHtmlPageBreakCell);
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Treat other STYLE parameters here when they're supported.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if(tag.HasParam(wxT("ALIGN")))
|
||||
{
|
||||
int old = m_WParser->GetAlign();
|
||||
wxHtmlContainerCell *c = m_WParser->GetContainer();
|
||||
if (c->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
c = m_WParser->GetContainer();
|
||||
c->SetAlign(tag);
|
||||
m_WParser->SetAlign(c->GetAlignHor());
|
||||
}
|
||||
else
|
||||
{
|
||||
c->SetAlign(tag);
|
||||
m_WParser->SetAlign(c->GetAlignHor());
|
||||
}
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetAlign(old);
|
||||
if (c->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
else
|
||||
c->SetAlignHor(old);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(DIV)
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(TITLE, "TITLE")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
if (m_WParser->GetWindow())
|
||||
{
|
||||
wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow());
|
||||
if (wfr)
|
||||
{
|
||||
const wxString& src = *m_WParser->GetSource();
|
||||
wfr->OnSetTitle(src.Mid(tag.GetBeginPos(),
|
||||
tag.GetEndPos1()-tag.GetBeginPos()));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(TITLE)
|
||||
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(BODY, "BODY")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxColour clr;
|
||||
|
||||
if (tag.GetParamAsColour(wxT("TEXT"), &clr))
|
||||
{
|
||||
m_WParser->SetActualColor(clr);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
|
||||
}
|
||||
|
||||
if (tag.GetParamAsColour(wxT("LINK"), &clr))
|
||||
m_WParser->SetLinkColor(clr);
|
||||
|
||||
if (tag.GetParamAsColour(wxT("BGCOLOR"), &clr))
|
||||
{
|
||||
m_WParser->GetContainer()->InsertCell(
|
||||
new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
|
||||
if (m_WParser->GetWindow() != NULL)
|
||||
m_WParser->GetWindow()->SetBackgroundColour(clr);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(BODY)
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
|
||||
if (c->GetAlignHor() == wxHTML_ALIGN_RIGHT)
|
||||
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_RIGHT);
|
||||
else
|
||||
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
|
||||
|
||||
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
m_WParser->OpenContainer();
|
||||
ParseInner(tag);
|
||||
c = m_WParser->CloseContainer();
|
||||
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_BOTTOM);
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(BLOCKQUOTE)
|
||||
|
||||
|
||||
|
||||
// Tag handler for tags that we have to ignore, otherwise non-text data
|
||||
// would show up as text:
|
||||
TAG_HANDLER_BEGIN(DoNothing, "SCRIPT")
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
TAG_HANDLER_END(DoNothing)
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Layout)
|
||||
|
||||
TAGS_MODULE_ADD(P)
|
||||
TAGS_MODULE_ADD(BR)
|
||||
TAGS_MODULE_ADD(CENTER)
|
||||
TAGS_MODULE_ADD(DIV)
|
||||
TAGS_MODULE_ADD(TITLE)
|
||||
TAGS_MODULE_ADD(BODY)
|
||||
TAGS_MODULE_ADD(BLOCKQUOTE)
|
||||
TAGS_MODULE_ADD(DoNothing)
|
||||
|
||||
TAGS_MODULE_END(Layout)
|
||||
|
||||
#endif
|
||||
98
src/html/m_links.cpp
Normal file
98
src/html/m_links.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_links.cpp
|
||||
// Purpose: wxHtml module for links & anchors
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
|
||||
FORCE_LINK_ME(m_links)
|
||||
|
||||
|
||||
class wxHtmlAnchorCell : public wxHtmlCell
|
||||
{
|
||||
private:
|
||||
wxString m_AnchorName;
|
||||
|
||||
public:
|
||||
wxHtmlAnchorCell(const wxString& name) : wxHtmlCell() {m_AnchorName = name;}
|
||||
virtual const wxHtmlCell* Find(int condition, const void* param) const
|
||||
{
|
||||
if ((condition == wxHTML_COND_ISANCHOR) && (m_AnchorName == (*((const wxString*)param))))
|
||||
return this;
|
||||
else
|
||||
return wxHtmlCell::Find(condition, param);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(A, "A")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
if (tag.HasParam( wxT("NAME") ))
|
||||
{
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlAnchorCell(tag.GetParam( wxT("NAME") )));
|
||||
}
|
||||
|
||||
if (tag.HasParam( wxT("HREF") ))
|
||||
{
|
||||
wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
|
||||
wxColour oldclr = m_WParser->GetActualColor();
|
||||
int oldund = m_WParser->GetFontUnderlined();
|
||||
wxString name(tag.GetParam( wxT("HREF") )), target;
|
||||
|
||||
if (tag.HasParam( wxT("TARGET") )) target = tag.GetParam( wxT("TARGET") );
|
||||
m_WParser->SetActualColor(m_WParser->GetLinkColor());
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(m_WParser->GetLinkColor()));
|
||||
m_WParser->SetFontUnderlined(TRUE);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
m_WParser->SetLink(wxHtmlLinkInfo(name, target));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetLink(oldlnk);
|
||||
m_WParser->SetFontUnderlined(oldund);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
m_WParser->SetActualColor(oldclr);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(A)
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Links)
|
||||
|
||||
TAGS_MODULE_ADD(A)
|
||||
|
||||
TAGS_MODULE_END(Links)
|
||||
|
||||
|
||||
#endif
|
||||
170
src/html/m_list.cpp
Normal file
170
src/html/m_list.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_list.cpp
|
||||
// Purpose: wxHtml module for lists
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/brush.h"
|
||||
#include "wx/dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
|
||||
FORCE_LINK_ME(m_list)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlListmarkCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlListmarkCell : public wxHtmlCell
|
||||
{
|
||||
private:
|
||||
wxBrush m_Brush;
|
||||
public:
|
||||
wxHtmlListmarkCell(wxDC *dc, const wxColour& clr);
|
||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
};
|
||||
|
||||
wxHtmlListmarkCell::wxHtmlListmarkCell(wxDC* dc, const wxColour& clr) : wxHtmlCell(), m_Brush(clr, wxSOLID)
|
||||
{
|
||||
m_Width = dc->GetCharHeight();
|
||||
m_Height = dc->GetCharHeight();
|
||||
m_Descent = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y, int WXUNUSED(view_y1), int WXUNUSED(view_y2))
|
||||
{
|
||||
dc.SetBrush(m_Brush);
|
||||
dc.DrawEllipse(x + m_PosX + m_Width / 3, y + m_PosY + m_Height / 3,
|
||||
(m_Width / 3), (m_Width / 3));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The list handler:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI")
|
||||
|
||||
TAG_HANDLER_VARS
|
||||
int m_Numbering;
|
||||
// this is number of actual item of list or 0 for dots
|
||||
|
||||
TAG_HANDLER_CONSTR(OLULLI)
|
||||
{
|
||||
m_Numbering = 0;
|
||||
}
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
// List Item:
|
||||
if (tag.GetName() == wxT("LI"))
|
||||
{
|
||||
m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP);
|
||||
// this is to prevent indetation in <li><p> case
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->CloseContainer();
|
||||
|
||||
c = m_WParser->OpenContainer();
|
||||
c->SetWidthFloat(2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
|
||||
if (m_Numbering == 0)
|
||||
{
|
||||
// Centering gives more space after the bullet
|
||||
c->SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||
c->InsertCell(new wxHtmlListmarkCell(m_WParser->GetDC(), m_WParser->GetActualColor()));
|
||||
}
|
||||
else
|
||||
{
|
||||
c->SetAlignHor(wxHTML_ALIGN_RIGHT);
|
||||
wxString mark;
|
||||
mark.Printf(wxT("%i."), m_Numbering);
|
||||
c->InsertCell(new wxHtmlWordCell(mark, *(m_WParser->GetDC())));
|
||||
}
|
||||
m_WParser->CloseContainer();
|
||||
|
||||
c = m_WParser->OpenContainer();
|
||||
c->SetIndent(m_WParser->GetCharWidth() / 4, wxHTML_INDENT_LEFT);
|
||||
c->SetWidthFloat(-2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
|
||||
|
||||
m_WParser->OpenContainer();
|
||||
|
||||
if (m_Numbering != 0) m_Numbering++;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Begin of List (not-numbered): "UL", "OL"
|
||||
else
|
||||
{
|
||||
int oldnum = m_Numbering;
|
||||
|
||||
if (tag.GetName() == wxT("UL")) m_Numbering = 0;
|
||||
else m_Numbering = 1;
|
||||
|
||||
c = m_WParser->GetContainer();
|
||||
if (c->GetFirstCell() != NULL)
|
||||
{
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
c = m_WParser->GetContainer();
|
||||
}
|
||||
c->SetAlignHor(wxHTML_ALIGN_LEFT);
|
||||
c->SetIndent(2 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
|
||||
m_WParser->OpenContainer()->SetAlignVer(wxHTML_ALIGN_TOP);
|
||||
|
||||
m_WParser->OpenContainer();
|
||||
m_WParser->OpenContainer();
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP);
|
||||
// this is to prevent indetation in <li><p> case
|
||||
m_WParser->CloseContainer();
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->CloseContainer();
|
||||
m_WParser->OpenContainer();
|
||||
|
||||
m_Numbering = oldnum;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(OLULLI)
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(List)
|
||||
|
||||
TAGS_MODULE_ADD(OLULLI)
|
||||
|
||||
TAGS_MODULE_END(List)
|
||||
|
||||
#endif
|
||||
130
src/html/m_pre.cpp
Normal file
130
src/html/m_pre.cpp
Normal file
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_pre.cpp
|
||||
// Purpose: wxHtml module for <PRE> ... </PRE> tag (code citation)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/encconv.h"
|
||||
|
||||
FORCE_LINK_ME(m_pre)
|
||||
|
||||
// replaces '\t', ' ' and '\n' with HTML markup:
|
||||
static wxString LINKAGEMODE HtmlizeWhitespaces(const wxString& str)
|
||||
{
|
||||
wxString out;
|
||||
size_t i = 0, j = 0, len = str.Len();
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
switch (str[i])
|
||||
{
|
||||
case wxT('<'):
|
||||
while (i < len && str[i] != wxT('>'))
|
||||
out << str[i++];
|
||||
out << wxT('>');
|
||||
break;
|
||||
case wxT(' '):
|
||||
out << wxT(" ");
|
||||
break;
|
||||
case wxT('\n'):
|
||||
out << wxT("<br>");
|
||||
break;
|
||||
case wxT('\t'):
|
||||
for (j = 8 - i%8; j > 0; j--) out << wxT(" ");
|
||||
break;
|
||||
default:
|
||||
out << str[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The list handler:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(PRE, "PRE")
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
int fixed = m_WParser->GetFontFixed(),
|
||||
italic = m_WParser->GetFontItalic(),
|
||||
underlined = m_WParser->GetFontUnderlined(),
|
||||
bold = m_WParser->GetFontBold(),
|
||||
fsize = m_WParser->GetFontSize();
|
||||
|
||||
c = m_WParser->GetContainer();
|
||||
m_WParser->SetFontUnderlined(FALSE);
|
||||
m_WParser->SetFontBold(FALSE);
|
||||
m_WParser->SetFontItalic(FALSE);
|
||||
m_WParser->SetFontFixed(TRUE);
|
||||
m_WParser->SetFontSize(3);
|
||||
c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
c->SetAlignHor(wxHTML_ALIGN_LEFT);
|
||||
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
|
||||
|
||||
wxString srcMid =
|
||||
m_WParser->GetSource()->Mid(tag.GetBeginPos(),
|
||||
tag.GetEndPos1() - tag.GetBeginPos());
|
||||
// It is safe to temporarily change the source being parsed,
|
||||
// provided we restore the state back after parsing
|
||||
m_Parser->SetSourceAndSaveState(HtmlizeWhitespaces(srcMid));
|
||||
m_Parser->DoParsing();
|
||||
m_Parser->RestoreState();
|
||||
|
||||
m_WParser->CloseContainer();
|
||||
c = m_WParser->OpenContainer();
|
||||
|
||||
m_WParser->SetFontUnderlined(underlined);
|
||||
m_WParser->SetFontBold(bold);
|
||||
m_WParser->SetFontItalic(italic);
|
||||
m_WParser->SetFontFixed(fixed);
|
||||
m_WParser->SetFontSize(fsize);
|
||||
c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(PRE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Pre)
|
||||
|
||||
TAGS_MODULE_ADD(PRE)
|
||||
|
||||
TAGS_MODULE_END(Pre)
|
||||
|
||||
#endif
|
||||
51
src/html/m_style.cpp
Normal file
51
src/html/m_style.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_style.cpp
|
||||
// Purpose: wxHtml module for parsing <style> tag
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2002 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
FORCE_LINK_ME(m_style)
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(STYLE, "STYLE")
|
||||
|
||||
TAG_HANDLER_PROC(WXUNUSED(tag))
|
||||
{
|
||||
// VS: Ignore styles for now. We must have this handler present,
|
||||
// because CSS style text would be rendered verbatim otherwise
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(STYLE)
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(StyleTag)
|
||||
|
||||
TAGS_MODULE_ADD(STYLE)
|
||||
|
||||
TAGS_MODULE_END(StyleTag)
|
||||
|
||||
#endif
|
||||
623
src/html/m_tables.cpp
Normal file
623
src/html/m_tables.cpp
Normal file
@@ -0,0 +1,623 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: m_tables.cpp
|
||||
// Purpose: wxHtml module for tables
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
REMARKS:
|
||||
1. This version of m_tables doesn't support auto-layout algorithm.
|
||||
This means that all columns are of same width unless explicitly specified.
|
||||
*/
|
||||
|
||||
|
||||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include "wx/html/htmlcell.h"
|
||||
|
||||
FORCE_LINK_ME(m_tables)
|
||||
|
||||
|
||||
#define TABLE_BORDER_CLR_1 wxColour(0xC5, 0xC2, 0xC5)
|
||||
#define TABLE_BORDER_CLR_2 wxColour(0x62, 0x61, 0x62)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlTableCell
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
struct colStruct
|
||||
{
|
||||
int width, units;
|
||||
// width of the column either in pixels or percents
|
||||
// ('width' is the number, 'units' determines its meaning)
|
||||
int minWidth, maxWidth;
|
||||
// minimal/maximal column width. This is needed by HTML 4.0
|
||||
// layouting algorithm and can be determined by trying to
|
||||
// layout table cells with width=1 and width=infinity
|
||||
int leftpos, pixwidth, maxrealwidth;
|
||||
// temporary (depends on actual width of table)
|
||||
};
|
||||
|
||||
enum cellState
|
||||
{
|
||||
cellSpan,
|
||||
cellUsed,
|
||||
cellFree
|
||||
};
|
||||
|
||||
struct cellStruct
|
||||
{
|
||||
wxHtmlContainerCell *cont;
|
||||
int colspan, rowspan;
|
||||
int minheight, valign;
|
||||
cellState flag;
|
||||
};
|
||||
|
||||
|
||||
class wxHtmlTableCell : public wxHtmlContainerCell
|
||||
{
|
||||
protected:
|
||||
/* These are real attributes: */
|
||||
|
||||
// should we draw borders or not?
|
||||
bool m_HasBorders;
|
||||
// number of columns; rows
|
||||
int m_NumCols, m_NumRows;
|
||||
// array of column information
|
||||
colStruct *m_ColsInfo;
|
||||
// 2D array of all cells in the table : m_CellInfo[row][column]
|
||||
cellStruct **m_CellInfo;
|
||||
// spaces between cells
|
||||
int m_Spacing;
|
||||
// cells internal indentation
|
||||
int m_Padding;
|
||||
|
||||
private:
|
||||
/* ...and these are valid only when parsing the table: */
|
||||
|
||||
// number of actual column (ranging from 0..m_NumCols)
|
||||
int m_ActualCol, m_ActualRow;
|
||||
|
||||
// default values (for table and row):
|
||||
wxColour m_tBkg, m_rBkg;
|
||||
wxString m_tValign, m_rValign;
|
||||
|
||||
double m_PixelScale;
|
||||
|
||||
|
||||
public:
|
||||
wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag, double pixel_scale = 1.0);
|
||||
~wxHtmlTableCell();
|
||||
virtual void Layout(int w);
|
||||
|
||||
void AddRow(const wxHtmlTag& tag);
|
||||
void AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag);
|
||||
|
||||
private:
|
||||
// Reallocates memory to given number of cols/rows
|
||||
// and changes m_NumCols/m_NumRows value to reflect this change
|
||||
// NOTE! You CAN'T change m_NumCols/m_NumRows before calling this!!
|
||||
void ReallocCols(int cols);
|
||||
void ReallocRows(int rows);
|
||||
|
||||
// Computes minimal and maximal widths of columns. Needs to be called
|
||||
// only once, before first Layout().
|
||||
void ComputeMinMaxWidths();
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlTableCell)
|
||||
};
|
||||
|
||||
|
||||
|
||||
wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag, double pixel_scale)
|
||||
: wxHtmlContainerCell(parent)
|
||||
{
|
||||
m_PixelScale = pixel_scale;
|
||||
m_HasBorders =
|
||||
(tag.HasParam(wxT("BORDER")) && tag.GetParam(wxT("BORDER")) != wxT("0"));
|
||||
m_ColsInfo = NULL;
|
||||
m_NumCols = m_NumRows = 0;
|
||||
m_CellInfo = NULL;
|
||||
m_ActualCol = m_ActualRow = -1;
|
||||
|
||||
/* scan params: */
|
||||
if (tag.HasParam(wxT("BGCOLOR")))
|
||||
tag.GetParamAsColour(wxT("BGCOLOR"), &m_tBkg);
|
||||
if (tag.HasParam(wxT("VALIGN")))
|
||||
m_tValign = tag.GetParam(wxT("VALIGN"));
|
||||
else
|
||||
m_tValign = wxEmptyString;
|
||||
if (!tag.GetParamAsInt(wxT("CELLSPACING"), &m_Spacing))
|
||||
m_Spacing = 2;
|
||||
if (!tag.GetParamAsInt(wxT("CELLPADDING"), &m_Padding))
|
||||
m_Padding = 3;
|
||||
m_Spacing = (int)(m_PixelScale * (double)m_Spacing);
|
||||
m_Padding = (int)(m_PixelScale * (double)m_Padding);
|
||||
|
||||
if (m_HasBorders)
|
||||
SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlTableCell::~wxHtmlTableCell()
|
||||
{
|
||||
if (m_ColsInfo) free(m_ColsInfo);
|
||||
if (m_CellInfo)
|
||||
{
|
||||
for (int i = 0; i < m_NumRows; i++)
|
||||
free(m_CellInfo[i]);
|
||||
free(m_CellInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlTableCell::ReallocCols(int cols)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for (i = 0; i < m_NumRows; i++)
|
||||
{
|
||||
m_CellInfo[i] = (cellStruct*) realloc(m_CellInfo[i], sizeof(cellStruct) * cols);
|
||||
for (j = m_NumCols; j < cols; j++)
|
||||
m_CellInfo[i][j].flag = cellFree;
|
||||
}
|
||||
|
||||
m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols);
|
||||
for (j = m_NumCols; j < cols; j++)
|
||||
{
|
||||
m_ColsInfo[j].width = 0;
|
||||
m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
|
||||
m_ColsInfo[j].minWidth = m_ColsInfo[j].maxWidth = -1;
|
||||
}
|
||||
|
||||
m_NumCols = cols;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlTableCell::ReallocRows(int rows)
|
||||
{
|
||||
m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows);
|
||||
for (int row = m_NumRows; row < rows ; row++)
|
||||
{
|
||||
if (m_NumCols == 0)
|
||||
m_CellInfo[row] = NULL;
|
||||
else
|
||||
{
|
||||
m_CellInfo[row] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols);
|
||||
for (int col = 0; col < m_NumCols; col++)
|
||||
m_CellInfo[row][col].flag = cellFree;
|
||||
}
|
||||
}
|
||||
m_NumRows = rows;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlTableCell::AddRow(const wxHtmlTag& tag)
|
||||
{
|
||||
m_ActualCol = -1;
|
||||
// VS: real allocation of row entry is done in AddCell in order
|
||||
// to correctly handle empty rows (i.e. "<tr></tr>")
|
||||
// m_ActualCol == -1 indicates that AddCell has to allocate new row.
|
||||
|
||||
// scan params:
|
||||
m_rBkg = m_tBkg;
|
||||
if (tag.HasParam(wxT("BGCOLOR")))
|
||||
tag.GetParamAsColour(wxT("BGCOLOR"), &m_rBkg);
|
||||
if (tag.HasParam(wxT("VALIGN")))
|
||||
m_rValign = tag.GetParam(wxT("VALIGN"));
|
||||
else
|
||||
m_rValign = m_tValign;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
|
||||
{
|
||||
// Is this cell in new row?
|
||||
// VS: we can't do it in AddRow, see my comment there
|
||||
if (m_ActualCol == -1)
|
||||
{
|
||||
if (m_ActualRow + 1 > m_NumRows - 1)
|
||||
ReallocRows(m_ActualRow + 2);
|
||||
m_ActualRow++;
|
||||
}
|
||||
|
||||
// cells & columns:
|
||||
do
|
||||
{
|
||||
m_ActualCol++;
|
||||
} while ((m_ActualCol < m_NumCols) &&
|
||||
(m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree));
|
||||
|
||||
if (m_ActualCol > m_NumCols - 1)
|
||||
ReallocCols(m_ActualCol + 1);
|
||||
|
||||
int r = m_ActualRow, c = m_ActualCol;
|
||||
|
||||
m_CellInfo[r][c].cont = cell;
|
||||
m_CellInfo[r][c].colspan = 1;
|
||||
m_CellInfo[r][c].rowspan = 1;
|
||||
m_CellInfo[r][c].flag = cellUsed;
|
||||
m_CellInfo[r][c].minheight = 0;
|
||||
m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP;
|
||||
|
||||
/* scan for parameters: */
|
||||
|
||||
// width:
|
||||
{
|
||||
if (tag.HasParam(wxT("WIDTH")))
|
||||
{
|
||||
wxString wd = tag.GetParam(wxT("WIDTH"));
|
||||
|
||||
if (wd[wd.Length()-1] == wxT('%'))
|
||||
{
|
||||
wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
|
||||
m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
|
||||
m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width);
|
||||
m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// spanning:
|
||||
{
|
||||
tag.GetParamAsInt(wxT("COLSPAN"), &m_CellInfo[r][c].colspan);
|
||||
tag.GetParamAsInt(wxT("ROWSPAN"), &m_CellInfo[r][c].rowspan);
|
||||
|
||||
// VS: the standard says this about col/rowspan:
|
||||
// "This attribute specifies the number of rows spanned by the
|
||||
// current cell. The default value of this attribute is one ("1").
|
||||
// The value zero ("0") means that the cell spans all rows from the
|
||||
// current row to the last row of the table." All mainstream
|
||||
// browsers act as if 0==1, though, and so does wxHTML.
|
||||
if (m_CellInfo[r][c].colspan < 1)
|
||||
m_CellInfo[r][c].colspan = 1;
|
||||
if (m_CellInfo[r][c].rowspan < 1)
|
||||
m_CellInfo[r][c].rowspan = 1;
|
||||
|
||||
if ((m_CellInfo[r][c].colspan > 1) || (m_CellInfo[r][c].rowspan > 1))
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (r + m_CellInfo[r][c].rowspan > m_NumRows)
|
||||
ReallocRows(r + m_CellInfo[r][c].rowspan);
|
||||
if (c + m_CellInfo[r][c].colspan > m_NumCols)
|
||||
ReallocCols(c + m_CellInfo[r][c].colspan);
|
||||
for (i = r; i < r + m_CellInfo[r][c].rowspan; i++)
|
||||
for (j = c; j < c + m_CellInfo[r][c].colspan; j++)
|
||||
m_CellInfo[i][j].flag = cellSpan;
|
||||
m_CellInfo[r][c].flag = cellUsed;
|
||||
}
|
||||
}
|
||||
|
||||
//background color:
|
||||
{
|
||||
wxColour bk = m_rBkg;
|
||||
if (tag.HasParam(wxT("BGCOLOR")))
|
||||
tag.GetParamAsColour(wxT("BGCOLOR"), &bk);
|
||||
if (bk.Ok())
|
||||
cell->SetBackgroundColour(bk);
|
||||
}
|
||||
if (m_HasBorders)
|
||||
cell->SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1);
|
||||
|
||||
// vertical alignment:
|
||||
{
|
||||
wxString valign;
|
||||
if (tag.HasParam(wxT("VALIGN")))
|
||||
valign = tag.GetParam(wxT("VALIGN"));
|
||||
else
|
||||
valign = m_tValign;
|
||||
valign.MakeUpper();
|
||||
if (valign == wxT("TOP"))
|
||||
m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP;
|
||||
else if (valign == wxT("BOTTOM"))
|
||||
m_CellInfo[r][c].valign = wxHTML_ALIGN_BOTTOM;
|
||||
else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER;
|
||||
}
|
||||
|
||||
cell->SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
|
||||
}
|
||||
|
||||
void wxHtmlTableCell::ComputeMinMaxWidths()
|
||||
{
|
||||
if (m_NumCols == 0 || m_ColsInfo[0].minWidth != -1) return;
|
||||
|
||||
int left, right, width;
|
||||
|
||||
for (int c = 0; c < m_NumCols; c++)
|
||||
{
|
||||
for (int r = 0; r < m_NumRows; r++)
|
||||
{
|
||||
cellStruct& cell = m_CellInfo[r][c];
|
||||
if (cell.flag == cellUsed)
|
||||
{
|
||||
cell.cont->Layout(2*m_Padding + 1);
|
||||
cell.cont->GetHorizontalConstraints(&left, &right);
|
||||
width = right - left;
|
||||
width -= (cell.colspan-1) * m_Spacing;
|
||||
// HTML 4.0 says it is acceptable to distribute min/max
|
||||
// width of spanning cells evently
|
||||
width /= cell.colspan;
|
||||
for (int j = 0; j < cell.colspan; j++)
|
||||
if (width > m_ColsInfo[c+j].minWidth)
|
||||
m_ColsInfo[c+j].minWidth = width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME -- compute maxWidth as well. Not needed yet, so there's no
|
||||
// point in computing it.
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlTableCell::Layout(int w)
|
||||
{
|
||||
ComputeMinMaxWidths();
|
||||
|
||||
wxHtmlCell::Layout(w);
|
||||
|
||||
/*
|
||||
|
||||
WIDTH ADJUSTING :
|
||||
|
||||
*/
|
||||
|
||||
if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
|
||||
{
|
||||
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
|
||||
else m_Width = m_WidthFloat * w / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
|
||||
else m_Width = m_WidthFloat;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
LAYOUTING :
|
||||
|
||||
*/
|
||||
|
||||
/* 1. setup columns widths: */
|
||||
{
|
||||
int wpix = m_Width - (m_NumCols + 1) * m_Spacing;
|
||||
int i, j;
|
||||
|
||||
// 1a. setup fixed-width columns:
|
||||
for (i = 0; i < m_NumCols; i++)
|
||||
if (m_ColsInfo[i].units == wxHTML_UNITS_PIXELS)
|
||||
{
|
||||
m_ColsInfo[i].pixwidth = wxMax(m_ColsInfo[i].width,
|
||||
m_ColsInfo[i].minWidth);
|
||||
wpix -= m_ColsInfo[i].pixwidth;
|
||||
}
|
||||
|
||||
// 1b. setup floating-width columns:
|
||||
int wtemp = 0;
|
||||
for (i = 0; i < m_NumCols; i++)
|
||||
if ((m_ColsInfo[i].units == wxHTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
|
||||
{
|
||||
m_ColsInfo[i].pixwidth = wxMax(m_ColsInfo[i].width * wpix / 100,
|
||||
m_ColsInfo[i].minWidth);
|
||||
wtemp += m_ColsInfo[i].pixwidth;
|
||||
}
|
||||
wpix -= wtemp;
|
||||
|
||||
// 1c. setup defalut columns (no width specification supplied):
|
||||
// NOTE! This algorithm doesn't conform to HTML standard : it assigns equal widths
|
||||
// instead of optimal
|
||||
for (i = j = 0; i < m_NumCols; i++)
|
||||
if (m_ColsInfo[i].width == 0) j++;
|
||||
for (i = 0; i < m_NumCols; i++)
|
||||
if (m_ColsInfo[i].width == 0)
|
||||
m_ColsInfo[i].pixwidth = wpix / j;
|
||||
}
|
||||
|
||||
/* 2. compute positions of columns: */
|
||||
{
|
||||
int wpos = m_Spacing;
|
||||
for (int i = 0; i < m_NumCols; i++)
|
||||
{
|
||||
m_ColsInfo[i].leftpos = wpos;
|
||||
wpos += m_ColsInfo[i].pixwidth + m_Spacing;
|
||||
}
|
||||
}
|
||||
|
||||
/* 3. sub-layout all cells: */
|
||||
{
|
||||
int *ypos = new int[m_NumRows + 1];
|
||||
|
||||
int actcol, actrow;
|
||||
int fullwid;
|
||||
wxHtmlContainerCell *actcell;
|
||||
|
||||
ypos[0] = m_Spacing;
|
||||
for (actrow = 1; actrow <= m_NumRows; actrow++) ypos[actrow] = -1;
|
||||
for (actrow = 0; actrow < m_NumRows; actrow++)
|
||||
{
|
||||
if (ypos[actrow] == -1) ypos[actrow] = ypos[actrow-1];
|
||||
// 3a. sub-layout and detect max height:
|
||||
|
||||
for (actcol = 0; actcol < m_NumCols; actcol++) {
|
||||
if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
|
||||
actcell = m_CellInfo[actrow][actcol].cont;
|
||||
fullwid = 0;
|
||||
for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++)
|
||||
fullwid += m_ColsInfo[i].pixwidth;
|
||||
fullwid += (m_CellInfo[actrow][actcol].colspan - 1) * m_Spacing;
|
||||
actcell->SetMinHeight(m_CellInfo[actrow][actcol].minheight, m_CellInfo[actrow][actcol].valign);
|
||||
actcell->Layout(fullwid);
|
||||
|
||||
if (ypos[actrow] + actcell->GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing > ypos[actrow + m_CellInfo[actrow][actcol].rowspan])
|
||||
ypos[actrow + m_CellInfo[actrow][actcol].rowspan] =
|
||||
ypos[actrow] + actcell->GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing;
|
||||
}
|
||||
}
|
||||
|
||||
for (actrow = 0; actrow < m_NumRows; actrow++)
|
||||
{
|
||||
// 3b. place cells in row & let'em all have same height:
|
||||
|
||||
for (actcol = 0; actcol < m_NumCols; actcol++)
|
||||
{
|
||||
if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
|
||||
actcell = m_CellInfo[actrow][actcol].cont;
|
||||
actcell->SetMinHeight(
|
||||
ypos[actrow + m_CellInfo[actrow][actcol].rowspan] - ypos[actrow] - m_Spacing,
|
||||
m_CellInfo[actrow][actcol].valign);
|
||||
fullwid = 0;
|
||||
for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++)
|
||||
fullwid += m_ColsInfo[i].pixwidth;
|
||||
fullwid += (m_CellInfo[actrow][actcol].colspan - 1) * m_Spacing;
|
||||
actcell->Layout(fullwid);
|
||||
actcell->SetPos(m_ColsInfo[actcol].leftpos, ypos[actrow]);
|
||||
}
|
||||
}
|
||||
m_Height = ypos[m_NumRows];
|
||||
delete[] ypos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The tables handler:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
|
||||
|
||||
TAG_HANDLER_VARS
|
||||
wxHtmlTableCell* m_Table;
|
||||
wxString m_tAlign, m_rAlign;
|
||||
|
||||
TAG_HANDLER_CONSTR(TABLE)
|
||||
{
|
||||
m_Table = NULL;
|
||||
m_tAlign = m_rAlign = wxEmptyString;
|
||||
}
|
||||
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxHtmlContainerCell *c;
|
||||
|
||||
// new table started, backup upper-level table (if any) and create new:
|
||||
if (tag.GetName() == wxT("TABLE"))
|
||||
{
|
||||
wxHtmlTableCell *oldt = m_Table;
|
||||
wxHtmlContainerCell *oldcont;
|
||||
|
||||
oldcont = c = m_WParser->OpenContainer();
|
||||
|
||||
c->SetWidthFloat(tag, m_WParser->GetPixelScale());
|
||||
m_Table = new wxHtmlTableCell(c, tag, m_WParser->GetPixelScale());
|
||||
int oldAlign = m_WParser->GetAlign();
|
||||
m_tAlign = wxEmptyString;
|
||||
if (tag.HasParam(wxT("ALIGN")))
|
||||
m_tAlign = tag.GetParam(wxT("ALIGN"));
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetAlign(oldAlign);
|
||||
m_WParser->SetContainer(oldcont);
|
||||
m_WParser->CloseContainer();
|
||||
|
||||
m_Table = oldt;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
else if (m_Table)
|
||||
{
|
||||
// new row in table
|
||||
if (tag.GetName() == wxT("TR"))
|
||||
{
|
||||
m_Table->AddRow(tag);
|
||||
m_rAlign = m_tAlign;
|
||||
if (tag.HasParam(wxT("ALIGN")))
|
||||
m_rAlign = tag.GetParam(wxT("ALIGN"));
|
||||
}
|
||||
|
||||
// new cell
|
||||
else
|
||||
{
|
||||
c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table));
|
||||
m_Table->AddCell(c, tag);
|
||||
|
||||
m_WParser->OpenContainer();
|
||||
|
||||
if (tag.GetName() == wxT("TH")) /*header style*/
|
||||
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
||||
else
|
||||
m_WParser->SetAlign(wxHTML_ALIGN_LEFT);
|
||||
|
||||
wxString als;
|
||||
|
||||
als = m_rAlign;
|
||||
if (tag.HasParam(wxT("ALIGN")))
|
||||
als = tag.GetParam(wxT("ALIGN"));
|
||||
als.MakeUpper();
|
||||
if (als == wxT("RIGHT"))
|
||||
m_WParser->SetAlign(wxHTML_ALIGN_RIGHT);
|
||||
else if (als == wxT("LEFT"))
|
||||
m_WParser->SetAlign(wxHTML_ALIGN_LEFT);
|
||||
else if (als == wxT("CENTER"))
|
||||
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
||||
|
||||
m_WParser->OpenContainer();
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(TABLE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Tables)
|
||||
|
||||
TAGS_MODULE_ADD(TABLE)
|
||||
|
||||
TAGS_MODULE_END(Tables)
|
||||
|
||||
|
||||
#endif
|
||||
519
src/html/winpars.cpp
Normal file
519
src/html/winpars.cpp
Normal file
@@ -0,0 +1,519 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: winpars.cpp
|
||||
// Purpose: wxHtmlParser class (generic parser)
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "winpars.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/intl.h"
|
||||
#include "wx/dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/html/htmldefs.h"
|
||||
#include "wx/html/winpars.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/fontmap.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlWinParser
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
wxList wxHtmlWinParser::m_Modules;
|
||||
|
||||
wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindow *wnd) : wxHtmlParser()
|
||||
{
|
||||
m_tmpStrBuf = NULL;
|
||||
m_tmpStrBufSize = 0;
|
||||
m_Window = wnd;
|
||||
m_Container = NULL;
|
||||
m_DC = NULL;
|
||||
m_CharHeight = m_CharWidth = 0;
|
||||
m_UseLink = FALSE;
|
||||
#if !wxUSE_UNICODE
|
||||
m_EncConv = NULL;
|
||||
m_InputEnc = wxFONTENCODING_ISO8859_1;
|
||||
m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||
#endif
|
||||
|
||||
{
|
||||
int i, j, k, l, m;
|
||||
for (i = 0; i < 2; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
for (k = 0; k < 2; k++)
|
||||
for (l = 0; l < 2; l++)
|
||||
for (m = 0; m < 7; m++)
|
||||
{
|
||||
m_FontsTable[i][j][k][l][m] = NULL;
|
||||
m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
|
||||
#if !wxUSE_UNICODE
|
||||
m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
|
||||
#endif
|
||||
}
|
||||
|
||||
SetFonts(wxEmptyString, wxEmptyString, NULL);
|
||||
}
|
||||
|
||||
// fill in wxHtmlParser's tables:
|
||||
wxNode *node = m_Modules.GetFirst();
|
||||
while (node)
|
||||
{
|
||||
wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
|
||||
mod->FillHandlersTable(this);
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
wxHtmlWinParser::~wxHtmlWinParser()
|
||||
{
|
||||
int i, j, k, l, m;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
for (k = 0; k < 2; k++)
|
||||
for (l = 0; l < 2; l++)
|
||||
for (m = 0; m < 7; m++)
|
||||
{
|
||||
if (m_FontsTable[i][j][k][l][m] != NULL)
|
||||
delete m_FontsTable[i][j][k][l][m];
|
||||
}
|
||||
#if !wxUSE_UNICODE
|
||||
delete m_EncConv;
|
||||
#endif
|
||||
delete[] m_tmpStrBuf;
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::AddModule(wxHtmlTagsModule *module)
|
||||
{
|
||||
m_Modules.Append(module);
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::RemoveModule(wxHtmlTagsModule *module)
|
||||
{
|
||||
m_Modules.DeleteObject(module);
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face,
|
||||
const int *sizes)
|
||||
{
|
||||
static int default_sizes[7] =
|
||||
{
|
||||
wxHTML_FONT_SIZE_1,
|
||||
wxHTML_FONT_SIZE_2,
|
||||
wxHTML_FONT_SIZE_3,
|
||||
wxHTML_FONT_SIZE_4,
|
||||
wxHTML_FONT_SIZE_5,
|
||||
wxHTML_FONT_SIZE_6,
|
||||
wxHTML_FONT_SIZE_7
|
||||
};
|
||||
|
||||
if (sizes == NULL) sizes = default_sizes;
|
||||
|
||||
int i, j, k, l, m;
|
||||
|
||||
for (i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i];
|
||||
m_FontFaceFixed = fixed_face;
|
||||
m_FontFaceNormal = normal_face;
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
SetInputEncoding(m_InputEnc);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
for (k = 0; k < 2; k++)
|
||||
for (l = 0; l < 2; l++)
|
||||
for (m = 0; m < 7; m++) {
|
||||
if (m_FontsTable[i][j][k][l][m] != NULL)
|
||||
{
|
||||
delete m_FontsTable[i][j][k][l][m];
|
||||
m_FontsTable[i][j][k][l][m] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::InitParser(const wxString& source)
|
||||
{
|
||||
wxHtmlParser::InitParser(source);
|
||||
wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to wxHtmlWinParser!!"));
|
||||
|
||||
m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE;
|
||||
m_FontSize = 3; //default one
|
||||
CreateCurrentFont(); // we're selecting default font into
|
||||
m_DC->GetTextExtent( wxT("H"), &m_CharWidth, &m_CharHeight);
|
||||
/* NOTE : we're not using GetCharWidth/Height() because
|
||||
of differences under X and win
|
||||
*/
|
||||
|
||||
m_UseLink = FALSE;
|
||||
m_Link = wxHtmlLinkInfo( wxT(""), wxT("") );
|
||||
m_LinkColor.Set(0, 0, 0xFF);
|
||||
m_ActualColor.Set(0, 0, 0);
|
||||
m_Align = wxHTML_ALIGN_LEFT;
|
||||
m_tmpLastWasSpace = FALSE;
|
||||
|
||||
OpenContainer();
|
||||
OpenContainer();
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
wxString charset = ExtractCharsetInformation(source);
|
||||
if (!charset.empty())
|
||||
{
|
||||
wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charset);
|
||||
if (enc != wxFONTENCODING_SYSTEM)
|
||||
SetInputEncoding(enc);
|
||||
}
|
||||
#endif
|
||||
|
||||
m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor));
|
||||
m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::DoneParser()
|
||||
{
|
||||
m_Container = NULL;
|
||||
#if !wxUSE_UNICODE
|
||||
SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call
|
||||
#endif
|
||||
wxHtmlParser::DoneParser();
|
||||
}
|
||||
|
||||
wxObject* wxHtmlWinParser::GetProduct()
|
||||
{
|
||||
wxHtmlContainerCell *top;
|
||||
|
||||
CloseContainer();
|
||||
OpenContainer();
|
||||
|
||||
top = m_Container;
|
||||
while (top->GetParent()) top = top->GetParent();
|
||||
return top;
|
||||
}
|
||||
|
||||
wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
|
||||
const wxString& url) const
|
||||
{
|
||||
// FIXME - normalize the URL to full path before passing to
|
||||
// OnOpeningURL!!
|
||||
if ( m_Window )
|
||||
{
|
||||
wxString myurl(url);
|
||||
wxHtmlOpeningStatus status;
|
||||
for (;;)
|
||||
{
|
||||
wxString redirect;
|
||||
status = m_Window->OnOpeningURL(type, myurl, &redirect);
|
||||
if ( status != wxHTML_REDIRECT )
|
||||
break;
|
||||
|
||||
myurl = redirect;
|
||||
}
|
||||
|
||||
if ( status == wxHTML_BLOCK )
|
||||
return NULL;
|
||||
|
||||
return GetFS()->OpenFile(myurl);
|
||||
}
|
||||
|
||||
return wxHtmlParser::OpenURL(type, url);
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::AddText(const wxChar* txt)
|
||||
{
|
||||
wxHtmlCell *c;
|
||||
size_t i = 0,
|
||||
x,
|
||||
lng = wxStrlen(txt);
|
||||
register wxChar d;
|
||||
int templen = 0;
|
||||
wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
|
||||
|
||||
if (lng+1 > m_tmpStrBufSize)
|
||||
{
|
||||
delete[] m_tmpStrBuf;
|
||||
m_tmpStrBuf = new wxChar[lng+1];
|
||||
m_tmpStrBufSize = lng+1;
|
||||
}
|
||||
wxChar *temp = m_tmpStrBuf;
|
||||
|
||||
if (m_tmpLastWasSpace)
|
||||
{
|
||||
while ((i < lng) &&
|
||||
((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) || (txt[i] == wxT(' ')) ||
|
||||
(txt[i] == wxT('\t')))) i++;
|
||||
}
|
||||
|
||||
while (i < lng)
|
||||
{
|
||||
x = 0;
|
||||
d = temp[templen++] = txt[i];
|
||||
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
|
||||
{
|
||||
i++, x++;
|
||||
while ((i < lng) && ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) ||
|
||||
(txt[i] == wxT(' ')) || (txt[i] == wxT('\t')))) i++, x++;
|
||||
}
|
||||
else i++;
|
||||
|
||||
if (x)
|
||||
{
|
||||
temp[templen-1] = wxT(' ');
|
||||
temp[templen] = 0;
|
||||
#if 0 // VS - WHY was this here?!
|
||||
if (templen == 1) continue;
|
||||
#endif
|
||||
templen = 0;
|
||||
#if !wxUSE_UNICODE
|
||||
if (m_EncConv)
|
||||
m_EncConv->Convert(temp);
|
||||
#endif
|
||||
size_t len = wxStrlen(temp);
|
||||
for (size_t j = 0; j < len; j++)
|
||||
if (temp[j] == nbsp)
|
||||
temp[j] = wxT(' ');
|
||||
c = new wxHtmlWordCell(temp, *(GetDC()));
|
||||
if (m_UseLink)
|
||||
c->SetLink(m_Link);
|
||||
m_Container->InsertCell(c);
|
||||
m_tmpLastWasSpace = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (templen && (templen > 1 || temp[0] != wxT(' ')))
|
||||
{
|
||||
temp[templen] = 0;
|
||||
#if !wxUSE_UNICODE
|
||||
if (m_EncConv)
|
||||
m_EncConv->Convert(temp);
|
||||
#endif
|
||||
size_t len = wxStrlen(temp);
|
||||
for (size_t j = 0; j < len; j++)
|
||||
if (temp[j] == nbsp)
|
||||
temp[j] = wxT(' ');
|
||||
c = new wxHtmlWordCell(temp, *(GetDC()));
|
||||
if (m_UseLink)
|
||||
c->SetLink(m_Link);
|
||||
m_Container->InsertCell(c);
|
||||
m_tmpLastWasSpace = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlContainerCell* wxHtmlWinParser::OpenContainer()
|
||||
{
|
||||
m_Container = new wxHtmlContainerCell(m_Container);
|
||||
m_Container->SetAlignHor(m_Align);
|
||||
m_tmpLastWasSpace = TRUE;
|
||||
/* to avoid space being first character in paragraph */
|
||||
return m_Container;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlContainerCell* wxHtmlWinParser::SetContainer(wxHtmlContainerCell *c)
|
||||
{
|
||||
m_tmpLastWasSpace = TRUE;
|
||||
/* to avoid space being first character in paragraph */
|
||||
return m_Container = c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxHtmlContainerCell* wxHtmlWinParser::CloseContainer()
|
||||
{
|
||||
m_Container = m_Container->GetParent();
|
||||
return m_Container;
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWinParser::SetFontSize(int s)
|
||||
{
|
||||
if (s < 1) s = 1;
|
||||
else if (s > 7) s = 7;
|
||||
m_FontSize = s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wxFont* wxHtmlWinParser::CreateCurrentFont()
|
||||
{
|
||||
int fb = GetFontBold(),
|
||||
fi = GetFontItalic(),
|
||||
fu = GetFontUnderlined(),
|
||||
ff = GetFontFixed(),
|
||||
fs = GetFontSize() - 1 /*remap from <1;7> to <0;6>*/ ;
|
||||
|
||||
wxString face = ff ? m_FontFaceFixed : m_FontFaceNormal;
|
||||
wxString *faceptr = &(m_FontsFacesTable[fb][fi][fu][ff][fs]);
|
||||
wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
|
||||
#if !wxUSE_UNICODE
|
||||
wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
|
||||
#endif
|
||||
|
||||
if (*fontptr != NULL && (*faceptr != face
|
||||
#if !wxUSE_UNICODE
|
||||
|| *encptr != m_OutputEnc
|
||||
#endif
|
||||
))
|
||||
{
|
||||
delete *fontptr;
|
||||
*fontptr = NULL;
|
||||
}
|
||||
|
||||
if (*fontptr == NULL)
|
||||
{
|
||||
*faceptr = face;
|
||||
*fontptr = new wxFont(
|
||||
(int) (m_FontsSizes[fs] * m_PixelScale),
|
||||
ff ? wxMODERN : wxSWISS,
|
||||
fi ? wxITALIC : wxNORMAL,
|
||||
fb ? wxBOLD : wxNORMAL,
|
||||
fu ? TRUE : FALSE, face
|
||||
#if wxUSE_UNICODE
|
||||
);
|
||||
#else
|
||||
, m_OutputEnc);
|
||||
*encptr = m_OutputEnc;
|
||||
#endif
|
||||
}
|
||||
m_DC->SetFont(**fontptr);
|
||||
return (*fontptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
m_Link = link;
|
||||
m_UseLink = (link.GetHref() != wxEmptyString);
|
||||
}
|
||||
|
||||
|
||||
void wxHtmlWinParser::SetFontFace(const wxString& face)
|
||||
{
|
||||
if (GetFontFixed()) m_FontFaceFixed = face;
|
||||
else m_FontFaceNormal = face;
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
if (m_InputEnc != wxFONTENCODING_DEFAULT)
|
||||
SetInputEncoding(m_InputEnc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
|
||||
{
|
||||
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||
if (m_EncConv)
|
||||
{
|
||||
delete m_EncConv;
|
||||
m_EncConv = NULL;
|
||||
}
|
||||
|
||||
if (enc == wxFONTENCODING_DEFAULT) return;
|
||||
|
||||
wxFontEncoding altfix, altnorm;
|
||||
bool availfix, availnorm;
|
||||
|
||||
// exact match?
|
||||
availnorm = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceNormal);
|
||||
availfix = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceFixed);
|
||||
if (availnorm && availfix)
|
||||
m_OutputEnc = enc;
|
||||
|
||||
// alternatives?
|
||||
else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) &&
|
||||
wxFontMapper::Get()->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) &&
|
||||
altnorm == altfix)
|
||||
m_OutputEnc = altnorm;
|
||||
|
||||
// at least normal face?
|
||||
else if (availnorm)
|
||||
m_OutputEnc = enc;
|
||||
else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE))
|
||||
m_OutputEnc = altnorm;
|
||||
|
||||
// okay, let convert to ISO_8859-1, available always
|
||||
else
|
||||
m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||
|
||||
m_InputEnc = enc;
|
||||
if (m_OutputEnc == wxFONTENCODING_DEFAULT)
|
||||
GetEntitiesParser()->SetEncoding(wxFONTENCODING_SYSTEM);
|
||||
else
|
||||
GetEntitiesParser()->SetEncoding(m_OutputEnc);
|
||||
|
||||
if (m_InputEnc == m_OutputEnc) return;
|
||||
|
||||
m_EncConv = new wxEncodingConverter();
|
||||
if (!m_EncConv->Init(m_InputEnc,
|
||||
(m_OutputEnc == wxFONTENCODING_DEFAULT) ?
|
||||
wxFONTENCODING_ISO8859_1 : m_OutputEnc,
|
||||
wxCONVERT_SUBSTITUTE))
|
||||
{ // total failture :-(
|
||||
wxLogError(_("Failed to display HTML document in %s encoding"),
|
||||
wxFontMapper::GetEncodingName(enc).c_str());
|
||||
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||
delete m_EncConv;
|
||||
m_EncConv = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlWinTagHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinTagHandler, wxHtmlTagHandler)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxHtmlTagsModule
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// NB: This is *NOT* winpars.cpp's initialization and shutdown code!!
|
||||
// This module is an ancestor for tag handlers modules defined
|
||||
// in m_*.cpp files with TAGS_MODULE_BEGIN...TAGS_MODULE_END construct.
|
||||
//
|
||||
// Do not add any winpars.cpp shutdown or initialization code to it,
|
||||
// create a new module instead!
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHtmlTagsModule, wxModule)
|
||||
|
||||
bool wxHtmlTagsModule::OnInit()
|
||||
{
|
||||
wxHtmlWinParser::AddModule(this);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxHtmlTagsModule::OnExit()
|
||||
{
|
||||
wxHtmlWinParser::RemoveModule(this);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
83
src/xrc/xh_html.cpp
Normal file
83
src/xrc/xh_html.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_html.cpp
|
||||
// Purpose: XRC resource for wxHtmlWindow
|
||||
// Author: Bob Mitchell
|
||||
// Created: 2000/03/21
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "xh_html.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/xrc/xh_html.h"
|
||||
|
||||
#if wxUSE_HTML
|
||||
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/filesys.h"
|
||||
|
||||
|
||||
wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
|
||||
: wxXmlResourceHandler()
|
||||
{
|
||||
XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER);
|
||||
XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO);
|
||||
AddWindowStyles();
|
||||
}
|
||||
|
||||
wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
|
||||
{
|
||||
XRC_MAKE_INSTANCE(control, wxHtmlWindow)
|
||||
|
||||
control->Create(m_parentAsWindow,
|
||||
GetID(),
|
||||
GetPosition(), GetSize(),
|
||||
GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO),
|
||||
GetName());
|
||||
|
||||
if (HasParam(wxT("borders")))
|
||||
{
|
||||
control->SetBorders(GetDimension(wxT("borders")));
|
||||
}
|
||||
|
||||
if (HasParam(wxT("url")))
|
||||
{
|
||||
wxString url = GetParamValue(wxT("url"));
|
||||
wxFileSystem& fsys = GetCurFileSystem();
|
||||
|
||||
wxFSFile *f = fsys.OpenFile(url);
|
||||
if (f)
|
||||
{
|
||||
control->LoadPage(f->GetLocation());
|
||||
delete f;
|
||||
}
|
||||
else
|
||||
control->LoadPage(url);
|
||||
}
|
||||
|
||||
else if (HasParam(wxT("htmlcode")))
|
||||
{
|
||||
control->SetPage(GetText(wxT("htmlcode")));
|
||||
}
|
||||
|
||||
SetupWindow(control);
|
||||
|
||||
return control;
|
||||
}
|
||||
|
||||
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
|
||||
{
|
||||
return IsOfClass(node, wxT("wxHtmlWindow"));
|
||||
}
|
||||
|
||||
#endif // wxUSE_HTML
|
||||
@@ -1,19 +0,0 @@
|
||||
.DS_Store
|
||||
.emacs.desktop
|
||||
.gdb_history
|
||||
MANIFEST
|
||||
_build_dmg
|
||||
_build_rpm
|
||||
build
|
||||
build-gtk
|
||||
build-gtk2
|
||||
build-gtk2.unicode
|
||||
build-pkg
|
||||
build-pkg-debug
|
||||
build.local
|
||||
build.unicode
|
||||
dist
|
||||
licence
|
||||
s.bat
|
||||
temp
|
||||
update.log
|
||||
@@ -1,72 +0,0 @@
|
||||
Building wxPython on Mac OS X
|
||||
-----------------------------
|
||||
|
||||
|
||||
These are the steps I have used for building wxPython on Mac OS X 10.x
|
||||
with the Apple Developer Tools, a.k.a the Darwin version. I assume
|
||||
that you know your way around a command line and that you know how to
|
||||
get things from various CVS repositories as needed.
|
||||
|
||||
|
||||
1. "MacPython-OSX" 2.3 is required. There is a disk image with an
|
||||
installer package in the wxPython Sourceforge download area, in
|
||||
this group:
|
||||
|
||||
http://sourceforge.net/project/showfiles.php?group_id=10718&release_id=84730
|
||||
|
||||
If, for some reason you need to build your own Python, get the
|
||||
source from www.python.org and follow the instructions in the
|
||||
Mac/OSX/README file to build and install the Python.framework and
|
||||
Python tools.
|
||||
|
||||
One last thing, make sure that /usr/local/bin is in your PATH
|
||||
environment variable since that is where the new python and pythonw
|
||||
commands will be located.
|
||||
|
||||
|
||||
2. In a wxWindows CVS tree make a build directory. (You can also use
|
||||
a CVS snapshot located in http://wxwindows.org/snapshots/ or the
|
||||
released wxPythonSrc-*.tr.gz archive.)
|
||||
|
||||
cd ~/proj/wxWindows # or wherever you put it
|
||||
mkdir build
|
||||
|
||||
3. Run configure from that build directory.
|
||||
|
||||
cd build
|
||||
../configure --with-mac --with-opengl --enable-debug
|
||||
|
||||
4. Make and install wxMac.
|
||||
|
||||
make
|
||||
sudo make install
|
||||
|
||||
5. Build and install wxPython.
|
||||
|
||||
cd ../wxPython
|
||||
python setup.py build install
|
||||
|
||||
If you would like to install to someplace besides the Python
|
||||
site-packages directory (such as to your home directory) then you
|
||||
can add "--root=<path>" after the "install" command. To use
|
||||
wxPython like this you'll need to ensure that the directory
|
||||
containing wxPyrthon is contained in in the PYTHONPATH environment
|
||||
variable.
|
||||
|
||||
6. Test. Just navigate in the Finder to the demo directory and double
|
||||
click demo.py, or simple.py, or whatever you want to run. Or from
|
||||
a command line you can run it this way:
|
||||
|
||||
cd demo
|
||||
pythonw demo.py
|
||||
|
||||
7. Figure out what's wrong, figure out how to fix it, and then send
|
||||
the patches to me. <wink>
|
||||
|
||||
--Robin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,340 +0,0 @@
|
||||
Building wxPython on Unix or Unix-like Systems
|
||||
----------------------------------------------
|
||||
|
||||
NOTE: You should probably look at the ../ README.1st.txt file for
|
||||
directions for how to build wxPython the "new way." This files
|
||||
describes the "old way" to build on unix-like systems. The difference
|
||||
is very simple: The new way uses a private copy of wxGTK while the
|
||||
old way uses either an existing wxGTK that may be installed and used
|
||||
by other apps, or you can build a wxGTK that will be accissible by
|
||||
other apps.
|
||||
|
||||
|
||||
NOTE 2: I use a tool called SWIG (http://www.swig.org) to help
|
||||
generate the C++ sources used in the wxPython extension module.
|
||||
However you don't need to have SWIG unless you want to modify the *.i
|
||||
files. I've made several modifications to and older version of SWIG
|
||||
that are specific to wxPython's needs and so the modified sources are
|
||||
included in the wx CVS at .../wxPython/wxSWIG. But because of the
|
||||
size and since most people won't need it my SWIG is not included in
|
||||
the wxPythonSrc tarball. You'll need to get it from CVS or a CVS
|
||||
snapshot.
|
||||
|
||||
If you need to modify the *.i files for wxPython then you will need to
|
||||
build wxswig. Change to the .../wxPython/wxSWIG directory and run:
|
||||
|
||||
configure
|
||||
make
|
||||
|
||||
(Do not run "make install" as wxswig is run in-place.) You'll then
|
||||
need to change a flag in the setup.py script as described below so the
|
||||
wxPython build process will use SWIG if needed.
|
||||
|
||||
I use the new Python Distutils tool to build wxPython. It is included
|
||||
with Python 2.0, but if you want to use Python 1.5.2 or 1.6 then
|
||||
you'll need to download and install Distutils 1.0 from
|
||||
http://www.python.org/sigs/distutils-sig/
|
||||
|
||||
Okay, now on the the fun stuff...
|
||||
|
||||
|
||||
1. Compile and/or install glib and gtk+
|
||||
---------------------------------------
|
||||
|
||||
A. First of all, check and see if you've already got glib/gtk+ on your
|
||||
system, all the Linux distributions I know of come with it, at
|
||||
least as an option. Look for libglib.* and libgtk.* in your system's
|
||||
standard library directories. You'll also need the headers and
|
||||
config scripts in order to build things that use glib/gtk. Try
|
||||
running gtk-config:
|
||||
|
||||
gtk-config --version
|
||||
|
||||
If you have version 1.2.7 or better then you're all set. Otherwise
|
||||
either get the pacakges for your unix distribution and install them
|
||||
or get the sources from www.gtk.org and build and install them.
|
||||
|
||||
The best version to get is the latest 1.2.x release as the
|
||||
wxWindows support for GTK 2.x is still beta-level. (Most tings
|
||||
work great though, and it looks real nice.)
|
||||
|
||||
|
||||
|
||||
2. Compile and/or install wxGTK
|
||||
-------------------------------
|
||||
|
||||
A. You can find the sources and RPMs for wxGTK at
|
||||
http://wxwindows.org/, just follow the download links from the
|
||||
navigation panel.
|
||||
|
||||
Source code for wxGTK is now included with the wxPythonSrc tarball,
|
||||
and is the recommended way to get released wxGTK source code if you
|
||||
plan on building both.
|
||||
|
||||
You can also check out a current snapshot of the sources from the
|
||||
CVS server. (Some information about annonymous CVS access is at
|
||||
http://wxwindows.org/cvs.htm.) The advantage of using CVS is that
|
||||
you can easily update as soon as the developers check in new
|
||||
sources or fixes. The advantage of using a released version is
|
||||
that it usually has had more thorough testing done. You can decide
|
||||
which method is best for you.
|
||||
|
||||
|
||||
B. You'll usually want to use a version of wxGTK that has the same
|
||||
version number as the wxPython sources you are using. (Another
|
||||
advantage of using wxPythonSrc or CVS is that you'll get both at
|
||||
the same time.)
|
||||
|
||||
|
||||
C. If using the RPMs be sure to get both the wxGTK and wxGTK-devel
|
||||
RPMs (at a minimum) and then install them as root.
|
||||
|
||||
rpm -Uhv wxGTK-2.2.2-0.i386.rpm wxGTK-devel-2.2.2-0.i386.rpm
|
||||
|
||||
|
||||
D. If using the sources (either from the tarball or from CVS) then
|
||||
configure it like this:
|
||||
|
||||
cd wxWindows # or whatever your top-level directory is called
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --with-gtk --enable-geometry
|
||||
|
||||
There are gobs and gobs of options for the configure script, run
|
||||
../configure --help to see them all. I'll describe some that I find
|
||||
useful here.
|
||||
|
||||
If you have OpenGL or compatible libraries installed, then add the
|
||||
--with-opengl flag.
|
||||
|
||||
If you are on Solaris and are using a recent version of GCC, then
|
||||
you'll probably want to add the --enable-permissive flag so the
|
||||
compiler won't barf on your broken X11 header files.
|
||||
|
||||
To make a debugging version of wxGTK, add the --enable-debug flag.
|
||||
This sets the -g flag for the compiler and also activates some
|
||||
special debugging code in wxWindows by defining the __WXDEBUG__
|
||||
macro. You'll get some extra asserts, failure logging, etc.
|
||||
|
||||
If you are using GTK 2.x then you'll want to add --enable-gtk2 and
|
||||
probably also --enable-unicode.
|
||||
|
||||
|
||||
E. Now just compile and install. You need to use GNU make, so if your
|
||||
system has something else get GNU make and build and install it and
|
||||
use it instead of your system's default make command.
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
The last step will probably have to be done as root. Also, if your
|
||||
system needs anything done to update the dynamic loader for shared
|
||||
libraries, (such as running ldconfig on Linux) then do it now.
|
||||
|
||||
|
||||
F. You can test your build by changing to one of the directories under
|
||||
build/samples or build/demos, running make and then running the
|
||||
executable that is built.
|
||||
|
||||
|
||||
|
||||
3. Compile and install wxPython
|
||||
-------------------------------
|
||||
|
||||
A. You have the same options (and same advantages/disadvantages) for
|
||||
getting the wxPython source, either a released snapshot or from
|
||||
CVS. The released version file is named wxPythonSrc-[version].tar.gz
|
||||
and is available at http://wxpython.org/download.php. If you want
|
||||
to use CVS you'll find wxPython in the wxWindows CVS tree (see
|
||||
above) in the wxWindows/wxPython directory.
|
||||
|
||||
|
||||
B. wxPython is built with the standard Python Distutils tool and
|
||||
currently includes it's own snapshot of the latest version of
|
||||
distutils which can also be used with previous versions of Python
|
||||
|
||||
On Unix systems Distutils figures out what commands and flags to
|
||||
use for the compiler and linker by looking in the Makefile that was
|
||||
used to build Python itself. Most of the time this works okay. If
|
||||
it doesn't, there doesn't seem to be a way to override the values
|
||||
that Distutils uses without hacking either Distutils itself, or
|
||||
Python's Makefile. (NOTE: This has been changed with the
|
||||
distutilsincluded with Python 2.3 but I havn't yet looked into how
|
||||
best to utilize this in wxPython...)
|
||||
|
||||
While we're on the subject of how Python was built... Since
|
||||
wxPython is a C++ extension some platforms and/or compilers will
|
||||
require that the Python executable was linked with the C++ linker
|
||||
in order for everything to work correctly. If you build and
|
||||
install Python yourself then this is easy to take care of,
|
||||
otherwise you may have to mess with binary packages or bribe your
|
||||
system administrator...
|
||||
|
||||
In my case on Solaris wxPython applications would core dump on
|
||||
exit. The core file indicated that the fault happened after
|
||||
_exit() was called and the run-time library was trying to execute
|
||||
cleanup code. After relinking the Python executable the problem
|
||||
went away. To build Python to link with the C++ linker do this:
|
||||
|
||||
cd Python-2.0 # wherever the root of the source tree is
|
||||
rm python # in case it's still there from an old build
|
||||
make LINKCC=g++ # or whatever your C++ command is
|
||||
make install
|
||||
|
||||
I recently built Python 2.1.3 and Python 2.2.1 on Solaris and did
|
||||
not have to resort to this workaround so apparently things are
|
||||
getting better there. I will leave this note here though in case
|
||||
there are similar issues elsewhere. However I did run into a
|
||||
Python build issue that affects the wxPython build when attempting
|
||||
to use SunCC instead of GNU gcc. See the note below titled
|
||||
"Building with non-GNU compilers" if you are interested.
|
||||
|
||||
|
||||
C. Change to the root wxPython directory and look at the setup.py
|
||||
file. This is the script that configures and defines all the
|
||||
information that Distutils needs to build wxPython. There are some
|
||||
options near the begining of the script that you may want or need
|
||||
to change based on your system and what options you have selected
|
||||
up to this point, (sources from tar.gz or from CVS, etc.) You can
|
||||
either change these flags directly in setup.py or supply them on
|
||||
the command-line.
|
||||
|
||||
BUILD_GLCANVAS Set to zero if you don't want to build the
|
||||
Open GL canvas extension module. If you don't
|
||||
have OpenGL or compatible libraries then you'll
|
||||
need to set this to zero.
|
||||
|
||||
BUILD_OGL Set to zero if you don't want to build the
|
||||
Object Graphics Library extension module.
|
||||
|
||||
BUILD_STC Set to zero if you don't want to build the
|
||||
wxStyledTextCtrl (the Scintilla wrapper)
|
||||
extension module.
|
||||
|
||||
USE_SWIG If you have edited any of the *.i files you
|
||||
will need to set this flag to non-zero so SWIG
|
||||
will be executed to regenerate the wrapper C++
|
||||
and shadow python files.
|
||||
|
||||
etc.
|
||||
|
||||
|
||||
D. To build and install wxPython you simply need to execute the
|
||||
setup.py script. If you have more than one version of Python
|
||||
installed, be sure to execute setup.py with the version you want to
|
||||
build wxPython for. Depending on the permissions on your
|
||||
site-packages directory you may need to be root to run the install
|
||||
command.
|
||||
|
||||
python setup.py build install
|
||||
|
||||
If you need to change any of the build flags that can also be done
|
||||
on the setup.py command line, like this:
|
||||
|
||||
python setup.py BUILD_GLCANVAS=0 build install
|
||||
|
||||
If you are using GTK 2.x then you'll want to add these flags:
|
||||
|
||||
python setup.py WXPORT=gtk2 UNICODE=1 build install
|
||||
|
||||
If you would like to install to someplace besides the Python
|
||||
site-packages directory (such as to your home directory) then you
|
||||
can add "--root=<path>" after the "install" command. To use
|
||||
wxPython like this you'll need to ensure that the directory
|
||||
containing wxPyrthon is contained in in the PYTHONPATH environment
|
||||
variable.
|
||||
|
||||
|
||||
E. At this point you should be able to change into the wxPython/demo
|
||||
directory and run the demo:
|
||||
|
||||
python demo.py
|
||||
|
||||
|
||||
F. If you would like to make a test build that doesn't overwrite any
|
||||
installed version of wxPython you can do so with this command
|
||||
instead of the install command above:
|
||||
|
||||
python setup.py build_ext --inplace
|
||||
|
||||
This will build the wxPython package in the local wxPython
|
||||
directory instead of installing it under your Python installation.
|
||||
To run using this test version just add the base wxPython source
|
||||
directory to the PYTHONPATH:
|
||||
|
||||
export PYTHONPATH=~/projects/wxWindows/wxPython
|
||||
# or whatever is required for your shell
|
||||
cd ~/projects/wxWindows/wxPython/demo
|
||||
python demo.py
|
||||
|
||||
|
||||
|
||||
4. Building with non-GNU compilers
|
||||
----------------------------------
|
||||
|
||||
As mentioned above Python's distutils uses whatever compiler Python
|
||||
was compiled with to compile extension modules. It also appears that
|
||||
distutils assumes that this compiler can compile C or C++ sources as
|
||||
distutils makes no differentiation between the two. For builds using
|
||||
GNU gcc and a few other compilers this is not an issue as they will
|
||||
determine the type of source from the file extension. For SunCC (and
|
||||
probably other compilers that came from cfront) it won't work as the C
|
||||
compiler (cc) is totally separate from the C++ compiler (CC). This
|
||||
causes distutils to attempt to compile the wxPython sources with the C
|
||||
compiler, which won't work.
|
||||
|
||||
There may be better ways to get around this, but here is the
|
||||
workaround I devised. I created a script that will execute either cc
|
||||
or CC based on the file extension given to it. If Python uses this
|
||||
script for its compiler then it will also be used by extensions built
|
||||
with distutils and everybody will be more or less happy. Here is a
|
||||
copy of the script I used. It was a fairly quick rush job so there
|
||||
are probably issues with it but it worked for me.
|
||||
|
||||
#!/bin/bash
|
||||
#--------------------------------------------------------------
|
||||
# Try to determine type of file being compiled and then
|
||||
# launch cc for C sources or CC for C++.
|
||||
#
|
||||
|
||||
args=$@
|
||||
is_C=
|
||||
|
||||
for arg in $args; do
|
||||
|
||||
# is the arg a file that exists?
|
||||
if [ -e $arg ]; then
|
||||
|
||||
# does it end in ".c"?
|
||||
if [ "${arg:${#arg}-2}" == ".c" ]; then
|
||||
is_C=yes
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# if the flag wasn't set then assume C++ and execute CC,
|
||||
# otherwise execute cc.
|
||||
if [ -z $is_C ]; then
|
||||
exec CC -w $@
|
||||
else
|
||||
exec cc -w $@
|
||||
fi
|
||||
#--------------------------------------------------------------
|
||||
|
||||
I called it pycc, put it in ${prefix}/bin and set its execute
|
||||
permission bit.
|
||||
|
||||
The next step is to configure and build Python such that it uses pycc
|
||||
as it's compiler. You can do that by setting CC in your environment
|
||||
before running configure, like this in bash:
|
||||
|
||||
export CC=pycc
|
||||
configure
|
||||
|
||||
After making and installing Python with this configuration you should
|
||||
be able to build wxPython as described in the steps above.
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
robin@alldunn.com
|
||||
@@ -1,303 +0,0 @@
|
||||
Building wxPython on Win32
|
||||
--------------------------
|
||||
|
||||
|
||||
Building wxPython for use on win32 systems is a fairly simple process
|
||||
consisting of just a few steps. However depending on where you get
|
||||
your sources from and what your desired end result is, there are
|
||||
several permutations of those steps. At a high level the basic steps
|
||||
are:
|
||||
|
||||
1. Get the sources
|
||||
2. Build the wxWindows DLL
|
||||
3. Build and Install wxPython
|
||||
|
||||
We'll go into more detail of each of these steps below, but first a
|
||||
few bits of background information on tools.
|
||||
|
||||
I use a tool called SWIG (http://www.swig.org) to help generate the
|
||||
C++ sources used in the wxPython extension module. However you don't
|
||||
need to have SWIG unless you want to modify the *.i files. I've made
|
||||
several modifications to SWIG specific to wxPython's needs and so the
|
||||
modified sources are included in the wx CVS at.../wxPython/wxSWIG.
|
||||
But because of the size and since most people won't need it my SWIG is
|
||||
not included in the wxPythonSrc tarball. You'll need to get it from
|
||||
CVS or a CVS snapshot.
|
||||
|
||||
If you need to modify the *.i files for wxPython then change to this
|
||||
directory and run:
|
||||
|
||||
nmake -f makefile.vc
|
||||
|
||||
Then you'll need to change a flag in the setup.py script as described
|
||||
below so the wxPython build process will use SWIG if needed.
|
||||
|
||||
I use the new Python Distutils tool to build wxPython. It is included
|
||||
with Python 2.0, but if you want to use Python 1.5.2 or 1.6 then
|
||||
you'll need to download and install Distutils 1.0 from
|
||||
http://www.python.org/sigs/distutils-sig/
|
||||
|
||||
I use Microsoft Visual C++ 6.0 (5.0 with the service packs should work
|
||||
also) to compile the wxPython C++ sources. Since I am using Distutils
|
||||
it should be easier now to build with other win32 compilers such as
|
||||
the free mingw32 or Borland compilers, but I havn't tried them yet.
|
||||
If anybody wants to try it I'll take any required patches for the
|
||||
setup script and for these instructions.
|
||||
|
||||
|
||||
|
||||
UNICODE
|
||||
-------
|
||||
|
||||
To build the version of wxWindows/wxPython that uses the unicode
|
||||
version of the Win32 APIs, just follow the steps below with these
|
||||
changes:
|
||||
|
||||
a. You'll need the MSLU runtime DLL and import lib. The former can
|
||||
be downloaded from Microsoft, the latter is part of the latest
|
||||
Platform SDK from Microsoft (see msdn.microsoft.com for
|
||||
details). An alternative implementation of import lib can be
|
||||
downloaded from http://libunicows.sourceforge.net
|
||||
|
||||
b. Add "UNICODE=1 MSLU=1" to the nmake command line when building
|
||||
wxWindows.
|
||||
|
||||
c. Add "UNICODE=1" to the setup.py commandline when building
|
||||
wxPython.
|
||||
|
||||
d. See the notes in CHANGES.txt about unicode.
|
||||
|
||||
|
||||
And now on to the fun stuff...
|
||||
|
||||
|
||||
|
||||
|
||||
1. Get the sources
|
||||
------------------
|
||||
|
||||
A. You can either use a tarball with the released version of the
|
||||
source code for wxWindows/wxPython, or you can get current
|
||||
development sources from the CVS repository. (Some information
|
||||
about annonymous CVS access is at the http://wxwindows.org/cvs.htm
|
||||
site.) The advantage of using CVS is that you can easily update as
|
||||
soon as the developers check in new sources or fixes. The
|
||||
advantage of using a released version is that it usually has had
|
||||
more thorough testing done. You can decide which method is best
|
||||
for you. The released version file is named
|
||||
wxPythonSrc-[version].tar.gz and is available from the wxPython
|
||||
website at http://wxpython.org/download.php. You can use WinZip to
|
||||
unpack it if you don't have tar and gzip.
|
||||
|
||||
|
||||
B. Once you get the sources be sure to put them in a path without a
|
||||
space in it (i.e., NOT c:\Program Files\wx) and set an environment
|
||||
variable named WXWIN to the top level directory. For example:
|
||||
|
||||
set WXWIN=c:\wx\wxPythonSrc-2.4.0.4
|
||||
|
||||
You'll probably want to add that line to your autoexec.bat or
|
||||
System Properties depending on the type of system you are on.
|
||||
|
||||
|
||||
C. Change to the %WXWIN%\include\wx\msw directory and copy setup0.h to
|
||||
setup.h and then edit setup.h. This is how you control which parts
|
||||
of wxWindows are compiled into or left out of the build, simply by
|
||||
turning options on or off. I have the following differences from
|
||||
the default setup0.h in my setup.h, but you can experiment with
|
||||
other settings if you like:
|
||||
|
||||
|
||||
WXWIN_COMPATIBILITY_2_2 0
|
||||
wxDIALOG_UNIT_COMPATIBILITY 0
|
||||
wxUSE_DEBUG_CONTEXT 1
|
||||
wxUSE_MEMORY_TRACING 1
|
||||
wxUSE_CMDLINE_PARSER 0
|
||||
wxUSE_FSVOLUME 0
|
||||
wxUSE_DIALUP_MANAGER 0
|
||||
wxUSE_DYNAMIC_LOADER 0
|
||||
wxUSE_TREELAYOUT 0
|
||||
wxUSE_MS_HTML_HELP 0
|
||||
wxUSE_POSTSCRIPT 1
|
||||
|
||||
|
||||
** NEW **
|
||||
Be sure that wxUSE_GLCANVAS is defined to be 0 as wxPython now
|
||||
keeps its own copy of the glcanvas sources and expects that it is
|
||||
not in the main library. This is done to reduce the number of
|
||||
dependant DLLs on the core library and therefore help reduce
|
||||
startup time.
|
||||
|
||||
|
||||
|
||||
2. Build the wxWindows DLL
|
||||
---------------------------
|
||||
|
||||
A. Although MSVC project files are provided I always use the makefiles
|
||||
to build wxWindows because by default the flags are compatible with
|
||||
Python, (and I make sure they stay that way.) You would have to
|
||||
edit the project files a bit to make it work otherwise.
|
||||
|
||||
|
||||
B. There are three different types of wxWindows DLLs that can be
|
||||
produced by the VC makefile simply by providing a flag on the nmake
|
||||
command-line, I call the three types DEBUG, FINAL, and HYBRID.
|
||||
Here are some more details:
|
||||
|
||||
DEBUG Specified with "FINAL=0" and produces a DLL named
|
||||
wxmsw[version]d.dll. This DLL is compiled with full
|
||||
debugging information and with the __WXDEBUG__ macro set,
|
||||
which enables some debugging-only code in wxWindows such
|
||||
as assertions and failure log messages. The /MDd flag is
|
||||
used which means that it is linked with the debugging
|
||||
version of the C runtime library and also that you must
|
||||
use the debugging version of Python, (python_d.exe and
|
||||
pythonXX_d.dll) which also means that all extensions
|
||||
loaded by Python should also have the _d in the name.
|
||||
With this option you can use the MSVC debugger to trace
|
||||
though the Python interpreter, as well as the code for the
|
||||
wxPython extension and the wxWindows DLL.
|
||||
|
||||
FINAL Specified with "FINAL=1" and produces a DLL named
|
||||
wxmsw[version].dll. This DLL is compiled with optimizations
|
||||
turned on and without debugging information and without
|
||||
__WXDEBUG__. The /MD flag is used which means that you
|
||||
can use this version with the standard python.exe.
|
||||
|
||||
HYBRID Specified with "FINAL=hybrid" and produces a DLL named
|
||||
wxmsw[version]h.dll. This DLL is almost the same as the
|
||||
FINAL version except the __WXDEBUG__ is used which means
|
||||
that you will get extra runtime assertions and validations
|
||||
from wxWindows. If any of these fail then they are turned
|
||||
into a Python exception that you can catch and deal with
|
||||
in your code. This is the version that I use when making
|
||||
the binary installer for win32.
|
||||
|
||||
|
||||
Since different DLL names and object file directories are used you
|
||||
can build all three types if you like.
|
||||
|
||||
|
||||
C. Change to the %WXWIN%\src\msw directory and type the following command,
|
||||
using the value for FINAL that you want:
|
||||
|
||||
nmake -f makefile.vc dll FINAL=hybrid
|
||||
|
||||
Your machine will then crunch away for possibly a long time,
|
||||
depending on your hardware, and when it's done you should have a
|
||||
DLL and some library files in %WXWIN%\lib.
|
||||
|
||||
|
||||
D. You'll either need to add %WXWIN%\lib to the PATH or copy the DLL
|
||||
file to a directory already on the PATH so the DLL can be found at
|
||||
runtime. Another option is to copy the DLL to the directory that
|
||||
the wxPython pacakge is installed to, for example,
|
||||
c:\Python22\lib\site-packages\wxPython.
|
||||
|
||||
|
||||
E. You can test your build by changing to one of the directories under
|
||||
%WXWIN%\samples or %WXWIN\demos and typing (using the right FINAL flag):
|
||||
|
||||
nmake -f makefile.vc FINAL=hybrid WXUSINGDLL=1
|
||||
|
||||
and then executing the resulting .exe file.
|
||||
|
||||
|
||||
|
||||
|
||||
3. Build and Install wxPython
|
||||
-----------------------------
|
||||
|
||||
A. As mentioned previouslly, wxPython is built with the standard
|
||||
Python Distutils tool. If you are using Python 2.0 or later you
|
||||
are all set, otherwise you need to download and install Distutils
|
||||
1.0 from http://www.python.org/sigs/distutils-sig/.
|
||||
|
||||
|
||||
B. Change to the root wxPython directory and look at the setup.py
|
||||
file. This is the script that configures and defines all the
|
||||
information that Distutils needs to build wxPython. There are some
|
||||
options near the begining of the script that you may want or need
|
||||
to change based on what options you have selected up to this point,
|
||||
(type of DLL built, sources from tar.gz or from CVS, etc.) You can
|
||||
either change these flags directly in setup.py or supply them on
|
||||
the command-line.
|
||||
|
||||
BUILD_GLCANVAS Set to zero if you don't want to build the
|
||||
Open GL canvas extension module.
|
||||
|
||||
BUILD_OGL Set to zero if you don't want to build the
|
||||
Object Graphics Library extension module.
|
||||
|
||||
BUILD_STC Set to zero if you don't want to build the
|
||||
wxStyledTextCtrl (the Scintilla wrapper)
|
||||
extension module.
|
||||
|
||||
USE_SWIG If you have edited any of the *.i files you
|
||||
will need to set this flag to non-zero so SWIG
|
||||
will be executed to regenerate the wrapper C++
|
||||
and shadow python files.
|
||||
|
||||
etc.
|
||||
|
||||
|
||||
C. To build and install wxPython you simply need to execute the
|
||||
setup.py script. If you have more than one version of Python
|
||||
installed, be sure to execute setup.py with the version you want to
|
||||
build wxPython for.
|
||||
|
||||
Depending on what kind of wxWindows DLL you built there are
|
||||
different command-line parameters you'll want to pass to setup (in
|
||||
addition to possibly one or more of the above):
|
||||
|
||||
FINAL: python setup.py install
|
||||
|
||||
DEBUG: python setup.py build --debug install
|
||||
|
||||
HYBRID: python setup.py HYBRID=1 install
|
||||
|
||||
NOTE: If you get an internal compiler error from MSVC then you
|
||||
need to edit setup.py and add in the /GX- flag that is normally
|
||||
commented out. Just search for "GX-" and uncomment it so it is put
|
||||
into the cflags list.
|
||||
|
||||
If you would like to install to someplace besides the Python
|
||||
site-packages directory (such as to your home directory) then you
|
||||
can add "--root=<path>" after the "install" command. To use
|
||||
wxPython like this you'll need to ensure that the directory
|
||||
containing wxPyrthon is contained in in the PYTHONPATH environment
|
||||
variable.
|
||||
|
||||
|
||||
D. At this point you should be able to change into the wxPython\demo
|
||||
directory and run the demo:
|
||||
|
||||
python demo.py
|
||||
|
||||
|
||||
E. If you would like to make a test build that doesn't overwrite the
|
||||
installed version of wxPython you can do so with one of these
|
||||
commands instead of the install command above:
|
||||
|
||||
FINAL: python setup.py build_ext --inplace
|
||||
|
||||
DEBUG: python setup.py build_ext --debug --inplace
|
||||
|
||||
HYBRID: python setup.py HYBRID=1 build_ext --inplace
|
||||
|
||||
This will build the wxPython package in the local wxPython
|
||||
directory instead of installing it under your Python installation.
|
||||
To run using this test version just add the base wxPython source
|
||||
directory to the PYTHONPATH:
|
||||
|
||||
set PYTHONPATH=%WXDIR%\wxPython
|
||||
cd %WXDIR%\wxPython\demo
|
||||
python demo.py
|
||||
|
||||
|
||||
That's all folks!
|
||||
|
||||
|
||||
-----------------
|
||||
robin@alldunn.com
|
||||
|
||||
1470
wxPython/CHANGES.txt
1470
wxPython/CHANGES.txt
File diff suppressed because it is too large
Load Diff
@@ -1,205 +0,0 @@
|
||||
include *.txt
|
||||
include my_distutils.py
|
||||
## include my_install_data.py
|
||||
include licence/*.txt
|
||||
include b
|
||||
include b.bat
|
||||
include MANIFEST.in
|
||||
|
||||
include SWIG/*
|
||||
exclude SWIG/CVS/*
|
||||
|
||||
include demo/*.py
|
||||
include demo/*.wdr
|
||||
include demo/*.txt
|
||||
include demo/*.xml
|
||||
include demo/*.ico
|
||||
include demo/bitmaps/*.bmp
|
||||
include demo/bitmaps/*.ico
|
||||
include demo/bitmaps/*.gif
|
||||
include demo/bitmaps/*.png
|
||||
include demo/bitmaps/*.jpg
|
||||
include demo/bmp_source/*.bmp
|
||||
include demo/bmp_source/*.ico
|
||||
include demo/bmp_source/*.gif
|
||||
include demo/bmp_source/*.png
|
||||
include demo/bmp_source/*.jpg
|
||||
include demo/data/*.png
|
||||
include demo/data/*.htm
|
||||
include demo/data/*.html
|
||||
include demo/data/*.bmp
|
||||
include demo/data/*.txt
|
||||
include demo/data/*.i
|
||||
include demo/data/*.h
|
||||
include demo/data/*.py
|
||||
include demo/data/*.wav
|
||||
include demo/data/*.wdr
|
||||
include demo/data/*.xrc
|
||||
include demo/dllwidget/Makefile
|
||||
include demo/dllwidget/makefile.*
|
||||
include demo/dllwidget/*.cpp
|
||||
include demo/dllwidget/*.py
|
||||
|
||||
include samples/doodle/*.txt
|
||||
include samples/doodle/*.py
|
||||
include samples/doodle/*.iss
|
||||
include samples/doodle/sample.ddl
|
||||
include samples/wxProject/*.txt
|
||||
include samples/wxProject/*.py
|
||||
include samples/StyleEditor/*.py
|
||||
include samples/StyleEditor/*.txt
|
||||
include samples/StyleEditor/*.cfg
|
||||
include samples/pySketch/*.py
|
||||
include samples/pySketch/images/*.bmp
|
||||
include samples/frogedit/*.py
|
||||
include samples/embedded/*.py
|
||||
include samples/embedded/*.cpp
|
||||
include samples/embedded/*.txt
|
||||
include samples/embedded/*.vc
|
||||
include samples/embedded/*.unx
|
||||
include samples/embedded/*.ico
|
||||
include samples/embedded/*.xpm
|
||||
|
||||
|
||||
include wxPython/lib/*.py
|
||||
include wxPython/lib/*.txt
|
||||
include wxPython/lib/*.wdr
|
||||
include wxPython/lib/editor/*.py
|
||||
include wxPython/lib/editor/*.txt
|
||||
include wxPython/lib/mixins/*.py
|
||||
include wxPython/lib/PyCrust/*.py
|
||||
include wxPython/lib/PyCrust/*.txt
|
||||
include wxPython/lib/PyCrust/*.ico
|
||||
|
||||
exclude wxPython/*
|
||||
exclude tests
|
||||
|
||||
include src/*.i
|
||||
include src/*.py
|
||||
include src/*.cpp
|
||||
include src/*.c
|
||||
include src/*.h
|
||||
include src/*.ico
|
||||
include src/*.rc
|
||||
include src/wxc.pyd.manifest
|
||||
|
||||
include src/msw/*.cpp
|
||||
include src/msw/*.h
|
||||
include src/msw/*.py
|
||||
|
||||
include src/gtk/*.cpp
|
||||
include src/gtk/*.h
|
||||
include src/gtk/*.py
|
||||
|
||||
include src/mac/*.cpp
|
||||
include src/mac/*.h
|
||||
include src/mac/*.py
|
||||
|
||||
include wxPython/tools/*.py
|
||||
include wxPython/tools/XRCed/CHANGES
|
||||
include wxPython/tools/XRCed/TODO
|
||||
include wxPython/tools/XRCed/README
|
||||
include wxPython/tools/XRCed/*.py
|
||||
include wxPython/tools/XRCed/*.xrc
|
||||
include wxPython/tools/XRCed/*.ico
|
||||
include wxPython/tools/XRCed/*.sh
|
||||
|
||||
include scripts/*
|
||||
|
||||
include contrib/glcanvas/*.i
|
||||
include contrib/glcanvas/*.py
|
||||
include contrib/glcanvas/*.cpp
|
||||
include contrib/glcanvas/*.c
|
||||
include contrib/glcanvas/*.h
|
||||
include contrib/glcanvas/msw/*.cpp
|
||||
include contrib/glcanvas/msw/*.h
|
||||
include contrib/glcanvas/msw/*.py
|
||||
include contrib/glcanvas/gtk/*.cpp
|
||||
include contrib/glcanvas/gtk/*.h
|
||||
include contrib/glcanvas/gtk/*.py
|
||||
include contrib/glcanvas/mac/*.cpp
|
||||
include contrib/glcanvas/mac/*.h
|
||||
include contrib/glcanvas/mac/*.py
|
||||
|
||||
include contrib/ogl/*.txt
|
||||
include contrib/ogl/*.i
|
||||
include contrib/ogl/*.py
|
||||
include contrib/ogl/*.cpp
|
||||
include contrib/ogl/*.c
|
||||
include contrib/ogl/*.h
|
||||
include contrib/ogl/contrib/include/wx/ogl/*.h
|
||||
include contrib/ogl/contrib/src/ogl/*.cpp
|
||||
|
||||
include contrib/stc/*.txt
|
||||
include contrib/stc/*.i
|
||||
include contrib/stc/*.py
|
||||
include contrib/stc/*.cpp
|
||||
include contrib/stc/*.c
|
||||
include contrib/stc/msw/*.h
|
||||
include contrib/stc/msw/*.cpp
|
||||
include contrib/stc/msw/*.py
|
||||
include contrib/stc/gtk/*.h
|
||||
include contrib/stc/gtk/*.cpp
|
||||
include contrib/stc/gtk/*.py
|
||||
include contrib/stc/mac/*.h
|
||||
include contrib/stc/mac/*.cpp
|
||||
include contrib/stc/mac/*.py
|
||||
include contrib/stc/contrib/include/wx/stc/*.h
|
||||
include contrib/stc/contrib/src/stc/*.h
|
||||
include contrib/stc/contrib/src/stc/*.cpp
|
||||
include contrib/stc/contrib/src/stc/*.txt
|
||||
include contrib/stc/contrib/src/stc/*.py
|
||||
include contrib/stc/contrib/src/stc/stc.*.in
|
||||
include contrib/stc/contrib/src/stc/scintilla/include/*.h
|
||||
include contrib/stc/contrib/src/stc/scintilla/include/*.iface
|
||||
include contrib/stc/contrib/src/stc/scintilla/src/*.h
|
||||
include contrib/stc/contrib/src/stc/scintilla/src/*.cxx
|
||||
include contrib/stc/contrib/src/stc/scintilla/*.txt
|
||||
|
||||
include contrib/xrc/*.txt
|
||||
include contrib/xrc/*.i
|
||||
include contrib/xrc/*.py
|
||||
include contrib/xrc/*.cpp
|
||||
include contrib/xrc/*.c
|
||||
include contrib/xrc/*.h
|
||||
include contrib/xrc/contrib/include/wx/xrc/*.h
|
||||
include contrib/xrc/contrib/src/xrc/*.cpp
|
||||
include contrib/xrc/contrib/src/xrc/*.txt
|
||||
include contrib/xrc/contrib/src/xrc/README.EXPAT
|
||||
include contrib/xrc/contrib/src/xrc/expat/*.txt
|
||||
include contrib/xrc/contrib/src/xrc/expat/xmlparse/*.c
|
||||
include contrib/xrc/contrib/src/xrc/expat/xmlparse/*.h
|
||||
include contrib/xrc/contrib/src/xrc/expat/xmltok/*.c
|
||||
include contrib/xrc/contrib/src/xrc/expat/xmltok/*.h
|
||||
|
||||
include contrib/gizmos/*.txt
|
||||
include contrib/gizmos/*.i
|
||||
include contrib/gizmos/*.py
|
||||
include contrib/gizmos/*.cpp
|
||||
include contrib/gizmos/*.c
|
||||
include contrib/gizmos/*.h
|
||||
include contrib/gizmos/contrib/include/wx/gizmos/*.h
|
||||
include contrib/gizmos/contrib/src/gizmos/*.cpp
|
||||
include contrib/gizmos/contrib/src/gizmos/*.xpm
|
||||
include contrib/gizmos/contrib/src/gizmos/*.txt
|
||||
|
||||
include contrib/iewin/*.txt
|
||||
include contrib/iewin/*.i
|
||||
include contrib/iewin/*.py
|
||||
include contrib/iewin/*.cpp
|
||||
include contrib/iewin/*.c
|
||||
include contrib/iewin/*.h
|
||||
|
||||
include contrib/dllwidget/*.txt
|
||||
include contrib/dllwidget/*.i
|
||||
include contrib/dllwidget/*.py
|
||||
include contrib/dllwidget/*.cpp
|
||||
include contrib/dllwidget/*.c
|
||||
include contrib/dllwidget/*.h
|
||||
|
||||
include demo/dllwidget/*.h
|
||||
include demo/dllwidget/*.cpp
|
||||
include demo/dllwidget/*.py
|
||||
include demo/dllwidget/Makefile
|
||||
include demo/dllwidget/makefile.*
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
wxPython README
|
||||
---------------
|
||||
|
||||
Welcome to the wonderful world of wxPython!
|
||||
|
||||
So where do you go from here? The best thing to do is to run the demo
|
||||
and use its source code to help you learn how to use wxPython. Most
|
||||
of the classes available are demonstrated there, and you can view the
|
||||
sources directly in the demo so it is designed to help you learn. If
|
||||
you are on Windows or OS X then you can run the demo just by double
|
||||
clicking it's icon. If you are on Linux/Unix then change to the
|
||||
directory containing the demo and type:
|
||||
|
||||
python demo.py
|
||||
|
||||
There are also some sample mini applications available for you to run
|
||||
and to play with as a learning exercise.
|
||||
|
||||
The next thing you should do is join the wxPython-users maillist where
|
||||
you can interact with a community of other users and developers who
|
||||
are willing to help you learn, answer questions and solve problems.
|
||||
To join the mail list just send an email message to the following
|
||||
address from the account you want to receive the mail messages from
|
||||
the list:
|
||||
|
||||
wxPython-users-subscribe@lists.wxwindows.org
|
||||
|
||||
There is also a good set of class reference documentation available
|
||||
for wxPython, but currently it is geared for the C++ user. This may
|
||||
be a little daunting at first, but with a little practice you'll
|
||||
easily be able to "translate" from the C++ shown there to Python. Not
|
||||
all classes documented are available in Python, but most of the GUI
|
||||
related classes are.
|
||||
|
||||
|
||||
Other Info
|
||||
----------
|
||||
|
||||
Please also see the following files in this directory:
|
||||
|
||||
CHANGES.txt Information about new features, fixes,
|
||||
etc. in each release.
|
||||
|
||||
../README.1st.txt Instructions for building wxGTK and
|
||||
wxPython on Unix-like platforms the
|
||||
"new way."
|
||||
|
||||
BUILD.unix.txt Instructions for building wxPython on
|
||||
various Unix-like platforms the "old way."
|
||||
|
||||
BUILD.win32.txt Instructions for building wxPython on Windows.
|
||||
|
||||
BUILD.osx.txt Instructions for building wxPython on Mac OS X.
|
||||
|
||||
licence/* Text of the wxWindows license.
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
Robin Dunn
|
||||
robin@alldunn.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
123
wxPython/b
123
wxPython/b
@@ -1,123 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
function getpyver {
|
||||
if [ "$1" = "15" ]; then
|
||||
PYVER=1.5
|
||||
elif [ "$1" = "20" ]; then
|
||||
PYVER=2.0
|
||||
elif [ "$1" = "21" ]; then
|
||||
PYVER=2.1
|
||||
elif [ "$1" = "22" ]; then
|
||||
PYVER=2.2
|
||||
elif [ "$1" = "23" ]; then
|
||||
PYVER=2.3
|
||||
else
|
||||
echo You must specify Python version as first parameter.
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
getpyver $1
|
||||
shift
|
||||
|
||||
python$PYVER -c "import sys;print '\n', sys.version, '\n'"
|
||||
|
||||
|
||||
SETUP="python$PYVER -u setup.py"
|
||||
FLAGS="USE_SWIG=1 IN_CVS_TREE=1" # BUILD_GLCANVAS=0"
|
||||
OTHERFLAGS=""
|
||||
|
||||
|
||||
|
||||
# "c" --> clean
|
||||
if [ "$1" = "c" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS clean $*"
|
||||
OTHERCMD="rm -f wxPython/*.so"
|
||||
|
||||
# "d" --> clean extension modules only
|
||||
elif [ "$1" = "d" ]; then
|
||||
shift
|
||||
CMD="rm -f wxPython/*.so"
|
||||
|
||||
# "t" --> touch *.i files
|
||||
elif [ "$1" = "t" ]; then
|
||||
shift
|
||||
#CMD="set CMD=touch src\*.i; touch contrib\glcanvas\*.i; touch contrib\ogl\*.i; touch contrib\stc\*.i"
|
||||
CMD='find . -name "*.i" | xargs touch'
|
||||
|
||||
# "i" --> install
|
||||
elif [ "$1" = "i" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*"
|
||||
|
||||
# "s" --> source dist
|
||||
elif [ "$1" = "s" ]; then
|
||||
shift
|
||||
CMD="$SETUP $OTHERFLAGS sdist $*"
|
||||
|
||||
# "r" --> rpm dist
|
||||
elif [ "$1" = "r" ]; then
|
||||
WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"`
|
||||
for VER in 21 22; do
|
||||
getpyver $VER
|
||||
|
||||
echo "*****************************************************************"
|
||||
echo "******* Building wxPython for Python $PYVER"
|
||||
echo "*****************************************************************"
|
||||
|
||||
SETUP="python$PYVER -u setup.py"
|
||||
|
||||
# save the original
|
||||
cp setup.py setup.py.save
|
||||
|
||||
# fix up setup.py the way we want...
|
||||
sed "s/BUILD_GLCANVAS = /BUILD_GLCANVAS = 0 #/" < setup.py.save > setup.py.temp
|
||||
sed "s/GL_ONLY = /GL_ONLY = 1 #/" < setup.py.temp > setup.py
|
||||
|
||||
# build wxPython-gl RPM
|
||||
$SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER
|
||||
### --requires=python$PYVER
|
||||
rm dist/wxPython-gl*.tar.gz
|
||||
|
||||
# Build wxPython RPM
|
||||
cp setup.py setup.py.temp
|
||||
sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py
|
||||
$SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER
|
||||
### --requires=python$PYVER
|
||||
|
||||
# put the oringal setup.py back
|
||||
cp setup.py.save setup.py
|
||||
rm setup.py.*
|
||||
|
||||
# rename the binary RPM's
|
||||
mv dist/wxPython-$WXPYVER-1.i386.rpm dist/wxPython-$WXPYVER-1-Py$VER.i386.rpm
|
||||
mv dist/wxPython-gl-$WXPYVER-1.i386.rpm dist/wxPython-gl-$WXPYVER-1-Py$VER.i386.rpm
|
||||
|
||||
done
|
||||
|
||||
# rebuild the source dists without the munched up setup.py
|
||||
$SETUP $OTHERFLAGS bdist_rpm --source-only
|
||||
exit 0
|
||||
|
||||
|
||||
# "f" --> FINAL (no debug)
|
||||
elif [ "$1" = "f" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*"
|
||||
|
||||
# (no command arg) --> normal build for development
|
||||
else
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*"
|
||||
fi
|
||||
|
||||
|
||||
echo $CMD
|
||||
eval $CMD
|
||||
|
||||
|
||||
if [ "$OTHERCMD" != "" ]; then
|
||||
echo $OTHERCMD
|
||||
$OTHERCMD
|
||||
fi
|
||||
|
||||
117
wxPython/b.bat
117
wxPython/b.bat
@@ -1,117 +0,0 @@
|
||||
@echo off
|
||||
REM ----------------------------------------------------------------------
|
||||
REM Note: This is a 4NT script
|
||||
REM ----------------------------------------------------------------------
|
||||
setlocal
|
||||
|
||||
set FLAGS=USE_SWIG=1 IN_CVS_TREE=1
|
||||
|
||||
|
||||
rem Use non-default python?
|
||||
iff "%1" == "15" .or. "%1" == "20" .or. "%1" == "21" .or. "%1" == "22" .or. "%1" == "23" then
|
||||
set VER=%1
|
||||
set PYTHON=%TOOLS%\python%1%\python.exe
|
||||
shift
|
||||
else
|
||||
beep
|
||||
echo You must specify Python version as first parameter.
|
||||
quit
|
||||
endiff
|
||||
set SETUP=%PYTHON% -u setup.py
|
||||
|
||||
|
||||
%PYTHON% -c "import sys;print '\n', sys.version, '\n'"
|
||||
|
||||
|
||||
rem "c" --> clean
|
||||
iff "%1" == "c" then
|
||||
shift
|
||||
set CMD=%SETUP% %FLAGS% clean %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
set OTHERCMD=del wxPython\*.pyd
|
||||
|
||||
rem just remove the *.pyd's
|
||||
elseiff "%1" == "d" then
|
||||
shift
|
||||
set CMD=del wxPython\*.pyd
|
||||
set OTHERCMD=del wxPython\*.pdb
|
||||
|
||||
rem touch all the *.i files so swig will regenerate
|
||||
elseiff "%1" == "t" then
|
||||
shift
|
||||
set CMD=echo Finished!
|
||||
find . -name "*.i" | xargs -l touch
|
||||
|
||||
rem "i" --> install
|
||||
elseiff "%1" == "i" then
|
||||
shift
|
||||
set CMD=%SETUP% build install
|
||||
|
||||
rem "r" --> make installer
|
||||
elseiff "%1" == "r" then
|
||||
shift
|
||||
set CMD=%PYTHON% distrib\make_installer.py %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
rem "s" --> source dist
|
||||
elseiff "%1" == "s" then
|
||||
shift
|
||||
set CMD=%SETUP sdist
|
||||
|
||||
rem "f" --> FINAL
|
||||
elseiff "%1" == "f" then
|
||||
shift
|
||||
set CMD=%SETUP% %FLAGS% FINAL=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
rem "h" --> HYBRID
|
||||
elseiff "%1" == "h" then
|
||||
shift
|
||||
set CMD=%SETUP% %FLAGS% HYBRID=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
rem "a" --> make all installers
|
||||
elseiff "%1" == "a" then
|
||||
shift
|
||||
set CMD=echo Finished!
|
||||
|
||||
call b.bat 21 d
|
||||
call b.bat 21 h
|
||||
call b.bat 21 r
|
||||
call b.bat 21 d UNICODE=1
|
||||
call b.bat 21 h UNICODE=1
|
||||
call b.bat 21 r UNICODE=1
|
||||
|
||||
call b.bat 22 d
|
||||
call b.bat 22 h
|
||||
call b.bat 22 r
|
||||
call b.bat 22 d UNICODE=1
|
||||
call b.bat 22 h UNICODE=1
|
||||
call b.bat 22 r UNICODE=1
|
||||
|
||||
call b.bat 23 d
|
||||
call b.bat 23 h
|
||||
call b.bat 23 r
|
||||
call b.bat 23 d UNICODE=1
|
||||
call b.bat 23 h UNICODE=1
|
||||
call b.bat 23 r UNICODE=1
|
||||
|
||||
|
||||
rem "b" --> both debug and hybrid builds
|
||||
elseiff "%1" == "b" then
|
||||
shift
|
||||
set CMD=echo Finished!
|
||||
call b.bat %VER% %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
call b.bat %VER% h %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
rem (no command arg) --> normal build for development
|
||||
else
|
||||
set CMD=%SETUP% %FLAGS% HYBRID=0 build_ext --inplace --debug %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
endiff
|
||||
|
||||
|
||||
|
||||
echo %CMD%
|
||||
%CMD%
|
||||
|
||||
iff "%OTHERCMD%" != "" then
|
||||
echo %OTHERCMD%
|
||||
%OTHERCMD%
|
||||
endiff
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
update.log
|
||||
@@ -1,3 +0,0 @@
|
||||
These sub directories contain add-on modules that are not part of the
|
||||
core wxPython, either because of licensing issues, optional code in
|
||||
wxWindows, contrib code in wxWindows, or whatever.
|
||||
@@ -1,128 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dllwidget.cpp
|
||||
// Purpose: Dynamically loadable C++ widget for wxPython
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2001/12/03
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dllwidget.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "dllwidget.h"
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDllWidget, wxPanel)
|
||||
|
||||
wxDllWidget::wxDllWidget(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& dllName, const wxString& className,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style)
|
||||
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
className + wxT("_container")),
|
||||
m_widget(NULL), m_lib(NULL), m_controlAdded(FALSE)
|
||||
{
|
||||
SetBackgroundColour(wxColour(255, 0, 255));
|
||||
if ( !!className )
|
||||
LoadWidget(dllName, className, style);
|
||||
}
|
||||
|
||||
wxDllWidget::~wxDllWidget()
|
||||
{
|
||||
UnloadWidget();
|
||||
}
|
||||
|
||||
void wxDllWidget::AddChild(wxWindowBase *child)
|
||||
{
|
||||
wxASSERT_MSG( !m_controlAdded, wxT("Couldn't load two widgets into one container!") );
|
||||
|
||||
wxPanel::AddChild(child);
|
||||
|
||||
m_controlAdded = TRUE;
|
||||
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add((wxWindow*)child, 1, wxEXPAND);
|
||||
SetSizer(sizer);
|
||||
SetAutoLayout(TRUE);
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
wxString wxDllWidget::GetDllExt()
|
||||
{
|
||||
return wxDllLoader::GetDllExt();
|
||||
}
|
||||
|
||||
|
||||
typedef WXDLLEXPORT bool (*DLL_WidgetFactory_t)(const wxString& className,
|
||||
wxWindow *parent,
|
||||
long style,
|
||||
wxWindow **classInst,
|
||||
wxSendCommandFunc *cmdFunc);
|
||||
|
||||
bool wxDllWidget::LoadWidget(const wxString& dll, const wxString& className,
|
||||
long style)
|
||||
{
|
||||
UnloadWidget();
|
||||
|
||||
// Load the dynamic library
|
||||
m_lib = new wxDynamicLibrary(dll);
|
||||
if ( !m_lib->IsLoaded() )
|
||||
{
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DLL_WidgetFactory_t factory;
|
||||
factory = (DLL_WidgetFactory_t) m_lib->GetSymbol(wxT("DLL_WidgetFactory"));
|
||||
if ( factory == NULL)
|
||||
{
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !factory(className, this, style, &m_widget, &m_cmdFunc) )
|
||||
{
|
||||
delete m_widget;
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
m_widget = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxDllWidget::UnloadWidget()
|
||||
{
|
||||
if ( m_widget )
|
||||
{
|
||||
DestroyChildren();
|
||||
m_widget = NULL;
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int wxDllWidget::SendCommand(int cmd, const wxString& param)
|
||||
{
|
||||
wxASSERT_MSG( m_widget && m_cmdFunc, wxT("Sending command to not loaded widget!"));
|
||||
|
||||
return m_cmdFunc(m_widget, cmd, param);
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dllwidget.h
|
||||
// Purpose: Dynamically loadable C++ widget for wxPython
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2001/12/03
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dllwidget.h"
|
||||
#endif
|
||||
|
||||
#ifndef __DLLWIDGET_H__
|
||||
#define __DLLWIDGET_H__
|
||||
|
||||
#include "wx/panel.h"
|
||||
|
||||
/*
|
||||
|
||||
wxDllWidget can be used to embed a wxWindow implemented in C++ in your
|
||||
wxPython application without the need to write a SWIG interface. Widget's code
|
||||
is stored in shared library or DLL that exports DLL_WidgetFactory symbol
|
||||
and loaded at runtime. All you have to do is to pass the name of DLL and the class
|
||||
to create to wxDllWidget's ctor.
|
||||
|
||||
Runtime-loadable widget must have HandleCommand method (see the example) that is
|
||||
used to communicate with Python app. You call wxDllWidget.SendCommand(cmd,param) from
|
||||
Python and it in turn calls HandleCommand of the loaded widget.
|
||||
|
||||
You must use DECLARE_DLL_WIDGET, BEGIN_WIDGET_LIBRARY, END_WIDGET_LIBRARY and
|
||||
REGISTER_WIDGET macros in your C++ module in order to provide all the meat
|
||||
wxDllWidget needs.
|
||||
|
||||
Example of use:
|
||||
|
||||
#define CMD_MAKEWHITE 1
|
||||
|
||||
class MyWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
MyWindow(wxWindow *parent, long style)
|
||||
: wxWindow(parent, -1) {}
|
||||
|
||||
int HandleCommand(int cmd, const wxString& param)
|
||||
{
|
||||
if (cmd == CMD_MAKEWHITE)
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyWindow)
|
||||
|
||||
class MyCanvasWindow : public wxScrolledWindow
|
||||
{
|
||||
...
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyCanvasWindow)
|
||||
|
||||
BEGIN_WIDGET_LIBRARY()
|
||||
REGISTER_WIDGET(MyWindow)
|
||||
REGISTER_WIDGET(MyCanvasWindow)
|
||||
END_WIDGET_LIBRARY()
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class WXDLLEXPORT wxDynamicLibrary;
|
||||
|
||||
typedef int (*wxSendCommandFunc)(wxWindow *wnd, int cmd, const wxString& param);
|
||||
|
||||
class wxDllWidget : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxDllWidget(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxString& dllName = wxEmptyString,
|
||||
const wxString& className = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
virtual ~wxDllWidget();
|
||||
|
||||
bool Ok() { return m_widget != NULL; }
|
||||
|
||||
virtual int SendCommand(int cmd, const wxString& param = wxEmptyString);
|
||||
virtual wxWindow* GetWidgetWindow() { return m_widget; }
|
||||
|
||||
virtual void AddChild(wxWindowBase *child);
|
||||
|
||||
static wxString GetDllExt();
|
||||
|
||||
|
||||
protected:
|
||||
bool LoadWidget(const wxString& dll, const wxString& className, long style);
|
||||
void UnloadWidget();
|
||||
|
||||
protected:
|
||||
wxWindow* m_widget;
|
||||
wxSendCommandFunc m_cmdFunc;
|
||||
wxDynamicLibrary* m_lib;
|
||||
bool m_controlAdded;
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_CLASS(wxDllWidget)
|
||||
};
|
||||
|
||||
|
||||
#define DECLARE_DLL_WIDGET(widget) \
|
||||
static int SendCommandTo##widget(wxWindow *wnd, int cmd, const wxString& param) \
|
||||
{ \
|
||||
return wxStaticCast(wnd, widget)->HandleCommand(cmd, param); \
|
||||
}
|
||||
|
||||
|
||||
#define BEGIN_WIDGET_LIBRARY() \
|
||||
extern "C" WXEXPORT bool DLL_WidgetFactory( \
|
||||
const wxString& className, \
|
||||
wxWindow *parent, \
|
||||
long style, \
|
||||
wxWindow **classInst, \
|
||||
wxSendCommandFunc *cmdFunc) \
|
||||
{ \
|
||||
wxClassInfo::CleanUpClasses(); \
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
|
||||
#define REGISTER_WIDGET(widget) \
|
||||
if ( className == wxT(#widget) ) \
|
||||
{ \
|
||||
*classInst = new widget(parent, style); \
|
||||
*cmdFunc = SendCommandTo##widget; \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
|
||||
#define END_WIDGET_LIBRARY() \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#endif // __DLLWIDGET_H__
|
||||
@@ -1,6 +0,0 @@
|
||||
# The SWIG module is named dllwidget_ to avoid name clashes, so
|
||||
# this stub just imports everything in it so the friendly module
|
||||
# name can be used elsewhere.
|
||||
|
||||
from dllwidget_ import *
|
||||
|
||||
@@ -1,467 +0,0 @@
|
||||
/*
|
||||
* FILE : contrib/dllwidget/dllwidget_.cpp
|
||||
*
|
||||
* This file was automatically generated by :
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
* Version 1.1 (Build 883)
|
||||
*
|
||||
* Portions Copyright (c) 1995-1998
|
||||
* The University of Utah and The Regents of the University of California.
|
||||
* Permission is granted to distribute this file in any manner provided
|
||||
* this notice remains intact.
|
||||
*
|
||||
* Do not make changes to this file--changes will be lost!
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define SWIGCODE
|
||||
/* Implementation : PYTHON */
|
||||
|
||||
#define SWIGPYTHON
|
||||
#include "Python.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
|
||||
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
extern PyObject *SWIG_newvarlink(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define SWIG_init initdllwidget_c
|
||||
|
||||
#define SWIG_name "dllwidget_c"
|
||||
|
||||
#include "wxPython.h"
|
||||
#include "dllwidget.h"
|
||||
|
||||
|
||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
PyObject* o3;
|
||||
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyTuple_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyTuple_New(1);
|
||||
PyTuple_SetItem(target, 0, o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3, 0, o);
|
||||
|
||||
o2 = target;
|
||||
target = PySequence_Concat(o2, o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
static void *SwigwxDllWidgetTowxPanel(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxPanel *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxPanel *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDllWidgetTowxWindow(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxWindow *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxWindow *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDllWidgetTowxEvtHandler(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxEvtHandler *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxEvtHandler *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDllWidgetTowxObject(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxObject *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxDllWidget(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (new wxDllWidget(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6))
|
||||
static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxDllWidget * _result;
|
||||
wxWindow * _arg0;
|
||||
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||
wxString * _arg2 = (wxString *) &wxPyEmptyString;
|
||||
wxString * _arg3 = (wxString *) &wxPyEmptyString;
|
||||
wxPoint * _arg4 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg5 = (wxSize *) &wxDefaultSize;
|
||||
long _arg6 = (long ) 0;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
PyObject * _obj3 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj4 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj5 = 0;
|
||||
char *_kwnames[] = { "parent","id","dllName","className","pos","size","style", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOOOl:new_wxDllWidget",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_obj4,&_obj5,&_arg6))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxDllWidget. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = wxString_in_helper(_obj2);
|
||||
if (_arg2 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = wxString_in_helper(_obj3);
|
||||
if (_arg3 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj4)
|
||||
{
|
||||
_arg4 = &temp;
|
||||
if (! wxPoint_helper(_obj4, &_arg4))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj5)
|
||||
{
|
||||
_arg5 = &temp0;
|
||||
if (! wxSize_helper(_obj5, &_arg5))
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxDllWidget *)new_wxDllWidget(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxDllWidget_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj2)
|
||||
delete _arg2;
|
||||
}
|
||||
{
|
||||
if (_obj3)
|
||||
delete _arg3;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDllWidget_Ok(_swigobj) (_swigobj->Ok())
|
||||
static PyObject *_wrap_wxDllWidget_Ok(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxDllWidget * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDllWidget_Ok",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_Ok. Expected _wxDllWidget_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxDllWidget_Ok(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDllWidget_SendCommand(_swigobj,_swigarg0,_swigarg1) (_swigobj->SendCommand(_swigarg0,_swigarg1))
|
||||
static PyObject *_wrap_wxDllWidget_SendCommand(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
int _result;
|
||||
wxDllWidget * _arg0;
|
||||
int _arg1;
|
||||
wxString * _arg2 = (wxString *) &wxPyEmptyString;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","cmd","param", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|O:wxDllWidget_SendCommand",_kwnames,&_argo0,&_arg1,&_obj2))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_SendCommand. Expected _wxDllWidget_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = wxString_in_helper(_obj2);
|
||||
if (_arg2 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (int )wxDllWidget_SendCommand(_arg0,_arg1,*_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (_obj2)
|
||||
delete _arg2;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDllWidget_GetWidgetWindow(_swigobj) (_swigobj->GetWidgetWindow())
|
||||
static PyObject *_wrap_wxDllWidget_GetWidgetWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _result;
|
||||
wxDllWidget * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDllWidget_GetWidgetWindow",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_GetWidgetWindow. Expected _wxDllWidget_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxWindow *)wxDllWidget_GetWidgetWindow(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{ _resultobj = wxPyMake_wxObject(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxDllWidget_GetDllExt(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxString * _result;
|
||||
char *_kwnames[] = { NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxDllWidget_GetDllExt",_kwnames))
|
||||
return NULL;
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = new wxString (wxDllWidget::GetDllExt());
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
}
|
||||
{
|
||||
delete _result;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyMethodDef dllwidget_cMethods[] = {
|
||||
{ "wxDllWidget_GetDllExt", (PyCFunction) _wrap_wxDllWidget_GetDllExt, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDllWidget_GetWidgetWindow", (PyCFunction) _wrap_wxDllWidget_GetWidgetWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDllWidget_SendCommand", (PyCFunction) _wrap_wxDllWidget_SendCommand, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDllWidget_Ok", (PyCFunction) _wrap_wxDllWidget_Ok, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxDllWidget", (PyCFunction) _wrap_new_wxDllWidget, METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This table is used by the pointer type-checker
|
||||
*/
|
||||
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_signed_long","_long",0},
|
||||
{ "_wxPrintQuality","_wxCoord",0},
|
||||
{ "_wxPrintQuality","_int",0},
|
||||
{ "_wxPrintQuality","_signed_int",0},
|
||||
{ "_wxPrintQuality","_unsigned_int",0},
|
||||
{ "_wxPrintQuality","_wxWindowID",0},
|
||||
{ "_wxPrintQuality","_uint",0},
|
||||
{ "_wxPrintQuality","_EBool",0},
|
||||
{ "_wxPrintQuality","_size_t",0},
|
||||
{ "_wxPrintQuality","_time_t",0},
|
||||
{ "_byte","_unsigned_char",0},
|
||||
{ "_long","_unsigned_long",0},
|
||||
{ "_long","_signed_long",0},
|
||||
{ "_size_t","_wxCoord",0},
|
||||
{ "_size_t","_wxPrintQuality",0},
|
||||
{ "_size_t","_time_t",0},
|
||||
{ "_size_t","_unsigned_int",0},
|
||||
{ "_size_t","_int",0},
|
||||
{ "_size_t","_wxWindowID",0},
|
||||
{ "_size_t","_uint",0},
|
||||
{ "_wxPanel","_wxDllWidget",SwigwxDllWidgetTowxPanel},
|
||||
{ "_uint","_wxCoord",0},
|
||||
{ "_uint","_wxPrintQuality",0},
|
||||
{ "_uint","_time_t",0},
|
||||
{ "_uint","_size_t",0},
|
||||
{ "_uint","_unsigned_int",0},
|
||||
{ "_uint","_int",0},
|
||||
{ "_uint","_wxWindowID",0},
|
||||
{ "_wxChar","_char",0},
|
||||
{ "_char","_wxChar",0},
|
||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||
{ "_EBool","_wxCoord",0},
|
||||
{ "_EBool","_wxPrintQuality",0},
|
||||
{ "_EBool","_signed_int",0},
|
||||
{ "_EBool","_int",0},
|
||||
{ "_EBool","_wxWindowID",0},
|
||||
{ "_unsigned_long","_long",0},
|
||||
{ "_wxNativeFontInfo","_struct_wxNativeFontInfo",0},
|
||||
{ "_signed_int","_wxCoord",0},
|
||||
{ "_signed_int","_wxPrintQuality",0},
|
||||
{ "_signed_int","_EBool",0},
|
||||
{ "_signed_int","_wxWindowID",0},
|
||||
{ "_signed_int","_int",0},
|
||||
{ "_WXTYPE","_wxDateTime_t",0},
|
||||
{ "_WXTYPE","_short",0},
|
||||
{ "_WXTYPE","_signed_short",0},
|
||||
{ "_WXTYPE","_unsigned_short",0},
|
||||
{ "_unsigned_short","_wxDateTime_t",0},
|
||||
{ "_unsigned_short","_WXTYPE",0},
|
||||
{ "_unsigned_short","_short",0},
|
||||
{ "_wxObject","_wxDllWidget",SwigwxDllWidgetTowxObject},
|
||||
{ "_signed_short","_WXTYPE",0},
|
||||
{ "_signed_short","_short",0},
|
||||
{ "_unsigned_char","_byte",0},
|
||||
{ "_unsigned_int","_wxCoord",0},
|
||||
{ "_unsigned_int","_wxPrintQuality",0},
|
||||
{ "_unsigned_int","_time_t",0},
|
||||
{ "_unsigned_int","_size_t",0},
|
||||
{ "_unsigned_int","_uint",0},
|
||||
{ "_unsigned_int","_wxWindowID",0},
|
||||
{ "_unsigned_int","_int",0},
|
||||
{ "_short","_wxDateTime_t",0},
|
||||
{ "_short","_WXTYPE",0},
|
||||
{ "_short","_unsigned_short",0},
|
||||
{ "_short","_signed_short",0},
|
||||
{ "_wxWindowID","_wxCoord",0},
|
||||
{ "_wxWindowID","_wxPrintQuality",0},
|
||||
{ "_wxWindowID","_time_t",0},
|
||||
{ "_wxWindowID","_size_t",0},
|
||||
{ "_wxWindowID","_EBool",0},
|
||||
{ "_wxWindowID","_uint",0},
|
||||
{ "_wxWindowID","_int",0},
|
||||
{ "_wxWindowID","_signed_int",0},
|
||||
{ "_wxWindowID","_unsigned_int",0},
|
||||
{ "_int","_wxCoord",0},
|
||||
{ "_int","_wxPrintQuality",0},
|
||||
{ "_int","_time_t",0},
|
||||
{ "_int","_size_t",0},
|
||||
{ "_int","_EBool",0},
|
||||
{ "_int","_uint",0},
|
||||
{ "_int","_wxWindowID",0},
|
||||
{ "_int","_unsigned_int",0},
|
||||
{ "_int","_signed_int",0},
|
||||
{ "_wxDateTime_t","_unsigned_short",0},
|
||||
{ "_wxDateTime_t","_short",0},
|
||||
{ "_wxDateTime_t","_WXTYPE",0},
|
||||
{ "_time_t","_wxCoord",0},
|
||||
{ "_time_t","_wxPrintQuality",0},
|
||||
{ "_time_t","_unsigned_int",0},
|
||||
{ "_time_t","_int",0},
|
||||
{ "_time_t","_wxWindowID",0},
|
||||
{ "_time_t","_uint",0},
|
||||
{ "_time_t","_size_t",0},
|
||||
{ "_wxCoord","_int",0},
|
||||
{ "_wxCoord","_signed_int",0},
|
||||
{ "_wxCoord","_unsigned_int",0},
|
||||
{ "_wxCoord","_wxWindowID",0},
|
||||
{ "_wxCoord","_uint",0},
|
||||
{ "_wxCoord","_EBool",0},
|
||||
{ "_wxCoord","_size_t",0},
|
||||
{ "_wxCoord","_time_t",0},
|
||||
{ "_wxCoord","_wxPrintQuality",0},
|
||||
{ "_wxEvtHandler","_wxDllWidget",SwigwxDllWidgetTowxEvtHandler},
|
||||
{ "_wxWindow","_wxDllWidget",SwigwxDllWidgetTowxWindow},
|
||||
{0,0,0}};
|
||||
|
||||
static PyObject *SWIG_globals;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void) initdllwidget_c() {
|
||||
PyObject *m, *d;
|
||||
SWIG_globals = SWIG_newvarlink();
|
||||
m = Py_InitModule("dllwidget_c", dllwidget_cMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; _swig_mapping[i].n1; i++)
|
||||
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dllwidget_.i
|
||||
// Purpose: Load wx widgets from external DLLs
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 04-Dec-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%module dllwidget_
|
||||
|
||||
|
||||
%{
|
||||
#include "wxPython.h"
|
||||
#include "dllwidget.h"
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
%extern wx.i
|
||||
%extern windows.i
|
||||
%extern _defs.i
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
||||
wxDllWidget can be used to embed a wxWindow implemented in C++ in your
|
||||
wxPython application without the need to write a SWIG interface. Widget's code
|
||||
is stored in shared library or DLL that exports DLL_WidgetFactory symbol
|
||||
and loaded at runtime. All you have to do is to pass the name of DLL and the class
|
||||
to create to wxDllWidget's ctor.
|
||||
|
||||
Runtime-loadable widget must have HandleCommand method (see the example) that is
|
||||
used to communicate with Python app. You call wxDllWidget.SendCommand(cmd,param) from
|
||||
Python and it in turn calls HandleCommand of the loaded widget.
|
||||
|
||||
You must use DECLARE_DLL_WIDGET, BEGIN_WIDGET_LIBRARY, END_WIDGET_LIBRARY and
|
||||
REGISTER_WIDGET macros in your C++ module in order to provide all the meat
|
||||
wxDllWidget needs.
|
||||
|
||||
Example of use:
|
||||
|
||||
#define CMD_MAKEWHITE 1
|
||||
|
||||
class MyWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
MyWindow(wxWindow *parent, long style)
|
||||
: wxWindow(parent, -1) {}
|
||||
|
||||
int HandleCommand(int cmd, const wxString& param)
|
||||
{
|
||||
if (cmd == CMD_MAKEWHITE)
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyWindow)
|
||||
|
||||
class MyCanvasWindow : public wxScrolledWindow
|
||||
{
|
||||
...
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyCanvasWindow)
|
||||
|
||||
BEGIN_WIDGET_LIBRARY()
|
||||
REGISTER_WIDGET(MyWindow)
|
||||
REGISTER_WIDGET(MyCanvasWindow)
|
||||
END_WIDGET_LIBRARY()
|
||||
|
||||
*/
|
||||
|
||||
class wxDllWidget : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxDllWidget(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxString& dllName = wxPyEmptyString,
|
||||
const wxString& className = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
|
||||
bool Ok();
|
||||
|
||||
int SendCommand(int cmd, const wxString& param = wxPyEmptyString);
|
||||
wxWindow* GetWidgetWindow();
|
||||
|
||||
static wxString GetDllExt();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
%}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -1,78 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import dllwidget_c
|
||||
|
||||
from misc import *
|
||||
|
||||
from misc2 import *
|
||||
|
||||
from windows import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from events import *
|
||||
|
||||
from streams import *
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
class wxDllWidgetPtr(wxPanelPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Ok(self, *_args, **_kwargs):
|
||||
val = apply(dllwidget_c.wxDllWidget_Ok,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SendCommand(self, *_args, **_kwargs):
|
||||
val = apply(dllwidget_c.wxDllWidget_SendCommand,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetWidgetWindow(self, *_args, **_kwargs):
|
||||
val = apply(dllwidget_c.wxDllWidget_GetWidgetWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxDllWidget instance at %s>" % (self.this,)
|
||||
class wxDllWidget(wxDllWidgetPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(dllwidget_c.new_wxDllWidget,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
wxDllWidget_GetDllExt = dllwidget_c.wxDllWidget_GetDllExt
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
contrib
|
||||
@@ -1,12 +0,0 @@
|
||||
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||
|
||||
wx.wxDynamicSashSplitEventPtr = wxDynamicSashSplitEventPtr
|
||||
wx.wxDynamicSashUnifyEventPtr = wxDynamicSashUnifyEventPtr
|
||||
wx.wxDynamicSashWindowPtr = wxDynamicSashWindowPtr
|
||||
|
||||
wx.wxEditableListBoxPtr = wxEditableListBoxPtr
|
||||
|
||||
wx.wxRemotelyScrolledTreeCtrlPtr = wxRemotelyScrolledTreeCtrlPtr
|
||||
wx.wxTreeCompanionWindowPtr = wxTreeCompanionWindowPtr
|
||||
wx.wxThinSplitterWindowPtr = wxThinSplitterWindowPtr
|
||||
wx.wxSplitterScrolledWindowPtr = wxSplitterScrolledWindowPtr
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,414 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gizmos.i
|
||||
// Purpose: Wrappers for the "gizmo" classes in wx/contrib
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 23-Nov-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%module gizmos
|
||||
|
||||
|
||||
%{
|
||||
#include "wxPython.h"
|
||||
#include <wx/gizmos/dynamicsash.h>
|
||||
#include <wx/gizmos/editlbox.h>
|
||||
#include <wx/gizmos/splittree.h>
|
||||
#include <wx/gizmos/ledctrl.h>
|
||||
#include <wx/listctrl.h>
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
%extern wx.i
|
||||
%extern windows.i
|
||||
%extern _defs.i
|
||||
%extern events.i
|
||||
%extern controls.i
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyDynamicSashNameStr(wxT("dynamicSashWindow"));
|
||||
static const wxString wxPyEditableListBoxNameStr(wxT("editableListBox"));
|
||||
%}
|
||||
|
||||
///----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
wxEVT_DYNAMIC_SASH_SPLIT,
|
||||
wxEVT_DYNAMIC_SASH_UNIFY,
|
||||
|
||||
wxDS_MANAGE_SCROLLBARS,
|
||||
wxDS_DRAG_CORNER,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
|
||||
whenever your view is being split by the user. It is your
|
||||
responsibility to handle this event by creating a new view window as
|
||||
a child of the wxDynamicSashWindow. wxDynamicSashWindow will
|
||||
automatically reparent it to the proper place in its window hierarchy.
|
||||
*/
|
||||
class wxDynamicSashSplitEvent : public wxCommandEvent {
|
||||
public:
|
||||
wxDynamicSashSplitEvent(wxObject *target);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
wxDynamicSashUnifyEvents are sent to your view by wxDynamicSashWindow
|
||||
whenever the sash which splits your view and its sibling is being
|
||||
reunified such that your view is expanding to replace its sibling.
|
||||
You needn't do anything with this event if you are allowing
|
||||
wxDynamicSashWindow to manage your view's scrollbars, but it is useful
|
||||
if you are managing the scrollbars yourself so that you can keep
|
||||
the scrollbars' event handlers connected to your view's event handler
|
||||
class.
|
||||
*/
|
||||
class wxDynamicSashUnifyEvent : public wxCommandEvent {
|
||||
public:
|
||||
wxDynamicSashUnifyEvent(wxObject *target);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
wxDynamicSashWindow
|
||||
|
||||
wxDynamicSashWindow widgets manages the way other widgets are viewed.
|
||||
When a wxDynamicSashWindow is first shown, it will contain one child
|
||||
view, a viewport for that child, and a pair of scrollbars to allow the
|
||||
user to navigate the child view area. Next to each scrollbar is a small
|
||||
tab. By clicking on either tab and dragging to the appropriate spot, a
|
||||
user can split the view area into two smaller views separated by a
|
||||
draggable sash. Later, when the user wishes to reunify the two subviews,
|
||||
the user simply drags the sash to the side of the window.
|
||||
wxDynamicSashWindow will automatically reparent the appropriate child
|
||||
view back up the window hierarchy, and the wxDynamicSashWindow will have
|
||||
only one child view once again.
|
||||
|
||||
As an application developer, you will simply create a wxDynamicSashWindow
|
||||
using either the Create() function or the more complex constructor
|
||||
provided below, and then create a view window whose parent is the
|
||||
wxDynamicSashWindow. The child should respond to
|
||||
wxDynamicSashSplitEvents -- perhaps with an OnSplit() event handler -- by
|
||||
constructing a new view window whose parent is also the
|
||||
wxDynamicSashWindow. That's it! Now your users can dynamically split
|
||||
and reunify the view you provided.
|
||||
|
||||
If you wish to handle the scrollbar events for your view, rather than
|
||||
allowing wxDynamicSashWindow to do it for you, things are a bit more
|
||||
complex. (You might want to handle scrollbar events yourself, if,
|
||||
for instance, you wish to scroll a subwindow of the view you add to
|
||||
your wxDynamicSashWindow object, rather than scrolling the whole view.)
|
||||
In this case, you will need to construct your wxDynamicSashWindow without
|
||||
the wxDS_MANAGE_SCROLLBARS style and you will need to use the
|
||||
GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
|
||||
controls and call SetEventHanler() on them to redirect the scrolling
|
||||
events whenever your window is reparented by wxDyanmicSashWindow.
|
||||
You will need to set the scrollbars' event handler at three times:
|
||||
|
||||
* When your view is created
|
||||
* When your view receives a wxDynamicSashSplitEvent
|
||||
* When your view receives a wxDynamicSashUnifyEvent
|
||||
|
||||
See the dynsash_switch sample application for an example which does this.
|
||||
|
||||
*/
|
||||
|
||||
class wxDynamicSashWindow : public wxWindow {
|
||||
public:
|
||||
wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
|
||||
const wxString& name = wxPyDynamicSashNameStr);
|
||||
%name(wxPreDynamicSashWindow)wxDynamicSashWindow();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
|
||||
const wxString& name = wxPyDynamicSashNameStr);
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
%pragma(python) addtomethod = "wxPreDynamicSashWindow:val._setOORInfo(val)"
|
||||
|
||||
wxScrollBar *GetHScrollBar(const wxWindow *child) const;
|
||||
wxScrollBar *GetVScrollBar(const wxWindow *child) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Python functions to act like the event macros
|
||||
|
||||
%pragma(python) code = "
|
||||
def EVT_DYNAMIC_SASH_SPLIT(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_DYNAMIC_SASH_SPLIT, func)
|
||||
|
||||
def EVT_DYNAMIC_SASH_UNIFY(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_DYNAMIC_SASH_UNIFY, func)
|
||||
"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
wxEL_ALLOW_NEW,
|
||||
wxEL_ALLOW_EDIT,
|
||||
wxEL_ALLOW_DELETE,
|
||||
};
|
||||
|
||||
// This class provides a composite control that lets the
|
||||
// user easily enter list of strings
|
||||
class wxEditableListBox : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxEditableListBox(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
|
||||
const wxString& name = wxPyEditableListBoxNameStr);
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
|
||||
void SetStrings(const wxArrayString& strings);
|
||||
|
||||
//void GetStrings(wxArrayString& strings);
|
||||
%addmethods {
|
||||
PyObject* GetStrings() {
|
||||
wxArrayString strings;
|
||||
self->GetStrings(strings);
|
||||
return wxArrayString2PyList_helper(strings);
|
||||
}
|
||||
}
|
||||
|
||||
wxListCtrl* GetListCtrl() { return m_listCtrl; }
|
||||
wxBitmapButton* GetDelButton() { return m_bDel; }
|
||||
wxBitmapButton* GetNewButton() { return m_bNew; }
|
||||
wxBitmapButton* GetUpButton() { return m_bUp; }
|
||||
wxBitmapButton* GetDownButton() { return m_bDown; }
|
||||
wxBitmapButton* GetEditButton() { return m_bEdit; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
/*
|
||||
* wxRemotelyScrolledTreeCtrl
|
||||
*
|
||||
* This tree control disables its vertical scrollbar and catches scroll
|
||||
* events passed by a scrolled window higher in the hierarchy.
|
||||
* It also updates the scrolled window vertical scrollbar as appropriate.
|
||||
*/
|
||||
|
||||
%{
|
||||
typedef wxTreeCtrl wxPyTreeCtrl;
|
||||
%}
|
||||
|
||||
class wxRemotelyScrolledTreeCtrl: public wxPyTreeCtrl
|
||||
{
|
||||
public:
|
||||
wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_HAS_BUTTONS);
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
|
||||
|
||||
void HideVScrollbar();
|
||||
|
||||
// Adjust the containing wxScrolledWindow's scrollbars appropriately
|
||||
void AdjustRemoteScrollbars();
|
||||
|
||||
// Find the scrolled window that contains this control
|
||||
wxScrolledWindow* GetScrolledWindow() const;
|
||||
|
||||
// Scroll to the given line (in scroll units where each unit is
|
||||
// the height of an item)
|
||||
void ScrollToLine(int posHoriz, int posVert);
|
||||
|
||||
// The companion window is one which will get notified when certain
|
||||
// events happen such as node expansion
|
||||
void SetCompanionWindow(wxWindow* companion);
|
||||
wxWindow* GetCompanionWindow() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* wxTreeCompanionWindow
|
||||
*
|
||||
* A window displaying values associated with tree control items.
|
||||
*/
|
||||
|
||||
%{
|
||||
class wxPyTreeCompanionWindow: public wxTreeCompanionWindow
|
||||
{
|
||||
public:
|
||||
wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0)
|
||||
: wxTreeCompanionWindow(parent, id, pos, size, style) {}
|
||||
|
||||
|
||||
virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) {
|
||||
bool found;
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
|
||||
PyObject* dcobj = wxPyMake_wxObject(&dc);
|
||||
PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), FALSE);
|
||||
PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), FALSE);
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
|
||||
Py_DECREF(dcobj);
|
||||
Py_DECREF(idobj);
|
||||
Py_DECREF(recobj);
|
||||
}
|
||||
wxPyEndBlockThreads();
|
||||
if (! found)
|
||||
wxTreeCompanionWindow::DrawItem(dc, id, rect);
|
||||
}
|
||||
|
||||
PYPRIVATE;
|
||||
};
|
||||
%}
|
||||
|
||||
|
||||
%name(wxTreeCompanionWindow) class wxPyTreeCompanionWindow: public wxWindow
|
||||
{
|
||||
public:
|
||||
wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxTreeCompanionWindow)"
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
|
||||
wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const;
|
||||
void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* wxThinSplitterWindow
|
||||
*
|
||||
* Implements a splitter with a less obvious sash
|
||||
* than the usual one.
|
||||
*/
|
||||
|
||||
class wxThinSplitterWindow: public wxSplitterWindow
|
||||
{
|
||||
public:
|
||||
wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_3D | wxCLIP_CHILDREN);
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* wxSplitterScrolledWindow
|
||||
*
|
||||
* This scrolled window is aware of the fact that one of its
|
||||
* children is a splitter window. It passes on its scroll events
|
||||
* (after some processing) to both splitter children for them
|
||||
* scroll appropriately.
|
||||
*/
|
||||
|
||||
class wxSplitterScrolledWindow: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
enum wxLEDValueAlign
|
||||
{
|
||||
wxLED_ALIGN_LEFT,
|
||||
wxLED_ALIGN_RIGHT,
|
||||
wxLED_ALIGN_CENTER,
|
||||
|
||||
wxLED_ALIGN_MASK,
|
||||
|
||||
wxLED_DRAW_FADED,
|
||||
};
|
||||
|
||||
|
||||
class wxLEDNumberCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
// Constructors.
|
||||
wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
|
||||
%name(wxPreLEDNumberCtrl) wxLEDNumberCtrl();
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
%pragma(python) addtomethod = "wxPreLEDNumberCtrl:val._setOORInfo(val)"
|
||||
|
||||
// Create functions.
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
|
||||
|
||||
wxLEDValueAlign GetAlignment() const { return m_Alignment; }
|
||||
bool GetDrawFaded() const { return m_DrawFaded; }
|
||||
const wxString &GetValue() const { return m_Value; }
|
||||
|
||||
void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true);
|
||||
void SetDrawFaded(bool DrawFaded, bool Redraw = true);
|
||||
void SetValue(const wxString &Value, bool Redraw = true);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
|
||||
%}
|
||||
|
||||
|
||||
%pragma(python) include="_gizmoextras.py";
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,318 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import gizmosc
|
||||
|
||||
from misc import *
|
||||
|
||||
from misc2 import *
|
||||
|
||||
from windows import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from events import *
|
||||
|
||||
from streams import *
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
|
||||
def EVT_DYNAMIC_SASH_SPLIT(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_DYNAMIC_SASH_SPLIT, func)
|
||||
|
||||
def EVT_DYNAMIC_SASH_UNIFY(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_DYNAMIC_SASH_UNIFY, func)
|
||||
|
||||
class wxDynamicSashSplitEventPtr(wxCommandEventPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __repr__(self):
|
||||
return "<C wxDynamicSashSplitEvent instance at %s>" % (self.this,)
|
||||
class wxDynamicSashSplitEvent(wxDynamicSashSplitEventPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxDynamicSashSplitEvent,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxDynamicSashUnifyEventPtr(wxCommandEventPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __repr__(self):
|
||||
return "<C wxDynamicSashUnifyEvent instance at %s>" % (self.this,)
|
||||
class wxDynamicSashUnifyEvent(wxDynamicSashUnifyEventPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxDynamicSashUnifyEvent,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxDynamicSashWindowPtr(wxWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Create(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxDynamicSashWindow_Create,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetHScrollBar(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxDynamicSashWindow_GetHScrollBar,(self,) + _args, _kwargs)
|
||||
if val: val = wxScrollBarPtr(val)
|
||||
return val
|
||||
def GetVScrollBar(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxDynamicSashWindow_GetVScrollBar,(self,) + _args, _kwargs)
|
||||
if val: val = wxScrollBarPtr(val)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxDynamicSashWindow instance at %s>" % (self.this,)
|
||||
class wxDynamicSashWindow(wxDynamicSashWindowPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxDynamicSashWindow,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxPreDynamicSashWindow(*_args,**_kwargs):
|
||||
val = wxDynamicSashWindowPtr(apply(gizmosc.new_wxPreDynamicSashWindow,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
||||
class wxEditableListBoxPtr(wxPanelPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetStrings(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_SetStrings,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetStrings(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetStrings,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetListCtrl(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetListCtrl,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetDelButton(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetDelButton,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetNewButton(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetNewButton,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetUpButton(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetUpButton,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetDownButton(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetDownButton,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetEditButton(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxEditableListBox_GetEditButton,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxEditableListBox instance at %s>" % (self.this,)
|
||||
class wxEditableListBox(wxEditableListBoxPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxEditableListBox,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxRemotelyScrolledTreeCtrlPtr(wxTreeCtrlPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def HideVScrollbar(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxRemotelyScrolledTreeCtrl_HideVScrollbar,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def AdjustRemoteScrollbars(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxRemotelyScrolledTreeCtrl_AdjustRemoteScrollbars,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetScrolledWindow(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxRemotelyScrolledTreeCtrl_GetScrolledWindow,(self,) + _args, _kwargs)
|
||||
if val: val = wxScrolledWindowPtr(val)
|
||||
return val
|
||||
def ScrollToLine(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxRemotelyScrolledTreeCtrl_ScrollToLine,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetCompanionWindow(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxRemotelyScrolledTreeCtrl_SetCompanionWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetCompanionWindow(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxRemotelyScrolledTreeCtrl_GetCompanionWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxRemotelyScrolledTreeCtrl instance at %s>" % (self.this,)
|
||||
class wxRemotelyScrolledTreeCtrl(wxRemotelyScrolledTreeCtrlPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxRemotelyScrolledTreeCtrl,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxTreeCompanionWindowPtr(wxWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxTreeCompanionWindow__setCallbackInfo,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetTreeCtrl(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxTreeCompanionWindow_GetTreeCtrl,(self,) + _args, _kwargs)
|
||||
if val: val = wxRemotelyScrolledTreeCtrlPtr(val)
|
||||
return val
|
||||
def SetTreeCtrl(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxTreeCompanionWindow_SetTreeCtrl,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxTreeCompanionWindow instance at %s>" % (self.this,)
|
||||
class wxTreeCompanionWindow(wxTreeCompanionWindowPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxTreeCompanionWindow,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxTreeCompanionWindow)
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxThinSplitterWindowPtr(wxSplitterWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __repr__(self):
|
||||
return "<C wxThinSplitterWindow instance at %s>" % (self.this,)
|
||||
class wxThinSplitterWindow(wxThinSplitterWindowPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxThinSplitterWindow,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxSplitterScrolledWindowPtr(wxScrolledWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __repr__(self):
|
||||
return "<C wxSplitterScrolledWindow instance at %s>" % (self.this,)
|
||||
class wxSplitterScrolledWindow(wxSplitterScrolledWindowPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxSplitterScrolledWindow,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxLEDNumberCtrlPtr(wxControlPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Create(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_Create,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetAlignment(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_GetAlignment,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetDrawFaded(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_GetDrawFaded,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetValue(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_GetValue,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetAlignment(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_SetAlignment,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetDrawFaded(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_SetDrawFaded,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetValue(self, *_args, **_kwargs):
|
||||
val = apply(gizmosc.wxLEDNumberCtrl_SetValue,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxLEDNumberCtrl instance at %s>" % (self.this,)
|
||||
class wxLEDNumberCtrl(wxLEDNumberCtrlPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gizmosc.new_wxLEDNumberCtrl,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxPreLEDNumberCtrl(*_args,**_kwargs):
|
||||
val = wxLEDNumberCtrlPtr(apply(gizmosc.new_wxPreLEDNumberCtrl,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
wxEVT_DYNAMIC_SASH_SPLIT = gizmosc.wxEVT_DYNAMIC_SASH_SPLIT
|
||||
wxEVT_DYNAMIC_SASH_UNIFY = gizmosc.wxEVT_DYNAMIC_SASH_UNIFY
|
||||
wxDS_MANAGE_SCROLLBARS = gizmosc.wxDS_MANAGE_SCROLLBARS
|
||||
wxDS_DRAG_CORNER = gizmosc.wxDS_DRAG_CORNER
|
||||
wxEL_ALLOW_NEW = gizmosc.wxEL_ALLOW_NEW
|
||||
wxEL_ALLOW_EDIT = gizmosc.wxEL_ALLOW_EDIT
|
||||
wxEL_ALLOW_DELETE = gizmosc.wxEL_ALLOW_DELETE
|
||||
wxLED_ALIGN_LEFT = gizmosc.wxLED_ALIGN_LEFT
|
||||
wxLED_ALIGN_RIGHT = gizmosc.wxLED_ALIGN_RIGHT
|
||||
wxLED_ALIGN_CENTER = gizmosc.wxLED_ALIGN_CENTER
|
||||
wxLED_ALIGN_MASK = gizmosc.wxLED_ALIGN_MASK
|
||||
wxLED_DRAW_FADED = gizmosc.wxLED_DRAW_FADED
|
||||
|
||||
|
||||
#-------------- USER INCLUDE -----------------------
|
||||
|
||||
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||
|
||||
wx.wxDynamicSashSplitEventPtr = wxDynamicSashSplitEventPtr
|
||||
wx.wxDynamicSashUnifyEventPtr = wxDynamicSashUnifyEventPtr
|
||||
wx.wxDynamicSashWindowPtr = wxDynamicSashWindowPtr
|
||||
|
||||
wx.wxEditableListBoxPtr = wxEditableListBoxPtr
|
||||
|
||||
wx.wxRemotelyScrolledTreeCtrlPtr = wxRemotelyScrolledTreeCtrlPtr
|
||||
wx.wxTreeCompanionWindowPtr = wxTreeCompanionWindowPtr
|
||||
wx.wxThinSplitterWindowPtr = wxThinSplitterWindowPtr
|
||||
wx.wxSplitterScrolledWindowPtr = wxSplitterScrolledWindowPtr
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
*.exp
|
||||
*.lib
|
||||
*.obj
|
||||
*.pch
|
||||
Makefile
|
||||
Makefile.pre
|
||||
Setup
|
||||
build.local
|
||||
config.c
|
||||
glcanvas.h
|
||||
glcanvasc.ilk
|
||||
glcanvasc.pyd
|
||||
sedscript
|
||||
@@ -1,178 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: glcanvas.i
|
||||
// Purpose: SWIG definitions for the OpenGL wxWindows classes
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 15-Mar-1999
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
%module glcanvas
|
||||
|
||||
%{
|
||||
#include "wxPython.h"
|
||||
#ifdef __WXMSW__
|
||||
#include "myglcanvas.h"
|
||||
#else
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
%extern wx.i
|
||||
%extern windows.i
|
||||
%extern windows2.i
|
||||
%extern windows3.i
|
||||
%extern frames.i
|
||||
%extern _defs.i
|
||||
%extern misc.i
|
||||
%extern gdi.i
|
||||
%extern controls.i
|
||||
%extern events.i
|
||||
|
||||
|
||||
%pragma(python) code = "import wx"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxPalette;
|
||||
class wxWindow;
|
||||
class wxSize;
|
||||
class wxPoint;
|
||||
class wxGLCanvas;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxGLContext : public wxObject {
|
||||
public:
|
||||
#ifndef __WXMAC__ // fix this?
|
||||
wxGLContext(bool isRGB, wxGLCanvas *win,
|
||||
const wxPalette& palette = wxNullPalette);
|
||||
#endif
|
||||
~wxGLContext();
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const wxString& colour);
|
||||
void SwapBuffers();
|
||||
|
||||
#ifdef __WXGTK__
|
||||
void SetupPixelFormat();
|
||||
void SetupPalette(const wxPalette& palette);
|
||||
wxPalette CreateDefaultPalette();
|
||||
wxPalette* GetPalette();
|
||||
#endif
|
||||
|
||||
wxWindow* GetWindow();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
WX_GL_RGBA, // use true color palette
|
||||
WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
|
||||
WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
|
||||
WX_GL_DOUBLEBUFFER, // use doublebuffer
|
||||
WX_GL_STEREO, // use stereoscopic display
|
||||
WX_GL_AUX_BUFFERS, // number of auxiliary buffers
|
||||
WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
|
||||
WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
|
||||
WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
|
||||
WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
|
||||
WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
|
||||
WX_GL_STENCIL_SIZE, // bits for stencil buffer
|
||||
WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
|
||||
WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
|
||||
WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
|
||||
WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
|
||||
};
|
||||
|
||||
|
||||
%typemap(python, in) int *attribList (int *temp) {
|
||||
int i;
|
||||
if (PySequence_Check($source)) {
|
||||
int size = PyObject_Length($source);
|
||||
temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp[i] = PyInt_AsLong(PySequence_GetItem($source, i));
|
||||
}
|
||||
temp[size] = 0;
|
||||
$target = temp;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(python, freearg) int *attribList
|
||||
{
|
||||
delete [] $source;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class wxGLCanvas : public wxWindow {
|
||||
public:
|
||||
wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxPyGLCanvasNameStr,
|
||||
int *attribList = NULL,
|
||||
const wxPalette& palette = wxNullPalette);
|
||||
|
||||
%name(wxGLCanvasWithContext)
|
||||
wxGLCanvas( wxWindow *parent,
|
||||
const wxGLContext *shared = NULL,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPyGLCanvasNameStr,
|
||||
int *attribList = NULL,
|
||||
const wxPalette& palette = wxNullPalette );
|
||||
|
||||
// bool Create(wxWindow *parent, wxWindowID id,
|
||||
// const wxPoint& pos, const wxSize& size, long style, const wxString& name);
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
%pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const wxString& colour);
|
||||
void SwapBuffers();
|
||||
|
||||
wxGLContext* GetContext();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
void SetupPixelFormat(int *attribList = NULL);
|
||||
void SetupPalette(const wxPalette& palette);
|
||||
wxPalette CreateDefaultPalette();
|
||||
wxPalette* GetPalette();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -1,2 +0,0 @@
|
||||
*~
|
||||
_glcanvas.cpp
|
||||
@@ -1,950 +0,0 @@
|
||||
/*
|
||||
* FILE : contrib/glcanvas/gtk/glcanvas.cpp
|
||||
*
|
||||
* This file was automatically generated by :
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
* Version 1.1 (Build 883)
|
||||
*
|
||||
* Portions Copyright (c) 1995-1998
|
||||
* The University of Utah and The Regents of the University of California.
|
||||
* Permission is granted to distribute this file in any manner provided
|
||||
* this notice remains intact.
|
||||
*
|
||||
* Do not make changes to this file--changes will be lost!
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define SWIGCODE
|
||||
/* Implementation : PYTHON */
|
||||
|
||||
#define SWIGPYTHON
|
||||
#include "Python.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
|
||||
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
extern PyObject *SWIG_newvarlink(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define SWIG_init initglcanvasc
|
||||
|
||||
#define SWIG_name "glcanvasc"
|
||||
|
||||
#include "wxPython.h"
|
||||
#ifdef __WXMSW__
|
||||
#include "myglcanvas.h"
|
||||
#else
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
PyObject* o3;
|
||||
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyTuple_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyTuple_New(1);
|
||||
PyTuple_SetItem(target, 0, o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3, 0, o);
|
||||
|
||||
o2 = target;
|
||||
target = PySequence_Concat(o2, o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
static void *SwigwxGLContextTowxObject(void *ptr) {
|
||||
wxGLContext *src;
|
||||
wxObject *dest;
|
||||
src = (wxGLContext *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxGLContext(_swigarg0,_swigarg1,_swigarg2) (new wxGLContext(_swigarg0,_swigarg1,_swigarg2))
|
||||
static PyObject *_wrap_new_wxGLContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _result;
|
||||
bool _arg0;
|
||||
wxGLCanvas * _arg1;
|
||||
wxPalette * _arg2 = (wxPalette *) &wxNullPalette;
|
||||
int tempbool0;
|
||||
PyObject * _argo1 = 0;
|
||||
PyObject * _argo2 = 0;
|
||||
char *_kwnames[] = { "isRGB","win","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"iO|O:new_wxGLContext",_kwnames,&tempbool0,&_argo1,&_argo2))
|
||||
return NULL;
|
||||
_arg0 = (bool ) tempbool0;
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxGLContext. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo2) {
|
||||
if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of new_wxGLContext. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLContext *)new_wxGLContext(_arg0,_arg1,*_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLContext_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define delete_wxGLContext(_swigobj) (delete _swigobj)
|
||||
static PyObject *_wrap_delete_wxGLContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxGLContext",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxGLContext. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
delete_wxGLContext(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetCurrent(_swigobj) (_swigobj->SetCurrent())
|
||||
static PyObject *_wrap_wxGLContext_SetCurrent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SetCurrent",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetCurrent. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetCurrent(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetColour(_swigobj,_swigarg0) (_swigobj->SetColour(_swigarg0))
|
||||
static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","colour", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLContext_SetColour",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetColour. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetColour(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SwapBuffers(_swigobj) (_swigobj->SwapBuffers())
|
||||
static PyObject *_wrap_wxGLContext_SwapBuffers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SwapBuffers",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SwapBuffers. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SwapBuffers(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetupPixelFormat(_swigobj) (_swigobj->SetupPixelFormat())
|
||||
static PyObject *_wrap_wxGLContext_SetupPixelFormat(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SetupPixelFormat",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetupPixelFormat. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetupPixelFormat(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetupPalette(_swigobj,_swigarg0) (_swigobj->SetupPalette(_swigarg0))
|
||||
static PyObject *_wrap_wxGLContext_SetupPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
wxPalette * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
char *_kwnames[] = { "self","palette", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLContext_SetupPalette",_kwnames,&_argo0,&_argo1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetupPalette. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGLContext_SetupPalette. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetupPalette(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_CreateDefaultPalette(_swigobj) (_swigobj->CreateDefaultPalette())
|
||||
static PyObject *_wrap_wxGLContext_CreateDefaultPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPalette * _result;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_CreateDefaultPalette",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_CreateDefaultPalette. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = new wxPalette (wxGLContext_CreateDefaultPalette(_arg0));
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxPalette_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_GetPalette(_swigobj) (_swigobj->GetPalette())
|
||||
static PyObject *_wrap_wxGLContext_GetPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPalette * _result;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_GetPalette",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_GetPalette. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxPalette *)wxGLContext_GetPalette(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPalette_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_GetWindow(_swigobj) (_swigobj->GetWindow())
|
||||
static PyObject *_wrap_wxGLContext_GetWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _result;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_GetWindow",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_GetWindow. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxWindow *)wxGLContext_GetWindow(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{ _resultobj = wxPyMake_wxObject(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxWindow(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxWindow *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxWindow *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxEvtHandler(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxEvtHandler *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxEvtHandler *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxObject(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxObject *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7) (new wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7))
|
||||
static PyObject *_wrap_new_wxGLCanvas(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _result;
|
||||
wxWindow * _arg0;
|
||||
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||
wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg3 = (wxSize *) &wxDefaultSize;
|
||||
long _arg4 = (long ) 0;
|
||||
wxString * _arg5 = (wxString *) &wxPyGLCanvasNameStr;
|
||||
int * _arg6 = (int *) NULL;
|
||||
wxPalette * _arg7 = (wxPalette *) &wxNullPalette;
|
||||
PyObject * _argo0 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj2 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj3 = 0;
|
||||
PyObject * _obj5 = 0;
|
||||
int * temp1;
|
||||
PyObject * _obj6 = 0;
|
||||
PyObject * _argo7 = 0;
|
||||
char *_kwnames[] = { "parent","id","pos","size","style","name","attribList","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOlOOO:new_wxGLCanvas",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_obj5,&_obj6,&_argo7))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGLCanvas. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = &temp;
|
||||
if (! wxPoint_helper(_obj2, &_arg2))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = &temp0;
|
||||
if (! wxSize_helper(_obj3, &_arg3))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj5)
|
||||
{
|
||||
_arg5 = wxString_in_helper(_obj5);
|
||||
if (_arg5 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj6)) {
|
||||
int size = PyObject_Length(_obj6);
|
||||
temp1 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp1[i] = PyInt_AsLong(PySequence_GetItem(_obj6, i));
|
||||
}
|
||||
temp1[size] = 0;
|
||||
_arg6 = temp1;
|
||||
}
|
||||
}
|
||||
if (_argo7) {
|
||||
if (SWIG_GetPtrObj(_argo7,(void **) &_arg7,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 8 of new_wxGLCanvas. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLCanvas *)new_wxGLCanvas(_arg0,_arg1,*_arg2,*_arg3,_arg4,*_arg5,_arg6,*_arg7);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLCanvas_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj5)
|
||||
delete _arg5;
|
||||
}
|
||||
{
|
||||
delete [] _arg6;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define new_wxGLCanvasWithContext(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8) (new wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8))
|
||||
static PyObject *_wrap_new_wxGLCanvasWithContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _result;
|
||||
wxWindow * _arg0;
|
||||
wxGLContext * _arg1 = (wxGLContext *) NULL;
|
||||
wxWindowID _arg2 = (wxWindowID ) -1;
|
||||
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
|
||||
long _arg5 = (long ) 0;
|
||||
wxString * _arg6 = (wxString *) &wxPyGLCanvasNameStr;
|
||||
int * _arg7 = (int *) NULL;
|
||||
wxPalette * _arg8 = (wxPalette *) &wxNullPalette;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj3 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj4 = 0;
|
||||
PyObject * _obj6 = 0;
|
||||
int * temp1;
|
||||
PyObject * _obj7 = 0;
|
||||
PyObject * _argo8 = 0;
|
||||
char *_kwnames[] = { "parent","shared","id","pos","size","style","name","attribList","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|OiOOlOOO:new_wxGLCanvasWithContext",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_obj4,&_arg5,&_obj6,&_obj7,&_argo8))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGLCanvasWithContext. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxGLCanvasWithContext. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = &temp;
|
||||
if (! wxPoint_helper(_obj3, &_arg3))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj4)
|
||||
{
|
||||
_arg4 = &temp0;
|
||||
if (! wxSize_helper(_obj4, &_arg4))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
_arg6 = wxString_in_helper(_obj6);
|
||||
if (_arg6 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj7)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj7)) {
|
||||
int size = PyObject_Length(_obj7);
|
||||
temp1 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp1[i] = PyInt_AsLong(PySequence_GetItem(_obj7, i));
|
||||
}
|
||||
temp1[size] = 0;
|
||||
_arg7 = temp1;
|
||||
}
|
||||
}
|
||||
if (_argo8) {
|
||||
if (SWIG_GetPtrObj(_argo8,(void **) &_arg8,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 9 of new_wxGLCanvasWithContext. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLCanvas *)new_wxGLCanvasWithContext(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,*_arg6,_arg7,*_arg8);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLCanvas_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj6)
|
||||
delete _arg6;
|
||||
}
|
||||
{
|
||||
delete [] _arg7;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetCurrent(_swigobj) (_swigobj->SetCurrent())
|
||||
static PyObject *_wrap_wxGLCanvas_SetCurrent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_SetCurrent",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetCurrent. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetCurrent(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetColour(_swigobj,_swigarg0) (_swigobj->SetColour(_swigarg0))
|
||||
static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","colour", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLCanvas_SetColour",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetColour. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetColour(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SwapBuffers(_swigobj) (_swigobj->SwapBuffers())
|
||||
static PyObject *_wrap_wxGLCanvas_SwapBuffers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_SwapBuffers",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SwapBuffers. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SwapBuffers(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_GetContext(_swigobj) (_swigobj->GetContext())
|
||||
static PyObject *_wrap_wxGLCanvas_GetContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _result;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_GetContext",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_GetContext. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLContext *)wxGLCanvas_GetContext(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLContext_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyMethodDef glcanvascMethods[] = {
|
||||
{ "wxGLCanvas_GetContext", (PyCFunction) _wrap_wxGLCanvas_GetContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SwapBuffers", (PyCFunction) _wrap_wxGLCanvas_SwapBuffers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetColour", (PyCFunction) _wrap_wxGLCanvas_SetColour, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetCurrent", (PyCFunction) _wrap_wxGLCanvas_SetCurrent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLCanvasWithContext", (PyCFunction) _wrap_new_wxGLCanvasWithContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLCanvas", (PyCFunction) _wrap_new_wxGLCanvas, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_GetWindow", (PyCFunction) _wrap_wxGLContext_GetWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_GetPalette", (PyCFunction) _wrap_wxGLContext_GetPalette, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_CreateDefaultPalette", (PyCFunction) _wrap_wxGLContext_CreateDefaultPalette, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetupPalette", (PyCFunction) _wrap_wxGLContext_SetupPalette, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetupPixelFormat", (PyCFunction) _wrap_wxGLContext_SetupPixelFormat, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SwapBuffers", (PyCFunction) _wrap_wxGLContext_SwapBuffers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetColour", (PyCFunction) _wrap_wxGLContext_SetColour, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetCurrent", (PyCFunction) _wrap_wxGLContext_SetCurrent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "delete_wxGLContext", (PyCFunction) _wrap_delete_wxGLContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLContext", (PyCFunction) _wrap_new_wxGLContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This table is used by the pointer type-checker
|
||||
*/
|
||||
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_signed_long","_long",0},
|
||||
{ "_wxPrintQuality","_wxCoord",0},
|
||||
{ "_wxPrintQuality","_int",0},
|
||||
{ "_wxPrintQuality","_signed_int",0},
|
||||
{ "_wxPrintQuality","_unsigned_int",0},
|
||||
{ "_wxPrintQuality","_wxWindowID",0},
|
||||
{ "_wxPrintQuality","_uint",0},
|
||||
{ "_wxPrintQuality","_EBool",0},
|
||||
{ "_wxPrintQuality","_size_t",0},
|
||||
{ "_wxPrintQuality","_time_t",0},
|
||||
{ "_byte","_unsigned_char",0},
|
||||
{ "_long","_unsigned_long",0},
|
||||
{ "_long","_signed_long",0},
|
||||
{ "_size_t","_wxCoord",0},
|
||||
{ "_size_t","_wxPrintQuality",0},
|
||||
{ "_size_t","_time_t",0},
|
||||
{ "_size_t","_unsigned_int",0},
|
||||
{ "_size_t","_int",0},
|
||||
{ "_size_t","_wxWindowID",0},
|
||||
{ "_size_t","_uint",0},
|
||||
{ "_uint","_wxCoord",0},
|
||||
{ "_uint","_wxPrintQuality",0},
|
||||
{ "_uint","_time_t",0},
|
||||
{ "_uint","_size_t",0},
|
||||
{ "_uint","_unsigned_int",0},
|
||||
{ "_uint","_int",0},
|
||||
{ "_uint","_wxWindowID",0},
|
||||
{ "_wxChar","_char",0},
|
||||
{ "_char","_wxChar",0},
|
||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||
{ "_EBool","_wxCoord",0},
|
||||
{ "_EBool","_wxPrintQuality",0},
|
||||
{ "_EBool","_signed_int",0},
|
||||
{ "_EBool","_int",0},
|
||||
{ "_EBool","_wxWindowID",0},
|
||||
{ "_unsigned_long","_long",0},
|
||||
{ "_wxNativeFontInfo","_struct_wxNativeFontInfo",0},
|
||||
{ "_signed_int","_wxCoord",0},
|
||||
{ "_signed_int","_wxPrintQuality",0},
|
||||
{ "_signed_int","_EBool",0},
|
||||
{ "_signed_int","_wxWindowID",0},
|
||||
{ "_signed_int","_int",0},
|
||||
{ "_WXTYPE","_wxDateTime_t",0},
|
||||
{ "_WXTYPE","_short",0},
|
||||
{ "_WXTYPE","_signed_short",0},
|
||||
{ "_WXTYPE","_unsigned_short",0},
|
||||
{ "_unsigned_short","_wxDateTime_t",0},
|
||||
{ "_unsigned_short","_WXTYPE",0},
|
||||
{ "_unsigned_short","_short",0},
|
||||
{ "_wxObject","_wxGLCanvas",SwigwxGLCanvasTowxObject},
|
||||
{ "_wxObject","_wxGLContext",SwigwxGLContextTowxObject},
|
||||
{ "_signed_short","_WXTYPE",0},
|
||||
{ "_signed_short","_short",0},
|
||||
{ "_unsigned_char","_byte",0},
|
||||
{ "_unsigned_int","_wxCoord",0},
|
||||
{ "_unsigned_int","_wxPrintQuality",0},
|
||||
{ "_unsigned_int","_time_t",0},
|
||||
{ "_unsigned_int","_size_t",0},
|
||||
{ "_unsigned_int","_uint",0},
|
||||
{ "_unsigned_int","_wxWindowID",0},
|
||||
{ "_unsigned_int","_int",0},
|
||||
{ "_short","_wxDateTime_t",0},
|
||||
{ "_short","_WXTYPE",0},
|
||||
{ "_short","_unsigned_short",0},
|
||||
{ "_short","_signed_short",0},
|
||||
{ "_wxWindowID","_wxCoord",0},
|
||||
{ "_wxWindowID","_wxPrintQuality",0},
|
||||
{ "_wxWindowID","_time_t",0},
|
||||
{ "_wxWindowID","_size_t",0},
|
||||
{ "_wxWindowID","_EBool",0},
|
||||
{ "_wxWindowID","_uint",0},
|
||||
{ "_wxWindowID","_int",0},
|
||||
{ "_wxWindowID","_signed_int",0},
|
||||
{ "_wxWindowID","_unsigned_int",0},
|
||||
{ "_int","_wxCoord",0},
|
||||
{ "_int","_wxPrintQuality",0},
|
||||
{ "_int","_time_t",0},
|
||||
{ "_int","_size_t",0},
|
||||
{ "_int","_EBool",0},
|
||||
{ "_int","_uint",0},
|
||||
{ "_int","_wxWindowID",0},
|
||||
{ "_int","_unsigned_int",0},
|
||||
{ "_int","_signed_int",0},
|
||||
{ "_wxDateTime_t","_unsigned_short",0},
|
||||
{ "_wxDateTime_t","_short",0},
|
||||
{ "_wxDateTime_t","_WXTYPE",0},
|
||||
{ "_time_t","_wxCoord",0},
|
||||
{ "_time_t","_wxPrintQuality",0},
|
||||
{ "_time_t","_unsigned_int",0},
|
||||
{ "_time_t","_int",0},
|
||||
{ "_time_t","_wxWindowID",0},
|
||||
{ "_time_t","_uint",0},
|
||||
{ "_time_t","_size_t",0},
|
||||
{ "_wxCoord","_int",0},
|
||||
{ "_wxCoord","_signed_int",0},
|
||||
{ "_wxCoord","_unsigned_int",0},
|
||||
{ "_wxCoord","_wxWindowID",0},
|
||||
{ "_wxCoord","_uint",0},
|
||||
{ "_wxCoord","_EBool",0},
|
||||
{ "_wxCoord","_size_t",0},
|
||||
{ "_wxCoord","_time_t",0},
|
||||
{ "_wxCoord","_wxPrintQuality",0},
|
||||
{ "_wxEvtHandler","_wxGLCanvas",SwigwxGLCanvasTowxEvtHandler},
|
||||
{ "_wxWindow","_wxGLCanvas",SwigwxGLCanvasTowxWindow},
|
||||
{0,0,0}};
|
||||
|
||||
static PyObject *SWIG_globals;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void) initglcanvasc() {
|
||||
PyObject *m, *d;
|
||||
SWIG_globals = SWIG_newvarlink();
|
||||
m = Py_InitModule("glcanvasc", glcanvascMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
PyDict_SetItemString(d,"WX_GL_RGBA", PyInt_FromLong((long) WX_GL_RGBA));
|
||||
PyDict_SetItemString(d,"WX_GL_BUFFER_SIZE", PyInt_FromLong((long) WX_GL_BUFFER_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_LEVEL", PyInt_FromLong((long) WX_GL_LEVEL));
|
||||
PyDict_SetItemString(d,"WX_GL_DOUBLEBUFFER", PyInt_FromLong((long) WX_GL_DOUBLEBUFFER));
|
||||
PyDict_SetItemString(d,"WX_GL_STEREO", PyInt_FromLong((long) WX_GL_STEREO));
|
||||
PyDict_SetItemString(d,"WX_GL_AUX_BUFFERS", PyInt_FromLong((long) WX_GL_AUX_BUFFERS));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_RED", PyInt_FromLong((long) WX_GL_MIN_RED));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_GREEN", PyInt_FromLong((long) WX_GL_MIN_GREEN));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_BLUE", PyInt_FromLong((long) WX_GL_MIN_BLUE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ALPHA));
|
||||
PyDict_SetItemString(d,"WX_GL_DEPTH_SIZE", PyInt_FromLong((long) WX_GL_DEPTH_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_STENCIL_SIZE", PyInt_FromLong((long) WX_GL_STENCIL_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_RED", PyInt_FromLong((long) WX_GL_MIN_ACCUM_RED));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_GREEN", PyInt_FromLong((long) WX_GL_MIN_ACCUM_GREEN));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_BLUE", PyInt_FromLong((long) WX_GL_MIN_ACCUM_BLUE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ACCUM_ALPHA));
|
||||
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; _swig_mapping[i].n1; i++)
|
||||
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import glcanvasc
|
||||
|
||||
from misc import *
|
||||
|
||||
from misc2 import *
|
||||
|
||||
from windows import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from events import *
|
||||
|
||||
from streams import *
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
import wx
|
||||
class wxGLContextPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self, delfunc=glcanvasc.delete_wxGLContext):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def SetCurrent(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetCurrent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetColour(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetColour,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SwapBuffers(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SwapBuffers,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetupPixelFormat(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetupPixelFormat,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetupPalette(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetupPalette,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def CreateDefaultPalette(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_CreateDefaultPalette,(self,) + _args, _kwargs)
|
||||
if val: val = wxPalettePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetPalette(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_GetPalette,(self,) + _args, _kwargs)
|
||||
if val: val = wxPalettePtr(val)
|
||||
return val
|
||||
def GetWindow(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_GetWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGLContext instance at %s>" % (self.this,)
|
||||
class wxGLContext(wxGLContextPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(glcanvasc.new_wxGLContext,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxGLCanvasPtr(wxWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetCurrent(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetCurrent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetColour(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetColour,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SwapBuffers(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SwapBuffers,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetContext(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_GetContext,(self,) + _args, _kwargs)
|
||||
if val: val = wxGLContextPtr(val)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGLCanvas instance at %s>" % (self.this,)
|
||||
class wxGLCanvas(wxGLCanvasPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(glcanvasc.new_wxGLCanvas,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxGLCanvasWithContext(*_args,**_kwargs):
|
||||
val = wxGLCanvasPtr(apply(glcanvasc.new_wxGLCanvasWithContext,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(self)
|
||||
return val
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
WX_GL_RGBA = glcanvasc.WX_GL_RGBA
|
||||
WX_GL_BUFFER_SIZE = glcanvasc.WX_GL_BUFFER_SIZE
|
||||
WX_GL_LEVEL = glcanvasc.WX_GL_LEVEL
|
||||
WX_GL_DOUBLEBUFFER = glcanvasc.WX_GL_DOUBLEBUFFER
|
||||
WX_GL_STEREO = glcanvasc.WX_GL_STEREO
|
||||
WX_GL_AUX_BUFFERS = glcanvasc.WX_GL_AUX_BUFFERS
|
||||
WX_GL_MIN_RED = glcanvasc.WX_GL_MIN_RED
|
||||
WX_GL_MIN_GREEN = glcanvasc.WX_GL_MIN_GREEN
|
||||
WX_GL_MIN_BLUE = glcanvasc.WX_GL_MIN_BLUE
|
||||
WX_GL_MIN_ALPHA = glcanvasc.WX_GL_MIN_ALPHA
|
||||
WX_GL_DEPTH_SIZE = glcanvasc.WX_GL_DEPTH_SIZE
|
||||
WX_GL_STENCIL_SIZE = glcanvasc.WX_GL_STENCIL_SIZE
|
||||
WX_GL_MIN_ACCUM_RED = glcanvasc.WX_GL_MIN_ACCUM_RED
|
||||
WX_GL_MIN_ACCUM_GREEN = glcanvasc.WX_GL_MIN_ACCUM_GREEN
|
||||
WX_GL_MIN_ACCUM_BLUE = glcanvasc.WX_GL_MIN_ACCUM_BLUE
|
||||
WX_GL_MIN_ACCUM_ALPHA = glcanvasc.WX_GL_MIN_ACCUM_ALPHA
|
||||
@@ -1,770 +0,0 @@
|
||||
/*
|
||||
* FILE : contrib/glcanvas/mac/glcanvas.cpp
|
||||
*
|
||||
* This file was automatically generated by :
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
* Version 1.1 (Build 883)
|
||||
*
|
||||
* Portions Copyright (c) 1995-1998
|
||||
* The University of Utah and The Regents of the University of California.
|
||||
* Permission is granted to distribute this file in any manner provided
|
||||
* this notice remains intact.
|
||||
*
|
||||
* Do not make changes to this file--changes will be lost!
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define SWIGCODE
|
||||
/* Implementation : PYTHON */
|
||||
|
||||
#define SWIGPYTHON
|
||||
#include "Python.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
|
||||
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
extern PyObject *SWIG_newvarlink(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define SWIG_init initglcanvasc
|
||||
|
||||
#define SWIG_name "glcanvasc"
|
||||
|
||||
#include "wxPython.h"
|
||||
#ifdef __WXMSW__
|
||||
#include "myglcanvas.h"
|
||||
#else
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
PyObject* o3;
|
||||
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyTuple_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyTuple_New(1);
|
||||
PyTuple_SetItem(target, 0, o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3, 0, o);
|
||||
|
||||
o2 = target;
|
||||
target = PySequence_Concat(o2, o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
static void *SwigwxGLContextTowxObject(void *ptr) {
|
||||
wxGLContext *src;
|
||||
wxObject *dest;
|
||||
src = (wxGLContext *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define delete_wxGLContext(_swigobj) (delete _swigobj)
|
||||
static PyObject *_wrap_delete_wxGLContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxGLContext",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxGLContext. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
delete_wxGLContext(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetCurrent(_swigobj) (_swigobj->SetCurrent())
|
||||
static PyObject *_wrap_wxGLContext_SetCurrent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SetCurrent",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetCurrent. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetCurrent(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetColour(_swigobj,_swigarg0) (_swigobj->SetColour(_swigarg0))
|
||||
static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","colour", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLContext_SetColour",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetColour. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetColour(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SwapBuffers(_swigobj) (_swigobj->SwapBuffers())
|
||||
static PyObject *_wrap_wxGLContext_SwapBuffers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SwapBuffers",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SwapBuffers. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SwapBuffers(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_GetWindow(_swigobj) (_swigobj->GetWindow())
|
||||
static PyObject *_wrap_wxGLContext_GetWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _result;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_GetWindow",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_GetWindow. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxWindow *)wxGLContext_GetWindow(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{ _resultobj = wxPyMake_wxObject(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxWindow(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxWindow *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxWindow *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxEvtHandler(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxEvtHandler *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxEvtHandler *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxObject(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxObject *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7) (new wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7))
|
||||
static PyObject *_wrap_new_wxGLCanvas(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _result;
|
||||
wxWindow * _arg0;
|
||||
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||
wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg3 = (wxSize *) &wxDefaultSize;
|
||||
long _arg4 = (long ) 0;
|
||||
wxString * _arg5 = (wxString *) &wxPyGLCanvasNameStr;
|
||||
int * _arg6 = (int *) NULL;
|
||||
wxPalette * _arg7 = (wxPalette *) &wxNullPalette;
|
||||
PyObject * _argo0 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj2 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj3 = 0;
|
||||
PyObject * _obj5 = 0;
|
||||
int * temp1;
|
||||
PyObject * _obj6 = 0;
|
||||
PyObject * _argo7 = 0;
|
||||
char *_kwnames[] = { "parent","id","pos","size","style","name","attribList","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOlOOO:new_wxGLCanvas",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_obj5,&_obj6,&_argo7))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGLCanvas. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = &temp;
|
||||
if (! wxPoint_helper(_obj2, &_arg2))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = &temp0;
|
||||
if (! wxSize_helper(_obj3, &_arg3))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj5)
|
||||
{
|
||||
_arg5 = wxString_in_helper(_obj5);
|
||||
if (_arg5 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj6)) {
|
||||
int size = PyObject_Length(_obj6);
|
||||
temp1 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp1[i] = PyInt_AsLong(PySequence_GetItem(_obj6, i));
|
||||
}
|
||||
temp1[size] = 0;
|
||||
_arg6 = temp1;
|
||||
}
|
||||
}
|
||||
if (_argo7) {
|
||||
if (SWIG_GetPtrObj(_argo7,(void **) &_arg7,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 8 of new_wxGLCanvas. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLCanvas *)new_wxGLCanvas(_arg0,_arg1,*_arg2,*_arg3,_arg4,*_arg5,_arg6,*_arg7);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLCanvas_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj5)
|
||||
delete _arg5;
|
||||
}
|
||||
{
|
||||
delete [] _arg6;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define new_wxGLCanvasWithContext(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8) (new wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8))
|
||||
static PyObject *_wrap_new_wxGLCanvasWithContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _result;
|
||||
wxWindow * _arg0;
|
||||
wxGLContext * _arg1 = (wxGLContext *) NULL;
|
||||
wxWindowID _arg2 = (wxWindowID ) -1;
|
||||
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
|
||||
long _arg5 = (long ) 0;
|
||||
wxString * _arg6 = (wxString *) &wxPyGLCanvasNameStr;
|
||||
int * _arg7 = (int *) NULL;
|
||||
wxPalette * _arg8 = (wxPalette *) &wxNullPalette;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj3 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj4 = 0;
|
||||
PyObject * _obj6 = 0;
|
||||
int * temp1;
|
||||
PyObject * _obj7 = 0;
|
||||
PyObject * _argo8 = 0;
|
||||
char *_kwnames[] = { "parent","shared","id","pos","size","style","name","attribList","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|OiOOlOOO:new_wxGLCanvasWithContext",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_obj4,&_arg5,&_obj6,&_obj7,&_argo8))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGLCanvasWithContext. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxGLCanvasWithContext. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = &temp;
|
||||
if (! wxPoint_helper(_obj3, &_arg3))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj4)
|
||||
{
|
||||
_arg4 = &temp0;
|
||||
if (! wxSize_helper(_obj4, &_arg4))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
_arg6 = wxString_in_helper(_obj6);
|
||||
if (_arg6 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj7)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj7)) {
|
||||
int size = PyObject_Length(_obj7);
|
||||
temp1 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp1[i] = PyInt_AsLong(PySequence_GetItem(_obj7, i));
|
||||
}
|
||||
temp1[size] = 0;
|
||||
_arg7 = temp1;
|
||||
}
|
||||
}
|
||||
if (_argo8) {
|
||||
if (SWIG_GetPtrObj(_argo8,(void **) &_arg8,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 9 of new_wxGLCanvasWithContext. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLCanvas *)new_wxGLCanvasWithContext(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,*_arg6,_arg7,*_arg8);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLCanvas_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj6)
|
||||
delete _arg6;
|
||||
}
|
||||
{
|
||||
delete [] _arg7;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetCurrent(_swigobj) (_swigobj->SetCurrent())
|
||||
static PyObject *_wrap_wxGLCanvas_SetCurrent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_SetCurrent",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetCurrent. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetCurrent(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetColour(_swigobj,_swigarg0) (_swigobj->SetColour(_swigarg0))
|
||||
static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","colour", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLCanvas_SetColour",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetColour. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetColour(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SwapBuffers(_swigobj) (_swigobj->SwapBuffers())
|
||||
static PyObject *_wrap_wxGLCanvas_SwapBuffers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_SwapBuffers",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SwapBuffers. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SwapBuffers(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_GetContext(_swigobj) (_swigobj->GetContext())
|
||||
static PyObject *_wrap_wxGLCanvas_GetContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _result;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_GetContext",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_GetContext. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLContext *)wxGLCanvas_GetContext(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLContext_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyMethodDef glcanvascMethods[] = {
|
||||
{ "wxGLCanvas_GetContext", (PyCFunction) _wrap_wxGLCanvas_GetContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SwapBuffers", (PyCFunction) _wrap_wxGLCanvas_SwapBuffers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetColour", (PyCFunction) _wrap_wxGLCanvas_SetColour, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetCurrent", (PyCFunction) _wrap_wxGLCanvas_SetCurrent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLCanvasWithContext", (PyCFunction) _wrap_new_wxGLCanvasWithContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLCanvas", (PyCFunction) _wrap_new_wxGLCanvas, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_GetWindow", (PyCFunction) _wrap_wxGLContext_GetWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SwapBuffers", (PyCFunction) _wrap_wxGLContext_SwapBuffers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetColour", (PyCFunction) _wrap_wxGLContext_SetColour, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetCurrent", (PyCFunction) _wrap_wxGLContext_SetCurrent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "delete_wxGLContext", (PyCFunction) _wrap_delete_wxGLContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This table is used by the pointer type-checker
|
||||
*/
|
||||
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_signed_long","_long",0},
|
||||
{ "_wxPrintQuality","_wxCoord",0},
|
||||
{ "_wxPrintQuality","_int",0},
|
||||
{ "_wxPrintQuality","_signed_int",0},
|
||||
{ "_wxPrintQuality","_unsigned_int",0},
|
||||
{ "_wxPrintQuality","_wxWindowID",0},
|
||||
{ "_wxPrintQuality","_uint",0},
|
||||
{ "_wxPrintQuality","_EBool",0},
|
||||
{ "_wxPrintQuality","_size_t",0},
|
||||
{ "_wxPrintQuality","_time_t",0},
|
||||
{ "_byte","_unsigned_char",0},
|
||||
{ "_long","_unsigned_long",0},
|
||||
{ "_long","_signed_long",0},
|
||||
{ "_size_t","_wxCoord",0},
|
||||
{ "_size_t","_wxPrintQuality",0},
|
||||
{ "_size_t","_time_t",0},
|
||||
{ "_size_t","_unsigned_int",0},
|
||||
{ "_size_t","_int",0},
|
||||
{ "_size_t","_wxWindowID",0},
|
||||
{ "_size_t","_uint",0},
|
||||
{ "_uint","_wxCoord",0},
|
||||
{ "_uint","_wxPrintQuality",0},
|
||||
{ "_uint","_time_t",0},
|
||||
{ "_uint","_size_t",0},
|
||||
{ "_uint","_unsigned_int",0},
|
||||
{ "_uint","_int",0},
|
||||
{ "_uint","_wxWindowID",0},
|
||||
{ "_wxChar","_char",0},
|
||||
{ "_char","_wxChar",0},
|
||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||
{ "_EBool","_wxCoord",0},
|
||||
{ "_EBool","_wxPrintQuality",0},
|
||||
{ "_EBool","_signed_int",0},
|
||||
{ "_EBool","_int",0},
|
||||
{ "_EBool","_wxWindowID",0},
|
||||
{ "_unsigned_long","_long",0},
|
||||
{ "_wxNativeFontInfo","_struct_wxNativeFontInfo",0},
|
||||
{ "_signed_int","_wxCoord",0},
|
||||
{ "_signed_int","_wxPrintQuality",0},
|
||||
{ "_signed_int","_EBool",0},
|
||||
{ "_signed_int","_wxWindowID",0},
|
||||
{ "_signed_int","_int",0},
|
||||
{ "_WXTYPE","_wxDateTime_t",0},
|
||||
{ "_WXTYPE","_short",0},
|
||||
{ "_WXTYPE","_signed_short",0},
|
||||
{ "_WXTYPE","_unsigned_short",0},
|
||||
{ "_unsigned_short","_wxDateTime_t",0},
|
||||
{ "_unsigned_short","_WXTYPE",0},
|
||||
{ "_unsigned_short","_short",0},
|
||||
{ "_wxObject","_wxGLCanvas",SwigwxGLCanvasTowxObject},
|
||||
{ "_wxObject","_wxGLContext",SwigwxGLContextTowxObject},
|
||||
{ "_signed_short","_WXTYPE",0},
|
||||
{ "_signed_short","_short",0},
|
||||
{ "_unsigned_char","_byte",0},
|
||||
{ "_unsigned_int","_wxCoord",0},
|
||||
{ "_unsigned_int","_wxPrintQuality",0},
|
||||
{ "_unsigned_int","_time_t",0},
|
||||
{ "_unsigned_int","_size_t",0},
|
||||
{ "_unsigned_int","_uint",0},
|
||||
{ "_unsigned_int","_wxWindowID",0},
|
||||
{ "_unsigned_int","_int",0},
|
||||
{ "_short","_wxDateTime_t",0},
|
||||
{ "_short","_WXTYPE",0},
|
||||
{ "_short","_unsigned_short",0},
|
||||
{ "_short","_signed_short",0},
|
||||
{ "_wxWindowID","_wxCoord",0},
|
||||
{ "_wxWindowID","_wxPrintQuality",0},
|
||||
{ "_wxWindowID","_time_t",0},
|
||||
{ "_wxWindowID","_size_t",0},
|
||||
{ "_wxWindowID","_EBool",0},
|
||||
{ "_wxWindowID","_uint",0},
|
||||
{ "_wxWindowID","_int",0},
|
||||
{ "_wxWindowID","_signed_int",0},
|
||||
{ "_wxWindowID","_unsigned_int",0},
|
||||
{ "_int","_wxCoord",0},
|
||||
{ "_int","_wxPrintQuality",0},
|
||||
{ "_int","_time_t",0},
|
||||
{ "_int","_size_t",0},
|
||||
{ "_int","_EBool",0},
|
||||
{ "_int","_uint",0},
|
||||
{ "_int","_wxWindowID",0},
|
||||
{ "_int","_unsigned_int",0},
|
||||
{ "_int","_signed_int",0},
|
||||
{ "_wxDateTime_t","_unsigned_short",0},
|
||||
{ "_wxDateTime_t","_short",0},
|
||||
{ "_wxDateTime_t","_WXTYPE",0},
|
||||
{ "_time_t","_wxCoord",0},
|
||||
{ "_time_t","_wxPrintQuality",0},
|
||||
{ "_time_t","_unsigned_int",0},
|
||||
{ "_time_t","_int",0},
|
||||
{ "_time_t","_wxWindowID",0},
|
||||
{ "_time_t","_uint",0},
|
||||
{ "_time_t","_size_t",0},
|
||||
{ "_wxCoord","_int",0},
|
||||
{ "_wxCoord","_signed_int",0},
|
||||
{ "_wxCoord","_unsigned_int",0},
|
||||
{ "_wxCoord","_wxWindowID",0},
|
||||
{ "_wxCoord","_uint",0},
|
||||
{ "_wxCoord","_EBool",0},
|
||||
{ "_wxCoord","_size_t",0},
|
||||
{ "_wxCoord","_time_t",0},
|
||||
{ "_wxCoord","_wxPrintQuality",0},
|
||||
{ "_wxEvtHandler","_wxGLCanvas",SwigwxGLCanvasTowxEvtHandler},
|
||||
{ "_wxWindow","_wxGLCanvas",SwigwxGLCanvasTowxWindow},
|
||||
{0,0,0}};
|
||||
|
||||
static PyObject *SWIG_globals;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void) initglcanvasc() {
|
||||
PyObject *m, *d;
|
||||
SWIG_globals = SWIG_newvarlink();
|
||||
m = Py_InitModule("glcanvasc", glcanvascMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
PyDict_SetItemString(d,"WX_GL_RGBA", PyInt_FromLong((long) WX_GL_RGBA));
|
||||
PyDict_SetItemString(d,"WX_GL_BUFFER_SIZE", PyInt_FromLong((long) WX_GL_BUFFER_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_LEVEL", PyInt_FromLong((long) WX_GL_LEVEL));
|
||||
PyDict_SetItemString(d,"WX_GL_DOUBLEBUFFER", PyInt_FromLong((long) WX_GL_DOUBLEBUFFER));
|
||||
PyDict_SetItemString(d,"WX_GL_STEREO", PyInt_FromLong((long) WX_GL_STEREO));
|
||||
PyDict_SetItemString(d,"WX_GL_AUX_BUFFERS", PyInt_FromLong((long) WX_GL_AUX_BUFFERS));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_RED", PyInt_FromLong((long) WX_GL_MIN_RED));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_GREEN", PyInt_FromLong((long) WX_GL_MIN_GREEN));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_BLUE", PyInt_FromLong((long) WX_GL_MIN_BLUE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ALPHA));
|
||||
PyDict_SetItemString(d,"WX_GL_DEPTH_SIZE", PyInt_FromLong((long) WX_GL_DEPTH_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_STENCIL_SIZE", PyInt_FromLong((long) WX_GL_STENCIL_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_RED", PyInt_FromLong((long) WX_GL_MIN_ACCUM_RED));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_GREEN", PyInt_FromLong((long) WX_GL_MIN_ACCUM_GREEN));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_BLUE", PyInt_FromLong((long) WX_GL_MIN_ACCUM_BLUE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ACCUM_ALPHA));
|
||||
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; _swig_mapping[i].n1; i++)
|
||||
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import glcanvasc
|
||||
|
||||
from misc import *
|
||||
|
||||
from misc2 import *
|
||||
|
||||
from windows import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from events import *
|
||||
|
||||
from streams import *
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
import wx
|
||||
class wxGLContextPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self, delfunc=glcanvasc.delete_wxGLContext):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def SetCurrent(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetCurrent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetColour(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetColour,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SwapBuffers(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SwapBuffers,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetWindow(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_GetWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGLContext instance at %s>" % (self.this,)
|
||||
class wxGLContext(wxGLContextPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
|
||||
|
||||
|
||||
|
||||
class wxGLCanvasPtr(wxWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetCurrent(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetCurrent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetColour(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetColour,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SwapBuffers(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SwapBuffers,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetContext(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_GetContext,(self,) + _args, _kwargs)
|
||||
if val: val = wxGLContextPtr(val)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGLCanvas instance at %s>" % (self.this,)
|
||||
class wxGLCanvas(wxGLCanvasPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(glcanvasc.new_wxGLCanvas,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxGLCanvasWithContext(*_args,**_kwargs):
|
||||
val = wxGLCanvasPtr(apply(glcanvasc.new_wxGLCanvasWithContext,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(self)
|
||||
return val
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
WX_GL_RGBA = glcanvasc.WX_GL_RGBA
|
||||
WX_GL_BUFFER_SIZE = glcanvasc.WX_GL_BUFFER_SIZE
|
||||
WX_GL_LEVEL = glcanvasc.WX_GL_LEVEL
|
||||
WX_GL_DOUBLEBUFFER = glcanvasc.WX_GL_DOUBLEBUFFER
|
||||
WX_GL_STEREO = glcanvasc.WX_GL_STEREO
|
||||
WX_GL_AUX_BUFFERS = glcanvasc.WX_GL_AUX_BUFFERS
|
||||
WX_GL_MIN_RED = glcanvasc.WX_GL_MIN_RED
|
||||
WX_GL_MIN_GREEN = glcanvasc.WX_GL_MIN_GREEN
|
||||
WX_GL_MIN_BLUE = glcanvasc.WX_GL_MIN_BLUE
|
||||
WX_GL_MIN_ALPHA = glcanvasc.WX_GL_MIN_ALPHA
|
||||
WX_GL_DEPTH_SIZE = glcanvasc.WX_GL_DEPTH_SIZE
|
||||
WX_GL_STENCIL_SIZE = glcanvasc.WX_GL_STENCIL_SIZE
|
||||
WX_GL_MIN_ACCUM_RED = glcanvasc.WX_GL_MIN_ACCUM_RED
|
||||
WX_GL_MIN_ACCUM_GREEN = glcanvasc.WX_GL_MIN_ACCUM_GREEN
|
||||
WX_GL_MIN_ACCUM_BLUE = glcanvasc.WX_GL_MIN_ACCUM_BLUE
|
||||
WX_GL_MIN_ACCUM_ALPHA = glcanvasc.WX_GL_MIN_ACCUM_ALPHA
|
||||
@@ -1 +0,0 @@
|
||||
*~
|
||||
@@ -1,969 +0,0 @@
|
||||
/*
|
||||
* FILE : contrib/glcanvas/msw/glcanvas.cpp
|
||||
*
|
||||
* This file was automatically generated by :
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
* Version 1.1 (Build 883)
|
||||
*
|
||||
* Portions Copyright (c) 1995-1998
|
||||
* The University of Utah and The Regents of the University of California.
|
||||
* Permission is granted to distribute this file in any manner provided
|
||||
* this notice remains intact.
|
||||
*
|
||||
* Do not make changes to this file--changes will be lost!
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define SWIGCODE
|
||||
/* Implementation : PYTHON */
|
||||
|
||||
#define SWIGPYTHON
|
||||
#include "Python.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
|
||||
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
extern PyObject *SWIG_newvarlink(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define SWIG_init initglcanvasc
|
||||
|
||||
#define SWIG_name "glcanvasc"
|
||||
|
||||
#include "wxPython.h"
|
||||
#ifdef __WXMSW__
|
||||
#include "myglcanvas.h"
|
||||
#else
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
PyObject* o3;
|
||||
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyTuple_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyTuple_New(1);
|
||||
PyTuple_SetItem(target, 0, o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3, 0, o);
|
||||
|
||||
o2 = target;
|
||||
target = PySequence_Concat(o2, o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyGLCanvasNameStr(wxT("GLCanvas"));
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
static void *SwigwxGLContextTowxObject(void *ptr) {
|
||||
wxGLContext *src;
|
||||
wxObject *dest;
|
||||
src = (wxGLContext *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxGLContext(_swigarg0,_swigarg1,_swigarg2) (new wxGLContext(_swigarg0,_swigarg1,_swigarg2))
|
||||
static PyObject *_wrap_new_wxGLContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _result;
|
||||
bool _arg0;
|
||||
wxGLCanvas * _arg1;
|
||||
wxPalette * _arg2 = (wxPalette *) &wxNullPalette;
|
||||
int tempbool0;
|
||||
PyObject * _argo1 = 0;
|
||||
PyObject * _argo2 = 0;
|
||||
char *_kwnames[] = { "isRGB","win","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"iO|O:new_wxGLContext",_kwnames,&tempbool0,&_argo1,&_argo2))
|
||||
return NULL;
|
||||
_arg0 = (bool ) tempbool0;
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxGLContext. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo2) {
|
||||
if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of new_wxGLContext. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLContext *)new_wxGLContext(_arg0,_arg1,*_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLContext_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define delete_wxGLContext(_swigobj) (delete _swigobj)
|
||||
static PyObject *_wrap_delete_wxGLContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxGLContext",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxGLContext. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
delete_wxGLContext(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetCurrent(_swigobj) (_swigobj->SetCurrent())
|
||||
static PyObject *_wrap_wxGLContext_SetCurrent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SetCurrent",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetCurrent. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetCurrent(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetColour(_swigobj,_swigarg0) (_swigobj->SetColour(_swigarg0))
|
||||
static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","colour", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLContext_SetColour",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetColour. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SetColour(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SwapBuffers(_swigobj) (_swigobj->SwapBuffers())
|
||||
static PyObject *_wrap_wxGLContext_SwapBuffers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_SwapBuffers",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SwapBuffers. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLContext_SwapBuffers(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_GetWindow(_swigobj) (_swigobj->GetWindow())
|
||||
static PyObject *_wrap_wxGLContext_GetWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _result;
|
||||
wxGLContext * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLContext_GetWindow",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_GetWindow. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxWindow *)wxGLContext_GetWindow(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{ _resultobj = wxPyMake_wxObject(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxWindow(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxWindow *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxWindow *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxEvtHandler(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxEvtHandler *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxEvtHandler *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxGLCanvasTowxObject(void *ptr) {
|
||||
wxGLCanvas *src;
|
||||
wxObject *dest;
|
||||
src = (wxGLCanvas *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7) (new wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7))
|
||||
static PyObject *_wrap_new_wxGLCanvas(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _result;
|
||||
wxWindow * _arg0;
|
||||
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||
wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg3 = (wxSize *) &wxDefaultSize;
|
||||
long _arg4 = (long ) 0;
|
||||
wxString * _arg5 = (wxString *) &wxPyGLCanvasNameStr;
|
||||
int * _arg6 = (int *) NULL;
|
||||
wxPalette * _arg7 = (wxPalette *) &wxNullPalette;
|
||||
PyObject * _argo0 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj2 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj3 = 0;
|
||||
PyObject * _obj5 = 0;
|
||||
int * temp1;
|
||||
PyObject * _obj6 = 0;
|
||||
PyObject * _argo7 = 0;
|
||||
char *_kwnames[] = { "parent","id","pos","size","style","name","attribList","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOlOOO:new_wxGLCanvas",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_obj5,&_obj6,&_argo7))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGLCanvas. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = &temp;
|
||||
if (! wxPoint_helper(_obj2, &_arg2))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = &temp0;
|
||||
if (! wxSize_helper(_obj3, &_arg3))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj5)
|
||||
{
|
||||
_arg5 = wxString_in_helper(_obj5);
|
||||
if (_arg5 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj6)) {
|
||||
int size = PyObject_Length(_obj6);
|
||||
temp1 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp1[i] = PyInt_AsLong(PySequence_GetItem(_obj6, i));
|
||||
}
|
||||
temp1[size] = 0;
|
||||
_arg6 = temp1;
|
||||
}
|
||||
}
|
||||
if (_argo7) {
|
||||
if (SWIG_GetPtrObj(_argo7,(void **) &_arg7,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 8 of new_wxGLCanvas. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLCanvas *)new_wxGLCanvas(_arg0,_arg1,*_arg2,*_arg3,_arg4,*_arg5,_arg6,*_arg7);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLCanvas_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj5)
|
||||
delete _arg5;
|
||||
}
|
||||
{
|
||||
delete [] _arg6;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define new_wxGLCanvasWithContext(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8) (new wxGLCanvas(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8))
|
||||
static PyObject *_wrap_new_wxGLCanvasWithContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _result;
|
||||
wxWindow * _arg0;
|
||||
wxGLContext * _arg1 = (wxGLContext *) NULL;
|
||||
wxWindowID _arg2 = (wxWindowID ) -1;
|
||||
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
|
||||
long _arg5 = (long ) 0;
|
||||
wxString * _arg6 = (wxString *) &wxPyGLCanvasNameStr;
|
||||
int * _arg7 = (int *) NULL;
|
||||
wxPalette * _arg8 = (wxPalette *) &wxNullPalette;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj3 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj4 = 0;
|
||||
PyObject * _obj6 = 0;
|
||||
int * temp1;
|
||||
PyObject * _obj7 = 0;
|
||||
PyObject * _argo8 = 0;
|
||||
char *_kwnames[] = { "parent","shared","id","pos","size","style","name","attribList","palette", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|OiOOlOOO:new_wxGLCanvasWithContext",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_obj4,&_arg5,&_obj6,&_obj7,&_argo8))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGLCanvasWithContext. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxGLCanvasWithContext. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = &temp;
|
||||
if (! wxPoint_helper(_obj3, &_arg3))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj4)
|
||||
{
|
||||
_arg4 = &temp0;
|
||||
if (! wxSize_helper(_obj4, &_arg4))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
_arg6 = wxString_in_helper(_obj6);
|
||||
if (_arg6 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj7)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj7)) {
|
||||
int size = PyObject_Length(_obj7);
|
||||
temp1 = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp1[i] = PyInt_AsLong(PySequence_GetItem(_obj7, i));
|
||||
}
|
||||
temp1[size] = 0;
|
||||
_arg7 = temp1;
|
||||
}
|
||||
}
|
||||
if (_argo8) {
|
||||
if (SWIG_GetPtrObj(_argo8,(void **) &_arg8,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 9 of new_wxGLCanvasWithContext. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLCanvas *)new_wxGLCanvasWithContext(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,*_arg6,_arg7,*_arg8);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLCanvas_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj6)
|
||||
delete _arg6;
|
||||
}
|
||||
{
|
||||
delete [] _arg7;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetCurrent(_swigobj) (_swigobj->SetCurrent())
|
||||
static PyObject *_wrap_wxGLCanvas_SetCurrent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_SetCurrent",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetCurrent. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetCurrent(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetColour(_swigobj,_swigarg0) (_swigobj->SetColour(_swigarg0))
|
||||
static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","colour", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLCanvas_SetColour",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetColour. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetColour(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SwapBuffers(_swigobj) (_swigobj->SwapBuffers())
|
||||
static PyObject *_wrap_wxGLCanvas_SwapBuffers(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_SwapBuffers",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SwapBuffers. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SwapBuffers(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_GetContext(_swigobj) (_swigobj->GetContext())
|
||||
static PyObject *_wrap_wxGLCanvas_GetContext(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _result;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_GetContext",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_GetContext. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGLContext *)wxGLCanvas_GetContext(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxGLContext_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetupPixelFormat(_swigobj,_swigarg0) (_swigobj->SetupPixelFormat(_swigarg0))
|
||||
static PyObject *_wrap_wxGLCanvas_SetupPixelFormat(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
int * _arg1 = (int *) NULL;
|
||||
PyObject * _argo0 = 0;
|
||||
int * temp;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","attribList", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|O:wxGLCanvas_SetupPixelFormat",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetupPixelFormat. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj1)
|
||||
{
|
||||
int i;
|
||||
if (PySequence_Check(_obj1)) {
|
||||
int size = PyObject_Length(_obj1);
|
||||
temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp[i] = PyInt_AsLong(PySequence_GetItem(_obj1, i));
|
||||
}
|
||||
temp[size] = 0;
|
||||
_arg1 = temp;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetupPixelFormat(_arg0,_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
delete [] _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_SetupPalette(_swigobj,_swigarg0) (_swigobj->SetupPalette(_swigarg0))
|
||||
static PyObject *_wrap_wxGLCanvas_SetupPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxGLCanvas * _arg0;
|
||||
wxPalette * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
char *_kwnames[] = { "self","palette", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLCanvas_SetupPalette",_kwnames,&_argo0,&_argo1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_SetupPalette. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGLCanvas_SetupPalette. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxGLCanvas_SetupPalette(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_CreateDefaultPalette(_swigobj) (_swigobj->CreateDefaultPalette())
|
||||
static PyObject *_wrap_wxGLCanvas_CreateDefaultPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPalette * _result;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_CreateDefaultPalette",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_CreateDefaultPalette. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = new wxPalette (wxGLCanvas_CreateDefaultPalette(_arg0));
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxPalette_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLCanvas_GetPalette(_swigobj) (_swigobj->GetPalette())
|
||||
static PyObject *_wrap_wxGLCanvas_GetPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPalette * _result;
|
||||
wxGLCanvas * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGLCanvas_GetPalette",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGLCanvas_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLCanvas_GetPalette. Expected _wxGLCanvas_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxPalette *)wxGLCanvas_GetPalette(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPalette_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyMethodDef glcanvascMethods[] = {
|
||||
{ "wxGLCanvas_GetPalette", (PyCFunction) _wrap_wxGLCanvas_GetPalette, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_CreateDefaultPalette", (PyCFunction) _wrap_wxGLCanvas_CreateDefaultPalette, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetupPalette", (PyCFunction) _wrap_wxGLCanvas_SetupPalette, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetupPixelFormat", (PyCFunction) _wrap_wxGLCanvas_SetupPixelFormat, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_GetContext", (PyCFunction) _wrap_wxGLCanvas_GetContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SwapBuffers", (PyCFunction) _wrap_wxGLCanvas_SwapBuffers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetColour", (PyCFunction) _wrap_wxGLCanvas_SetColour, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLCanvas_SetCurrent", (PyCFunction) _wrap_wxGLCanvas_SetCurrent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLCanvasWithContext", (PyCFunction) _wrap_new_wxGLCanvasWithContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLCanvas", (PyCFunction) _wrap_new_wxGLCanvas, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_GetWindow", (PyCFunction) _wrap_wxGLContext_GetWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SwapBuffers", (PyCFunction) _wrap_wxGLContext_SwapBuffers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetColour", (PyCFunction) _wrap_wxGLContext_SetColour, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxGLContext_SetCurrent", (PyCFunction) _wrap_wxGLContext_SetCurrent, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "delete_wxGLContext", (PyCFunction) _wrap_delete_wxGLContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxGLContext", (PyCFunction) _wrap_new_wxGLContext, METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This table is used by the pointer type-checker
|
||||
*/
|
||||
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_signed_long","_long",0},
|
||||
{ "_wxPrintQuality","_wxCoord",0},
|
||||
{ "_wxPrintQuality","_int",0},
|
||||
{ "_wxPrintQuality","_signed_int",0},
|
||||
{ "_wxPrintQuality","_unsigned_int",0},
|
||||
{ "_wxPrintQuality","_wxWindowID",0},
|
||||
{ "_wxPrintQuality","_uint",0},
|
||||
{ "_wxPrintQuality","_EBool",0},
|
||||
{ "_wxPrintQuality","_size_t",0},
|
||||
{ "_wxPrintQuality","_time_t",0},
|
||||
{ "_byte","_unsigned_char",0},
|
||||
{ "_long","_unsigned_long",0},
|
||||
{ "_long","_signed_long",0},
|
||||
{ "_size_t","_wxCoord",0},
|
||||
{ "_size_t","_wxPrintQuality",0},
|
||||
{ "_size_t","_time_t",0},
|
||||
{ "_size_t","_unsigned_int",0},
|
||||
{ "_size_t","_int",0},
|
||||
{ "_size_t","_wxWindowID",0},
|
||||
{ "_size_t","_uint",0},
|
||||
{ "_uint","_wxCoord",0},
|
||||
{ "_uint","_wxPrintQuality",0},
|
||||
{ "_uint","_time_t",0},
|
||||
{ "_uint","_size_t",0},
|
||||
{ "_uint","_unsigned_int",0},
|
||||
{ "_uint","_int",0},
|
||||
{ "_uint","_wxWindowID",0},
|
||||
{ "_wxChar","_char",0},
|
||||
{ "_char","_wxChar",0},
|
||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||
{ "_EBool","_wxCoord",0},
|
||||
{ "_EBool","_wxPrintQuality",0},
|
||||
{ "_EBool","_signed_int",0},
|
||||
{ "_EBool","_int",0},
|
||||
{ "_EBool","_wxWindowID",0},
|
||||
{ "_unsigned_long","_long",0},
|
||||
{ "_wxNativeFontInfo","_struct_wxNativeFontInfo",0},
|
||||
{ "_signed_int","_wxCoord",0},
|
||||
{ "_signed_int","_wxPrintQuality",0},
|
||||
{ "_signed_int","_EBool",0},
|
||||
{ "_signed_int","_wxWindowID",0},
|
||||
{ "_signed_int","_int",0},
|
||||
{ "_WXTYPE","_wxDateTime_t",0},
|
||||
{ "_WXTYPE","_short",0},
|
||||
{ "_WXTYPE","_signed_short",0},
|
||||
{ "_WXTYPE","_unsigned_short",0},
|
||||
{ "_unsigned_short","_wxDateTime_t",0},
|
||||
{ "_unsigned_short","_WXTYPE",0},
|
||||
{ "_unsigned_short","_short",0},
|
||||
{ "_wxObject","_wxGLCanvas",SwigwxGLCanvasTowxObject},
|
||||
{ "_wxObject","_wxGLContext",SwigwxGLContextTowxObject},
|
||||
{ "_signed_short","_WXTYPE",0},
|
||||
{ "_signed_short","_short",0},
|
||||
{ "_unsigned_char","_byte",0},
|
||||
{ "_unsigned_int","_wxCoord",0},
|
||||
{ "_unsigned_int","_wxPrintQuality",0},
|
||||
{ "_unsigned_int","_time_t",0},
|
||||
{ "_unsigned_int","_size_t",0},
|
||||
{ "_unsigned_int","_uint",0},
|
||||
{ "_unsigned_int","_wxWindowID",0},
|
||||
{ "_unsigned_int","_int",0},
|
||||
{ "_short","_wxDateTime_t",0},
|
||||
{ "_short","_WXTYPE",0},
|
||||
{ "_short","_unsigned_short",0},
|
||||
{ "_short","_signed_short",0},
|
||||
{ "_wxWindowID","_wxCoord",0},
|
||||
{ "_wxWindowID","_wxPrintQuality",0},
|
||||
{ "_wxWindowID","_time_t",0},
|
||||
{ "_wxWindowID","_size_t",0},
|
||||
{ "_wxWindowID","_EBool",0},
|
||||
{ "_wxWindowID","_uint",0},
|
||||
{ "_wxWindowID","_int",0},
|
||||
{ "_wxWindowID","_signed_int",0},
|
||||
{ "_wxWindowID","_unsigned_int",0},
|
||||
{ "_int","_wxCoord",0},
|
||||
{ "_int","_wxPrintQuality",0},
|
||||
{ "_int","_time_t",0},
|
||||
{ "_int","_size_t",0},
|
||||
{ "_int","_EBool",0},
|
||||
{ "_int","_uint",0},
|
||||
{ "_int","_wxWindowID",0},
|
||||
{ "_int","_unsigned_int",0},
|
||||
{ "_int","_signed_int",0},
|
||||
{ "_wxDateTime_t","_unsigned_short",0},
|
||||
{ "_wxDateTime_t","_short",0},
|
||||
{ "_wxDateTime_t","_WXTYPE",0},
|
||||
{ "_time_t","_wxCoord",0},
|
||||
{ "_time_t","_wxPrintQuality",0},
|
||||
{ "_time_t","_unsigned_int",0},
|
||||
{ "_time_t","_int",0},
|
||||
{ "_time_t","_wxWindowID",0},
|
||||
{ "_time_t","_uint",0},
|
||||
{ "_time_t","_size_t",0},
|
||||
{ "_wxCoord","_int",0},
|
||||
{ "_wxCoord","_signed_int",0},
|
||||
{ "_wxCoord","_unsigned_int",0},
|
||||
{ "_wxCoord","_wxWindowID",0},
|
||||
{ "_wxCoord","_uint",0},
|
||||
{ "_wxCoord","_EBool",0},
|
||||
{ "_wxCoord","_size_t",0},
|
||||
{ "_wxCoord","_time_t",0},
|
||||
{ "_wxCoord","_wxPrintQuality",0},
|
||||
{ "_wxEvtHandler","_wxGLCanvas",SwigwxGLCanvasTowxEvtHandler},
|
||||
{ "_wxWindow","_wxGLCanvas",SwigwxGLCanvasTowxWindow},
|
||||
{0,0,0}};
|
||||
|
||||
static PyObject *SWIG_globals;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void) initglcanvasc() {
|
||||
PyObject *m, *d;
|
||||
SWIG_globals = SWIG_newvarlink();
|
||||
m = Py_InitModule("glcanvasc", glcanvascMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
PyDict_SetItemString(d,"WX_GL_RGBA", PyInt_FromLong((long) WX_GL_RGBA));
|
||||
PyDict_SetItemString(d,"WX_GL_BUFFER_SIZE", PyInt_FromLong((long) WX_GL_BUFFER_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_LEVEL", PyInt_FromLong((long) WX_GL_LEVEL));
|
||||
PyDict_SetItemString(d,"WX_GL_DOUBLEBUFFER", PyInt_FromLong((long) WX_GL_DOUBLEBUFFER));
|
||||
PyDict_SetItemString(d,"WX_GL_STEREO", PyInt_FromLong((long) WX_GL_STEREO));
|
||||
PyDict_SetItemString(d,"WX_GL_AUX_BUFFERS", PyInt_FromLong((long) WX_GL_AUX_BUFFERS));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_RED", PyInt_FromLong((long) WX_GL_MIN_RED));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_GREEN", PyInt_FromLong((long) WX_GL_MIN_GREEN));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_BLUE", PyInt_FromLong((long) WX_GL_MIN_BLUE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ALPHA));
|
||||
PyDict_SetItemString(d,"WX_GL_DEPTH_SIZE", PyInt_FromLong((long) WX_GL_DEPTH_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_STENCIL_SIZE", PyInt_FromLong((long) WX_GL_STENCIL_SIZE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_RED", PyInt_FromLong((long) WX_GL_MIN_ACCUM_RED));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_GREEN", PyInt_FromLong((long) WX_GL_MIN_ACCUM_GREEN));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_BLUE", PyInt_FromLong((long) WX_GL_MIN_ACCUM_BLUE));
|
||||
PyDict_SetItemString(d,"WX_GL_MIN_ACCUM_ALPHA", PyInt_FromLong((long) WX_GL_MIN_ACCUM_ALPHA));
|
||||
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; _swig_mapping[i].n1; i++)
|
||||
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import glcanvasc
|
||||
|
||||
from misc import *
|
||||
|
||||
from misc2 import *
|
||||
|
||||
from windows import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from events import *
|
||||
|
||||
from streams import *
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
import wx
|
||||
class wxGLContextPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self, delfunc=glcanvasc.delete_wxGLContext):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def SetCurrent(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetCurrent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetColour(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SetColour,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SwapBuffers(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_SwapBuffers,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetWindow(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLContext_GetWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGLContext instance at %s>" % (self.this,)
|
||||
class wxGLContext(wxGLContextPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(glcanvasc.new_wxGLContext,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxGLCanvasPtr(wxWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetCurrent(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetCurrent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetColour(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetColour,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SwapBuffers(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SwapBuffers,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetContext(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_GetContext,(self,) + _args, _kwargs)
|
||||
if val: val = wxGLContextPtr(val)
|
||||
return val
|
||||
def SetupPixelFormat(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetupPixelFormat,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetupPalette(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_SetupPalette,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def CreateDefaultPalette(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_CreateDefaultPalette,(self,) + _args, _kwargs)
|
||||
if val: val = wxPalettePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetPalette(self, *_args, **_kwargs):
|
||||
val = apply(glcanvasc.wxGLCanvas_GetPalette,(self,) + _args, _kwargs)
|
||||
if val: val = wxPalettePtr(val)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGLCanvas instance at %s>" % (self.this,)
|
||||
class wxGLCanvas(wxGLCanvasPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(glcanvasc.new_wxGLCanvas,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxGLCanvasWithContext(*_args,**_kwargs):
|
||||
val = wxGLCanvasPtr(apply(glcanvasc.new_wxGLCanvasWithContext,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(self)
|
||||
return val
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
WX_GL_RGBA = glcanvasc.WX_GL_RGBA
|
||||
WX_GL_BUFFER_SIZE = glcanvasc.WX_GL_BUFFER_SIZE
|
||||
WX_GL_LEVEL = glcanvasc.WX_GL_LEVEL
|
||||
WX_GL_DOUBLEBUFFER = glcanvasc.WX_GL_DOUBLEBUFFER
|
||||
WX_GL_STEREO = glcanvasc.WX_GL_STEREO
|
||||
WX_GL_AUX_BUFFERS = glcanvasc.WX_GL_AUX_BUFFERS
|
||||
WX_GL_MIN_RED = glcanvasc.WX_GL_MIN_RED
|
||||
WX_GL_MIN_GREEN = glcanvasc.WX_GL_MIN_GREEN
|
||||
WX_GL_MIN_BLUE = glcanvasc.WX_GL_MIN_BLUE
|
||||
WX_GL_MIN_ALPHA = glcanvasc.WX_GL_MIN_ALPHA
|
||||
WX_GL_DEPTH_SIZE = glcanvasc.WX_GL_DEPTH_SIZE
|
||||
WX_GL_STENCIL_SIZE = glcanvasc.WX_GL_STENCIL_SIZE
|
||||
WX_GL_MIN_ACCUM_RED = glcanvasc.WX_GL_MIN_ACCUM_RED
|
||||
WX_GL_MIN_ACCUM_GREEN = glcanvasc.WX_GL_MIN_ACCUM_GREEN
|
||||
WX_GL_MIN_ACCUM_BLUE = glcanvasc.WX_GL_MIN_ACCUM_BLUE
|
||||
WX_GL_MIN_ACCUM_ALPHA = glcanvasc.WX_GL_MIN_ACCUM_ALPHA
|
||||
@@ -1,747 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: glcanvas.cpp
|
||||
// Purpose: wxGLCanvas, for using OpenGL with wxWindows under MS Windows
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "glcanvas.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include <wx/setup.h>
|
||||
|
||||
|
||||
#undef wxUSE_GLCANVAS
|
||||
#define wxUSE_GLCANVAS 1
|
||||
#if wxUSE_GLCANVAS
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/frame.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#include "myglcanvas.h"
|
||||
|
||||
const wxChar* wxGLCanvasName = wxT("GLcanvas");
|
||||
static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass");
|
||||
static const wxChar *wxGLCanvasClassNameNoRedraw = wxT("wxGLCanvasClassNR");
|
||||
|
||||
LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/*
|
||||
* GLContext implementation
|
||||
*/
|
||||
|
||||
wxGLContext::wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette)
|
||||
{
|
||||
m_window = win;
|
||||
|
||||
m_hDC = win->GetHDC();
|
||||
|
||||
m_glContext = wglCreateContext((HDC) m_hDC);
|
||||
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
|
||||
|
||||
wglMakeCurrent((HDC) m_hDC, m_glContext);
|
||||
}
|
||||
|
||||
wxGLContext::wxGLContext(
|
||||
bool isRGB, wxGLCanvas *win,
|
||||
const wxPalette& palette,
|
||||
const wxGLContext *other /* for sharing display lists */
|
||||
)
|
||||
{
|
||||
m_window = win;
|
||||
|
||||
m_hDC = win->GetHDC();
|
||||
|
||||
m_glContext = wglCreateContext((HDC) m_hDC);
|
||||
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
|
||||
|
||||
if( other != 0 )
|
||||
wglShareLists( other->m_glContext, m_glContext );
|
||||
|
||||
wglMakeCurrent((HDC) m_hDC, m_glContext);
|
||||
}
|
||||
|
||||
wxGLContext::~wxGLContext()
|
||||
{
|
||||
if (m_glContext)
|
||||
{
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(m_glContext);
|
||||
}
|
||||
}
|
||||
|
||||
void wxGLContext::SwapBuffers()
|
||||
{
|
||||
if (m_glContext)
|
||||
{
|
||||
wglMakeCurrent((HDC) m_hDC, m_glContext);
|
||||
::SwapBuffers((HDC) m_hDC); //blits the backbuffer into DC
|
||||
}
|
||||
}
|
||||
|
||||
void wxGLContext::SetCurrent()
|
||||
{
|
||||
if (m_glContext)
|
||||
{
|
||||
wglMakeCurrent((HDC) m_hDC, m_glContext);
|
||||
}
|
||||
|
||||
/*
|
||||
setupPixelFormat(hDC);
|
||||
setupPalette(hDC);
|
||||
*/
|
||||
}
|
||||
|
||||
void wxGLContext::SetColour(const wxChar *colour)
|
||||
{
|
||||
float r = 0.0;
|
||||
float g = 0.0;
|
||||
float b = 0.0;
|
||||
wxColour *col = wxTheColourDatabase->FindColour(colour);
|
||||
if (col)
|
||||
{
|
||||
r = (float)(col->Red()/256.0);
|
||||
g = (float)(col->Green()/256.0);
|
||||
b = (float)(col->Blue()/256.0);
|
||||
glColor3f( r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* wxGLCanvas implementation
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
|
||||
EVT_SIZE(wxGLCanvas::OnSize)
|
||||
EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged)
|
||||
EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||
int *attribList, const wxPalette& palette) : wxWindow()
|
||||
{
|
||||
m_glContext = (wxGLContext*) NULL;
|
||||
|
||||
bool ret = Create(parent, id, pos, size, style, name);
|
||||
|
||||
if ( ret )
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
}
|
||||
|
||||
m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
|
||||
|
||||
SetupPixelFormat(attribList);
|
||||
SetupPalette(palette);
|
||||
|
||||
m_glContext = new wxGLContext(TRUE, this, palette);
|
||||
}
|
||||
|
||||
wxGLCanvas::wxGLCanvas( wxWindow *parent,
|
||||
const wxGLContext *shared, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||
int *attribList, const wxPalette& palette )
|
||||
: wxWindow()
|
||||
{
|
||||
m_glContext = (wxGLContext*) NULL;
|
||||
|
||||
bool ret = Create(parent, id, pos, size, style, name);
|
||||
|
||||
if ( ret )
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
}
|
||||
|
||||
m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
|
||||
|
||||
SetupPixelFormat(attribList);
|
||||
SetupPalette(palette);
|
||||
|
||||
m_glContext = new wxGLContext(TRUE, this, palette, shared );
|
||||
}
|
||||
|
||||
// Not very useful for wxMSW, but this is to be wxGTK compliant
|
||||
|
||||
wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||
int *attribList, const wxPalette& palette ):
|
||||
wxWindow()
|
||||
{
|
||||
m_glContext = (wxGLContext*) NULL;
|
||||
|
||||
bool ret = Create(parent, id, pos, size, style, name);
|
||||
|
||||
if ( ret )
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
}
|
||||
|
||||
m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
|
||||
|
||||
SetupPixelFormat(attribList);
|
||||
SetupPalette(palette);
|
||||
|
||||
wxGLContext *sharedContext=0;
|
||||
if (shared) sharedContext=shared->GetContext();
|
||||
m_glContext = new wxGLContext(TRUE, this, palette, sharedContext );
|
||||
}
|
||||
|
||||
wxGLCanvas::~wxGLCanvas()
|
||||
{
|
||||
if (m_glContext)
|
||||
delete m_glContext;
|
||||
|
||||
::ReleaseDC((HWND) GetHWND(), (HDC) m_hDC);
|
||||
}
|
||||
|
||||
// Replaces wxWindow::Create functionality, since we need to use a different
|
||||
// window class
|
||||
bool wxGLCanvas::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
static bool s_registeredGLCanvasClass = FALSE;
|
||||
|
||||
// We have to register a special window class because we need
|
||||
// the CS_OWNDC style for GLCanvas.
|
||||
|
||||
/*
|
||||
From Angel Popov <jumpo@bitex.com>
|
||||
|
||||
Here are two snips from a dicussion in the OpenGL Gamedev list that explains
|
||||
how this problem can be fixed:
|
||||
|
||||
"There are 5 common DCs available in Win95. These are aquired when you call
|
||||
GetDC or GetDCEx from a window that does _not_ have the OWNDC flag.
|
||||
OWNDC flagged windows do not get their DC from the common DC pool, the issue
|
||||
is they require 800 bytes each from the limited 64Kb local heap for GDI."
|
||||
|
||||
"The deal is, if you hold onto one of the 5 shared DC's too long (as GL apps
|
||||
do), Win95 will actually "steal" it from you. MakeCurrent fails,
|
||||
apparently, because Windows re-assigns the HDC to a different window. The
|
||||
only way to prevent this, the only reliable means, is to set CS_OWNDC."
|
||||
*/
|
||||
|
||||
if (!s_registeredGLCanvasClass)
|
||||
{
|
||||
WNDCLASS wndclass;
|
||||
|
||||
// the fields which are common to all classes
|
||||
wndclass.lpfnWndProc = (WNDPROC)wxWndProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = sizeof( DWORD ); // VZ: what is this DWORD used for?
|
||||
wndclass.hInstance = wxhInstance;
|
||||
wndclass.hIcon = (HICON) NULL;
|
||||
wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
|
||||
// Register the GLCanvas class name
|
||||
wndclass.hbrBackground = (HBRUSH)NULL;
|
||||
wndclass.lpszClassName = wxGLCanvasClassName;
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC;
|
||||
|
||||
if ( !::RegisterClass(&wndclass) )
|
||||
{
|
||||
wxLogLastError(wxT("RegisterClass(wxGLCanvasClass)"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Register the GLCanvas class name for windows which don't do full repaint
|
||||
// on resize
|
||||
wndclass.lpszClassName = wxGLCanvasClassNameNoRedraw;
|
||||
wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW);
|
||||
|
||||
if ( !::RegisterClass(&wndclass) )
|
||||
{
|
||||
wxLogLastError(wxT("RegisterClass(wxGLCanvasClassNameNoRedraw)"));
|
||||
|
||||
::UnregisterClass(wxGLCanvasClassName, wxhInstance);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s_registeredGLCanvasClass = TRUE;
|
||||
}
|
||||
|
||||
wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") );
|
||||
|
||||
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||
return FALSE;
|
||||
|
||||
parent->AddChild(this);
|
||||
|
||||
DWORD msflags = 0;
|
||||
if ( style & wxBORDER )
|
||||
msflags |= WS_BORDER;
|
||||
if ( style & wxTHICK_FRAME )
|
||||
msflags |= WS_THICKFRAME;
|
||||
|
||||
/*
|
||||
A general rule with OpenGL and Win32 is that any window that will have a
|
||||
HGLRC built for it must have two flags: WS_CLIPCHILDREN & WS_CLIPSIBLINGS.
|
||||
You can find references about this within the knowledge base and most OpenGL
|
||||
books that contain the wgl function descriptions.
|
||||
*/
|
||||
|
||||
msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||
|
||||
bool want3D;
|
||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
|
||||
|
||||
// Even with extended styles, need to combine with WS_BORDER
|
||||
// for them to look right.
|
||||
if ( want3D || (m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
|
||||
(m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
|
||||
{
|
||||
msflags |= WS_BORDER;
|
||||
}
|
||||
|
||||
return MSWCreate(wxGLCanvasClassName, NULL, pos, size, msflags, exStyle);
|
||||
}
|
||||
|
||||
static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList)
|
||||
{
|
||||
if (attribList) {
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_COLORINDEX;
|
||||
pfd.cColorBits = 0;
|
||||
int arg=0;
|
||||
|
||||
while( (attribList[arg]!=0) )
|
||||
{
|
||||
switch( attribList[arg++] )
|
||||
{
|
||||
case WX_GL_RGBA:
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
break;
|
||||
case WX_GL_BUFFER_SIZE:
|
||||
pfd.cColorBits = attribList[arg++];
|
||||
break;
|
||||
case WX_GL_LEVEL:
|
||||
// this member looks like it may be obsolete
|
||||
if (attribList[arg] > 0) {
|
||||
pfd.iLayerType = (BYTE)PFD_OVERLAY_PLANE;
|
||||
} else if (attribList[arg] < 0) {
|
||||
pfd.iLayerType = (BYTE)PFD_UNDERLAY_PLANE;
|
||||
} else {
|
||||
pfd.iLayerType = (BYTE)PFD_MAIN_PLANE;
|
||||
}
|
||||
arg++;
|
||||
break;
|
||||
case WX_GL_DOUBLEBUFFER:
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER;
|
||||
break;
|
||||
case WX_GL_STEREO:
|
||||
pfd.dwFlags |= PFD_STEREO;
|
||||
break;
|
||||
case WX_GL_AUX_BUFFERS:
|
||||
pfd.cAuxBuffers = attribList[arg++];
|
||||
break;
|
||||
case WX_GL_MIN_RED:
|
||||
pfd.cColorBits += (pfd.cRedBits = attribList[arg++]);
|
||||
break;
|
||||
case WX_GL_MIN_GREEN:
|
||||
pfd.cColorBits += (pfd.cGreenBits = attribList[arg++]);
|
||||
break;
|
||||
case WX_GL_MIN_BLUE:
|
||||
pfd.cColorBits += (pfd.cBlueBits = attribList[arg++]);
|
||||
break;
|
||||
case WX_GL_MIN_ALPHA:
|
||||
// doesn't count in cColorBits
|
||||
pfd.cAlphaBits = attribList[arg++];
|
||||
break;
|
||||
case WX_GL_DEPTH_SIZE:
|
||||
pfd.cDepthBits = attribList[arg++];
|
||||
break;
|
||||
case WX_GL_STENCIL_SIZE:
|
||||
pfd.cStencilBits = attribList[arg++];
|
||||
break;
|
||||
case WX_GL_MIN_ACCUM_RED:
|
||||
pfd.cAccumBits += (pfd.cAccumRedBits = attribList[arg++]);
|
||||
break;
|
||||
case WX_GL_MIN_ACCUM_GREEN:
|
||||
pfd.cAccumBits += (pfd.cAccumGreenBits = attribList[arg++]);
|
||||
break;
|
||||
case WX_GL_MIN_ACCUM_BLUE:
|
||||
pfd.cAccumBits += (pfd.cAccumBlueBits = attribList[arg++]);
|
||||
break;
|
||||
case WX_GL_MIN_ACCUM_ALPHA:
|
||||
pfd.cAccumBits += (pfd.cAccumAlphaBits = attribList[arg++]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), /* size */
|
||||
1, /* version */
|
||||
PFD_SUPPORT_OPENGL |
|
||||
PFD_DRAW_TO_WINDOW |
|
||||
PFD_DOUBLEBUFFER, /* support double-buffering */
|
||||
PFD_TYPE_RGBA, /* color type */
|
||||
16, /* prefered color depth */
|
||||
0, 0, 0, 0, 0, 0, /* color bits (ignored) */
|
||||
0, /* no alpha buffer */
|
||||
0, /* alpha bits (ignored) */
|
||||
0, /* no accumulation buffer */
|
||||
0, 0, 0, 0, /* accum bits (ignored) */
|
||||
16, /* depth buffer */
|
||||
0, /* no stencil buffer */
|
||||
0, /* no auxiliary buffers */
|
||||
PFD_MAIN_PLANE, /* main layer */
|
||||
0, /* reserved */
|
||||
0, 0, 0, /* no layer, visible, damage masks */
|
||||
};
|
||||
|
||||
AdjustPFDForAttributes(pfd, attribList);
|
||||
|
||||
int pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
|
||||
if (pixelFormat == 0) {
|
||||
wxLogLastError(_T("ChoosePixelFormat"));
|
||||
}
|
||||
else {
|
||||
if ( !::SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) ) {
|
||||
wxLogLastError(_T("SetPixelFormat"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxGLCanvas::SetupPalette(const wxPalette& palette)
|
||||
{
|
||||
int pixelFormat = GetPixelFormat((HDC) m_hDC);
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
DescribePixelFormat((HDC) m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
if (pfd.dwFlags & PFD_NEED_PALETTE)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_palette = palette;
|
||||
|
||||
if ( !m_palette.Ok() )
|
||||
{
|
||||
m_palette = CreateDefaultPalette();
|
||||
}
|
||||
|
||||
if (m_palette.Ok())
|
||||
{
|
||||
SelectPalette((HDC) m_hDC, (HPALETTE) m_palette.GetHPALETTE(), FALSE);
|
||||
RealizePalette((HDC) m_hDC);
|
||||
}
|
||||
}
|
||||
|
||||
wxPalette wxGLCanvas::CreateDefaultPalette()
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
int paletteSize;
|
||||
int pixelFormat = GetPixelFormat((HDC) m_hDC);
|
||||
|
||||
DescribePixelFormat((HDC) m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
paletteSize = 1 << pfd.cColorBits;
|
||||
|
||||
LOGPALETTE* pPal =
|
||||
(LOGPALETTE*) malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY));
|
||||
pPal->palVersion = 0x300;
|
||||
pPal->palNumEntries = paletteSize;
|
||||
|
||||
/* build a simple RGB color palette */
|
||||
{
|
||||
int redMask = (1 << pfd.cRedBits) - 1;
|
||||
int greenMask = (1 << pfd.cGreenBits) - 1;
|
||||
int blueMask = (1 << pfd.cBlueBits) - 1;
|
||||
int i;
|
||||
|
||||
for (i=0; i<paletteSize; ++i) {
|
||||
pPal->palPalEntry[i].peRed =
|
||||
(((i >> pfd.cRedShift) & redMask) * 255) / redMask;
|
||||
pPal->palPalEntry[i].peGreen =
|
||||
(((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
|
||||
pPal->palPalEntry[i].peBlue =
|
||||
(((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
|
||||
pPal->palPalEntry[i].peFlags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
HPALETTE hPalette = CreatePalette(pPal);
|
||||
free(pPal);
|
||||
|
||||
wxPalette palette;
|
||||
palette.SetHPALETTE((WXHPALETTE) hPalette);
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
void wxGLCanvas::SwapBuffers()
|
||||
{
|
||||
if (m_glContext)
|
||||
m_glContext->SwapBuffers();
|
||||
}
|
||||
|
||||
void wxGLCanvas::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
void wxGLCanvas::SetCurrent()
|
||||
{
|
||||
if (m_glContext)
|
||||
{
|
||||
m_glContext->SetCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
void wxGLCanvas::SetColour(const wxChar *colour)
|
||||
{
|
||||
if (m_glContext)
|
||||
m_glContext->SetColour(colour);
|
||||
}
|
||||
|
||||
// TODO: Have to have this called by parent frame (?)
|
||||
// So we need wxFrame to call OnQueryNewPalette for all children...
|
||||
void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent& event)
|
||||
{
|
||||
/* realize palette if this is the current window */
|
||||
if ( GetPalette()->Ok() ) {
|
||||
::UnrealizeObject((HPALETTE) GetPalette()->GetHPALETTE());
|
||||
::SelectPalette((HDC) GetHDC(), (HPALETTE) GetPalette()->GetHPALETTE(), FALSE);
|
||||
::RealizePalette((HDC) GetHDC());
|
||||
Refresh();
|
||||
event.SetPaletteRealized(TRUE);
|
||||
}
|
||||
else
|
||||
event.SetPaletteRealized(FALSE);
|
||||
}
|
||||
|
||||
// I think this doesn't have to be propagated to child windows.
|
||||
void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent& event)
|
||||
{
|
||||
/* realize palette if this is *not* the current window */
|
||||
if ( GetPalette() &&
|
||||
GetPalette()->Ok() && (this != event.GetChangedWindow()) )
|
||||
{
|
||||
::UnrealizeObject((HPALETTE) GetPalette()->GetHPALETTE());
|
||||
::SelectPalette((HDC) GetHDC(), (HPALETTE) GetPalette()->GetHPALETTE(), FALSE);
|
||||
::RealizePalette((HDC) GetHDC());
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/* Give extensions proper function names. */
|
||||
|
||||
/* EXT_vertex_array */
|
||||
void glArrayElementEXT(GLint i)
|
||||
{
|
||||
}
|
||||
|
||||
void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
|
||||
{
|
||||
}
|
||||
|
||||
void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count)
|
||||
{
|
||||
#ifdef GL_EXT_vertex_array
|
||||
static PFNGLDRAWARRAYSEXTPROC proc = 0;
|
||||
|
||||
if ( !proc )
|
||||
{
|
||||
proc = (PFNGLDRAWARRAYSEXTPROC) wglGetProcAddress("glDrawArraysEXT");
|
||||
}
|
||||
|
||||
if ( proc )
|
||||
(* proc) (mode, first, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer)
|
||||
{
|
||||
}
|
||||
|
||||
void glGetPointervEXT(GLenum pname, GLvoid* *params)
|
||||
{
|
||||
}
|
||||
|
||||
void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
|
||||
{
|
||||
}
|
||||
|
||||
void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
|
||||
{
|
||||
#ifdef GL_EXT_vertex_array
|
||||
static PFNGLNORMALPOINTEREXTPROC proc = 0;
|
||||
|
||||
if ( !proc )
|
||||
{
|
||||
proc = (PFNGLNORMALPOINTEREXTPROC) wglGetProcAddress("glNormalPointerEXT");
|
||||
}
|
||||
|
||||
if ( proc )
|
||||
(* proc) (type, stride, count, pointer);
|
||||
#endif
|
||||
}
|
||||
|
||||
void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
|
||||
{
|
||||
}
|
||||
|
||||
void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
|
||||
{
|
||||
#ifdef GL_EXT_vertex_array
|
||||
static PFNGLVERTEXPOINTEREXTPROC proc = 0;
|
||||
|
||||
if ( !proc )
|
||||
{
|
||||
proc = (PFNGLVERTEXPOINTEREXTPROC) wglGetProcAddress("glVertexPointerEXT");
|
||||
}
|
||||
if ( proc )
|
||||
(* proc) (size, type, stride, count, pointer);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* EXT_color_subtable */
|
||||
void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table)
|
||||
{
|
||||
}
|
||||
|
||||
/* EXT_color_table */
|
||||
void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
|
||||
{
|
||||
}
|
||||
|
||||
void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
|
||||
{
|
||||
}
|
||||
|
||||
void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table)
|
||||
{
|
||||
}
|
||||
|
||||
void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params)
|
||||
{
|
||||
}
|
||||
|
||||
void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
}
|
||||
|
||||
/* SGI_compiled_vertex_array */
|
||||
void glLockArraysSGI(GLint first, GLsizei count)
|
||||
{
|
||||
}
|
||||
|
||||
void glUnlockArraysSGI()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* SGI_cull_vertex */
|
||||
void glCullParameterdvSGI(GLenum pname, GLdouble* params)
|
||||
{
|
||||
}
|
||||
|
||||
void glCullParameterfvSGI(GLenum pname, GLfloat* params)
|
||||
{
|
||||
}
|
||||
|
||||
/* SGI_index_func */
|
||||
void glIndexFuncSGI(GLenum func, GLclampf ref)
|
||||
{
|
||||
}
|
||||
|
||||
/* SGI_index_material */
|
||||
void glIndexMaterialSGI(GLenum face, GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
/* WIN_swap_hint */
|
||||
void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxGLApp
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxGLApp, wxApp)
|
||||
|
||||
bool wxGLApp::InitGLVisual(int *attribList)
|
||||
{
|
||||
int pixelFormat;
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), /* size */
|
||||
1, /* version */
|
||||
PFD_SUPPORT_OPENGL |
|
||||
PFD_DRAW_TO_WINDOW |
|
||||
PFD_DOUBLEBUFFER, /* support double-buffering */
|
||||
PFD_TYPE_RGBA, /* color type */
|
||||
16, /* prefered color depth */
|
||||
0, 0, 0, 0, 0, 0, /* color bits (ignored) */
|
||||
0, /* no alpha buffer */
|
||||
0, /* alpha bits (ignored) */
|
||||
0, /* no accumulation buffer */
|
||||
0, 0, 0, 0, /* accum bits (ignored) */
|
||||
16, /* depth buffer */
|
||||
0, /* no stencil buffer */
|
||||
0, /* no auxiliary buffers */
|
||||
PFD_MAIN_PLANE, /* main layer */
|
||||
0, /* reserved */
|
||||
0, 0, 0, /* no layer, visible, damage masks */
|
||||
};
|
||||
|
||||
AdjustPFDForAttributes(pfd, attribList);
|
||||
|
||||
// use DC for whole (root) screen, since no windows have yet been created
|
||||
pixelFormat = ChoosePixelFormat(ScreenHDC(), &pfd);
|
||||
|
||||
if (pixelFormat == 0) {
|
||||
wxLogError(_("Failed to initialize OpenGL"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxGLApp::~wxGLApp()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
// wxUSE_GLCANVAS
|
||||
@@ -1,162 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: glcanvas.h
|
||||
// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Windows
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "glcanvas.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WX_GLCANVAS_H_
|
||||
#define _WX_GLCANVAS_H_
|
||||
|
||||
#include <wx/setup.h>
|
||||
#undef wxUSE_GLCANVAS
|
||||
#define wxUSE_GLCANVAS 1
|
||||
|
||||
#include <wx/palette.h>
|
||||
#include <wx/scrolwin.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include "wx/msw/winundef.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Constants for attriblist
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// The generic GL implementation doesn't support most of these options,
|
||||
// such as stereo, auxiliary buffers, alpha channel, and accum buffer.
|
||||
// Other implementations may actually support them.
|
||||
|
||||
enum
|
||||
{
|
||||
WX_GL_RGBA=1, /* use true color palette */
|
||||
WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */
|
||||
WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */
|
||||
WX_GL_DOUBLEBUFFER, /* use doublebuffer */
|
||||
WX_GL_STEREO, /* use stereoscopic display */
|
||||
WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */
|
||||
WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */
|
||||
WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */
|
||||
WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */
|
||||
WX_GL_MIN_ALPHA, /* use blue buffer with most bits (> MIN_ALPHA bits) */
|
||||
WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */
|
||||
WX_GL_STENCIL_SIZE, /* bits for stencil buffer */
|
||||
WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
|
||||
WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
|
||||
WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
|
||||
WX_GL_MIN_ACCUM_ALPHA /* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
|
||||
};
|
||||
|
||||
class wxGLCanvas; /* forward reference */
|
||||
|
||||
class wxGLContext: public wxObject
|
||||
{
|
||||
public:
|
||||
wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
|
||||
wxGLContext(
|
||||
bool isRGB, wxGLCanvas *win,
|
||||
const wxPalette& WXUNUSED(palette),
|
||||
const wxGLContext *other /* for sharing display lists */
|
||||
);
|
||||
~wxGLContext();
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const wxChar *colour);
|
||||
void SwapBuffers();
|
||||
|
||||
|
||||
inline wxWindow* GetWindow() const { return m_window; }
|
||||
inline WXHDC GetHDC() const { return m_hDC; }
|
||||
inline HGLRC GetGLRC() const { return m_glContext; }
|
||||
|
||||
public:
|
||||
HGLRC m_glContext;
|
||||
WXHDC m_hDC;
|
||||
wxWindow* m_window;
|
||||
};
|
||||
|
||||
|
||||
extern const wxChar* wxGLCanvasName;
|
||||
|
||||
|
||||
class wxGLCanvas: public wxWindow
|
||||
{
|
||||
DECLARE_CLASS(wxGLCanvas)
|
||||
public:
|
||||
wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxGLCanvasName, int *attribList = 0, const wxPalette& palette = wxNullPalette);
|
||||
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
|
||||
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0, const wxString&
|
||||
name = wxGLCanvasName,
|
||||
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
|
||||
|
||||
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxGLCanvasName, int *attribList = 0, const wxPalette& palette = wxNullPalette );
|
||||
|
||||
~wxGLCanvas();
|
||||
|
||||
// Replaces wxWindow::Create functionality, since we need to use a different window class
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name);
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const wxChar *colour);
|
||||
void SwapBuffers();
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
void OnQueryNewPalette(wxQueryNewPaletteEvent& event);
|
||||
void OnPaletteChanged(wxPaletteChangedEvent& event);
|
||||
|
||||
inline wxGLContext* GetContext() const { return m_glContext; }
|
||||
|
||||
inline WXHDC GetHDC() const { return m_hDC; }
|
||||
void SetupPixelFormat(int *attribList = (int*) NULL);
|
||||
void SetupPalette(const wxPalette& palette);
|
||||
wxPalette CreateDefaultPalette();
|
||||
|
||||
inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
|
||||
|
||||
protected:
|
||||
wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
|
||||
wxPalette m_palette;
|
||||
WXHDC m_hDC;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
|
||||
class wxGLApp : public wxApp
|
||||
{
|
||||
public:
|
||||
wxGLApp() : wxApp() { }
|
||||
virtual ~wxGLApp();
|
||||
|
||||
// use this in the constructor of the user-derived wxGLApp class to
|
||||
// determine if an OpenGL rendering context with these attributes
|
||||
// is available - returns TRUE if so, FALSE if not.
|
||||
bool InitGLVisual(int *attribList);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGLApp)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_GLCANVAS_H_
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// For MSW I keep my own copy of the glcanvas code. This lets me build
|
||||
// the main wxWindows library without OpenGL support and the DLL
|
||||
// depenencies that go along with it. The DLL dependencies will then
|
||||
// be localized to this extension module, will not need to be loaded
|
||||
// when the core is started up, and won't make the core unrunnable on
|
||||
// systems that don't have OpenGL.
|
||||
//
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "msw/myglcanvas.h"
|
||||
#else
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
orig
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user