wxruby 1.9.3-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/LICENSE +53 -0
  2. data/README +299 -0
  3. data/lib/wx.rb +42 -0
  4. data/lib/wx/accessors.rb +52 -0
  5. data/lib/wx/classes/app.rb +45 -0
  6. data/lib/wx/classes/artprovider.rb +31 -0
  7. data/lib/wx/classes/bitmap.rb +23 -0
  8. data/lib/wx/classes/checklistbox.rb +45 -0
  9. data/lib/wx/classes/choice.rb +4 -0
  10. data/lib/wx/classes/clientdc.rb +13 -0
  11. data/lib/wx/classes/clipboard.rb +16 -0
  12. data/lib/wx/classes/colour.rb +47 -0
  13. data/lib/wx/classes/combobox.rb +4 -0
  14. data/lib/wx/classes/commandevent.rb +7 -0
  15. data/lib/wx/classes/controlwithitems.rb +10 -0
  16. data/lib/wx/classes/event.rb +5 -0
  17. data/lib/wx/classes/evthandler.rb +894 -0
  18. data/lib/wx/classes/font.rb +118 -0
  19. data/lib/wx/classes/grid.rb +129 -0
  20. data/lib/wx/classes/helpcontroller.rb +5 -0
  21. data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
  22. data/lib/wx/classes/htmlwindow.rb +6 -0
  23. data/lib/wx/classes/icon.rb +14 -0
  24. data/lib/wx/classes/image.rb +14 -0
  25. data/lib/wx/classes/listbox.rb +4 -0
  26. data/lib/wx/classes/listctrl.rb +21 -0
  27. data/lib/wx/classes/locale.rb +28 -0
  28. data/lib/wx/classes/mediactrl.rb +22 -0
  29. data/lib/wx/classes/menu.rb +62 -0
  30. data/lib/wx/classes/menuitem.rb +7 -0
  31. data/lib/wx/classes/object.rb +7 -0
  32. data/lib/wx/classes/paintdc.rb +12 -0
  33. data/lib/wx/classes/point.rb +48 -0
  34. data/lib/wx/classes/previewframe.rb +13 -0
  35. data/lib/wx/classes/rect.rb +5 -0
  36. data/lib/wx/classes/size.rb +49 -0
  37. data/lib/wx/classes/sound.rb +23 -0
  38. data/lib/wx/classes/styledtextctrl.rb +92 -0
  39. data/lib/wx/classes/textctrl.rb +14 -0
  40. data/lib/wx/classes/texturlevent.rb +6 -0
  41. data/lib/wx/classes/timer.rb +69 -0
  42. data/lib/wx/classes/treectrl.rb +44 -0
  43. data/lib/wx/classes/window.rb +49 -0
  44. data/lib/wx/classes/xmlresource.rb +16 -0
  45. data/lib/wx/keyword_ctors.rb +219 -0
  46. data/lib/wx/keyword_defs.rb +485 -0
  47. data/lib/wx/version.rb +3 -0
  48. data/lib/wxruby2.bundle +0 -0
  49. data/samples/SAMPLES-LICENSE.TXT +18 -0
  50. data/samples/aui/aui.rb +1360 -0
  51. data/samples/bigdemo/About.rbw +39 -0
  52. data/samples/bigdemo/ColorPanel.rbw +25 -0
  53. data/samples/bigdemo/GridSimple.rbw +80 -0
  54. data/samples/bigdemo/MDIDemo.rbw +59 -0
  55. data/samples/bigdemo/PopupMenu.rbw +151 -0
  56. data/samples/bigdemo/ShapedWindow.rbw +135 -0
  57. data/samples/bigdemo/Sizers.rbw +545 -0
  58. data/samples/bigdemo/bigdemo.rb +826 -0
  59. data/samples/bigdemo/demoTemplate.rbw +37 -0
  60. data/samples/bigdemo/helpfile.htb +0 -0
  61. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  62. data/samples/bigdemo/icons/Test 015.png +0 -0
  63. data/samples/bigdemo/icons/choice.bmp +0 -0
  64. data/samples/bigdemo/icons/choice.xpm +27 -0
  65. data/samples/bigdemo/icons/combo.bmp +0 -0
  66. data/samples/bigdemo/icons/combo.xpm +27 -0
  67. data/samples/bigdemo/icons/copy.xpm +25 -0
  68. data/samples/bigdemo/icons/cut.xpm +24 -0
  69. data/samples/bigdemo/icons/gauge.bmp +0 -0
  70. data/samples/bigdemo/icons/gauge.xpm +27 -0
  71. data/samples/bigdemo/icons/help.xpm +25 -0
  72. data/samples/bigdemo/icons/list.bmp +0 -0
  73. data/samples/bigdemo/icons/list.xpm +27 -0
  74. data/samples/bigdemo/icons/mondrian.ico +0 -0
  75. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  76. data/samples/bigdemo/icons/new.xpm +24 -0
  77. data/samples/bigdemo/icons/ogl.ico +0 -0
  78. data/samples/bigdemo/icons/ogl.xpm +45 -0
  79. data/samples/bigdemo/icons/open.xpm +26 -0
  80. data/samples/bigdemo/icons/paste.bmp +0 -0
  81. data/samples/bigdemo/icons/paste.xpm +38 -0
  82. data/samples/bigdemo/icons/pointy.png +0 -0
  83. data/samples/bigdemo/icons/preview.xpm +26 -0
  84. data/samples/bigdemo/icons/print.xpm +26 -0
  85. data/samples/bigdemo/icons/radio.bmp +0 -0
  86. data/samples/bigdemo/icons/radio.xpm +27 -0
  87. data/samples/bigdemo/icons/robert.xpm +415 -0
  88. data/samples/bigdemo/icons/ruby.png +0 -0
  89. data/samples/bigdemo/icons/sashtest.ico +0 -0
  90. data/samples/bigdemo/icons/save.xpm +25 -0
  91. data/samples/bigdemo/icons/smiles.bmp +0 -0
  92. data/samples/bigdemo/icons/smiles.xpm +39 -0
  93. data/samples/bigdemo/icons/smiley.ico +0 -0
  94. data/samples/bigdemo/icons/smiley.xpm +42 -0
  95. data/samples/bigdemo/icons/stattext.xpm +24 -0
  96. data/samples/bigdemo/icons/test2.bmp +0 -0
  97. data/samples/bigdemo/icons/test2.png +0 -0
  98. data/samples/bigdemo/icons/test2.xpm +79 -0
  99. data/samples/bigdemo/icons/text.bmp +0 -0
  100. data/samples/bigdemo/icons/text.xpm +27 -0
  101. data/samples/bigdemo/icons/tog1.bmp +0 -0
  102. data/samples/bigdemo/icons/tog1.xpm +38 -0
  103. data/samples/bigdemo/icons/tog2.bmp +0 -0
  104. data/samples/bigdemo/icons/tog2.xpm +38 -0
  105. data/samples/bigdemo/icons/wxwin.ico +0 -0
  106. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  107. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  108. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  109. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  110. data/samples/bigdemo/run.rb +94 -0
  111. data/samples/bigdemo/tips.txt +7 -0
  112. data/samples/bigdemo/utils.rb +12 -0
  113. data/samples/bigdemo/wxArtProvider.rbw +285 -0
  114. data/samples/bigdemo/wxBitmapButton.rbw +64 -0
  115. data/samples/bigdemo/wxButton.rbw +66 -0
  116. data/samples/bigdemo/wxCalendarCtrl.rbw +72 -0
  117. data/samples/bigdemo/wxCheckBox.rbw +52 -0
  118. data/samples/bigdemo/wxCheckListBox.rbw +77 -0
  119. data/samples/bigdemo/wxChoice.rbw +49 -0
  120. data/samples/bigdemo/wxChoicebook.rbw +80 -0
  121. data/samples/bigdemo/wxColourDialog.rbw +34 -0
  122. data/samples/bigdemo/wxComboBox.rbw +79 -0
  123. data/samples/bigdemo/wxCursor.rbw +140 -0
  124. data/samples/bigdemo/wxDialog.rbw +92 -0
  125. data/samples/bigdemo/wxDirDialog.rbw +32 -0
  126. data/samples/bigdemo/wxDragImage.rbw +74 -0
  127. data/samples/bigdemo/wxFileDialog.rbw +39 -0
  128. data/samples/bigdemo/wxFileDialog_Save.rbw +38 -0
  129. data/samples/bigdemo/wxFindReplaceDialog.rbw +85 -0
  130. data/samples/bigdemo/wxFontDialog.rbw +176 -0
  131. data/samples/bigdemo/wxFrame.rbw +55 -0
  132. data/samples/bigdemo/wxGauge.rbw +73 -0
  133. data/samples/bigdemo/wxGenericDirCtrl.rbw +78 -0
  134. data/samples/bigdemo/wxGrid.rbw +68 -0
  135. data/samples/bigdemo/wxHtmlHelpController.rbw +57 -0
  136. data/samples/bigdemo/wxListBox.rbw +142 -0
  137. data/samples/bigdemo/wxListCtrl_virtual.rbw +109 -0
  138. data/samples/bigdemo/wxMDIWindows.rbw +52 -0
  139. data/samples/bigdemo/wxMenu.rbw +238 -0
  140. data/samples/bigdemo/wxMessageDialog.rbw +30 -0
  141. data/samples/bigdemo/wxMiniFrame.rbw +74 -0
  142. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +34 -0
  143. data/samples/bigdemo/wxNotebook.rbw +138 -0
  144. data/samples/bigdemo/wxProgressDialog.rbw +45 -0
  145. data/samples/bigdemo/wxRadioBox.rbw +74 -0
  146. data/samples/bigdemo/wxRadioButton.rbw +127 -0
  147. data/samples/bigdemo/wxSashWindow.rbw +145 -0
  148. data/samples/bigdemo/wxScrolledMessageDialog.rbw +59 -0
  149. data/samples/bigdemo/wxScrolledWindow.rbw +201 -0
  150. data/samples/bigdemo/wxSingleChoiceDialog.rbw +35 -0
  151. data/samples/bigdemo/wxSlider.rbw +44 -0
  152. data/samples/bigdemo/wxSpinButton.rbw +52 -0
  153. data/samples/bigdemo/wxSpinCtrl.rbw +53 -0
  154. data/samples/bigdemo/wxSplitterWindow.rbw +65 -0
  155. data/samples/bigdemo/wxStaticBitmap.rbw +53 -0
  156. data/samples/bigdemo/wxStaticText.rbw +57 -0
  157. data/samples/bigdemo/wxStatusBar.rbw +128 -0
  158. data/samples/bigdemo/wxTextCtrl.rbw +151 -0
  159. data/samples/bigdemo/wxTextEntryDialog.rbw +34 -0
  160. data/samples/bigdemo/wxToggleButton.rbw +51 -0
  161. data/samples/bigdemo/wxToolBar.rbw +133 -0
  162. data/samples/bigdemo/wxTreeCtrl.rbw +192 -0
  163. data/samples/calendar/calendar.rb +275 -0
  164. data/samples/caret/caret.rb +286 -0
  165. data/samples/caret/mondrian.xpm +44 -0
  166. data/samples/controls/controls.rb +1140 -0
  167. data/samples/controls/get_item_sample.rb +87 -0
  168. data/samples/controls/icons/choice.xpm +27 -0
  169. data/samples/controls/icons/combo.xpm +27 -0
  170. data/samples/controls/icons/gauge.xpm +27 -0
  171. data/samples/controls/icons/list.xpm +27 -0
  172. data/samples/controls/icons/radio.xpm +27 -0
  173. data/samples/controls/icons/stattext.xpm +24 -0
  174. data/samples/controls/icons/text.xpm +27 -0
  175. data/samples/controls/mondrian.ico +0 -0
  176. data/samples/controls/mondrian.xpm +44 -0
  177. data/samples/controls/test2.bmp +0 -0
  178. data/samples/dialogs/dialogs.rb +724 -0
  179. data/samples/dialogs/tips.txt +18 -0
  180. data/samples/drawing/graphics_drawing.rb +232 -0
  181. data/samples/drawing/images.rb +48 -0
  182. data/samples/drawing/paperclip.png +0 -0
  183. data/samples/etc/activation.rb +108 -0
  184. data/samples/etc/choice.rb +72 -0
  185. data/samples/etc/miniframe.rb +84 -0
  186. data/samples/etc/sash.rb +135 -0
  187. data/samples/etc/scrollwin.rb +116 -0
  188. data/samples/etc/system_settings.rb +258 -0
  189. data/samples/etc/threaded.rb +81 -0
  190. data/samples/etc/wizard.rb +79 -0
  191. data/samples/event/event.rb +184 -0
  192. data/samples/grid/grid.rb +202 -0
  193. data/samples/html/html.rb +264 -0
  194. data/samples/listbook/listbook.rb +181 -0
  195. data/samples/listbook/listbook.xrc +370 -0
  196. data/samples/mdi/mdi.rb +87 -0
  197. data/samples/media/mediactrl.rb +173 -0
  198. data/samples/minimal/minimal.rb +85 -0
  199. data/samples/minimal/mondrian.ico +0 -0
  200. data/samples/minimal/mondrian.png +0 -0
  201. data/samples/minimal/nothing.rb +21 -0
  202. data/samples/opengl/cube.rb +123 -0
  203. data/samples/printing/mondrian.ico +0 -0
  204. data/samples/printing/mondrian.xpm +44 -0
  205. data/samples/printing/printing.rb +484 -0
  206. data/samples/sockets/SocketPackets.rb +27 -0
  207. data/samples/sockets/res/message-new.png +0 -0
  208. data/samples/sockets/res/user.png +0 -0
  209. data/samples/sockets/wxClient.rb +395 -0
  210. data/samples/sockets/wxServer.rb +422 -0
  211. data/samples/sockets/wxSocketGUI.rb +97 -0
  212. data/samples/text/mondrian.ico +0 -0
  213. data/samples/text/mondrian.xpm +44 -0
  214. data/samples/text/scintilla.rb +174 -0
  215. data/samples/text/textctrl.rb +124 -0
  216. data/samples/text/unicode.rb +238 -0
  217. data/samples/text/utf8.txt +15 -0
  218. data/samples/treectrl/icon1.xpm +79 -0
  219. data/samples/treectrl/icon2.xpm +53 -0
  220. data/samples/treectrl/icon3.xpm +79 -0
  221. data/samples/treectrl/icon4.xpm +43 -0
  222. data/samples/treectrl/icon5.xpm +79 -0
  223. data/samples/treectrl/treectrl.rb +1180 -0
  224. data/samples/xrc/samples.xrc +46 -0
  225. data/samples/xrc/xrc_sample.rb +107 -0
  226. metadata +296 -0
