wxruby 1.9.0-i686-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. data/lib/wx.rb +35 -0
  2. data/lib/wx/classes/app.rb +25 -0
  3. data/lib/wx/classes/artprovider.rb +31 -0
  4. data/lib/wx/classes/bitmap.rb +23 -0
  5. data/lib/wx/classes/choice.rb +4 -0
  6. data/lib/wx/classes/clientdc.rb +13 -0
  7. data/lib/wx/classes/colour.rb +47 -0
  8. data/lib/wx/classes/combobox.rb +4 -0
  9. data/lib/wx/classes/evthandler.rb +824 -0
  10. data/lib/wx/classes/font.rb +118 -0
  11. data/lib/wx/classes/grid.rb +130 -0
  12. data/lib/wx/classes/helpcontroller.rb +5 -0
  13. data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
  14. data/lib/wx/classes/htmlwindow.rb +6 -0
  15. data/lib/wx/classes/icon.rb +14 -0
  16. data/lib/wx/classes/image.rb +14 -0
  17. data/lib/wx/classes/listbox.rb +4 -0
  18. data/lib/wx/classes/locale.rb +28 -0
  19. data/lib/wx/classes/object.rb +7 -0
  20. data/lib/wx/classes/paintdc.rb +12 -0
  21. data/lib/wx/classes/point.rb +5 -0
  22. data/lib/wx/classes/previewframe.rb +13 -0
  23. data/lib/wx/classes/rect.rb +5 -0
  24. data/lib/wx/classes/size.rb +5 -0
  25. data/lib/wx/classes/texturlevent.rb +6 -0
  26. data/lib/wx/classes/timer.rb +69 -0
  27. data/lib/wx/classes/window.rb +38 -0
  28. data/lib/wx/classes/xmlresource.rb +16 -0
  29. data/lib/wx/version.rb +3 -0
  30. data/lib/wxruby2.so +0 -0
  31. data/samples/SAMPLES-LICENSE.TXT +18 -0
  32. data/samples/aui/aui.rb +1352 -0
  33. data/samples/bigdemo/About.rbw +39 -0
  34. data/samples/bigdemo/ColorPanel.rbw +25 -0
  35. data/samples/bigdemo/GridSimple.rbw +80 -0
  36. data/samples/bigdemo/MDIDemo.rbw +59 -0
  37. data/samples/bigdemo/PopupMenu.rbw +151 -0
  38. data/samples/bigdemo/ShapedWindow.rbw +135 -0
  39. data/samples/bigdemo/Sizers.rbw +545 -0
  40. data/samples/bigdemo/bigdemo.rb +826 -0
  41. data/samples/bigdemo/demoTemplate.rbw +37 -0
  42. data/samples/bigdemo/helpfile.htb +0 -0
  43. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  44. data/samples/bigdemo/icons/Test 015.png +0 -0
  45. data/samples/bigdemo/icons/choice.bmp +0 -0
  46. data/samples/bigdemo/icons/choice.xpm +27 -0
  47. data/samples/bigdemo/icons/combo.bmp +0 -0
  48. data/samples/bigdemo/icons/combo.xpm +27 -0
  49. data/samples/bigdemo/icons/copy.xpm +25 -0
  50. data/samples/bigdemo/icons/cut.xpm +24 -0
  51. data/samples/bigdemo/icons/gauge.bmp +0 -0
  52. data/samples/bigdemo/icons/gauge.xpm +27 -0
  53. data/samples/bigdemo/icons/help.xpm +25 -0
  54. data/samples/bigdemo/icons/list.bmp +0 -0
  55. data/samples/bigdemo/icons/list.xpm +27 -0
  56. data/samples/bigdemo/icons/mondrian.ico +0 -0
  57. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  58. data/samples/bigdemo/icons/new.xpm +24 -0
  59. data/samples/bigdemo/icons/ogl.ico +0 -0
  60. data/samples/bigdemo/icons/ogl.xpm +45 -0
  61. data/samples/bigdemo/icons/open.xpm +26 -0
  62. data/samples/bigdemo/icons/paste.bmp +0 -0
  63. data/samples/bigdemo/icons/paste.xpm +38 -0
  64. data/samples/bigdemo/icons/pointy.png +0 -0
  65. data/samples/bigdemo/icons/preview.xpm +26 -0
  66. data/samples/bigdemo/icons/print.xpm +26 -0
  67. data/samples/bigdemo/icons/radio.bmp +0 -0
  68. data/samples/bigdemo/icons/radio.xpm +27 -0
  69. data/samples/bigdemo/icons/robert.xpm +415 -0
  70. data/samples/bigdemo/icons/ruby.png +0 -0
  71. data/samples/bigdemo/icons/sashtest.ico +0 -0
  72. data/samples/bigdemo/icons/save.xpm +25 -0
  73. data/samples/bigdemo/icons/smiles.bmp +0 -0
  74. data/samples/bigdemo/icons/smiles.xpm +39 -0
  75. data/samples/bigdemo/icons/smiley.ico +0 -0
  76. data/samples/bigdemo/icons/smiley.xpm +42 -0
  77. data/samples/bigdemo/icons/stattext.xpm +24 -0
  78. data/samples/bigdemo/icons/test2.bmp +0 -0
  79. data/samples/bigdemo/icons/test2.png +0 -0
  80. data/samples/bigdemo/icons/test2.xpm +79 -0
  81. data/samples/bigdemo/icons/text.bmp +0 -0
  82. data/samples/bigdemo/icons/text.xpm +27 -0
  83. data/samples/bigdemo/icons/tog1.bmp +0 -0
  84. data/samples/bigdemo/icons/tog1.xpm +38 -0
  85. data/samples/bigdemo/icons/tog2.bmp +0 -0
  86. data/samples/bigdemo/icons/tog2.xpm +38 -0
  87. data/samples/bigdemo/icons/wxwin.ico +0 -0
  88. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  89. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  90. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  91. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  92. data/samples/bigdemo/run.rb +94 -0
  93. data/samples/bigdemo/tips.txt +7 -0
  94. data/samples/bigdemo/utils.rb +12 -0
  95. data/samples/bigdemo/wxArtProvider.rbw +285 -0
  96. data/samples/bigdemo/wxBitmapButton.rbw +64 -0
  97. data/samples/bigdemo/wxButton.rbw +66 -0
  98. data/samples/bigdemo/wxCalendarCtrl.rbw +72 -0
  99. data/samples/bigdemo/wxCheckBox.rbw +52 -0
  100. data/samples/bigdemo/wxCheckListBox.rbw +77 -0
  101. data/samples/bigdemo/wxChoice.rbw +49 -0
  102. data/samples/bigdemo/wxChoicebook.rbw +80 -0
  103. data/samples/bigdemo/wxColourDialog.rbw +34 -0
  104. data/samples/bigdemo/wxComboBox.rbw +79 -0
  105. data/samples/bigdemo/wxCursor.rbw +140 -0
  106. data/samples/bigdemo/wxDialog.rbw +92 -0
  107. data/samples/bigdemo/wxDirDialog.rbw +32 -0
  108. data/samples/bigdemo/wxDragImage.rbw +74 -0
  109. data/samples/bigdemo/wxFileDialog.rbw +39 -0
  110. data/samples/bigdemo/wxFileDialog_Save.rbw +38 -0
  111. data/samples/bigdemo/wxFindReplaceDialog.rbw +85 -0
  112. data/samples/bigdemo/wxFontDialog.rbw +176 -0
  113. data/samples/bigdemo/wxFrame.rbw +55 -0
  114. data/samples/bigdemo/wxGauge.rbw +73 -0
  115. data/samples/bigdemo/wxGenericDirCtrl.rbw +78 -0
  116. data/samples/bigdemo/wxGrid.rbw +68 -0
  117. data/samples/bigdemo/wxHtmlHelpController.rbw +57 -0
  118. data/samples/bigdemo/wxListBox.rbw +142 -0
  119. data/samples/bigdemo/wxListCtrl_virtual.rbw +109 -0
  120. data/samples/bigdemo/wxMDIWindows.rbw +52 -0
  121. data/samples/bigdemo/wxMenu.rbw +238 -0
  122. data/samples/bigdemo/wxMessageDialog.rbw +30 -0
  123. data/samples/bigdemo/wxMiniFrame.rbw +74 -0
  124. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +34 -0
  125. data/samples/bigdemo/wxNotebook.rbw +138 -0
  126. data/samples/bigdemo/wxProgressDialog.rbw +45 -0
  127. data/samples/bigdemo/wxRadioBox.rbw +74 -0
  128. data/samples/bigdemo/wxRadioButton.rbw +127 -0
  129. data/samples/bigdemo/wxSashWindow.rbw +155 -0
  130. data/samples/bigdemo/wxScrolledMessageDialog.rbw +59 -0
  131. data/samples/bigdemo/wxScrolledWindow.rbw +196 -0
  132. data/samples/bigdemo/wxSingleChoiceDialog.rbw +35 -0
  133. data/samples/bigdemo/wxSlider.rbw +44 -0
  134. data/samples/bigdemo/wxSpinButton.rbw +52 -0
  135. data/samples/bigdemo/wxSpinCtrl.rbw +53 -0
  136. data/samples/bigdemo/wxSplitterWindow.rbw +65 -0
  137. data/samples/bigdemo/wxStaticBitmap.rbw +53 -0
  138. data/samples/bigdemo/wxStaticText.rbw +57 -0
  139. data/samples/bigdemo/wxStatusBar.rbw +128 -0
  140. data/samples/bigdemo/wxTextCtrl.rbw +151 -0
  141. data/samples/bigdemo/wxTextEntryDialog.rbw +34 -0
  142. data/samples/bigdemo/wxToggleButton.rbw +51 -0
  143. data/samples/bigdemo/wxToolBar.rbw +133 -0
  144. data/samples/bigdemo/wxTreeCtrl.rbw +192 -0
  145. data/samples/calendar/calendar.rb +275 -0
  146. data/samples/caret/caret.rb +296 -0
  147. data/samples/caret/mondrian.xpm +44 -0
  148. data/samples/controls/controls.rb +1140 -0
  149. data/samples/controls/get_item_sample.rb +87 -0
  150. data/samples/controls/icons/choice.xpm +27 -0
  151. data/samples/controls/icons/combo.xpm +27 -0
  152. data/samples/controls/icons/gauge.xpm +27 -0
  153. data/samples/controls/icons/list.xpm +27 -0
  154. data/samples/controls/icons/radio.xpm +27 -0
  155. data/samples/controls/icons/stattext.xpm +24 -0
  156. data/samples/controls/icons/text.xpm +27 -0
  157. data/samples/controls/mondrian.ico +0 -0
  158. data/samples/controls/mondrian.xpm +44 -0
  159. data/samples/controls/test2.bmp +0 -0
  160. data/samples/dialogs/dialogs.rb +724 -0
  161. data/samples/dialogs/tips.txt +18 -0
  162. data/samples/etc/activation.rb +108 -0
  163. data/samples/etc/choice.rb +72 -0
  164. data/samples/etc/miniframe.rb +84 -0
  165. data/samples/etc/sash.rb +135 -0
  166. data/samples/etc/scrollwin.rb +116 -0
  167. data/samples/etc/system_settings.rb +258 -0
  168. data/samples/etc/wizard.rb +81 -0
  169. data/samples/grid/grid.rb +201 -0
  170. data/samples/html/html.rb +251 -0
  171. data/samples/images/Thumbs.db +0 -0
  172. data/samples/images/images.rb +48 -0
  173. data/samples/images/paperclip.png +0 -0
  174. data/samples/listbook/listbook.rb +183 -0
  175. data/samples/listbook/listbook.xrc +370 -0
  176. data/samples/mdi/mdi.rb +87 -0
  177. data/samples/minimal/minimal.rb +95 -0
  178. data/samples/minimal/mondrian.ico +0 -0
  179. data/samples/minimal/mondrian.xpm +44 -0
  180. data/samples/minimal/nothing.rb +46 -0
  181. data/samples/minimal/text.rb +35 -0
  182. data/samples/printing/mondrian.ico +0 -0
  183. data/samples/printing/mondrian.xpm +44 -0
  184. data/samples/printing/printing.rb +484 -0
  185. data/samples/text/mondrian.ico +0 -0
  186. data/samples/text/mondrian.xpm +44 -0
  187. data/samples/text/scintilla.rb +180 -0
  188. data/samples/text/textctrl.rb +124 -0
  189. data/samples/text/unicode.rb +238 -0
  190. data/samples/text/utf8.txt +15 -0
  191. data/samples/treectrl/icon1.xpm +79 -0
  192. data/samples/treectrl/icon2.xpm +53 -0
  193. data/samples/treectrl/icon3.xpm +79 -0
  194. data/samples/treectrl/icon4.xpm +43 -0
  195. data/samples/treectrl/icon5.xpm +79 -0
  196. data/samples/treectrl/treectrl.rb +1210 -0
  197. data/samples/xrc/samples.xrc +46 -0
  198. data/samples/xrc/xrc_sample.rb +107 -0
  199. metadata +264 -0