@@ -0,0 +1,15 @@
1
+ Western European: ÀÉÎè
2
+
3
+ Chinese (Simplified): 丁万不㐀㐁丣並
4
+
5
+ Extended Latin: ĀčŁœ
6
+
7
+ Japanese Hiragana: あきぐけ゚
8
+
9
+ Arabic: ؟تص
10
+
11
+ Cyrillic: ЀЋЖ
12
+
13
+ Greek: Άαξ
14
+
15
+ Korean: 了丫乖
@@ -0,0 +1,79 @@
1
+ /* XPM */
2
+ static char *icon1_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 41 1",
5
+ "> c #97C4E7",
6
+ "# c #4381AA",
7
+ "d c #FFFFFF",
8
+ "< c #71B2DE",
9
+ "+ c #538BB1",
10
+ "& c #D1E5F5",
11
+ "q c #63B3DE",
12
+ "6 c #F1F4F7",
13
+ "* c #CAE1F3",
14
+ "y c #7AC4E5",
15
+ "= c #C3DDF1",
16
+ "X c #74A1BD",
17
+ "- c #BCD9EF",
18
+ "5 c #619BC4",
19
+ "3 c #E6EAF1",
20
+ "2 c #4B8EBF",
21
+ "o c #6B97B6",
22
+ ". c #4B82A8",
23
+ " c None",
24
+ "w c #54A6D8",
25
+ "1 c #71A8D1",
26
+ ", c #85BBE2",
27
+ "t c #EFF6FC",
28
+ "7 c #DEEDF8",
29
+ "@ c #4388B4",
30
+ "a c #F7FBFD",
31
+ "$ c #D7E0E9",
32
+ "r c #FAFCFE",
33
+ "4 c #DAEAF7",
34
+ "e c #E9F3FA",
35
+ "0 c #76BAE2",
36
+ "% c #7FA6C0",
37
+ "s c #FDFDFE",
38
+ "O c #5896BE",
39
+ "p c #B6D5EE",
40
+ "8 c #87ABC3",
41
+ ": c #A5CCEA",
42
+ "9 c #E5F0F9",
43
+ "; c #AFD1EC",
44
+ "i c #F4F9FD",
45
+ "u c #8FB0C3",
46
+ /* pixels */
47
+ " ",
48
+ " ",
49
+ " ",
50
+ " ",
51
+ " ",
52
+ " .XXXooOO++@#$ ",
53
+ " %&*=-;:>>,<123 ",
54
+ " %4&*=-;:>>,1>56 ",
55
+ " %74&*=-;:>>1*>56 ",
56
+ " 89700qqqqwq1e*>X ",
57
+ " 8e974&*=-;:1re*>8 ",
58
+ " 8te974&*=-;11111# ",
59
+ " 8tty000qqqqqww>,+ ",
60
+ " uitte974&*=-p:>>+ ",
61
+ " uaitte974&*=-p:>O ",
62
+ " uaayyyy000qqqqp:O ",
63
+ " uraaitte974&*=-po ",
64
+ " urraaitte974&*=-o ",
65
+ " usryyyyyyy000q*=X ",
66
+ " ussrraaitte974&*X ",
67
+ " udssrraaitte974&X ",
68
+ " uddyyyyyyyyyy074% ",
69
+ " udddssrraaitte97% ",
70
+ " uddddssrraaitte9% ",
71
+ " udddddssrraaitte8 ",
72
+ " uddddddssrraaitt8 ",
73
+ " uuuuuuuuuuuuuu88u ",
74
+ " ",
75
+ " ",
76
+ " ",
77
+ " ",
78
+ " "
79
+ };
@@ -0,0 +1,53 @@
1
+ /* XPM */
2
+ static char *icon2_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 15 1",
5
+ ". c Black",
6
+ "O c #97C4E7",
7
+ "$ c #63B3DE",
8
+ "@ c #CAE1F3",
9
+ "; c #7AC4E5",
10
+ "* c #74A1BD",
11
+ "+ c #619BC4",
12
+ "o c #4B8EBF",
13
+ " c None",
14
+ "% c #54A6D8",
15
+ "= c #FAFCFE",
16
+ "& c #E9F3FA",
17
+ "# c #76BAE2",
18
+ "X c #C00000",
19
+ "- c #87ABC3",
20
+ /* pixels */
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ " ............. ",
27
+ " .XXXXXXXXXX.o. ",
28
+ " .XXXXXXXXXX.O+. ",
29
+ " .XXXXXXXXXX.@O+. ",
30
+ " .XX##$$$$%$.&@O* ",
31
+ " .XXXXXXXXXX.=&@O- ",
32
+ " .XXXXXXXXXX...... ",
33
+ " .XX;###$$$$$%%XX. ",
34
+ " .XXXXXXXXXXXXXXX. ",
35
+ " .XXXXXXXXXXXXXXX. ",
36
+ " .XX;;;;###$$$$XX. ",
37
+ " .XXXXXXXXXXXXXXX. ",
38
+ " .XXXXXXXXXXXXXXX. ",
39
+ " .XX;;;;;;;###$XX. ",
40
+ " .XXXXXXXXXXXXXXX. ",
41
+ " .XXXXXXXXXXXXXXX. ",
42
+ " .XX;;;;;;;;;;#XX. ",
43
+ " .XXXXXXXXXXXXXXX. ",
44
+ " .XXXXXXXXXXXXXXX. ",
45
+ " .XXXXXXXXXXXXXXX. ",
46
+ " .XXXXXXXXXXXXXXX. ",
47
+ " ................. ",
48
+ " ",
49
+ " ",
50
+ " ",
51
+ " ",
52
+ " "
53
+ };
@@ -0,0 +1,79 @@
1
+ /* XPM */
2
+ static char *icon3_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 41 1",
5
+ "6 c #EDF2FB",
6
+ "- c #AAC1E8",
7
+ ": c #B9CDED",
8
+ "X c #295193",
9
+ ", c #C6D6F0",
10
+ "a c #4A7CCE",
11
+ "u c #779DDB",
12
+ "y c #7FA2DD",
13
+ "$ c #3263B4",
14
+ "5 c #EAF0FA",
15
+ ". c #2D59A3",
16
+ "o c #6E96D8",
17
+ "* c #356AC1",
18
+ "r c #F7F9FD",
19
+ "> c #BED0EE",
20
+ "3 c #E1E9F7",
21
+ "7 c #F0F5FC",
22
+ "< c #CBD9F1",
23
+ "2 c #DAE5F6",
24
+ "# c #3161B1",
25
+ " c None",
26
+ "0 c #FDFEFF",
27
+ "= c #9FB9E5",
28
+ "e c #AEC5EA",
29
+ "t c #89A9DF",
30
+ "q c #98B5E4",
31
+ "p c #5584D1",
32
+ "d c #3A70CA",
33
+ "@ c #305FAC",
34
+ "i c #5D89D3",
35
+ "1 c #D2DFF4",
36
+ "% c #3366B9",
37
+ "9 c #FAFCFE",
38
+ "8 c #F5F8FD",
39
+ "s c #4075CC",
40
+ "O c #638ED5",
41
+ "w c #90AFE2",
42
+ "& c #3467BC",
43
+ "+ c #2F5DA9",
44
+ "; c #B3C8EB",
45
+ "4 c #E5EDF9",
46
+ /* pixels */
47
+ " ",
48
+ " ",
49
+ " ",
50
+ " ",
51
+ " ",
52
+ " ",
53
+ " ......X ",
54
+ " .oooooO+ ",
55
+ " .ooooooo. ",
56
+ " .+@@@##$%%&&&&&****. ",
57
+ " .=-;:>,<12345678900. ",
58
+ " .q=-;:>,<1234567890. ",
59
+ " .wq=-e:>,<12345678r. ",
60
+ " .twq=-e:>,<12345678. ",
61
+ " .ytwq=-e:>,<1234567. ",
62
+ " .uytwq=-e:>,<123456. ",
63
+ " .ouytwq=-e:>,<12345. ",
64
+ " .Oouytwq=-e;>,<1234. ",
65
+ " .iOouytwq=-e;>,<123. ",
66
+ " .piOouytwq=-e;>,<12. ",
67
+ " .apiOouytwq=-e;>,<1. ",
68
+ " .sapiOouytwq=-e;>,<. ",
69
+ " .dsapiOouytwq=-e;>,. ",
70
+ " ...................# ",
71
+ " ",
72
+ " ",
73
+ " ",
74
+ " ",
75
+ " ",
76
+ " ",
77
+ " ",
78
+ " "
79
+ };
@@ -0,0 +1,43 @@
1
+ /* XPM */
2
+ static char *icon4_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 5 1",
5
+ ". c Black",
6
+ "o c #8399B4",
7
+ "X c #8DA0B9",
8
+ " c None",
9
+ "O c #800000",
10
+ /* pixels */
11
+ " ",
12
+ " ",
13
+ " ",
14
+ " ",
15
+ " ",
16
+ " ",
17
+ " ....... ",
18
+ " .XXXXXo. ",
19
+ " .XXXXXXX. ",
20
+ " .................... ",
21
+ " .OOOOOOOOOOOOOOOOOO. ",
22
+ " .OOOOOOOOOOOOOOOOOO. ",
23
+ " .OOOOOOOOOOOOOOOOOO. ",
24
+ " .OOOOOOOOOOOOOOOOOO. ",
25
+ " .OOOOOOOOOOOOOOOOOO. ",
26
+ " .OOOOOOOOOOOOOOOOOO. ",
27
+ " .OOOOOOOOOOOOOOOOOO. ",
28
+ " .OOOOOOOOOOOOOOOOOO. ",
29
+ " .OOOOOOOOOOOOOOOOOO. ",
30
+ " .OOOOOOOOOOOOOOOOOO. ",
31
+ " .OOOOOOOOOOOOOOOOOO. ",
32
+ " .OOOOOOOOOOOOOOOOOO. ",
33
+ " .OOOOOOOOOOOOOOOOOO. ",
34
+ " .................... ",
35
+ " ",
36
+ " ",
37
+ " ",
38
+ " ",
39
+ " ",
40
+ " ",
41
+ " ",
42
+ " "
43
+ };
@@ -0,0 +1,79 @@
1
+ /* XPM */
2
+ static char *icon5_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 41 1",
5
+ "0 c #AAC1E8",
6
+ "q c #B9CDED",
7
+ "X c #295193",
8
+ "e c #C6D6F0",
9
+ "a c #4A7CCE",
10
+ "& c #779DDB",
11
+ "* c #7FA2DD",
12
+ "2 c #EAF0FA",
13
+ "@ c #2D59A3",
14
+ "o c #6E96D8",
15
+ "y c #356AC1",
16
+ "d c #214279",
17
+ "w c #BED0EE",
18
+ "= c #85A7DF",
19
+ "< c #E1E9F7",
20
+ "3 c #F0F5FC",
21
+ "s c #CBD9F1",
22
+ ", c #DAE5F6",
23
+ "7 c #3161B1",
24
+ " c None",
25
+ ". c #274D8B",
26
+ "6 c #FDFEFF",
27
+ "i c #E7EEF9",
28
+ "9 c #9FB9E5",
29
+ "- c #89A9DF",
30
+ "8 c #98B5E4",
31
+ "$ c #5584D1",
32
+ "+ c #3569BF",
33
+ "% c #305FAC",
34
+ "O c #5D89D3",
35
+ "> c #D2DFF4",
36
+ "p c #3366B9",
37
+ "5 c #FAFCFE",
38
+ "4 c #F5F8FD",
39
+ "t c #4075CC",
40
+ "u c #638ED5",
41
+ "r c #CEDCF2",
42
+ "; c #90AFE2",
43
+ "# c #2F5DA9",
44
+ ": c #B3C8EB",
45
+ "1 c #E5EDF9",
46
+ /* pixels */
47
+ " ",
48
+ " ",
49
+ " ",
50
+ " ",
51
+ " ",
52
+ " ",
53
+ " ",
54
+ " ......X ",
55
+ " XoooooO. ",
56
+ " Xoooooo+. ",
57
+ " Xooooooo@XXXXXXXXXX# ",
58
+ " Xoooooooooooooooooo# ",
59
+ " Xoooooooooooooooooo# ",
60
+ " Xoo$################### ",
61
+ " Xoo%O&*=-;:>,<123445667 ",
62
+ " XooX890:qwer>,<123445q# ",
63
+ " Xoty;890:qwer>,<12344# ",
64
+ " Xo%u-;890:qwer>,<i234# ",
65
+ " XoX&*-;890:qwer>,<i2r# ",
66
+ " Xtpo&*-;890:qwer>,<i# ",
67
+ " X%auo&*-;890:qwer>,<# ",
68
+ " XX$Ouo&*-;890:qwer>s# ",
69
+ " d%a$Ouo&*-;890:qwer# ",
70
+ " d+ta$Ouo&*-;890:qwe# ",
71
+ " d..................# ",
72
+ " ",
73
+ " ",
74
+ " ",
75
+ " ",
76
+ " ",
77
+ " ",
78
+ " "
79
+ };
@@ -0,0 +1,1180 @@
1
+ #!/usr/bin/env ruby
2
+ # wxRuby2 Sample Code. Copyright (c) 2004-2006 Kevin B. Smith
3
+ # Freely reusable code: see SAMPLES-LICENSE.TXT for details
4
+
5
+ begin
6
+ require 'wx'
7
+ rescue LoadError => no_wx_err
8
+ begin
9
+ require 'rubygems'
10
+ require 'wx'
11
+ rescue LoadError
12
+ raise no_wx_err
13
+ end
14
+ end
15
+
16
+ # This sample shows off the features of the TreeCtrl widget. The actual
17
+ # features vary somewhat across platforms; for example, the button
18
+ # styles and connecting lines between items are not available on OS X.
19
+ # Also, some items remain to be implemented - for example, setting item
20
+ # icons and item data.
21
+
22
+ # Just some event ids for the numerous menu items
23
+ TreeTest_TogButtons,
24
+ TreeTest_TogTwist,
25
+ TreeTest_TogLines,
26
+ TreeTest_TogEdit,
27
+ TreeTest_TogHideRoot,
28
+ TreeTest_TogRootLines,
29
+ TreeTest_TogBorder,
30
+ TreeTest_TogFullHighlight,
31
+ TreeTest_SetFgColour,
32
+ TreeTest_SetBgColour,
33
+ TreeTest_ResetStyle,
34
+ TreeTest_Dump,
35
+ TreeTest_DumpSelected,
36
+ TreeTest_Count,
37
+ TreeTest_CountRec,
38
+ TreeTest_Sort,
39
+ TreeTest_SortRev,
40
+ TreeTest_SetBold,
41
+ TreeTest_ClearBold,
42
+ TreeTest_Rename,
43
+ TreeTest_Delete,
44
+ TreeTest_DeleteChildren,
45
+ TreeTest_DeleteAll,
46
+ TreeTest_Recreate,
47
+ TreeTest_ToggleImages,
48
+ TreeTest_ToggleButtons,
49
+ TreeTest_SetImageSize,
50
+ TreeTest_ToggleSel,
51
+ TreeTest_CollapseAndReset,
52
+ TreeTest_EnsureVisible,
53
+ TreeTest_AddItem,
54
+ TreeTest_InsertItem,
55
+ TreeTest_IncIndent,
56
+ TreeTest_DecIndent,
57
+ TreeTest_IncSpacing,
58
+ TreeTest_DecSpacing,
59
+ TreeTest_ToggleIcon,
60
+ TreeTest_Select,
61
+ TreeTest_Unselect = (Wx::ID_HIGHEST..Wx::ID_HIGHEST+39).to_a
62
+
63
+ TreeCtrlIcon_File,
64
+ TreeCtrlIcon_FileSelected,
65
+ TreeCtrlIcon_Folder,
66
+ TreeCtrlIcon_FolderSelected,
67
+ TreeCtrlIcon_FolderOpened = 0,1,2,3,4
68
+
69
+ class MyTreeCtrl < Wx::TreeCtrl
70
+ def initialize(parent, args)
71
+ super
72
+
73
+ @reverse_sort = false
74
+
75
+ create_image_list
76
+
77
+ # add some items to the tree
78
+ add_test_items_to_tree(5, 2)
79
+
80
+ # TreeCtrl supports a large number of different events...
81
+ evt_tree_begin_drag self, :on_begin_drag
82
+ evt_tree_begin_rdrag self, :on_begin_rdrag
83
+ evt_tree_end_drag self, :on_end_drag
84
+ evt_tree_begin_label_edit self, :on_begin_label_edit
85
+ evt_tree_end_label_edit self, :on_end_label_edit
86
+ evt_tree_delete_item self, :on_delete_item
87
+ evt_tree_set_info self, :on_set_info
88
+ evt_tree_item_expanded self, :on_item_expanded
89
+ evt_tree_item_expanding self, :on_item_expanding
90
+ evt_tree_item_collapsed self, :on_item_collapsed
91
+ evt_tree_item_collapsing self, :on_item_collapsing
92
+ evt_tree_item_right_click self, :on_item_right_click
93
+ evt_tree_sel_changed self, :on_sel_changed
94
+ evt_tree_sel_changing self, :on_sel_changing
95
+ evt_tree_key_down self, :on_tree_key_down
96
+ evt_tree_item_activated self, :on_item_activated
97
+
98
+ evt_right_dclick :on_rmouse_dclick
99
+ evt_right_up :on_rmouse_up
100
+ end
101
+
102
+ def show_info(id)
103
+ Wx::log_message("Item '%s': %sselected, %sexpanded, %sbold,\n" +
104
+ "%d children (%d immediately under selected item).",
105
+ get_item_text( id ),
106
+ bool_to_str( is_selected( id ) ),
107
+ bool_to_str( is_expanded( id ) ),
108
+ bool_to_str( is_bold( id ) ),
109
+ get_children_count( id ),
110
+ get_children_count(id, false) )
111
+ end
112
+
113
+ def bool_to_str(bool)
114
+ bool ? " " : "not "
115
+ end
116
+
117
+ def do_sort_children(item, reverse = false)
118
+ @reverse_sort = reverse
119
+ sort_children(item)
120
+ end
121
+
122
+ def do_ensure_visible()
123
+ ensure_visible(@last_item)
124
+ end
125
+
126
+ def image_size()
127
+ return @image_size
128
+ end
129
+
130
+ def is_test_item(item)
131
+ # the test item is the first child folder
132
+ return item_parent(item) == root_item && ! prev_sibling(item)
133
+ end
134
+
135
+ def create_image_list
136
+ @imageSize = 16
137
+
138
+ # Make an image list containing small icons
139
+ images = Wx::ImageList.new(32, 32, true)
140
+ # should correspond to TreeCtrlIcon_xxx enum
141
+ Wx::BusyCursor.busy do
142
+ icons = (1 .. 5).map do | i |
143
+ icon_file = File.join(File.dirname(__FILE__), "icon#{i}.xpm")
144
+ Wx::Bitmap.new(icon_file, Wx::BITMAP_TYPE_XPM)
145
+ end
146
+ icons.each { | ic | images.add(ic) }
147
+ self.image_list = images
148
+ end
149
+ end
150
+
151
+ def unset_image_list
152
+ self.image_list = nil
153
+ end
154
+
155
+ def create_buttons_image_list()
156
+ # Make an image list containing small icons
157
+ images = Wx::ImageList.new(16, 16, true)
158
+
159
+ # should correspond to TreeCtrlIcon_xxx enum
160
+ Wx::BusyCursor.busy do |x|
161
+ icons = [
162
+ Wx::Icon.new("icon3.xpm"), # closed
163
+ Wx::Icon.new("icon3.xpm"), # closed, selected
164
+ Wx::Icon.new("icon5.xpm"), # open
165
+ Wx::Icon.new("icon5.xpm") ] # open, selected
166
+
167
+ icons.each do | ic |
168
+ orig_size = ic.get_width()
169
+ if size == orig_size
170
+ images.add(ic)
171
+ else
172
+ resized = ic.convert_to_image.rescale(size, size)
173
+ images.add( Wx::Bitmap.new(resized) )
174
+ end
175
+ end
176
+
177
+ self.buttons_image_list = images
178
+ end
179
+ end
180
+
181
+ def on_compare_items(item1,item2)
182
+ if @reverse_sort
183
+ # just exchange 1st and 2nd items
184
+ return super(item2, item1)
185
+ else
186
+ return super(item1, item2)
187
+ end
188
+ end
189
+
190
+ def add_items_recursively(parent_id, num_children, depth, folder)
191
+ if depth > 0
192
+ has_children = depth > 1
193
+
194
+ for n in 0 ... num_children
195
+ # at depth 1 elements won't have any more children
196
+ if has_children
197
+ str = sprintf("%s child %d", "Folder", n + 1)
198
+ else
199
+ str = sprintf("%s child %d.%d", "File", folder, n + 1)
200
+ end
201
+ # here we pass to append_item() normal and selected item images (we
202
+ # suppose that selected image follows the normal one in the enum)
203
+ if Wx::THE_APP.show_images
204
+ image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder
205
+ imageSel = image + 1
206
+ else
207
+ image = imageSel = -1
208
+ end
209
+ id = append_item(parent_id, str, image, imageSel)
210
+
211
+ # and now we also set the expanded one (only for the folders)
212
+ if has_children && Wx::get_app.show_images()
213
+ set_item_image( id, TreeCtrlIcon_FolderOpened,
214
+ Wx::TREE_ITEM_ICON_EXPANDED)
215
+ end
216
+
217
+ # remember the last child for OnEnsureVisible()
218
+ if ! has_children && n == num_children - 1
219
+ @last_item = id
220
+ end
221
+
222
+ add_items_recursively(id, num_children, depth - 1, n + 1)
223
+ end
224
+ end
225
+ end
226
+
227
+ def add_test_items_to_tree(num_children,depth)
228
+ image = Wx::THE_APP.show_images ? TreeCtrlIcon_Folder : -1
229
+ root_id = add_root("Root",image, image)
230
+ if image != -1
231
+ set_item_image( root_id, TreeCtrlIcon_FolderOpened,
232
+ Wx::TREE_ITEM_ICON_EXPANDED)
233
+ end
234
+
235
+ add_items_recursively(root_id, num_children, depth, 0)
236
+
237
+ # set some colours/fonts for testing
238
+ # note that font sizes can also be varied, but only on platforms
239
+ # that use the generic TreeCtrl - OS X and GTK, and only if
240
+ # Wx::TR_HAS_VARIABLE_ROW_HEIGHT style was used in the constructor
241
+ font = get_font
242
+ font.style = Wx::FONTSTYLE_ITALIC
243
+ set_item_font(root_id, font)
244
+
245
+ ids = get_children(root_id)
246
+
247
+ # make the first item blue
248
+ set_item_text_colour(ids[0], Wx::BLUE)
249
+
250
+ # make the third item red on grey
251
+ if Wx::PLATFORM == "WXMSW"
252
+ set_item_text_colour(ids[2], Wx::RED)
253
+ set_item_background_colour(ids[2], Wx::LIGHT_GREY)
254
+ end
255
+ end
256
+
257
+ def get_items_recursively(parent_id, cookie)
258
+ if cookie == -1
259
+ id, cookie = get_first_child(parent_id)
260
+ else
261
+ id, cookie = get_next_child(parent_id, cookie)
262
+ end
263
+ if not id.nonzero?
264
+ return nil
265
+ end
266
+
267
+ text = item_text(id)
268
+ Wx::log_message(text)
269
+
270
+ if item_has_children(id)
271
+ get_items_recursively(id,-1)
272
+ end
273
+ get_items_recursively(parent_id, cookie)
274
+ end
275
+
276
+ def do_toggle_icon(item)
277
+ old_img = get_item_image(item)
278
+ if old_img == TreeCtrlIcon_Folder
279
+ new_img = TreeCtrlIcon_File
280
+ else
281
+ new_img = TreeCtrlIcon_Folder
282
+ end
283
+
284
+ set_item_image(item, new_img)
285
+ end
286
+
287
+ def on_begin_rdrag(event)
288
+ Wx::log_message("OnBeginRDrag")
289
+ event.skip
290
+ end
291
+
292
+ def on_delete_item(event)
293
+ Wx::log_message("OnDeleteItem")
294
+ event.skip
295
+ end
296
+
297
+ def on_get_info(event)
298
+ Wx::log_message("OnGetInfo")
299
+ event.skip
300
+ end
301
+
302
+ def on_set_info(event)
303
+ Wx::log_message("OnSetInfo")
304
+ event.skip
305
+ end
306
+
307
+ def on_item_expanded(event)
308
+ Wx::log_message("OnItemExpanded")
309
+ event.skip
310
+ end
311
+
312
+ def on_item_expanding(event)
313
+ Wx::log_message("OnItemExpanding")
314
+ event.skip
315
+ end
316
+
317
+ def on_item_collapsed(event)
318
+ Wx::log_message("OnItemCollapsed")
319
+ event.skip
320
+ end
321
+
322
+ def on_sel_changed(event)
323
+ Wx::log_message("OnSelChanged")
324
+ event.skip
325
+ end
326
+
327
+ def on_sel_changing(event)
328
+ Wx::log_message("OnSelChanging")
329
+ event.skip
330
+ end
331
+
332
+ def log_key_event(name,event)
333
+ keycode = event.key_code
334
+
335
+ case keycode
336
+ when Wx::K_BACK
337
+ key = "BACK"
338
+ when Wx::K_TAB
339
+ key = "TAB"
340
+ when Wx::K_RETURN
341
+ key = "RETURN"
342
+ when Wx::K_ESCAPE
343
+ key = "ESCAPE"
344
+ when Wx::K_SPACE
345
+ key = "SPACE"
346
+ when Wx::K_DELETE
347
+ key = "DELETE"
348
+ when Wx::K_START
349
+ key = "START"
350
+ when Wx::K_LBUTTON
351
+ key = "LBUTTON"
352
+ when Wx::K_RBUTTON
353
+ key = "RBUTTON"
354
+ when Wx::K_CANCEL
355
+ key = "CANCEL"
356
+ when Wx::K_MBUTTON
357
+ key = "MBUTTON"
358
+ when Wx::K_CLEAR
359
+ key = "CLEAR"
360
+ when Wx::K_SHIFT
361
+ key = "SHIFT"
362
+ when Wx::K_ALT
363
+ key = "ALT"
364
+ when Wx::K_CONTROL
365
+ key = "CONTROL"
366
+ when Wx::K_MENU
367
+ key = "MENU"
368
+ when Wx::K_PAUSE
369
+ key = "PAUSE"
370
+ when Wx::K_CAPITAL
371
+ key = "CAPITAL"
372
+ when Wx::K_PRIOR
373
+ key = "PRIOR"
374
+ when Wx::K_NEXT
375
+ key = "NEXT"
376
+ when Wx::K_END
377
+ key = "END"
378
+ when Wx::K_HOME
379
+ key = "HOME"
380
+ when Wx::K_LEFT
381
+ key = "LEFT"
382
+ when Wx::K_UP
383
+ key = "UP"
384
+ when Wx::K_RIGHT
385
+ key = "RIGHT"
386
+ when Wx::K_DOWN
387
+ key = "DOWN"
388
+ when Wx::K_SELECT
389
+ key = "SELECT"
390
+ when Wx::K_PRINT
391
+ key = "PRINT"
392
+ when Wx::K_EXECUTE
393
+ key = "EXECUTE"
394
+ when Wx::K_SNAPSHOT
395
+ key = "SNAPSHOT"
396
+ when Wx::K_INSERT
397
+ key = "INSERT"
398
+ when Wx::K_HELP
399
+ key = "HELP"
400
+ when Wx::K_NUMPAD0
401
+ key = "NUMPAD0"
402
+ when Wx::K_NUMPAD1
403
+ key = "NUMPAD1"
404
+ when Wx::K_NUMPAD2
405
+ key = "NUMPAD2"
406
+ when Wx::K_NUMPAD3
407
+ key = "NUMPAD3"
408
+ when Wx::K_NUMPAD4
409
+ key = "NUMPAD4"
410
+ when Wx::K_NUMPAD5
411
+ key = "NUMPAD5"
412
+ when Wx::K_NUMPAD6
413
+ key = "NUMPAD6"
414
+ when Wx::K_NUMPAD7
415
+ key = "NUMPAD7"
416
+ when Wx::K_NUMPAD8
417
+ key = "NUMPAD8"
418
+ when Wx::K_NUMPAD9
419
+ key = "NUMPAD9"
420
+ when Wx::K_MULTIPLY
421
+ key = "MULTIPLY"
422
+ when Wx::K_ADD
423
+ key = "ADD"
424
+ when Wx::K_SEPARATOR
425
+ key = "SEPARATOR"
426
+ when Wx::K_SUBTRACT
427
+ key = "SUBTRACT"
428
+ when Wx::K_DECIMAL
429
+ key = "DECIMAL"
430
+ when Wx::K_DIVIDE
431
+ key = "DIVIDE"
432
+ when Wx::K_F1
433
+ key = "F1"
434
+ when Wx::K_F2
435
+ key = "F2"
436
+ when Wx::K_F3
437
+ key = "F3"
438
+ when Wx::K_F4
439
+ key = "F4"
440
+ when Wx::K_F5
441
+ key = "F5"
442
+ when Wx::K_F6
443
+ key = "F6"
444
+ when Wx::K_F7
445
+ key = "F7"
446
+ when Wx::K_F8
447
+ key = "F8"
448
+ when Wx::K_F9
449
+ key = "F9"
450
+ when Wx::K_F10
451
+ key = "F10"
452
+ when Wx::K_F11
453
+ key = "F11"
454
+ when Wx::K_F12
455
+ key = "F12"
456
+ when Wx::K_F13
457
+ key = "F13"
458
+ when Wx::K_F14
459
+ key = "F14"
460
+ when Wx::K_F15
461
+ key = "F15"
462
+ when Wx::K_F16
463
+ key = "F16"
464
+ when Wx::K_F17
465
+ key = "F17"
466
+ when Wx::K_F18
467
+ key = "F18"
468
+ when Wx::K_F19
469
+ key = "F19"
470
+ when Wx::K_F20
471
+ key = "F20"
472
+ when Wx::K_F21
473
+ key = "F21"
474
+ when Wx::K_F22
475
+ key = "F22"
476
+ when Wx::K_F23
477
+ key = "F23"
478
+ when Wx::K_F24
479
+ key = "F24"
480
+ when Wx::K_NUMLOCK
481
+ key = "NUMLOCK"
482
+ when Wx::K_SCROLL
483
+ key = "SCROLL"
484
+ when Wx::K_PAGEUP
485
+ key = "PAGEUP"
486
+ when Wx::K_PAGEDOWN
487
+ key = "PAGEDOWN"
488
+ when Wx::K_NUMPAD_SPACE
489
+ key = "NUMPAD_SPACE"
490
+ when Wx::K_NUMPAD_TAB
491
+ key = "NUMPAD_TAB"
492
+ when Wx::K_NUMPAD_ENTER
493
+ key = "NUMPAD_ENTER"
494
+ when Wx::K_NUMPAD_F1
495
+ key = "NUMPAD_F1"
496
+ when Wx::K_NUMPAD_F2
497
+ key = "NUMPAD_F2"
498
+ when Wx::K_NUMPAD_F3
499
+ key = "NUMPAD_F3"
500
+ when Wx::K_NUMPAD_F4
501
+ key = "NUMPAD_F4"
502
+ when Wx::K_NUMPAD_HOME
503
+ key = "NUMPAD_HOME"
504
+ when Wx::K_NUMPAD_LEFT
505
+ key = "NUMPAD_LEFT"
506
+ when Wx::K_NUMPAD_UP
507
+ key = "NUMPAD_UP"
508
+ when Wx::K_NUMPAD_RIGHT
509
+ key = "NUMPAD_RIGHT"
510
+ when Wx::K_NUMPAD_DOWN
511
+ key = "NUMPAD_DOWN"
512
+ when Wx::K_NUMPAD_PRIOR
513
+ key = "NUMPAD_PRIOR"
514
+ when Wx::K_NUMPAD_PAGEUP
515
+ key = "NUMPAD_PAGEUP"
516
+ when Wx::K_NUMPAD_PAGEDOWN
517
+ key = "NUMPAD_PAGEDOWN"
518
+ when Wx::K_NUMPAD_END
519
+ key = "NUMPAD_END"
520
+ when Wx::K_NUMPAD_BEGIN
521
+ key = "NUMPAD_BEGIN"
522
+ when Wx::K_NUMPAD_INSERT
523
+ key = "NUMPAD_INSERT"
524
+ when Wx::K_NUMPAD_DELETE
525
+ key = "NUMPAD_DELETE"
526
+ when Wx::K_NUMPAD_EQUAL
527
+ key = "NUMPAD_EQUAL"
528
+ when Wx::K_NUMPAD_MULTIPLY
529
+ key = "NUMPAD_MULTIPLY"
530
+ when Wx::K_NUMPAD_ADD
531
+ key = "NUMPAD_ADD"
532
+ when Wx::K_NUMPAD_SEPARATOR
533
+ key = "NUMPAD_SEPARATOR"
534
+ when Wx::K_NUMPAD_SUBTRACT
535
+ key = "NUMPAD_SUBTRACT"
536
+ when Wx::K_NUMPAD_DECIMAL
537
+ key = "NUMPAD_DECIMAL"
538
+ else
539
+ if keycode >= 32 && keycode <127
540
+ key = sprintf("'%s'", keycode.chr)
541
+ elsif keycode > 0 && keycode < 27
542
+ key = sprintf("Ctrl-%c", ?A + keycode - 1)
543
+ else
544
+ key = sprintf("unknown (%d)", keycode)
545
+ end
546
+ end
547
+
548
+ Wx::log_message( "%s event: %s (flags = %s%s%s%s)",
549
+ name, key,
550
+ event.control_down() ? 'C' : '-',
551
+ event.alt_down() ? 'A' : '-',
552
+ event.shift_down() ? 'S' : '-',
553
+ event.meta_down() ? 'M' : '-')
554
+ end
555
+
556
+ def on_tree_key_down(event)
557
+ log_key_event("Tree key down ", event.key_event )
558
+ event.skip
559
+ end
560
+
561
+ def on_begin_drag(event)
562
+ # need to explicitly allow drag
563
+ if event.item != root_item()
564
+ @dragged_item = event.item
565
+ Wx::log_message( "OnBeginDrag: started dragging %s",
566
+ item_text(@dragged_item))
567
+ event.allow
568
+ else
569
+ Wx::log_message("OnBeginDrag: selected item can't be dragged.")
570
+ end
571
+ end
572
+
573
+ def on_end_drag(event)
574
+ src_item = @dragged_item
575
+ dest_item = event.item
576
+ @dragged_item = 0
577
+
578
+ if dest_item.nonzero? && ! item_has_children(dest_item)
579
+ # copy to the parent then
580
+ dest_item = item_parent(dest_item)
581
+ end
582
+
583
+ unless dest_item.nonzero?()
584
+ Wx::log_message("OnEndDrag: can't drop here.")
585
+ return nil
586
+ end
587
+
588
+ text = item_text(src_item)
589
+ Wx::log_message("OnEndDrag: '%s' copied to '%s'.",
590
+ text, item_text(dest_item))
591
+
592
+ # just do append here - we could also insert it just before/after the item
593
+ # on which it was dropped, but self requires slightly more work... we also
594
+ # completely ignore the client data and icon of the old item but could
595
+ # copy them as well.
596
+ #
597
+ # Finally, we only copy one item here but we might copy the entire tree if
598
+ # we were dragging a folder.
599
+ image = Wx::THE_APP.show_images() ? TreeCtrlIcon_File : -1
600
+ append_item(dest_item, text, image)
601
+ end
602
+
603
+ def on_begin_label_edit(event)
604
+ Wx::log_message("OnBeginLabelEdit")
605
+
606
+ # for testing, prevent self item's label editing
607
+ if is_test_item(event.item)
608
+ Wx::message_box("The demo prevents you editing this item.")
609
+ event.veto()
610
+ end
611
+ end
612
+
613
+ def on_end_label_edit(event)
614
+ Wx::log_message("OnEndLabelEdit")
615
+ if event.edit_cancelled?
616
+ Wx::log_message("Label edit was cancelled by user")
617
+ return
618
+ end
619
+
620
+ # For a demo, don't allow anything except letters in the labels
621
+ if event.label =~ /[^\w.]/
622
+ msg = "Only letters, numbers and full stops are allowed in the label."
623
+ Wx::message_box(msg)
624
+ Wx::log_message("Label edit was cancelled by demo")
625
+ event.veto
626
+ end
627
+ end
628
+
629
+ def on_item_collapsing(event)
630
+ Wx::log_message("OnItemCollapsing")
631
+
632
+ # for testing, prevent the user from collapsing the first child folder
633
+ if is_test_item(event.item)
634
+ Wx::message_box("You can't collapse self item.")
635
+ event.veto
636
+ end
637
+ end
638
+
639
+ # show some info about activated item
640
+ def on_item_activated(event)
641
+ if item_id = event.item
642
+ show_info(item_id)
643
+ end
644
+ Wx::log_message("OnItemActivated")
645
+ end
646
+
647
+ def on_item_right_click(event)
648
+ show_popup_menu(event.item, event.point)
649
+ end
650
+
651
+ def on_rmouse_up(event)
652
+ pos = event.position
653
+ item = hit_test(pos)
654
+ show_popup_menu(item, pos)
655
+ end
656
+
657
+ def show_popup_menu(id, pos)
658
+ title = ""
659
+ if id.nonzero?
660
+ title << "Menu for " << item_text(id)
661
+ else
662
+ title = "Menu for no particular item"
663
+ end
664
+
665
+ menu = Wx::Menu.new(title)
666
+ menu.append(Wx::ID_ABOUT, "&About...")
667
+ menu.append(TreeTest_Dump, "&Dump")
668
+ popup_menu(menu, pos)
669
+ end
670
+
671
+ def on_rmouse_dclick(event)
672
+ id = hit_test(event.get_position())
673
+ if not id
674
+ Wx::log_message("No item under mouse")
675
+ else
676
+ item = get_item_text(id)
677
+ if item
678
+ Wx::log_message("Item '%s' under mouse", item)
679
+ end
680
+ end
681
+ end
682
+ end
683
+
684
+
685
+ class MyFrame < Wx::Frame
686
+ def initialize(title, x, y, w, h)
687
+ super( nil, :title => title, :pos => [ x, y ], :size => [ w, h ] )
688
+ @treectrl = nil
689
+ @textctrl = nil
690
+ @s_num = 0
691
+
692
+ # This reduces flicker effects - even better would be to define
693
+ # OnEraseBackground to do nothing. When the tree control's scrollbars are
694
+ # show or hidden, the frame is sent a background erase event.
695
+ self.background_colour = Wx::WHITE
696
+
697
+ # Make a menubar
698
+ file_menu = Wx::Menu.new
699
+ style_menu = Wx::Menu.new
700
+ tree_menu = Wx::Menu.new
701
+ item_menu = Wx::Menu.new
702
+
703
+ file_menu.append(Wx::ID_ABOUT, "&About...")
704
+ file_menu.append_separator()
705
+ file_menu.append(Wx::ID_EXIT, "E&xit\tAlt-X")
706
+
707
+ style_menu.append(TreeTest_TogButtons,
708
+ "Toggle &normal buttons", "", Wx::ITEM_CHECK)
709
+ style_menu.append(TreeTest_TogTwist,
710
+ "Toggle &twister buttons", "", Wx::ITEM_CHECK)
711
+ style_menu.append(TreeTest_ToggleButtons,
712
+ "Toggle image &buttons", "", Wx::ITEM_CHECK)
713
+ style_menu.append_separator()
714
+ style_menu.append(TreeTest_TogLines,
715
+ "Toggle &connecting lines", "", Wx::ITEM_CHECK)
716
+ style_menu.append(TreeTest_TogRootLines,
717
+ "Toggle &lines at root", "", Wx::ITEM_CHECK)
718
+ style_menu.append(TreeTest_TogHideRoot,
719
+ "Toggle &hidden root", "", Wx::ITEM_CHECK)
720
+ style_menu.append(TreeTest_TogBorder,
721
+ "Toggle &item border", "", Wx::ITEM_CHECK)
722
+ style_menu.append(TreeTest_TogFullHighlight,
723
+ "Toggle &full row highlight", "", Wx::ITEM_CHECK)
724
+ style_menu.append(TreeTest_TogEdit,
725
+ "Toggle &editing allowed", "", Wx::ITEM_CHECK)
726
+ style_menu.append(TreeTest_ToggleSel,
727
+ "Toggle multiple &selection", "", Wx::ITEM_CHECK)
728
+ style_menu.append(TreeTest_ToggleImages,
729
+ "Toggle show ima&ges", "", Wx::ITEM_CHECK)
730
+ style_menu.append(TreeTest_SetImageSize, "Set image si&ze...")
731
+ style_menu.append_separator()
732
+ style_menu.append(TreeTest_SetFgColour, "Set &foreground colour...")
733
+ style_menu.append(TreeTest_SetBgColour, "Set &background colour...")
734
+ style_menu.append_separator()
735
+ style_menu.append(TreeTest_ResetStyle, "&Reset to default\tF10")
736
+
737
+ tree_menu.append(TreeTest_Recreate, "&Recreate the tree")
738
+ tree_menu.append(TreeTest_CollapseAndReset, "C&ollapse and reset")
739
+ tree_menu.append_separator()
740
+ tree_menu.append(TreeTest_AddItem, "Append a &new item")
741
+ tree_menu.append(TreeTest_InsertItem, "&Insert a new item")
742
+ tree_menu.append(TreeTest_Delete, "&Delete selected item")
743
+ tree_menu.append(TreeTest_DeleteChildren, "Delete &children")
744
+ tree_menu.append(TreeTest_DeleteAll, "Delete &all items")
745
+ tree_menu.append_separator()
746
+ tree_menu.append(TreeTest_Count, "Count children of current item")
747
+ tree_menu.append(TreeTest_CountRec, "Recursively count children of current item")
748
+ tree_menu.append_separator()
749
+ tree_menu.append(TreeTest_Sort, "Sort children")
750
+ tree_menu.append(TreeTest_SortRev, "Reverse sort children")
751
+ tree_menu.append_separator()
752
+ tree_menu.append(TreeTest_EnsureVisible, "Make the last item &visible")
753
+ tree_menu.append_separator()
754
+ tree_menu.append(TreeTest_IncIndent, "Increase indentation\tAlt-I")
755
+ tree_menu.append(TreeTest_DecIndent, "Reduce indentation\tAlt-R")
756
+ tree_menu.append_separator()
757
+ tree_menu.append(TreeTest_IncSpacing, "Increase spacing\tCtrl-I")
758
+ tree_menu.append(TreeTest_DecSpacing, "Reduce spacing\tCtrl-R")
759
+
760
+ item_menu.append(TreeTest_Dump, "&Dump item children")
761
+ item_menu.append(TreeTest_Rename, "&Rename item...")
762
+
763
+ item_menu.append_separator()
764
+ item_menu.append(TreeTest_SetBold, "Make item &bold")
765
+ item_menu.append(TreeTest_ClearBold, "Make item &not bold")
766
+ item_menu.append_separator()
767
+ item_menu.append(TreeTest_ToggleIcon, "Toggle the item's &icon")
768
+
769
+ item_menu.append_separator()
770
+ item_menu.append(TreeTest_DumpSelected, "Dump selected items\tAlt-D")
771
+ item_menu.append(TreeTest_Select, "Select current item\tAlt-S")
772
+ item_menu.append(TreeTest_Unselect, "Unselect everything\tAlt-U")
773
+
774
+ menu_bar = Wx::MenuBar.new
775
+ menu_bar.append(file_menu, "&File")
776
+ menu_bar.append(style_menu, "&Style")
777
+ menu_bar.append(tree_menu, "&Tree")
778
+ menu_bar.append(item_menu, "&Item")
779
+ self.menu_bar = menu_bar
780
+
781
+
782
+ # create the controls
783
+ @textctrl = Wx::TextCtrl.new( self,
784
+ :text => '',
785
+ :style => Wx::TE_MULTILINE|Wx::SUNKEN_BORDER)
786
+
787
+ create_tree_with_default_style()
788
+
789
+ menu_bar.check(TreeTest_ToggleImages, true)
790
+
791
+ # create a status bar with 3 panes
792
+ create_status_bar(3)
793
+ set_status_text("", 0)
794
+
795
+ # set our text control as the log target
796
+ logWindow = Wx::LogTextCtrl.new(@textctrl)
797
+ Wx::Log::active_target = logWindow
798
+
799
+ evt_size :on_size
800
+ evt_close :on_close
801
+
802
+ evt_menu Wx::ID_EXIT, :on_quit
803
+ evt_menu Wx::ID_ABOUT, :on_about
804
+
805
+ evt_menu TreeTest_TogButtons, :on_tog_buttons
806
+ evt_menu TreeTest_TogTwist, :on_tog_twist
807
+ evt_menu TreeTest_TogLines, :on_tog_lines
808
+ evt_menu TreeTest_TogEdit, :on_tog_edit
809
+ evt_menu TreeTest_TogHideRoot, :on_tog_hide_root
810
+ evt_menu TreeTest_TogRootLines, :on_tog_root_lines
811
+ evt_menu TreeTest_TogBorder, :on_tog_border
812
+ evt_menu TreeTest_TogFullHighlight, :on_tog_full_highlight
813
+ evt_menu TreeTest_SetFgColour, :on_set_fg_colour
814
+ evt_menu TreeTest_SetBgColour, :on_set_bg_colour
815
+ evt_menu TreeTest_ResetStyle, :on_reset_style
816
+
817
+ evt_menu TreeTest_Dump, :on_dump
818
+ evt_menu TreeTest_DumpSelected, :on_dump_selected
819
+ evt_menu TreeTest_Select, :on_select
820
+ evt_menu TreeTest_Unselect, :on_unselect
821
+ evt_menu TreeTest_ToggleSel, :on_toggle_sel
822
+ evt_menu TreeTest_Rename, :on_rename
823
+ evt_menu TreeTest_Count, :on_count
824
+ evt_menu TreeTest_CountRec, :on_count_rec
825
+ evt_menu TreeTest_Sort, :on_sort
826
+ evt_menu TreeTest_SortRev, :on_sort_rev
827
+ evt_menu TreeTest_SetBold, :on_set_bold
828
+ evt_menu TreeTest_ClearBold, :on_clear_bold
829
+ evt_menu TreeTest_Delete, :on_delete
830
+ evt_menu TreeTest_DeleteChildren, :on_delete_children
831
+ evt_menu TreeTest_DeleteAll, :on_delete_all
832
+ evt_menu TreeTest_Recreate, :on_recreate
833
+ evt_menu TreeTest_ToggleImages, :on_toggle_images
834
+ evt_menu TreeTest_ToggleButtons, :on_toggle_buttons
835
+ evt_menu TreeTest_SetImageSize, :on_set_image_size
836
+ evt_menu TreeTest_CollapseAndReset, :on_collapse_and_reset
837
+ evt_menu TreeTest_EnsureVisible, :on_ensure_visible
838
+ evt_menu TreeTest_AddItem, :on_add_item
839
+ evt_menu TreeTest_InsertItem, :on_insert_item
840
+ evt_menu TreeTest_IncIndent, :on_inc_indent
841
+ evt_menu TreeTest_DecIndent, :on_dec_indent
842
+ evt_menu TreeTest_IncSpacing, :on_inc_spacing
843
+ evt_menu TreeTest_DecSpacing, :on_dec_spacing
844
+ evt_menu TreeTest_ToggleIcon, :on_toggle_icon
845
+ end
846
+
847
+ def create_tree_with_default_style()
848
+
849
+ style = Wx::TR_DEFAULT_STYLE|Wx::TR_EDIT_LABELS|
850
+ Wx::TR_TWIST_BUTTONS|Wx::TR_ROW_LINES|Wx::TR_FULL_ROW_HIGHLIGHT
851
+
852
+ create_tree(style|Wx::SUNKEN_BORDER)
853
+
854
+ # as we don't know what Wx::TR_DEFAULT_STYLE could contain, test for
855
+ # everything
856
+ mbar = menu_bar
857
+ mbar.check(TreeTest_TogButtons, (style & Wx::TR_HAS_BUTTONS) != 0)
858
+ mbar.check(TreeTest_TogButtons, (style & Wx::TR_TWIST_BUTTONS) != 0)
859
+ mbar.check(TreeTest_TogLines, (style & Wx::TR_NO_LINES) == 0)
860
+ mbar.check(TreeTest_TogRootLines, (style & Wx::TR_LINES_AT_ROOT) != 0)
861
+ mbar.check(TreeTest_TogHideRoot, (style & Wx::TR_HIDE_ROOT) != 0)
862
+ mbar.check(TreeTest_TogEdit, (style & Wx::TR_EDIT_LABELS) != 0)
863
+ mbar.check(TreeTest_TogBorder, (style & Wx::TR_ROW_LINES) != 0)
864
+ mbar.check(TreeTest_TogFullHighlight, (style & Wx::TR_FULL_ROW_HIGHLIGHT) != 0)
865
+ end
866
+
867
+ def create_tree(style)
868
+ @treectrl = MyTreeCtrl.new(self, :style => style)
869
+ resize
870
+ end
871
+
872
+ def tog_style(id,flag)
873
+
874
+ style = @treectrl.window_style_flag ^ flag
875
+
876
+ # most treectrl styles can't be changed on the fly using the native
877
+ # control and the tree must be recreated
878
+ @treectrl.destroy
879
+ create_tree(style)
880
+ menu_bar.check(id, (style & flag) != 0)
881
+ end
882
+
883
+ def on_tog_buttons(event)
884
+ tog_style(event.id, Wx::TR_HAS_BUTTONS)
885
+ end
886
+
887
+ def on_tog_twist(event)
888
+ tog_style(event.id, Wx::TR_TWIST_BUTTONS)
889
+ end
890
+
891
+ def on_tog_lines(event)
892
+ tog_style(event.id, Wx::TR_NO_LINES)
893
+ end
894
+
895
+ def on_tog_edit(event)
896
+ tog_style(event.id, Wx::TR_EDIT_LABELS)
897
+ end
898
+
899
+ def on_tog_hide_root(event)
900
+ tog_style(event.id, Wx::TR_HIDE_ROOT)
901
+ end
902
+
903
+ def on_tog_root_lines(event)
904
+ tog_style(event.id, Wx::TR_LINES_AT_ROOT)
905
+ end
906
+
907
+ def on_tog_border(event)
908
+ tog_style(event.id, Wx::TR_ROW_LINES)
909
+ end
910
+
911
+ def on_tog_full_highlight(event)
912
+ tog_style(event.id, Wx::TR_FULL_ROW_HIGHLIGHT)
913
+ end
914
+
915
+ def on_reset_style(event)
916
+ create_tree_with_default_style()
917
+ end
918
+
919
+ def on_set_bold(event)
920
+ do_set_bold(true)
921
+ end
922
+
923
+ def on_clear_bold(event)
924
+ do_set_bold(false)
925
+ end
926
+
927
+ def on_sort(event)
928
+ do_sort
929
+ end
930
+
931
+ def on_sort_rev(event)
932
+ do_sort(true)
933
+ end
934
+
935
+ def on_size(event)
936
+ if @treectrl && @textctrl
937
+ resize
938
+ end
939
+ event.skip
940
+ end
941
+
942
+ def resize
943
+ my_size = self.client_size
944
+ @treectrl.size = [ my_size.x, 2 * my_size.y / 3 ]
945
+ end
946
+
947
+ def on_close(event)
948
+ Wx::Log::active_target = nil
949
+ destroy
950
+ end
951
+
952
+ def on_quit(event)
953
+ close(true)
954
+ end
955
+
956
+ def on_about(event)
957
+ Wx::message_box( "Tree test sample\n" +
958
+ "(c) Julian Smart 1997, Vadim Zeitlin 1998",
959
+ "About tree test",
960
+ Wx::OK|Wx::ICON_INFORMATION, self)
961
+ end
962
+
963
+ def check_item(item)
964
+ unless item.nonzero?
965
+ Wx::message_box("Please select some item first!",
966
+ "Tree sample error",
967
+ Wx::OK|Wx::ICON_EXCLAMATION, self)
968
+ return false
969
+ end
970
+ true
971
+ end
972
+
973
+ def on_rename(event)
974
+ item = @treectrl.selection
975
+ return nil unless check_item( item )
976
+ # TODO demonstrate creating a custom edit control...
977
+ @treectrl.edit_label(item)
978
+ end
979
+
980
+ def on_count(event)
981
+ item = @treectrl.selection
982
+ return nil unless check_item( item )
983
+ i = @treectrl.children_count( item, false )
984
+ Wx::log_message("%d children", i)
985
+ end
986
+
987
+ def on_count_rec(event)
988
+ item = @treectrl.selection
989
+ return nil unless check_item( item )
990
+ Wx::log_message("%d children", @treectrl.children_count( item ))
991
+ end
992
+
993
+ def do_sort(reverse = false)
994
+ item = @treectrl.selection
995
+ return nil unless check_item( item )
996
+ @treectrl.do_sort_children(item, reverse)
997
+ end
998
+
999
+ def on_dump(event)
1000
+ root = @treectrl.selection
1001
+ return nil unless check_item( root )
1002
+ @treectrl.get_items_recursively(root, -1)
1003
+ end
1004
+
1005
+ def on_toggle_sel(event)
1006
+ tog_style(event.id, Wx::TR_MULTIPLE)
1007
+ end
1008
+
1009
+ def on_dump_selected(event)
1010
+ if ( @treectrl.window_style & Wx::TR_MULTIPLE ) == 0
1011
+ item_id = @treectrl.selection
1012
+ if item_id.nonzero?
1013
+ Wx::log_message("<TreeItem '%s'>",
1014
+ @treectrl.get_item_text(item_id))
1015
+ else
1016
+ Wx::log_message("No tree item selected")
1017
+ end
1018
+ else
1019
+ Wx::log_message("NOT IMPLEMENTED: Multiple selections not available")
1020
+ # Requires Wx::List - Ruby Array typemap, pointer handling, 29/08/2006
1021
+ # Currently raises incorrect number of args, 1 for 0
1022
+ # selected = @treectrl.get_selections()
1023
+ # selected_items.each do | item_id |
1024
+ # Wx::log_message("\t%s", @treectrl.get_item_text(item_id))
1025
+ # end
1026
+ end
1027
+ end
1028
+
1029
+ def on_select(event)
1030
+ @treectrl.select_item(@treectrl.selection)
1031
+ end
1032
+
1033
+ def on_unselect(event)
1034
+ @treectrl.unselect_all()
1035
+ end
1036
+
1037
+ def do_set_bold(bold = true)
1038
+ item = @treectrl.selection
1039
+ return nil unless check_item( item )
1040
+ @treectrl.set_item_bold(item, bold)
1041
+ end
1042
+
1043
+ def on_delete(event)
1044
+ item = @treectrl.selection
1045
+ return nil unless check_item( item )
1046
+ @treectrl.delete(item)
1047
+ end
1048
+
1049
+ def on_delete_children(event)
1050
+ item = @treectrl.selection
1051
+ return nil unless check_item( item )
1052
+ @treectrl.delete_children(item)
1053
+ end
1054
+
1055
+ def on_delete_all(event)
1056
+ @treectrl.delete_all_items()
1057
+ end
1058
+
1059
+ def on_recreate(event)
1060
+ on_delete_all(event)
1061
+ @treectrl.add_test_items_to_tree(5, 2)
1062
+ end
1063
+
1064
+ def on_set_image_size(event)
1065
+ size = get_number_from_user("Enter the size for the images to use",
1066
+ "Size: ",
1067
+ "TreeCtrl sample",
1068
+ @treectrl.image_size())
1069
+ if size == -1
1070
+ return nil
1071
+ end
1072
+
1073
+ @treectrl.create_image_list(size)
1074
+ Wx::THE_APP.show_images = true
1075
+ end
1076
+
1077
+ def on_toggle_images(event)
1078
+ if Wx::get_app.show_images
1079
+ @treectrl.unset_image_list
1080
+ Wx::get_app.show_images = false
1081
+ else
1082
+ @treectrl.create_image_list
1083
+ Wx::get_app.show_images = true
1084
+ end
1085
+ end
1086
+
1087
+ def on_toggle_buttons(event)
1088
+ end
1089
+
1090
+ def on_collapse_and_reset(event)
1091
+ @treectrl.collapse_and_reset(@treectrl.get_root_item())
1092
+ end
1093
+
1094
+ def on_ensure_visible(event)
1095
+ @treectrl.do_ensure_visible()
1096
+ end
1097
+
1098
+ def on_insert_item(event)
1099
+ image = Wx::THE_APP.show_images() ? TreeCtrlIcon_File : -1
1100
+ @treectrl.insert_item(@treectrl.root_item, -1, "2nd item", image)
1101
+ end
1102
+
1103
+ def on_add_item(event)
1104
+ @s_num += 1
1105
+ text = sprintf("Item #%d", @s_num)
1106
+ @treectrl.append_item(@treectrl.root_item, text)
1107
+ end
1108
+
1109
+ def on_inc_indent(event)
1110
+ if @treectrl.indent < 100
1111
+ @treectrl.indent += 5
1112
+ end
1113
+ end
1114
+
1115
+ def on_dec_indent(event)
1116
+ if @treectrl.indent > 10
1117
+ @treectrl.indent -= 5
1118
+ end
1119
+ end
1120
+
1121
+ def on_inc_spacing(event)
1122
+ if @treectrl.spacing < 100
1123
+ @treectrl.spacing += 5
1124
+ end
1125
+ end
1126
+
1127
+ def on_dec_spacing(event)
1128
+ if @treectrl.spacing > 10
1129
+ @treectrl.spacing -= 5
1130
+ end
1131
+ end
1132
+
1133
+ def on_toggle_icon(event)
1134
+ item = @treectrl.selection
1135
+ return nil unless check_item( item )
1136
+ @treectrl.do_toggle_icon(item)
1137
+ end
1138
+
1139
+ # TODO
1140
+ def on_set_fg_colour(event)
1141
+ Wx::log_message('NOT IMPLEMENTED')
1142
+ return
1143
+ col = Wx::get_colour_from_user(self, @treectrl.foreground_colour)
1144
+ if col.ok?
1145
+ @treectrl.foreground_colour = col
1146
+ end
1147
+ end
1148
+
1149
+ # TODO
1150
+ def on_set_bg_colour(event)
1151
+ Wx::log_message('NOT IMPLEMENTED')
1152
+ return
1153
+ col = Wx::get_colour_from_user(self, @treectrl.background_colour)
1154
+ if col.ok?
1155
+ @treectrl.background_colour = col
1156
+ end
1157
+ end
1158
+
1159
+ end
1160
+
1161
+ class MyApp < Wx::App
1162
+ attr_accessor :show_images, :show_buttons
1163
+ def initialize
1164
+ self.show_images = true
1165
+ self.show_buttons = false
1166
+ super
1167
+ end
1168
+
1169
+ def on_init
1170
+ # Create the main frame window
1171
+ frame = MyFrame.new("TreeCtrl Test", 50, 50, 450, 600)
1172
+ # show the frame
1173
+ frame.show(true)
1174
+ # set_top_window(frame)
1175
+
1176
+ end
1177
+ end
1178
+
1179
+ app = MyApp.new
1180
+ app.main_loop