@@ -0,0 +1,38 @@
1
+ # Copyright 2004-2007 by Kevin Smith
2
+ # released under the MIT-style wxruby2 license
3
+
4
+ class Wx::Window
5
+ # Recursively searches all windows below +self+ and returns the first
6
+ # window which has the id +an_id+. This corresponds to the find_window
7
+ # method method in WxWidgets when called with an integer.
8
+ def find_window_by_id(an_id)
9
+ Wx::Window.find_window_by_id(an_id, self)
10
+ end
11
+
12
+ # Searches all windows below +self+ and returns the first window which
13
+ # has the name +a_name+ This corresponds to the find_window method method
14
+ # in WxWidgets when called with an string.
15
+ def find_window_by_name(a_name)
16
+ Wx::Window.find_window_by_name(a_name, self)
17
+ end
18
+
19
+ # Searches all windows below +self+ and returns the first window which
20
+ # has the label +a_label+.
21
+ def find_window_by_label(a_label)
22
+ Wx:Window.find_window_by_label(a_label, self)
23
+ end
24
+
25
+ alias :__old_evt_paint :evt_paint
26
+ # This modified version of evt_paint sets a variable indicating that a
27
+ # paint event is being handled just before running the event
28
+ # handler. This ensures that any call to Window#paint within the
29
+ # handler will supply a Wx::PaintDC (see swig/Window.i).
30
+ def evt_paint(&block)
31
+ wrapped_block = proc do | event |
32
+ instance_variable_set("@__painting__", true)
33
+ block.call(event)
34
+ remove_instance_variable("@__painting__")
35
+ end
36
+ __old_evt_paint(&wrapped_block)
37
+ end
38
+ end
@@ -0,0 +1,16 @@
1
+ class Wx::XmlResource
2
+ # The standard .load method returns a boolean indicating success or
3
+ # failure. Failure might result from bad XML, or a non-existent
4
+ # file. In ruby, in these circumstances, it's more natural to raise an
5
+ # Exception than expect the user to test the return value.
6
+ wx_load = self.instance_method(:load)
7
+ define_method(:load) do | fname |
8
+ result = wx_load.bind(self).call(fname)
9
+ if not result
10
+ Kernel.raise( RuntimeError,
11
+ "Failed to load XRC from '#{fname}'; " +
12
+ "check the file exists and is valid XML")
13
+ end
14
+ fname
15
+ end
16
+ end
data/lib/wx/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Wx
2
+ WXRUBY_VERSION = '1.9.0'
3
+ end
data/lib/wxruby2.so ADDED
Binary file
@@ -0,0 +1,18 @@
1
+ wxRuby2 Sample Code
2
+ Copyright (c) 2004-2006 Kevin B. Smith
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software, to deal in the Software without restriction,
6
+ including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of any portion of
8
+ this Software, and to permit persons to whom the Software is furnished
9
+ to do so. This copyright notice need not be retained in any derived
10
+ work.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
16
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
17
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,1352 @@
1
+ #!/usr/bin/env ruby
2
+ # wxRuby2 Sample Code. Copyright (c) 2004-2007 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
+ load 'wx'
11
+ rescue
12
+ raise no_wx_err
13
+ end
14
+ end
15
+
16
+ # A resizable control that displays its current size, and, if an AUI
17
+ # arrangement, its position and layer
18
+ class SizeReportCtrl < Wx::Control
19
+ def initialize(parent, id, pos, size, mgr = nil)
20
+ super(parent, id, pos, size)
21
+ @mgr = mgr
22
+ evt_paint { on_paint }
23
+ evt_size { on_size }
24
+ end
25
+
26
+ def on_paint
27
+ paint do | dc |
28
+ size = get_client_size
29
+
30
+ dc.set_font Wx::NORMAL_FONT
31
+ dc.set_brush Wx::WHITE_BRUSH
32
+ dc.set_pen Wx::WHITE_PEN
33
+ dc.draw_rectangle(0, 0, size.x, size.y)
34
+ dc.set_pen Wx::LIGHT_GREY_PEN
35
+ dc.set_pen Wx::LIGHT_GREY_PEN
36
+ dc.draw_line(0, 0, size.x, size.y)
37
+ dc.draw_line(0, size.y, size.x, 0)
38
+
39
+ msg = "Size: %d x %d" % [ size.x, size.y ]
40
+ width, height = dc.get_text_extent(msg)
41
+ height += 3
42
+ dc.draw_text(msg,
43
+ (size.x - width) / 2,
44
+ (size.y - ( height * 5 ) ) / 2 )
45
+
46
+ if @mgr
47
+ pi = @mgr.get_pane(self)
48
+ msg = "Layer: %d" % pi.dock_layer
49
+ width, height = dc.get_text_extent(msg)
50
+ dc.draw_text(msg,
51
+ (size.x - width) / 2,
52
+ ( ( size.y - ( height * 5 ) ) / 2 ) + height )
53
+
54
+ msg = "Dock: %d Row: %d" % [ pi.dock_direction, pi.dock_row ]
55
+ width, height = dc.get_text_extent(msg)
56
+ dc.draw_text(msg,
57
+ (size.x - width) / 2,
58
+ ( ( size.y - ( height * 5 ) ) / 2) + ( height * 2 ) )
59
+
60
+ msg = "Position: %d" % pi.dock_pos
61
+ width, height = dc.get_text_extent(msg)
62
+ dc.draw_text(msg,
63
+ (size.x - width) / 2 ,
64
+ ( ( size.y - ( height * 5 ) ) / 2 ) + ( height * 3 ) )
65
+
66
+ msg = "Proportion: %d" % pi.dock_proportion
67
+ width, height = dc.get_text_extent(msg)
68
+ dc.draw_text(msg,
69
+ (size.x - width) / 2 ,
70
+ ( ( size.y - ( height * 5 ) ) / 2 ) + ( height * 4 ) )
71
+
72
+ end
73
+ end
74
+ end
75
+
76
+ def on_size
77
+ refresh
78
+ end
79
+ end
80
+
81
+ class SettingsPanel < Wx::Panel
82
+ consts = %w[
83
+ ID_PaneBorderSize
84
+ ID_SashSize
85
+ ID_CaptionSize
86
+ ID_BackgroundColour
87
+ ID_SashColour
88
+ ID_InactiveCaptionColour
89
+ ID_InactiveCaptionGradientColour
90
+ ID_InactiveCaptionTextColour
91
+ ID_ActiveCaptionColour
92
+ ID_ActiveCaptionGradientColour
93
+ ID_ActiveCaptionTextColour
94
+ ID_BorderColour
95
+ ID_GripperColour ]
96
+
97
+ consts.each_with_index do | c, i |
98
+ const_set(c, 1001 + i)
99
+ end
100
+
101
+ def initialize(parent, frame)
102
+ super(parent, Wx::ID_ANY)
103
+ @frame = frame
104
+ @base_bmp = create_colour_bitmap(Wx::BLACK)
105
+
106
+ # set up some spin ctrls for integer variables
107
+ @border_size, s1 = make_metric_spin_ctrl( ID_PaneBorderSize,
108
+ "Pane Border Size:",
109
+ Wx::AUI_DOCKART_PANE_BORDER_SIZE)
110
+
111
+ @sash_size, s2 = make_metric_spin_ctrl( ID_SashSize,
112
+ "Sash Size:",
113
+ Wx::AUI_DOCKART_SASH_SIZE)
114
+
115
+ @cap_size, s3 = make_metric_spin_ctrl( ID_CaptionSize,
116
+ "Caption Size:",
117
+ Wx::AUI_DOCKART_CAPTION_SIZE)
118
+
119
+ # colour controls
120
+ @bckg_colour, s4 = make_colour_button( ID_BackgroundColour,
121
+ "Background Colour:")
122
+ @sash_colour, s5 = make_colour_button( ID_SashColour,
123
+ "Sash Colour:")
124
+ @capt_colour, s6 = make_colour_button( ID_InactiveCaptionColour,
125
+ "Normal Caption:")
126
+ @capt_gradnt, s7 = make_colour_button( ID_InactiveCaptionGradientColour,
127
+ "Normal Caption Gradient:")
128
+ @capt_text, s8 = make_colour_button( ID_InactiveCaptionTextColour,
129
+ "Normal Caption Text:")
130
+ @acap_colour, s9 = make_colour_button( ID_ActiveCaptionColour,
131
+ "Active Caption:")
132
+ @acap_gradnt, s10 = make_colour_button( ID_ActiveCaptionGradientColour,
133
+ "Active Caption Gradient:")
134
+ @acap_text, s11 = make_colour_button( ID_ActiveCaptionTextColour,
135
+ "Active Caption Text:")
136
+ @brdr_colour, s12 = make_colour_button( ID_BorderColour,
137
+ "Border Colour:")
138
+ @grip_colour, s13 = make_colour_button( ID_GripperColour,
139
+ "Gripper Colour:")
140
+
141
+
142
+ grid_sizer = Wx::GridSizer.new(2)
143
+ grid_sizer.set_h_gap(5)
144
+
145
+ grid_sizer.add(s1); grid_sizer.add(s4)
146
+ grid_sizer.add(s2); grid_sizer.add(s5)
147
+ grid_sizer.add(s3); grid_sizer.add(s13)
148
+ grid_sizer.add(1,1); grid_sizer.add(s12)
149
+ grid_sizer.add(s6); grid_sizer.add(s9)
150
+ grid_sizer.add(s7); grid_sizer.add(s10)
151
+ grid_sizer.add(s8); grid_sizer.add(s11)
152
+
153
+ cont_sizer =Wx::BoxSizer.new(Wx::VERTICAL)
154
+ cont_sizer.add(grid_sizer, 1, Wx::EXPAND|Wx::ALL, 5)
155
+ self.set_sizer(cont_sizer)
156
+ get_sizer.set_size_hints(self)
157
+ update_colours
158
+
159
+ evt_spinctrl(ID_PaneBorderSize) { | e | on_pane_border_size(e) }
160
+ evt_spinctrl(ID_SashSize) { | e | on_sash_size(e) }
161
+ evt_spinctrl(ID_CaptionSize) { | e | on_caption_size(e) }
162
+ evt_button(ID_BackgroundColour) { | e | on_set_colour(e) }
163
+ evt_button(ID_SashColour) { | e | on_set_colour(e) }
164
+ evt_button(ID_InactiveCaptionColour) { | e | on_set_colour(e) }
165
+ evt_button(ID_InactiveCaptionGradientColour) { | e | on_set_colour(e) }
166
+ evt_button(ID_InactiveCaptionTextColour) { | e | on_set_colour(e) }
167
+ evt_button(ID_ActiveCaptionColour) { | e | on_set_colour(e) }
168
+ evt_button(ID_ActiveCaptionGradientColour) { | e | on_set_colour(e) }
169
+ evt_button(ID_ActiveCaptionTextColour) { | e | on_set_colour(e) }
170
+ evt_button(ID_BorderColour) { | e | on_set_colour(e) }
171
+ evt_button(ID_GripperColour) { | e | on_set_colour(e) }
172
+ end
173
+
174
+
175
+ def update_colours()
176
+ art = @frame.get_dock_art
177
+
178
+ col = art.get_color(Wx::AUI_DOCKART_BACKGROUND_COLOUR)
179
+ @bckg_colour.set_bitmap_label( create_colour_bitmap(col) )
180
+
181
+ col = art.get_color(Wx::AUI_DOCKART_SASH_COLOUR)
182
+ @sash_colour.set_bitmap_label( create_colour_bitmap(col) )
183
+
184
+ col = art.get_color(Wx::AUI_DOCKART_INACTIVE_CAPTION_COLOUR)
185
+ @capt_colour.set_bitmap_label( create_colour_bitmap(col) )
186
+
187
+ col = art.get_color(Wx::AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)
188
+ @capt_gradnt.set_bitmap_label( create_colour_bitmap(col) )
189
+
190
+ col = art.get_color(Wx::AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)
191
+ @capt_text.set_bitmap_label( create_colour_bitmap(col) )
192
+
193
+ col = art.get_color(Wx::AUI_DOCKART_ACTIVE_CAPTION_COLOUR)
194
+ @acap_colour.set_bitmap_label( create_colour_bitmap(col) )
195
+
196
+ col = art.get_color(Wx::AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)
197
+ @acap_gradnt.set_bitmap_label( create_colour_bitmap(col) )
198
+
199
+ col = art.get_color(Wx::AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)
200
+ @acap_text.set_bitmap_label( create_colour_bitmap(col) )
201
+
202
+ col = art.get_color(Wx::AUI_DOCKART_SASH_COLOUR)
203
+ @brdr_colour.set_bitmap_label( create_colour_bitmap(col) )
204
+
205
+ col = art.get_color(Wx::AUI_DOCKART_GRIPPER_COLOUR)
206
+ @grip_colour.set_bitmap_label( create_colour_bitmap(col) )
207
+ end
208
+
209
+ def on_pane_border_size(event)
210
+ @frame.get_dock_art.set_metric( Wx::AUI_DOCKART_PANE_BORDER_SIZE,
211
+ event.get_position )
212
+ @frame.do_update
213
+ end
214
+
215
+ def on_sash_size(event)
216
+ @frame.get_dock_art.set_metric( Wx::AUI_DOCKART_SASH_SIZE,
217
+ event.get_position )
218
+ @frame.do_update
219
+ end
220
+
221
+ def on_caption_size(event)
222
+ @frame.get_dock_art.set_metric( Wx::AUI_DOCKART_CAPTION_SIZE,
223
+ event.get_position )
224
+ @frame.do_update
225
+ end
226
+
227
+ def on_set_colour(event)
228
+ dlg = Wx::ColourDialog.new(@frame)
229
+ dlg.set_title("Colour Picker")
230
+
231
+ return unless dlg.show_modal == Wx::ID_OK
232
+
233
+ var = nil
234
+ case event.get_id()
235
+ when ID_BackgroundColour
236
+ var = Wx::AUI_DOCKART_BACKGROUND_COLOUR
237
+ when ID_SashColour
238
+ var = Wx::AUI_DOCKART_SASH_COLOUR
239
+ when ID_InactiveCaptionColour
240
+ var = Wx::AUI_DOCKART_INACTIVE_CAPTION_COLOUR
241
+ when ID_InactiveCaptionGradientColour
242
+ var = Wx::AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
243
+ when ID_InactiveCaptionTextColour
244
+ var = Wx::AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
245
+ when ID_ActiveCaptionColour
246
+ var = Wx::AUI_DOCKART_ACTIVE_CAPTION_COLOUR
247
+ when ID_ActiveCaptionGradientColour
248
+ var = Wx::AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
249
+ when ID_ActiveCaptionTextColour
250
+ var = Wx::AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
251
+ when ID_BorderColour
252
+ var = Wx::AUI_DOCKART_BORDER_COLOUR
253
+ when ID_GripperColour
254
+ var = Wx::AUI_DOCKART_GRIPPER_COLOUR
255
+ else
256
+ return
257
+ end
258
+
259
+ @frame.get_dock_art.set_colour(var, dlg.get_colour_data.get_colour )
260
+ @frame.do_update
261
+ update_colours
262
+ end
263
+
264
+ private
265
+ def make_metric_spin_ctrl(an_id, caption, metric)
266
+ metric_val = @frame.get_dock_art.get_metric(metric)
267
+ sp = Wx::SpinCtrl.new( self, an_id, metric_val.to_s,
268
+ Wx::DEFAULT_POSITION,
269
+ Wx::Size.new(50, 20),
270
+ Wx::SP_ARROW_KEYS,
271
+ 0, 100, metric_val)
272
+
273
+ sz = Wx::BoxSizer.new(Wx::HORIZONTAL)
274
+ sz.add(1, 1, 1, Wx::EXPAND)
275
+ sz.add( Wx::StaticText.new(self, Wx::ID_ANY, caption) )
276
+ sz.add(sp)
277
+ sz.add(1, 1, 1, Wx::EXPAND)
278
+ sz.set_item_min_size(1, 180, 20)
279
+ return sp, sz
280
+ end
281
+
282
+ # utility to make a little captioned button;
283
+ # returns the button and a sizer containing the button and caption
284
+ def make_colour_button(an_id, caption)
285
+ bmp_butt = Wx::BitmapButton.new( self, an_id, @base_bmp,
286
+ Wx::DEFAULT_POSITION,
287
+ Wx::Size.new(50, 25) )
288
+
289
+ sz = Wx::BoxSizer.new(Wx::HORIZONTAL)
290
+ sz.add(1, 1, 1, Wx::EXPAND)
291
+ sz.add( Wx::StaticText.new(self, Wx::ID_ANY, caption) )
292
+ sz.add(bmp_butt)
293
+ sz.add(1, 1, 1, Wx::EXPAND)
294
+ sz.set_item_min_size(1, 180, 20)
295
+ return bmp_butt, sz
296
+ end
297
+
298
+ # returns a 25 x 14 image with solid colour +colour+, with a 1-pixel
299
+ # black border
300
+ def create_colour_bitmap(colour)
301
+ img = Wx::Image.new(25, 14)
302
+ 0.upto(24) do | x |
303
+ 0.upto(13) do | y |
304
+ if (x == 0 || x == 24 || y == 0 || y == 13)
305
+ pixcol = Wx::BLACK
306
+ else
307
+ pixcol = colour
308
+ end
309
+ img.set_rgb(x, y, pixcol.red, pixcol.green, pixcol.blue)
310
+ end
311
+ end
312
+ return Wx::Bitmap.new(img)
313
+ end
314
+ end
315
+
316
+
317
+ class AuiFrame < Wx::Frame
318
+ consts = %w[
319
+ ID_CreateTree
320
+ ID_CreateGrid
321
+ ID_CreateText
322
+ ID_CreateHTML
323
+ ID_CreateNotebook
324
+ ID_CreateSizeReport
325
+ ID_GridContent
326
+ ID_TextContent
327
+ ID_TreeContent
328
+ ID_HTMLContent
329
+ ID_NotebookContent
330
+ ID_SizeReportContent
331
+ ID_CreatePerspective
332
+ ID_CopyPerspectiveCode
333
+ ID_AllowFloating
334
+ ID_AllowActivePane
335
+ ID_TransparentHint
336
+ ID_VenetianBlindsHint
337
+ ID_RectangleHint
338
+ ID_NoHint
339
+ ID_HintFade
340
+ ID_NoVenetianFade
341
+ ID_TransparentDrag
342
+ ID_NoGradient
343
+ ID_VerticalGradient
344
+ ID_HorizontalGradient
345
+ ID_Settings
346
+ ID_NotebookNoCloseButton
347
+ ID_NotebookCloseButton
348
+ ID_NotebookCloseButtonAll
349
+ ID_NotebookCloseButtonActive
350
+ ID_NotebookAllowTabMove
351
+ ID_NotebookAllowTabExternalMove
352
+ ID_NotebookAllowTabSplit
353
+ ID_NotebookWindowList
354
+ ID_NotebookScrollButtons
355
+ ID_NotebookTabFixedWidth
356
+ ID_NotebookArtGloss
357
+ ID_NotebookArtSimple ]
358
+
359
+ consts.each_with_index do | c, i |
360
+ const_set(c, 2000 + i)
361
+ end
362
+ ID_FirstPerspective = ID_CreatePerspective + 1000
363
+
364
+ def initialize(*args)
365
+ super
366
+ @mgr = Wx::AuiManager.new
367
+ @mgr.set_managed_window(self)
368
+ @perspectives = []
369
+
370
+ # set up default notebook style
371
+ @notebook_style = Wx::AUI_NB_DEFAULT_STYLE|
372
+ Wx::AUI_NB_TAB_EXTERNAL_MOVE|Wx::NO_BORDER
373
+ @notebook_theme = 0
374
+ setup_menu
375
+ create_status_bar
376
+ get_status_bar.set_status_text("Ready")
377
+ set_min_size( Wx::Size.new(400,300) )
378
+ setup_toolbars
379
+ setup_panes
380
+ setup_perspectives
381
+ setup_events
382
+ @mgr.update
383
+ end
384
+
385
+ #
386
+ def setup_menu
387
+ mb = Wx::MenuBar.new
388
+
389
+ file_menu = Wx::Menu.new
390
+ file_menu.append(Wx::ID_EXIT, "Exit")
391
+
392
+ view_menu = Wx::Menu.new
393
+ view_menu.append(ID_CreateText, "Create Text Control")
394
+ view_menu.append(ID_CreateHTML, "Create HTML Control")
395
+ view_menu.append(ID_CreateTree, "Create Tree")
396
+ view_menu.append(ID_CreateGrid, "Create Grid")
397
+ view_menu.append(ID_CreateNotebook, "Create Notebook")
398
+ view_menu.append(ID_CreateSizeReport, "Create Size Reporter")
399
+ view_menu.append_separator
400
+
401
+ view_menu.append( ID_GridContent,
402
+ "Use a Grid for the Content Pane")
403
+ view_menu.append( ID_TextContent,
404
+ "Use a Text Control for the Content Pane")
405
+ view_menu.append( ID_HTMLContent,
406
+ "Use an HTML Control for the Content Pane")
407
+ view_menu.append( ID_TreeContent,
408
+ "Use a Tree Control for the Content Pane")
409
+ view_menu.append( ID_NotebookContent,
410
+ "Use a wxAuiNotebook control for the Content Pane")
411
+ view_menu.append(ID_SizeReportContent,
412
+ "Use a Size Reporter for the Content Pane")
413
+
414
+ options_menu = Wx::Menu.new
415
+ # Hints
416
+ options_menu.append_radio_item( ID_TransparentHint,
417
+ "Transparent Hint")
418
+ options_menu.append_radio_item( ID_VenetianBlindsHint,
419
+ "Venetian Blinds Hint")
420
+ options_menu.append_radio_item( ID_RectangleHint,
421
+ "Rectangle Hint")
422
+ options_menu.append_radio_item( ID_NoHint,
423
+ "No Hint")
424
+
425
+ options_menu.append_separator
426
+ # Hints Options
427
+ options_menu.append_check_item( ID_HintFade,
428
+ "Hint Fade-in")
429
+ options_menu.append_check_item( ID_AllowFloating,
430
+ "Allow Floating")
431
+ options_menu.append_check_item( ID_NoVenetianFade,
432
+ "Disable Venetian Blinds Hint Fade-in")
433
+ options_menu.append_check_item( ID_TransparentDrag,
434
+ "Transparent Drag")
435
+ options_menu.append_check_item( ID_AllowActivePane,
436
+ "Allow Active Pane")
437
+ options_menu.append_separator
438
+ options_menu.append_radio_item( ID_NoGradient,
439
+ "No Caption Gradient")
440
+ options_menu.append_radio_item( ID_VerticalGradient,
441
+ "Vertical Caption Gradient")
442
+ options_menu.append_radio_item( ID_HorizontalGradient,
443
+ "Horizontal Caption Gradient")
444
+ options_menu.append_separator
445
+ options_menu.append(ID_Settings, "Settings Pane")
446
+
447
+ notebook_menu = Wx::Menu.new
448
+ notebook_menu.append_radio_item( ID_NotebookArtGloss,
449
+ "Glossy Theme (Default)")
450
+ notebook_menu.append_radio_item( ID_NotebookArtSimple,
451
+ "Simple Theme")
452
+
453
+ notebook_menu.append_separator
454
+
455
+ notebook_menu.append_radio_item( ID_NotebookNoCloseButton,
456
+ "No Close Button")
457
+ notebook_menu.append_radio_item( ID_NotebookCloseButton,
458
+ "Close Button at Right")
459
+ notebook_menu.append_radio_item( ID_NotebookCloseButtonAll,
460
+ "Close Button on All Tabs")
461
+ notebook_menu.append_radio_item( ID_NotebookCloseButtonActive,
462
+ "Close Button on Active Tab")
463
+
464
+ notebook_menu.append_separator
465
+ notebook_menu.append_check_item( ID_NotebookAllowTabMove,
466
+ "Allow Tab Move")
467
+ notebook_menu.append_check_item( ID_NotebookAllowTabExternalMove,
468
+ "Allow External Tab Move")
469
+ notebook_menu.append_check_item( ID_NotebookAllowTabSplit,
470
+ "Allow Notebook Split")
471
+ notebook_menu.append_check_item( ID_NotebookScrollButtons,
472
+ "Scroll Buttons Visible")
473
+ notebook_menu.append_check_item( ID_NotebookWindowList,
474
+ "Window List Button Visible")
475
+ notebook_menu.append_check_item( ID_NotebookTabFixedWidth,
476
+ "Fixed-width Tabs")
477
+
478
+ @perspectives_menu = Wx::Menu.new
479
+ @perspectives_menu.append( ID_CreatePerspective,
480
+ "Create Perspective")
481
+ @perspectives_menu.append( ID_CopyPerspectiveCode,
482
+ "Copy Perspective Data To Clipboard")
483
+ @perspectives_menu.append_separator
484
+ @perspectives_menu.append( ID_FirstPerspective + 0, "Default Startup")
485
+ @perspectives_menu.append( ID_FirstPerspective + 1, "All Panes")
486
+
487
+ help_menu = Wx::Menu.new
488
+ help_menu.append(Wx::ID_ABOUT, "About...")
489
+
490
+ mb.append(file_menu, "File")
491
+ mb.append(view_menu, "View")
492
+ mb.append(@perspectives_menu, "Perspectives")
493
+ mb.append(options_menu, "Options")
494
+ mb.append(notebook_menu, "Notebook")
495
+ mb.append(help_menu, "Help")
496
+
497
+ set_menu_bar(mb)
498
+ end
499
+
500
+ def setup_events
501
+ evt_erase_background { | e | on_erase_background(e) }
502
+ evt_size{ | e | on_size(e) }
503
+
504
+ evt_menu(ID_CreateTree) { | e | on_create_tree }
505
+ evt_menu(ID_CreateGrid) { | e | on_create_grid }
506
+ evt_menu(ID_CreateText) { | e | on_create_text }
507
+ evt_menu(ID_CreateHTML) { | e | on_create_html }
508
+ evt_menu(ID_CreateSizeReport) { | e | on_create_size_report }
509
+ evt_menu(ID_CreateNotebook) { | e | on_create_notebook }
510
+ evt_menu(ID_CreatePerspective) { | e | on_create_perspective }
511
+ evt_menu(ID_CopyPerspectiveCode) { | e | on_copy_perspective_code}
512
+ evt_menu(ID_AllowFloating) { | e | on_manager_flag(e) }
513
+ evt_menu(ID_TransparentHint) { | e | on_manager_flag(e) }
514
+ evt_menu(ID_VenetianBlindsHint) { | e | on_manager_flag(e) }
515
+ evt_menu(ID_RectangleHint) { | e | on_manager_flag(e) }
516
+ evt_menu(ID_NoHint) { | e | on_manager_flag(e) }
517
+ evt_menu(ID_HintFade) { | e | on_manager_flag(e) }
518
+ evt_menu(ID_NoVenetianFade) { | e | on_manager_flag(e) }
519
+ evt_menu(ID_TransparentDrag) { | e | on_manager_flag(e) }
520
+ evt_menu(ID_AllowActivePane) { | e | on_manager_flag(e) }
521
+ evt_menu(ID_NotebookTabFixedWidth) { | e | on_notebook_flag(e) }
522
+ evt_menu(ID_NotebookNoCloseButton) { | e | on_notebook_flag(e) }
523
+ evt_menu(ID_NotebookCloseButton) { | e | on_notebook_flag(e) }
524
+ evt_menu(ID_NotebookCloseButtonAll) { | e | on_notebook_flag(e) }
525
+ evt_menu(ID_NotebookCloseButtonActive) { | e | on_notebook_flag(e) }
526
+ evt_menu(ID_NotebookAllowTabMove) { | e | on_notebook_flag(e) }
527
+ evt_menu(ID_NotebookAllowTabExternalMove) { | e | on_notebook_flag(e) }
528
+ evt_menu(ID_NotebookAllowTabSplit) { | e | on_notebook_flag(e) }
529
+ evt_menu(ID_NotebookScrollButtons) { | e | on_notebook_flag(e) }
530
+ evt_menu(ID_NotebookWindowList) { | e | on_notebook_flag(e) }
531
+ evt_menu(ID_NotebookArtGloss) { | e | on_notebook_flag(e) }
532
+ evt_menu(ID_NotebookArtSimple) { | e | on_notebook_flag(e) }
533
+ evt_menu(ID_NoGradient) { | e | on_gradient(e) }
534
+ evt_menu(ID_VerticalGradient) { | e | on_gradient(e) }
535
+ evt_menu(ID_HorizontalGradient) { | e | on_gradient(e) }
536
+ evt_menu(ID_Settings) { on_settings }
537
+ evt_menu(ID_GridContent) { | e | on_change_content_pane(e) }
538
+ evt_menu(ID_TreeContent) { | e | on_change_content_pane(e) }
539
+ evt_menu(ID_TextContent) { | e | on_change_content_pane(e) }
540
+ evt_menu(ID_SizeReportContent) { | e | on_change_content_pane(e) }
541
+ evt_menu(ID_HTMLContent) { | e | on_change_content_pane(e) }
542
+ evt_menu(ID_NotebookContent) { | e | on_change_content_pane(e) }
543
+ evt_menu(Wx::ID_EXIT) { | e | on_exit }
544
+ evt_menu(Wx::ID_ABOUT) { | e | on_about }
545
+ evt_update_ui(ID_NotebookTabFixedWidth) { | e | on_update_ui(e) }
546
+ evt_update_ui(ID_NotebookNoCloseButton) { | e | on_update_ui(e) }
547
+ evt_update_ui(ID_NotebookCloseButton) { | e | on_update_ui(e) }
548
+ evt_update_ui(ID_NotebookCloseButtonAll) { | e | on_update_ui(e) }
549
+ evt_update_ui(ID_NotebookCloseButtonActive) { | e | on_update_ui(e) }
550
+ evt_update_ui(ID_NotebookAllowTabMove) { | e | on_update_ui(e) }
551
+ evt_update_ui(ID_NotebookAllowTabExternalMove) { | e | on_update_ui(e) }
552
+ evt_update_ui(ID_NotebookAllowTabSplit) { | e | on_update_ui(e) }
553
+ evt_update_ui(ID_NotebookScrollButtons) { | e | on_update_ui(e) }
554
+ evt_update_ui(ID_NotebookWindowList) { | e | on_update_ui(e) }
555
+ evt_update_ui(ID_AllowFloating) { | e | on_update_ui(e) }
556
+ evt_update_ui(ID_TransparentHint) { | e | on_update_ui(e) }
557
+ evt_update_ui(ID_VenetianBlindsHint) { | e | on_update_ui(e) }
558
+ evt_update_ui(ID_RectangleHint) { | e | on_update_ui(e) }
559
+ evt_update_ui(ID_NoHint) { | e | on_update_ui(e) }
560
+ evt_update_ui(ID_HintFade) { | e | on_update_ui(e) }
561
+ evt_update_ui(ID_NoVenetianFade) { | e | on_update_ui(e) }
562
+ evt_update_ui(ID_TransparentDrag) { | e | on_update_ui(e) }
563
+ evt_update_ui(ID_NoGradient) { | e | on_update_ui(e) }
564
+ evt_update_ui(ID_VerticalGradient) { | e | on_update_ui(e) }
565
+ evt_update_ui(ID_HorizontalGradient) { | e | on_update_ui(e) }
566
+ evt_menu_range( ID_FirstPerspective,
567
+ ID_FirstPerspective + @perspectives.length) { | e | }
568
+ evt_aui_pane_close { | e | on_pane_close(e) }
569
+ evt_auinotebook_page_close(Wx::ID_ANY) { | e | on_notebook_page_close(e) }
570
+ end
571
+
572
+ # create some toolbars
573
+ def setup_toolbars
574
+ tb1 = Wx::ToolBar.new( self, Wx::ID_ANY,
575
+ Wx::DEFAULT_POSITION,
576
+ Wx::DEFAULT_SIZE,
577
+ Wx::TB_FLAT|Wx::TB_NODIVIDER)
578
+ tb1.set_tool_bitmap_size( Wx::Size.new(48,48) )
579
+ tb1.add_tool( 101, "Test",
580
+ Wx::ArtProvider::get_bitmap(Wx::ART_ERROR) )
581
+ tb1.add_separator
582
+ tb1.add_tool( 102, "Test",
583
+ Wx::ArtProvider::get_bitmap(Wx::ART_QUESTION) )
584
+ tb1.add_tool( 103, "Test",
585
+ Wx::ArtProvider::get_bitmap(Wx::ART_INFORMATION) )
586
+ tb1.add_tool( 103, "Test",
587
+ Wx::ArtProvider::get_bitmap(Wx::ART_WARNING));
588
+ tb1.add_tool( 103, "Test",
589
+ Wx::ArtProvider::get_bitmap(Wx::ART_MISSING_IMAGE));
590
+ tb1.realize
591
+
592
+
593
+ tb2 = Wx::ToolBar.new( self, Wx::ID_ANY, Wx::DEFAULT_POSITION,
594
+ Wx::DEFAULT_SIZE,
595
+ Wx::TB_FLAT|Wx::TB_NODIVIDER )
596
+ tb2.set_tool_bitmap_size( Wx::Size.new(16,16) )
597
+
598
+ tb2_bmp1 = Wx::ArtProvider::get_bitmap( Wx::ART_QUESTION,
599
+ Wx::ART_OTHER,
600
+ Wx::Size.new(16,16) )
601
+ tb2.add_tool(101, "Test", tb2_bmp1);
602
+ tb2.add_tool(101, "Test", tb2_bmp1);
603
+ tb2.add_tool(101, "Test", tb2_bmp1);
604
+ tb2.add_tool(101, "Test", tb2_bmp1);
605
+ tb2.add_separator
606
+ tb2.add_tool(101, "Test", tb2_bmp1);
607
+ tb2.add_tool(101, "Test", tb2_bmp1);
608
+ tb2.add_separator
609
+ tb2.add_tool(101, "Test", tb2_bmp1);
610
+ tb2.add_tool(101, "Test", tb2_bmp1);
611
+ tb2.add_tool(101, "Test", tb2_bmp1);
612
+ tb2.add_tool(101, "Test", tb2_bmp1);
613
+ tb2.realize
614
+
615
+
616
+ tb3 = Wx::ToolBar.new(self, Wx::ID_ANY,
617
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
618
+ Wx::TB_FLAT|Wx::TB_NODIVIDER)
619
+ tb3.set_tool_bitmap_size( Wx::Size.new(16,16) )
620
+ tb3_bmp1 = Wx::ArtProvider::get_bitmap( Wx::ART_FOLDER,
621
+ Wx::ART_OTHER,
622
+ Wx::Size.new(16,16) )
623
+ tb3.add_tool(101, "Test", tb3_bmp1)
624
+ tb3.add_tool(101, "Test", tb3_bmp1)
625
+ tb3.add_tool(101, "Test", tb3_bmp1)
626
+ tb3.add_tool(101, "Test", tb3_bmp1)
627
+ tb3.add_separator
628
+ tb3.add_tool(101, "Test", tb3_bmp1)
629
+ tb3.add_tool(101, "Test", tb3_bmp1)
630
+ tb3.realize
631
+
632
+
633
+ tb4 = Wx::ToolBar.new( self, Wx::ID_ANY,
634
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
635
+ Wx::TB_FLAT|Wx::TB_NODIVIDER|Wx::TB_HORZ_TEXT)
636
+ tb4.set_tool_bitmap_size( Wx::Size.new(16, 16) )
637
+ tb4_bmp1 = Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE,
638
+ Wx::ART_OTHER,
639
+ Wx::Size.new(16, 16) )
640
+ tb4.add_tool(101, "Item 1", tb4_bmp1)
641
+ tb4.add_tool(101, "Item 2", tb4_bmp1)
642
+ tb4.add_tool(101, "Item 3", tb4_bmp1)
643
+ tb4.add_tool(101, "Item 4", tb4_bmp1)
644
+ tb4.add_separator
645
+ tb4.add_tool(101, "Item 5", tb4_bmp1)
646
+ tb4.add_tool(101, "Item 6", tb4_bmp1)
647
+ tb4.add_tool(101, "Item 7", tb4_bmp1)
648
+ tb4.add_tool(101, "Item 8", tb4_bmp1)
649
+ tb4.realize
650
+
651
+ # create some toolbars
652
+ tb5 = Wx::ToolBar.new( self, Wx::ID_ANY,
653
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
654
+ Wx::TB_FLAT|Wx::TB_NODIVIDER|Wx::TB_VERTICAL)
655
+ tb5.set_tool_bitmap_size( Wx::Size.new(48,48))
656
+ tb5.add_tool( 101, "Test",
657
+ Wx::ArtProvider::get_bitmap(Wx::ART_ERROR) )
658
+ tb5.add_separator
659
+ tb5.add_tool( 102, "Test",
660
+ Wx::ArtProvider::get_bitmap(Wx::ART_QUESTION) )
661
+ tb5.add_tool( 103, "Test",
662
+ Wx::ArtProvider::get_bitmap(Wx::ART_INFORMATION) )
663
+ tb5.add_tool( 103, "Test",
664
+ Wx::ArtProvider::get_bitmap(Wx::ART_WARNING) )
665
+ tb5.add_tool( 103, "Test",
666
+ Wx::ArtProvider::get_bitmap(Wx::ART_MISSING_IMAGE) )
667
+ tb5.realize
668
+
669
+ # add the toolbars to the manager
670
+ pi = Wx::AuiPaneInfo.new
671
+ pi.set_name('tb1').set_caption("Big Toolbar").toolbar_pane
672
+ pi.top.set_left_dockable(false).set_right_dockable(false)
673
+ @mgr.add_pane(tb1, pi)
674
+
675
+
676
+ pi = Wx::AuiPaneInfo.new
677
+ pi.set_name('tb2').set_caption("Toolbar 2").toolbar_pane
678
+ pi.top.set_row(1)
679
+ pi.set_left_dockable(false).set_right_dockable(false)
680
+ @mgr.add_pane(tb2, pi)
681
+
682
+ pi = Wx::AuiPaneInfo.new
683
+ pi.set_name('tb3').set_caption("Toolbar 3").toolbar_pane
684
+ pi.top.set_row(1).set_position(1)
685
+ pi.set_left_dockable(false).set_right_dockable(false)
686
+ @mgr.add_pane(tb3, pi)
687
+
688
+ pi = Wx::AuiPaneInfo.new
689
+ pi.set_name('tb4').set_caption("Sample Bookmark Toolbar")
690
+ pi.toolbar_pane.top.set_row(2)
691
+ pi.set_left_dockable(false).set_right_dockable(false)
692
+ @mgr.add_pane(tb4, pi)
693
+
694
+ pi = Wx::AuiPaneInfo.new
695
+ pi.set_name('tb5').set_caption("Sample Vertical Toolbar")
696
+ pi.toolbar_pane.left.set_gripper_top
697
+ pi.set_left_dockable(false).set_right_dockable(false)
698
+ @mgr.add_pane(tb5, pi)
699
+ end
700
+
701
+ def setup_panes
702
+ # add a bunch of panes
703
+ pi = Wx::AuiPaneInfo.new
704
+ pi.set_name('test1').set_caption('Pane Caption').top
705
+ @mgr.add_pane(create_size_report_ctrl, pi)
706
+
707
+ pi = Wx::AuiPaneInfo.new
708
+ pi.set_name('test2').set_caption('Client Size Reporter').bottom
709
+ pi.set_position(1).set_close_button.set_maximize_button
710
+ @mgr.add_pane(create_size_report_ctrl, pi)
711
+
712
+ pi = Wx::AuiPaneInfo.new
713
+ pi.set_name('test3').set_caption('Client Size Reporter').bottom
714
+ pi.set_close_button.set_maximize_button
715
+ @mgr.add_pane(create_size_report_ctrl, pi)
716
+
717
+ pi = Wx::AuiPaneInfo.new
718
+ pi.set_name('test4').set_caption('Pane Caption').left
719
+ @mgr.add_pane(create_size_report_ctrl, pi)
720
+
721
+ pi = Wx::AuiPaneInfo.new
722
+ pi.set_name('test5').set_caption('No Close Button').right
723
+ pi.set_close_button(false)
724
+ @mgr.add_pane(create_size_report_ctrl, pi)
725
+
726
+ pi = Wx::AuiPaneInfo.new
727
+ pi.set_name('test6').set_caption('Client Size Report').right
728
+ pi.set_row(1).set_close_button.set_maximize_button
729
+ @mgr.add_pane(create_size_report_ctrl, pi)
730
+
731
+ pi = Wx::AuiPaneInfo.new
732
+ pi.set_name('test7').set_caption('Client Size Report').left
733
+ pi.set_layer(1).set_close_button.set_maximize_button
734
+ @mgr.add_pane(create_size_report_ctrl, pi)
735
+
736
+ pi = Wx::AuiPaneInfo.new
737
+ pi.set_name('test8').set_caption('Tree Pane').left
738
+ pi.set_layer(1).set_position(1).set_close_button.set_maximize_button
739
+ @mgr.add_pane(create_tree_ctrl, pi)
740
+
741
+ pi = Wx::AuiPaneInfo.new
742
+ pi_size = Wx::Size.new(200, 100)
743
+ pi.set_name('test9').set_caption('Min Size 200x100').bottom
744
+ pi.set_best_size(pi_size).set_min_size(pi_size)
745
+ pi.set_layer(1).set_close_button.set_maximize_button
746
+ @mgr.add_pane(create_size_report_ctrl, pi)
747
+
748
+ wnd10 = create_text_ctrl("This pane will prompt the user before hiding.")
749
+ pi = Wx::AuiPaneInfo.new
750
+ pi.set_name('test10').set_caption('Text Pane with hide prompt')
751
+ pi.bottom.set_layer(1).set_position(1)
752
+ @mgr.add_pane(wnd10, pi)
753
+
754
+ pi = Wx::AuiPaneInfo.new
755
+ pi.set_name('test11').set_caption('Fixed Pane').bottom
756
+ pi.set_layer(1).set_position(2).fixed
757
+ @mgr.add_pane(create_size_report_ctrl, pi)
758
+
759
+
760
+ pi = Wx::AuiPaneInfo.new
761
+ pi.set_name('settings').set_caption('Dock Manager Settings')
762
+ pi.set_dockable(false).float.hide
763
+
764
+ @mgr.add_pane(SettingsPanel.new(self, self), pi)
765
+
766
+ # create some center panes
767
+
768
+ pi = Wx::AuiPaneInfo.new
769
+ pi.set_name('grid_content').center_pane.hide
770
+ @mgr.add_pane(create_grid, pi)
771
+
772
+ pi = Wx::AuiPaneInfo.new
773
+ pi.set_name('tree_content').center_pane.hide
774
+ @mgr.add_pane(create_tree_ctrl, pi)
775
+
776
+ pi = Wx::AuiPaneInfo.new
777
+ pi.set_name('sizereport_content').center_pane.hide
778
+ @mgr.add_pane(create_size_report_ctrl, pi)
779
+
780
+ pi = Wx::AuiPaneInfo.new
781
+ pi.set_name('text_content').center_pane.hide
782
+ @mgr.add_pane(create_text_ctrl, pi)
783
+
784
+ pi = Wx::AuiPaneInfo.new
785
+ pi.set_name('html_content').center_pane.hide
786
+ @mgr.add_pane(create_html_ctrl, pi)
787
+
788
+ pi = Wx::AuiPaneInfo.new
789
+ pi.set_name('notebook_content').center_pane.hide
790
+ @mgr.add_pane(create_notebook, pi)
791
+
792
+ pi = Wx::AuiPaneInfo.new
793
+ pi.set_name('tb6').toolbar_pane.top
794
+ pi.set_row(2).set_position(1)
795
+ pi.set_left_dockable(false).set_right_dockable(false)
796
+ @mgr.add_pane(Wx::Button.new(self, Wx::ID_ANY, "Test Button"), pi)
797
+ end
798
+
799
+ # make some default perspectives
800
+ def setup_perspectives
801
+ perspective_all = @mgr.save_perspective
802
+
803
+ @mgr.get_all_panes.each do | pane |
804
+ pane.hide unless pane.is_toolbar
805
+ end
806
+
807
+ @mgr.get_pane("tb1").hide
808
+ @mgr.get_pane("tb6").hide
809
+ @mgr.get_pane("test8").show.left.set_layer(0).set_row(0).set_position(0)
810
+ @mgr.get_pane("test10").show.bottom.set_layer(0).set_row(0).set_position(0)
811
+ @mgr.get_pane("notebook_content").show()
812
+ perspective_default = @mgr.save_perspective
813
+
814
+ @perspectives << perspective_default
815
+ @perspectives << perspective_all
816
+ end
817
+
818
+ def get_dock_art
819
+ @mgr.get_art_provider
820
+ end
821
+
822
+ def do_update
823
+ @mgr.update
824
+ end
825
+
826
+ def on_erase_background(event)
827
+ event.skip
828
+ end
829
+
830
+ def on_size(event)
831
+ event.skip
832
+ end
833
+
834
+ def on_settings
835
+ float_pane = @mgr.get_pane("settings").float.show
836
+ if float_pane.get_floating_position == Wx::DEFAULT_POSITION
837
+ float_pane.set_floating_position( get_start_position )
838
+ end
839
+ @mgr.update
840
+ end
841
+
842
+ def on_gradient(event)
843
+ gradient = nil
844
+ case event.get_id
845
+ when ID_NoGradient
846
+ gradient = Wx::AUI_GRADIENT_NONE
847
+ when ID_VerticalGradient
848
+ gradient = Wx::AUI_GRADIENT_VERTICAL
849
+ when ID_HorizontalGradient
850
+ gradient = Wx::AUI_GRADIENT_HORIZONTAL
851
+ end
852
+ return if not gradient
853
+ @mgr.get_art_provider.set_metric( Wx::AUI_DOCKART_GRADIENT_TYPE,
854
+ gradient)
855
+ @mgr.update
856
+ end
857
+
858
+ def on_manager_flag(event)
859
+ e_id = event.get_id
860
+ if e_id == ID_TransparentHint or
861
+ e_id == ID_VenetianBlindsHint or
862
+ e_id == ID_RectangleHint or
863
+ e_id == ID_NoHint
864
+ flags = @mgr.get_flags
865
+ flags &= ~Wx::AUI_MGR_TRANSPARENT_HINT
866
+ flags &= ~Wx::AUI_MGR_VENETIAN_BLINDS_HINT
867
+ flags &= ~Wx::AUI_MGR_RECTANGLE_HINT
868
+ @mgr.set_flags(flags)
869
+ end
870
+
871
+ flag = nil
872
+ case e_id
873
+ when ID_AllowFloating
874
+ flag = Wx::AUI_MGR_ALLOW_FLOATING
875
+ when ID_TransparentDrag
876
+ flag = Wx::AUI_MGR_TRANSPARENT_DRAG
877
+ when ID_HintFade
878
+ flag = Wx::AUI_MGR_HINT_FADE
879
+ when ID_NoVenetianFade
880
+ flag = Wx::AUI_MGR_NO_VENETIAN_BLINDS_FADE
881
+ when ID_AllowActivePane
882
+ flag = Wx::AUI_MGR_ALLOW_ACTIVE_PANE
883
+ when ID_TransparentHint
884
+ flag = Wx::AUI_MGR_TRANSPARENT_HINT
885
+ when ID_VenetianBlindsHint
886
+ flag = Wx::AUI_MGR_VENETIAN_BLINDS_HINT
887
+ when ID_RectangleHint
888
+ flag = Wx::AUI_MGR_RECTANGLE_HINT
889
+ end
890
+
891
+ if flag
892
+ @mgr.set_flags(@mgr.get_flags ^ flag)
893
+ end
894
+
895
+ @mgr.update
896
+ end
897
+
898
+ def on_notebook_flag(event)
899
+ e_id = event.get_id
900
+
901
+ if e_id == ID_NotebookNoCloseButton or
902
+ e_id == ID_NotebookCloseButton or
903
+ e_id == ID_NotebookCloseButtonAll or
904
+ e_id == ID_NotebookCloseButtonActive
905
+ @notebook_style &= ~( Wx::AUI_NB_CLOSE_BUTTON|
906
+ Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB|
907
+ Wx::AUI_NB_CLOSE_ON_ALL_TABS )
908
+ end
909
+
910
+ case e_id
911
+ when ID_NotebookNoCloseButton
912
+ # nothing
913
+ when ID_NotebookCloseButton
914
+ @notebook_style |= Wx::AUI_NB_CLOSE_BUTTON
915
+ when ID_NotebookCloseButtonAll
916
+ @notebook_style |= Wx::AUI_NB_CLOSE_ON_ALL_TABS
917
+ when ID_NotebookCloseButtonActive
918
+ @notebook_style |= Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB
919
+ end
920
+
921
+ if e_id == ID_NotebookAllowTabMove
922
+ @notebook_style ^= Wx::AUI_NB_TAB_MOVE
923
+ end
924
+
925
+ if e_id == ID_NotebookAllowTabExternalMove
926
+ @notebook_style ^= Wx::AUI_NB_TAB_EXTERNAL_MOVE
927
+ elsif e_id == ID_NotebookAllowTabSplit
928
+ @notebook_style ^= Wx::AUI_NB_TAB_SPLIT
929
+ elsif e_id == ID_NotebookWindowList
930
+ @notebook_style ^= Wx::AUI_NB_WINDOWLIST_BUTTON
931
+ elsif e_id == ID_NotebookScrollButtons
932
+ @notebook_style ^= Wx::AUI_NB_SCROLL_BUTTONS
933
+ elsif e_id == ID_NotebookTabFixedWidth
934
+ @notebook_style ^= Wx::AUI_NB_TAB_FIXED_WIDTH
935
+ end
936
+
937
+
938
+ @mgr.get_all_panes.each do | pane |
939
+ maybe_nb = pane.get_window
940
+ next unless maybe_nb.kind_of?(Wx::AuiNotebook)
941
+ if e_id == ID_NotebookArtGloss
942
+ maybe_nb.set_art_provider(Wx::AuiDefaultTabArt.new)
943
+ @notebook_theme = 0
944
+ elsif e_id == ID_NotebookArtSimple
945
+ maybe_nb.set_art_provider(Wx::AuiSimpleTabArt.new)
946
+ @notebook_theme = 1
947
+ end
948
+
949
+ maybe_nb.set_window_style_flag(@notebook_style)
950
+ maybe_nb.refresh()
951
+ end
952
+ end
953
+
954
+ def on_update_ui(event)
955
+ flags = @mgr.get_flags
956
+
957
+ case event.get_id
958
+ when ID_NoGradient
959
+ event.check(@mgr.get_art_provider.get_metric(Wx::AUI_DOCKART_GRADIENT_TYPE) == Wx::AUI_GRADIENT_NONE)
960
+ when ID_VerticalGradient
961
+ event.check(@mgr.get_art_provider.get_metric(Wx::AUI_DOCKART_GRADIENT_TYPE) == Wx::AUI_GRADIENT_VERTICAL)
962
+ when ID_HorizontalGradient
963
+ event.check(@mgr.get_art_provider.get_metric(Wx::AUI_DOCKART_GRADIENT_TYPE) == Wx::AUI_GRADIENT_HORIZONTAL)
964
+ when ID_AllowFloating
965
+ event.check((flags & Wx::AUI_MGR_ALLOW_FLOATING) != 0)
966
+ when ID_TransparentDrag
967
+ event.check((flags & Wx::AUI_MGR_TRANSPARENT_DRAG) != 0)
968
+ when ID_TransparentHint
969
+ event.check((flags & Wx::AUI_MGR_TRANSPARENT_HINT) != 0)
970
+ when ID_VenetianBlindsHint
971
+ event.check((flags & Wx::AUI_MGR_VENETIAN_BLINDS_HINT) != 0)
972
+ when ID_RectangleHint
973
+ event.check((flags & Wx::AUI_MGR_RECTANGLE_HINT) != 0)
974
+ when ID_NoHint
975
+ event.check( (Wx::AUI_MGR_TRANSPARENT_HINT|
976
+ Wx::AUI_MGR_VENETIAN_BLINDS_HINT|
977
+ Wx::AUI_MGR_RECTANGLE_HINT) & flags == 0)
978
+ when ID_HintFade
979
+ event.check((flags & Wx::AUI_MGR_HINT_FADE) != 0)
980
+ when ID_NoVenetianFade
981
+ event.check((flags & Wx::AUI_MGR_NO_VENETIAN_BLINDS_FADE) != 0)
982
+ when ID_NotebookNoCloseButton
983
+ event.check( (@notebook_style &
984
+ ( Wx::AUI_NB_CLOSE_BUTTON|
985
+ Wx::AUI_NB_CLOSE_ON_ALL_TABS|
986
+ Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB) ) != 0)
987
+ when ID_NotebookCloseButton
988
+ event.check((@notebook_style & Wx::AUI_NB_CLOSE_BUTTON) != 0)
989
+ when ID_NotebookCloseButtonAll
990
+ event.check((@notebook_style & Wx::AUI_NB_CLOSE_ON_ALL_TABS) != 0)
991
+ when ID_NotebookCloseButtonActive
992
+ event.check((@notebook_style & Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB) != 0)
993
+ when ID_NotebookAllowTabSplit:
994
+ event.check((@notebook_style & Wx::AUI_NB_TAB_SPLIT) != 0)
995
+ when ID_NotebookAllowTabMove
996
+ event.check((@notebook_style & Wx::AUI_NB_TAB_MOVE) != 0)
997
+ when ID_NotebookAllowTabExternalMove
998
+ event.check((@notebook_style & Wx::AUI_NB_TAB_EXTERNAL_MOVE) != 0)
999
+ when ID_NotebookScrollButtons
1000
+ event.check((@notebook_style & Wx::AUI_NB_SCROLL_BUTTONS) != 0)
1001
+ when ID_NotebookWindowList
1002
+ event.check((@notebook_style & Wx::AUI_NB_WINDOWLIST_BUTTON) != 0)
1003
+ when ID_NotebookTabFixedWidth
1004
+ event.check((@notebook_style & Wx::AUI_NB_TAB_FIXED_WIDTH) != 0)
1005
+ when ID_NotebookArtGloss
1006
+ event.check(@notebook_style == 0)
1007
+ when ID_NotebookArtSimple
1008
+ event.check(@notebook_style == 1)
1009
+ end
1010
+ end
1011
+
1012
+ def on_pane_close(event)
1013
+ if event.get_pane.get_name == "test10"
1014
+ msg = "Are you sure you want to close/hide this pane?"
1015
+ dlg = Wx::MessageDialog.new(self, msg, "Wx::AUI", Wx::YES_NO)
1016
+ if dlg.show_modal != Wx::ID_YES
1017
+ return event.veto
1018
+ end
1019
+ end
1020
+ end
1021
+
1022
+
1023
+ def on_create_perspective
1024
+ msg = "Enter a name for the new perspective:"
1025
+ dlg = Wx::TextEntryDialog.new(self, msg, "Wx::AUI Test")
1026
+ dlg.set_value("Perspective %d" % @perspectives.length + 1)
1027
+ return unless dlg.show_modal != Wx::ID_OK
1028
+ if @perspectives.length.zero?
1029
+ @perspectives_menu.append_separator
1030
+ end
1031
+ @perspectives_menu.append(ID_FirstPerspective + @perspectives.length,
1032
+ dlg.get_value)
1033
+ @perspectives << @mgr.save_perspective
1034
+ end
1035
+
1036
+ def on_copy_perspective_code
1037
+ Kernel.raise NotImplementedError
1038
+ end
1039
+
1040
+ def on_restore_perspective(event)
1041
+ perspective = @perspectives[ event.get_id - ID_FirstPerspective]
1042
+ @mgr.load_perspective(perspective)
1043
+ end
1044
+
1045
+ def on_notebook_page_close(event)
1046
+ notebook = event.get_event_object
1047
+ if notebook.get_page(event.get_selection).kind_of?(Wx::HtmlWindow)
1048
+ msg = "Are you sure you want to close/hide this notebook page?"
1049
+ dlg = Wx::MessageDialog.new(self, msg, "Wx::AUI", Wx::YES_NO)
1050
+ if dlg.show_modal != Wx::ID_YES
1051
+ event.veto
1052
+ else
1053
+ event.allow
1054
+ end
1055
+ end
1056
+ end
1057
+
1058
+ def get_start_position
1059
+ origin = client_to_screen( Wx::Point.new(0, 0) )
1060
+ return Wx::Point.new(origin.x + 20, origin.y + 20)
1061
+ end
1062
+
1063
+ def on_create_tree
1064
+ pi = Wx::AuiPaneInfo.new
1065
+ pi.set_caption("Tree Control").float
1066
+ pi.set_floating_position(get_start_position)
1067
+ pi.set_floating_size(Wx::Size.new(150, 300))
1068
+ @mgr.add_pane( create_tree_ctrl, pi)
1069
+ @mgr.update
1070
+ end
1071
+
1072
+ def on_create_grid
1073
+ pi = Wx::AuiPaneInfo.new
1074
+ pi.set_caption("Grid").float
1075
+ pi.set_floating_position(get_start_position)
1076
+ pi.set_floating_size(Wx::Size.new(300, 200))
1077
+ @mgr.add_pane( create_grid, pi)
1078
+ @mgr.update
1079
+ end
1080
+
1081
+ def on_create_html
1082
+ pi = Wx::AuiPaneInfo.new
1083
+ pi.set_caption("HTML Control").float
1084
+ pi.set_floating_position(get_start_position)
1085
+ pi.set_floating_size(Wx::Size.new(300, 200))
1086
+ @mgr.add_pane( create_html_ctrl, pi)
1087
+ @mgr.update
1088
+ end
1089
+
1090
+ def on_create_notebook
1091
+ pi = Wx::AuiPaneInfo.new
1092
+ pi.set_caption("Notebook").float
1093
+ pi.set_floating_position(get_start_position)
1094
+ pi.set_close_button.set_maximize_button
1095
+ @mgr.add_pane( create_notebook, pi)
1096
+ @mgr.update
1097
+ end
1098
+
1099
+ def on_create_text
1100
+ pi = Wx::AuiPaneInfo.new
1101
+ pi.set_caption("Text Control").float
1102
+ pi.set_floating_position(get_start_position)
1103
+ @mgr.add_pane( create_text_ctrl, pi)
1104
+ @mgr.update
1105
+ end
1106
+
1107
+ def on_create_size_report
1108
+ pi = Wx::AuiPaneInfo.new
1109
+ pi.set_caption("Client Size Reporter").float
1110
+ pi.set_floating_position(get_start_position)
1111
+ pi.set_close_button.set_maximize_button
1112
+ @mgr.add_pane( create_size_report, pi)
1113
+ @mgr.update
1114
+ end
1115
+
1116
+ def on_change_content_pane(event)
1117
+ e_id = event.get_id
1118
+ @mgr.get_pane("grid_content").show(e_id == ID_GridContent)
1119
+ @mgr.get_pane("text_content").show(e_id == ID_TextContent)
1120
+ @mgr.get_pane("tree_content").show(e_id == ID_TreeContent)
1121
+ @mgr.get_pane("sizereport_content").show(e_id == ID_SizeReportContent)
1122
+ @mgr.get_pane("html_content").show(e_id == ID_HTMLContent)
1123
+ @mgr.get_pane("notebook_content").show(e_id == ID_NotebookContent)
1124
+ @mgr.update
1125
+ end
1126
+
1127
+ def on_exit
1128
+ close(true)
1129
+ end
1130
+
1131
+ def on_about
1132
+ msg = "Wx::AUI Demo\nAn advanced window management library for wxRuby\nAdapted by Alex Fenton from the wxWidgets AUI Demo\n which is (c) Copyright 2005-2006, Kirix Corporation"
1133
+ dlg = Wx::MessageDialog.new(self, msg, "Wx::AUI", Wx::OK)
1134
+ dlg.show_modal
1135
+ end
1136
+
1137
+ def create_text_ctrl(text = "")
1138
+ if text.empty?
1139
+ text = "This is a test text box"
1140
+ end
1141
+ Wx::TextCtrl.new( self, Wx::ID_ANY, text,
1142
+ Wx::Point.new(0, 0), Wx::Size.new(150, 90),
1143
+ Wx::NO_BORDER|Wx::TE_MULTILINE)
1144
+ end
1145
+
1146
+ def create_grid
1147
+ grid = Wx::Grid.new(self, Wx::ID_ANY,
1148
+ Wx::Point.new(0, 0),
1149
+ Wx::Size.new(150, 250),
1150
+ Wx::NO_BORDER|Wx::WANTS_CHARS)
1151
+ grid.create_grid(50, 20)
1152
+ grid
1153
+ end
1154
+
1155
+
1156
+ def create_tree_ctrl
1157
+ tree = Wx::TreeCtrl.new( self, Wx::ID_ANY,
1158
+ Wx::Point.new(0, 0), Wx::Size.new(160, 250),
1159
+ Wx::TR_DEFAULT_STYLE|Wx::NO_BORDER)
1160
+
1161
+ img_list = Wx::ImageList.new(16, 16, true, 2)
1162
+ img_list.add( Wx::ArtProvider::get_bitmap( Wx::ART_FOLDER,
1163
+ Wx::ART_OTHER,
1164
+ Wx::Size.new(16, 16) ) )
1165
+ img_list.add( Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE,
1166
+ Wx::ART_OTHER,
1167
+ Wx::Size.new(16, 16) ) )
1168
+ tree.set_image_list(img_list)
1169
+ root = tree.add_root("Wx::AUI Project", 0)
1170
+ items = []
1171
+ 1.upto(5) { | i | items << tree.append_item(root, "Item #{i}", 0) }
1172
+
1173
+ items.each do | id |
1174
+ 1.upto(5) { | i | tree.append_item(id, "Subitem #{i}", 0) }
1175
+ end
1176
+
1177
+ tree.expand(root)
1178
+ tree
1179
+ end
1180
+
1181
+ def create_size_report_ctrl(width = 80, height = 80)
1182
+ SizeReportCtrl.new( self, Wx::ID_ANY,
1183
+ Wx::DEFAULT_POSITION,
1184
+ Wx::Size.new(width, height), @mgr )
1185
+ end
1186
+
1187
+ def create_html_ctrl(parent = nil)
1188
+ if not parent
1189
+ parent = self
1190
+ end
1191
+ ctrl = Wx::HtmlWindow.new(parent, Wx::ID_ANY,
1192
+ Wx::DEFAULT_POSITION,
1193
+ Wx::Size.new(400, 300) )
1194
+ ctrl.set_page(DATA.read)
1195
+ ctrl
1196
+ end
1197
+
1198
+ def create_notebook
1199
+ # create the notebook off-window to avoid flicker
1200
+ client_size = get_client_size
1201
+
1202
+ ctrl = Wx::AuiNotebook.new( self, Wx::ID_ANY,
1203
+ Wx::Point.new(client_size.x, client_size.y),
1204
+ Wx::Size.new(430, 200),
1205
+ @notebook_style)
1206
+
1207
+ page_bmp = Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE,
1208
+ Wx::ART_OTHER,
1209
+ Wx::Size.new(16,16) )
1210
+
1211
+ ctrl.add_page( create_html_ctrl(ctrl),
1212
+ "Welcome to Wx::AUI", false, page_bmp)
1213
+
1214
+ panel = Wx::Panel.new(ctrl, Wx::ID_ANY)
1215
+ flex = Wx::FlexGridSizer.new( 2 )
1216
+ flex.add_growable_row( 0 )
1217
+ flex.add_growable_row( 3 )
1218
+ flex.add_growable_row( 1 )
1219
+
1220
+ flex.add( 5, 5 )
1221
+ flex.add( 5, 5 )
1222
+ flex.add( Wx::StaticText.new( panel, -1, "Wx::TextCtrl:" ),
1223
+ 0, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
1224
+ flex.add( Wx::TextCtrl.new( panel, -1, "",
1225
+ Wx::DEFAULT_POSITION, Wx::Size.new(100,-1) ),
1226
+ 1, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
1227
+
1228
+ flex.add( Wx::StaticText.new( panel, -1, "Wx::SpinCtrl:" ),
1229
+ 0, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
1230
+ flex.add( Wx::SpinCtrl.new( panel, -1, "5",
1231
+ Wx::DEFAULT_POSITION, Wx::Size.new(100,-1),
1232
+ Wx::SP_ARROW_KEYS, 5, 50, 5 ),
1233
+ 1, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
1234
+
1235
+ flex.add( 5,5 )
1236
+ flex.add( 5,5 )
1237
+ panel.set_sizer( flex )
1238
+ ctrl.add_page( panel, "wxPanel", false, page_bmp )
1239
+
1240
+
1241
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some text",
1242
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1243
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1244
+ "wxTextCtrl 1", false, page_bmp )
1245
+
1246
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1247
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1248
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1249
+ "wxTextCtrl 2" )
1250
+
1251
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1252
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1253
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1254
+ "wxTextCtrl 3" )
1255
+
1256
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1257
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1258
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1259
+ "wxTextCtrl 4" )
1260
+
1261
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1262
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1263
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1264
+ "wxTextCtrl 5" )
1265
+
1266
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1267
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1268
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1269
+ "wxTextCtrl 6" )
1270
+
1271
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1272
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1273
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1274
+ "wxTextCtrl 7 (longer title)" )
1275
+
1276
+ ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
1277
+ Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
1278
+ Wx::TE_MULTILINE|Wx::NO_BORDER),
1279
+ "wxTextCtrl 8" )
1280
+ return ctrl
1281
+ end
1282
+ end
1283
+
1284
+
1285
+ class AuiDemoApp < Wx::App
1286
+ def on_init
1287
+ frame = AuiFrame.new( nil, Wx::ID_ANY, "Wx::AUI Sample Application",
1288
+ Wx::DEFAULT_POSITION,
1289
+ Wx::Size.new(800, 600) )
1290
+ set_top_window(frame)
1291
+ frame.show
1292
+ return true
1293
+ end
1294
+ end
1295
+
1296
+ AuiDemoApp.new.main_loop()
1297
+
1298
+
1299
+ __END__
1300
+
1301
+ <html><body>
1302
+ <h3>Welcome to Wx::AUI</h3>
1303
+ <br/><b>Overview</b><br/>
1304
+ <p>Wx::AUI is an Advanced User Interface library for the wxWidgets toolkit
1305
+ that allows developers to create high-quality, cross-platform user
1306
+ interfaces quickly and easily.</p>
1307
+ <p><b>Features</b></p>
1308
+ <p>With Wx::AUI, developers can create application frameworks with:</p>
1309
+ <ul>
1310
+ <li>Native, dockable floating frames</li>
1311
+ <li>Perspective saving and loading</li>
1312
+ <li>Native toolbars incorporating real-time, &quot;spring-loaded&quot; dragging</li>
1313
+ <li>Customizable floating/docking behavior</li>
1314
+ <li>Completely customizable look-and-feel</li>
1315
+ <li>Optional transparent window effects (while dragging or docking)</li>
1316
+ <li>Splittable notebook control</li>
1317
+ </ul>
1318
+ <p><b>What's new in 0.9.3?</b></p>
1319
+ <p>Wx::AUI 0.9.3, which is now bundled with wxWidgets, adds the following features:
1320
+ <ul>
1321
+ <li>New wxAuiNotebook class, a dynamic splittable notebook control</li>
1322
+ <li>New wxAuiMDI* classes, a tab-based MDI and drop-in replacement for classic MDI</li>
1323
+ <li>Maximize/Restore buttons implemented</li>
1324
+ <li>Better hinting with wxGTK</li>
1325
+ <li>Class rename. 'wxAui' is now the standard class prefix for all Wx::AUI classes</li>
1326
+ <li>Lots of bug fixes</li>
1327
+ </ul>
1328
+ <p><b>What's new in 0.9.2?</b></p>
1329
+ <p>The following features/fixes have been added since the last version of Wx::AUI:</p>
1330
+ <ul>
1331
+ <li>Support for wxMac</li>
1332
+ <li>Updates for wxWidgets 2.6.3</li>
1333
+ <li>Fix to pass more unused events through</li>
1334
+ <li>Fix to allow floating windows to receive idle events</li>
1335
+ <li>Fix for minimizing/maximizing problem with transparent hint pane</li>
1336
+ <li>Fix to not paint empty hint rectangles</li>
1337
+ <li>Fix for 64-bit compilation</li>
1338
+ </ul>
1339
+ <p><b>What changed in 0.9.1?</b></p>
1340
+ <p>The following features/fixes were added in Wx::AUIy 0.9.1:</p>
1341
+ <ul>
1342
+ <li>Support for MDI frames</li>
1343
+ <li>Gradient captions option</li>
1344
+ <li>Active/Inactive panes option</li>
1345
+ <li>Fix for screen artifacts/paint problems</li>
1346
+ <li>Fix for hiding/showing floated window problem</li>
1347
+ <li>Fix for floating pane sizing problem</li>
1348
+ <li>Fix for drop position problem when dragging around center pane margins</li>
1349
+ <li>LF-only text file formatting for source code</li>
1350
+ </ul>
1351
+ <p>See README.txt for more information.</p>
1352
+ </body></html>