wxruby-ruby19 1.9.8-x86-darwin-9 → 1.9.10-x86-darwin-9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. data/LICENSE +53 -0
  2. data/README +297 -0
  3. data/lib/wx.rb +2 -2
  4. data/lib/wx/accessors.rb +7 -1
  5. data/lib/wx/classes/app.rb +10 -4
  6. data/lib/wx/classes/bitmap.rb +29 -1
  7. data/lib/wx/classes/clipboard.rb +19 -3
  8. data/lib/wx/classes/colour.rb +6 -4
  9. data/lib/wx/classes/data_object.rb +14 -0
  10. data/lib/wx/classes/data_object_simple.rb +6 -0
  11. data/lib/wx/classes/dataformat.rb +23 -0
  12. data/lib/wx/classes/evthandler.rb +79 -4
  13. data/lib/wx/classes/genericdirctrl.rb +36 -0
  14. data/lib/wx/classes/grid.rb +8 -0
  15. data/lib/wx/classes/hboxsizer.rb +6 -0
  16. data/lib/wx/classes/icon.rb +12 -1
  17. data/lib/wx/classes/image.rb +13 -1
  18. data/lib/wx/classes/listctrl.rb +12 -0
  19. data/lib/wx/classes/point.rb +8 -0
  20. data/lib/wx/classes/rect.rb +10 -1
  21. data/lib/wx/classes/richtextctrl.rb +63 -0
  22. data/lib/wx/classes/size.rb +9 -0
  23. data/lib/wx/classes/sizer.rb +18 -3
  24. data/lib/wx/classes/standardpaths.rb +9 -0
  25. data/lib/wx/classes/texturlevent.rb +14 -2
  26. data/lib/wx/classes/toolbar.rb +4 -6
  27. data/lib/wx/classes/vboxsizer.rb +6 -0
  28. data/lib/wx/classes/window.rb +7 -0
  29. data/lib/wx/classes/xmlresource.rb +17 -0
  30. data/lib/wx/helpers.rb +16 -1
  31. data/lib/wx/keyword_ctors.rb +3 -2
  32. data/lib/wx/keyword_defs.rb +56 -5
  33. data/lib/wx/version.rb +1 -1
  34. data/lib/wxruby2.bundle +0 -0
  35. data/samples/SAMPLES-LICENSE.TXT +18 -0
  36. data/samples/aui/aui.rb +1356 -0
  37. data/samples/bigdemo/About.rbw +39 -0
  38. data/samples/bigdemo/ColorPanel.rbw +23 -0
  39. data/samples/bigdemo/GridSimple.rbw +78 -0
  40. data/samples/bigdemo/MDIDemo.rbw +57 -0
  41. data/samples/bigdemo/PopupMenu.rbw +149 -0
  42. data/samples/bigdemo/ShapedWindow.rbw +131 -0
  43. data/samples/bigdemo/Sizers.rbw +543 -0
  44. data/samples/bigdemo/bigdemo.rb +823 -0
  45. data/samples/bigdemo/demoTemplate.rbw +33 -0
  46. data/samples/bigdemo/helpfile.htb +0 -0
  47. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  48. data/samples/bigdemo/icons/Test 015.png +0 -0
  49. data/samples/bigdemo/icons/choice.bmp +0 -0
  50. data/samples/bigdemo/icons/choice.xpm +27 -0
  51. data/samples/bigdemo/icons/combo.bmp +0 -0
  52. data/samples/bigdemo/icons/combo.xpm +27 -0
  53. data/samples/bigdemo/icons/copy.xpm +25 -0
  54. data/samples/bigdemo/icons/cut.xpm +24 -0
  55. data/samples/bigdemo/icons/gauge.bmp +0 -0
  56. data/samples/bigdemo/icons/gauge.xpm +27 -0
  57. data/samples/bigdemo/icons/help.xpm +25 -0
  58. data/samples/bigdemo/icons/list.bmp +0 -0
  59. data/samples/bigdemo/icons/list.xpm +27 -0
  60. data/samples/bigdemo/icons/mondrian.ico +0 -0
  61. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  62. data/samples/bigdemo/icons/new.xpm +24 -0
  63. data/samples/bigdemo/icons/ogl.ico +0 -0
  64. data/samples/bigdemo/icons/ogl.xpm +45 -0
  65. data/samples/bigdemo/icons/open.xpm +26 -0
  66. data/samples/bigdemo/icons/paste.bmp +0 -0
  67. data/samples/bigdemo/icons/paste.xpm +38 -0
  68. data/samples/bigdemo/icons/pointy.png +0 -0
  69. data/samples/bigdemo/icons/preview.xpm +26 -0
  70. data/samples/bigdemo/icons/print.xpm +26 -0
  71. data/samples/bigdemo/icons/radio.bmp +0 -0
  72. data/samples/bigdemo/icons/radio.xpm +27 -0
  73. data/samples/bigdemo/icons/robert.xpm +415 -0
  74. data/samples/bigdemo/icons/ruby.png +0 -0
  75. data/samples/bigdemo/icons/sashtest.ico +0 -0
  76. data/samples/bigdemo/icons/save.xpm +25 -0
  77. data/samples/bigdemo/icons/smiles.bmp +0 -0
  78. data/samples/bigdemo/icons/smiles.xpm +39 -0
  79. data/samples/bigdemo/icons/smiley.ico +0 -0
  80. data/samples/bigdemo/icons/smiley.xpm +42 -0
  81. data/samples/bigdemo/icons/stattext.xpm +24 -0
  82. data/samples/bigdemo/icons/test2.bmp +0 -0
  83. data/samples/bigdemo/icons/test2.png +0 -0
  84. data/samples/bigdemo/icons/test2.xpm +79 -0
  85. data/samples/bigdemo/icons/text.bmp +0 -0
  86. data/samples/bigdemo/icons/text.xpm +27 -0
  87. data/samples/bigdemo/icons/tog1.bmp +0 -0
  88. data/samples/bigdemo/icons/tog1.xpm +38 -0
  89. data/samples/bigdemo/icons/tog2.bmp +0 -0
  90. data/samples/bigdemo/icons/tog2.xpm +38 -0
  91. data/samples/bigdemo/icons/wxwin.ico +0 -0
  92. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  93. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  94. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  95. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  96. data/samples/bigdemo/run.rb +90 -0
  97. data/samples/bigdemo/tips.txt +7 -0
  98. data/samples/bigdemo/utils.rb +12 -0
  99. data/samples/bigdemo/wxArtProvider.rbw +281 -0
  100. data/samples/bigdemo/wxBitmapButton.rbw +65 -0
  101. data/samples/bigdemo/wxButton.rbw +64 -0
  102. data/samples/bigdemo/wxCalendarCtrl.rbw +60 -0
  103. data/samples/bigdemo/wxCheckBox.rbw +50 -0
  104. data/samples/bigdemo/wxCheckListBox.rbw +65 -0
  105. data/samples/bigdemo/wxChoice.rbw +47 -0
  106. data/samples/bigdemo/wxChoicebook.rbw +78 -0
  107. data/samples/bigdemo/wxColourDialog.rbw +31 -0
  108. data/samples/bigdemo/wxComboBox.rbw +77 -0
  109. data/samples/bigdemo/wxCursor.rbw +136 -0
  110. data/samples/bigdemo/wxDialog.rbw +74 -0
  111. data/samples/bigdemo/wxDirDialog.rbw +29 -0
  112. data/samples/bigdemo/wxDragImage.rbw +70 -0
  113. data/samples/bigdemo/wxFileDialog.rbw +37 -0
  114. data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
  115. data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
  116. data/samples/bigdemo/wxFontDialog.rbw +173 -0
  117. data/samples/bigdemo/wxFrame.rbw +53 -0
  118. data/samples/bigdemo/wxGauge.rbw +71 -0
  119. data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
  120. data/samples/bigdemo/wxGrid.rbw +66 -0
  121. data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
  122. data/samples/bigdemo/wxListBox.rbw +140 -0
  123. data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -0
  124. data/samples/bigdemo/wxMDIWindows.rbw +50 -0
  125. data/samples/bigdemo/wxMenu.rbw +236 -0
  126. data/samples/bigdemo/wxMessageDialog.rbw +27 -0
  127. data/samples/bigdemo/wxMiniFrame.rbw +70 -0
  128. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -0
  129. data/samples/bigdemo/wxNotebook.rbw +136 -0
  130. data/samples/bigdemo/wxProgressDialog.rbw +43 -0
  131. data/samples/bigdemo/wxRadioBox.rbw +72 -0
  132. data/samples/bigdemo/wxRadioButton.rbw +125 -0
  133. data/samples/bigdemo/wxSashWindow.rbw +141 -0
  134. data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
  135. data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
  136. data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
  137. data/samples/bigdemo/wxSlider.rbw +42 -0
  138. data/samples/bigdemo/wxSpinButton.rbw +50 -0
  139. data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
  140. data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
  141. data/samples/bigdemo/wxStaticBitmap.rbw +51 -0
  142. data/samples/bigdemo/wxStaticText.rbw +55 -0
  143. data/samples/bigdemo/wxStatusBar.rbw +126 -0
  144. data/samples/bigdemo/wxTextCtrl.rbw +149 -0
  145. data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
  146. data/samples/bigdemo/wxToggleButton.rbw +49 -0
  147. data/samples/bigdemo/wxToolBar.rbw +131 -0
  148. data/samples/bigdemo/wxTreeCtrl.rbw +191 -0
  149. data/samples/calendar/calendar.rb +256 -0
  150. data/samples/caret/caret.rb +282 -0
  151. data/samples/caret/mondrian.xpm +44 -0
  152. data/samples/controls/controls.rb +1136 -0
  153. data/samples/controls/get_item_sample.rb +87 -0
  154. data/samples/controls/icons/choice.xpm +27 -0
  155. data/samples/controls/icons/combo.xpm +27 -0
  156. data/samples/controls/icons/gauge.xpm +27 -0
  157. data/samples/controls/icons/list.xpm +27 -0
  158. data/samples/controls/icons/radio.xpm +27 -0
  159. data/samples/controls/icons/stattext.xpm +24 -0
  160. data/samples/controls/icons/text.xpm +27 -0
  161. data/samples/controls/mondrian.ico +0 -0
  162. data/samples/controls/mondrian.xpm +44 -0
  163. data/samples/controls/test2.bmp +0 -0
  164. data/samples/dialogs/dialogs.rb +797 -0
  165. data/samples/dialogs/tips.txt +18 -0
  166. data/samples/dragdrop/dragdrop.rb +177 -0
  167. data/samples/drawing/graphics_drawing.rb +235 -0
  168. data/samples/drawing/images.rb +37 -0
  169. data/samples/drawing/paperclip.png +0 -0
  170. data/samples/etc/activation.rb +102 -0
  171. data/samples/etc/choice.rb +67 -0
  172. data/samples/etc/miniframe.rb +79 -0
  173. data/samples/etc/sash.rb +130 -0
  174. data/samples/etc/scrollwin.rb +110 -0
  175. data/samples/etc/system_settings.rb +252 -0
  176. data/samples/etc/threaded.rb +72 -0
  177. data/samples/etc/toolbar_sizer_additem.rb +55 -0
  178. data/samples/etc/wizard.rb +74 -0
  179. data/samples/event/event.rb +182 -0
  180. data/samples/event/update_ui_event.rb +70 -0
  181. data/samples/grid/grid.rb +198 -0
  182. data/samples/grid/gridtablebase.rb +148 -0
  183. data/samples/html/html.rb +262 -0
  184. data/samples/listbook/listbook.rb +174 -0
  185. data/samples/listbook/listbook.xrc +370 -0
  186. data/samples/mdi/mdi.rb +85 -0
  187. data/samples/media/mediactrl.rb +167 -0
  188. data/samples/minimal/minimal.rb +77 -0
  189. data/samples/minimal/mondrian.ico +0 -0
  190. data/samples/minimal/mondrian.png +0 -0
  191. data/samples/minimal/nothing.rb +16 -0
  192. data/samples/opengl/cube.rb +117 -0
  193. data/samples/printing/mondrian.ico +0 -0
  194. data/samples/printing/mondrian.xpm +44 -0
  195. data/samples/printing/printing.rb +487 -0
  196. data/samples/sockets/SocketPackets.rb +27 -0
  197. data/samples/sockets/res/message-new.png +0 -0
  198. data/samples/sockets/res/user.png +0 -0
  199. data/samples/sockets/wxClient.rb +395 -0
  200. data/samples/sockets/wxServer.rb +422 -0
  201. data/samples/sockets/wxSocketGUI.rb +97 -0
  202. data/samples/text/format-text-bold.png +0 -0
  203. data/samples/text/format-text-italic.png +0 -0
  204. data/samples/text/format-text-underline.png +0 -0
  205. data/samples/text/mondrian.ico +0 -0
  206. data/samples/text/mondrian.xpm +44 -0
  207. data/samples/text/rich_textctrl.rb +98 -0
  208. data/samples/text/scintilla.rb +169 -0
  209. data/samples/text/textctrl.rb +111 -0
  210. data/samples/text/unicode.rb +242 -0
  211. data/samples/text/utf8.txt +15 -0
  212. data/samples/treectrl/icon1.xpm +79 -0
  213. data/samples/treectrl/icon2.xpm +53 -0
  214. data/samples/treectrl/icon3.xpm +79 -0
  215. data/samples/treectrl/icon4.xpm +43 -0
  216. data/samples/treectrl/icon5.xpm +79 -0
  217. data/samples/treectrl/treectrl.rb +1166 -0
  218. data/samples/xrc/samples.xrc +46 -0
  219. data/samples/xrc/xrc_sample.rb +76 -0
  220. metadata +17 -3
@@ -1,16 +1,32 @@
1
1
  class Wx::Clipboard
2
+ # See if we like these better
3
+ alias :place :set_data
4
+ alias :fetch :get_data
5
+
2
6
  class << self
7
+ # This is provided internally by the SWIG interface file, but all
8
+ # public access should be via Clipboard.open; see below
9
+ private :get_global_clipboard
10
+
3
11
  # Class method to provide access to the clipboard within a ruby
4
12
  # block. Tests that the clipboard could be accessed, and ensures
5
13
  # that it is closed when the block is finished.
6
14
  def open
7
- clip = Wx::Clipboard.new
15
+ clip = nil
16
+ # Trying to access the segfault outside main_loop will segfault on
17
+ # some platforms (eg, GTK)
18
+ unless Wx::const_defined?(:THE_APP)
19
+ raise RuntimeError,
20
+ "The clipboard can only be accessed when the App is running"
21
+ end
22
+
23
+ clip = get_global_clipboard
8
24
  unless clip.open
9
25
  Kernel.raise "Could not open clipboard"
10
26
  end
11
27
  yield clip
12
- ensure
13
- clip.close
28
+ ensure
29
+ clip.close if clip
14
30
  end
15
31
  end
16
32
  end
@@ -33,11 +33,13 @@ class Wx::Colour
33
33
  # Colours are equal to one another if they have the same red, green
34
34
  # and blue intensity, and the same alpha
35
35
  def ==(other)
36
- if not other.is_a?(self.class)
37
- raise ArgumentError, "No comparison of #{self} to #{other}"
38
- end
39
- [ red, green, blue, alpha ] ==
36
+ case other
37
+ when Wx::Colour
38
+ [ self.red, self.green, self.blue, self.alpha ] ==
40
39
  [ other.red, other.green, other.blue, other.alpha ]
40
+ else
41
+ false
42
+ end
41
43
  end
42
44
 
43
45
  # More informative output for inspect etc
@@ -0,0 +1,14 @@
1
+ # Provide some default implementations of these to make life easier
2
+ class Wx::DataObject
3
+ def get_preferred_format(direction)
4
+ get_all_formats(direction).first
5
+ end
6
+
7
+ def get_format_count(direction)
8
+ get_all_formats(direction).length
9
+ end
10
+
11
+ def get_data_size(format)
12
+ get_data_here(format).size
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ # Provide some default implementations of these to make life easier
2
+ class Wx::DataObjectSimple
3
+ def get_data_size(format)
4
+ get_data_here(format).size
5
+ end
6
+ end
@@ -0,0 +1,23 @@
1
+ # Make this easier to use for multi-typed data objects. Comparison
2
+ # doesn't work correctly in the SWIG binding
3
+ class Wx::DataFormat
4
+ def ==(other)
5
+ if self.get_type > Wx::DATA_FORMAT_ID_INVALID
6
+ self.get_type == other.get_type
7
+ else
8
+ self.id == other.id
9
+ end
10
+ end
11
+ end
12
+
13
+ # Provide pre-cooked data formats for the standard types
14
+ module Wx
15
+ DF_TEXT = DataFormat.new( DATA_FORMAT_ID_TEXT )
16
+ DF_BITMAP = DataFormat.new( DATA_FORMAT_ID_BITMAP )
17
+ if Wx::PLATFORM != 'WXGTK'
18
+ DF_METAFILE = DataFormat.new( DATA_FORMAT_ID_METAFILE )
19
+ end
20
+ DF_FILENAME = DataFormat.new( DATA_FORMAT_ID_FILENAME )
21
+ DF_UNICODETEXT = DataFormat.new( DATA_FORMAT_ID_UNICODETEXT )
22
+ # DF_HTML is only supported on Windows + MSVC, so don't offer it
23
+ end
@@ -235,6 +235,12 @@ class Wx::EvtHandler
235
235
  EventType['evt_aui_render', 0,
236
236
  Wx::EVT_AUI_RENDER,
237
237
  Wx::AuiManagerEvent],
238
+ EventType['evt_bookctrl_page_changed', 1,
239
+ Wx::EVT_COMMAND_BOOKCTRL_PAGE_CHANGED,
240
+ Wx::BookCtrlBaseEvent],
241
+ EventType['evt_bookctrl_page_changing', 1,
242
+ Wx::EVT_COMMAND_BOOKCTRL_PAGE_CHANGING,
243
+ Wx::BookCtrlBaseEvent],
238
244
  EventType['evt_button', 1,
239
245
  Wx::EVT_COMMAND_BUTTON_CLICKED,
240
246
  Wx::CommandEvent],
@@ -313,15 +319,18 @@ class Wx::EvtHandler
313
319
  EventType['evt_context_menu', 0,
314
320
  Wx::EVT_CONTEXT_MENU,
315
321
  Wx::ContextMenuEvent],
316
- EventType['evt_drop_files', 0,
317
- Wx::EVT_DROP_FILES,
318
- Wx::Event],
322
+ EventType['evt_date_changed', 1,
323
+ Wx::EVT_DATE_CHANGED,
324
+ Wx::DateEvent],
319
325
  EventType['evt_detailed_help', 1,
320
326
  Wx::EVT_DETAILED_HELP,
321
327
  Wx::HelpEvent],
322
328
  EventType['evt_detailed_help_range', 2,
323
329
  Wx::EVT_DETAILED_HELP,
324
330
  Wx::HelpEvent],
331
+ EventType['evt_drop_files', 0,
332
+ Wx::EVT_DROP_FILES,
333
+ Wx::Event],
325
334
  EventType['evt_end_process', 1,
326
335
  Wx::EVT_END_PROCESS,
327
336
  Wx::Event],
@@ -625,6 +634,9 @@ class Wx::EvtHandler
625
634
  EventType['evt_moving', 0,
626
635
  Wx::EVT_MOVING,
627
636
  Wx::MoveEvent],
637
+ EventType['evt_navigation_key', 0,
638
+ Wx::EVT_NAVIGATION_KEY,
639
+ Wx::NavigationKeyEvent],
628
640
  EventType['evt_nc_paint', 0,
629
641
  Wx::EVT_NC_PAINT,
630
642
  Wx::Event],
@@ -649,6 +661,51 @@ class Wx::EvtHandler
649
661
  EventType['evt_radiobutton', 1,
650
662
  Wx::EVT_COMMAND_RADIOBUTTON_SELECTED,
651
663
  Wx::CommandEvent],
664
+ EventType['evt_richtext_character', 1,
665
+ Wx::EVT_COMMAND_RICHTEXT_CHARACTER,
666
+ Wx::RichTextEvent],
667
+ EventType['evt_richtext_content_inserted', 1,
668
+ Wx::EVT_COMMAND_RICHTEXT_CONTENT_INSERTED,
669
+ Wx::RichTextEvent],
670
+ EventType['evt_richtext_content_deleted', 1,
671
+ Wx::EVT_COMMAND_RICHTEXT_CONTENT_DELETED,
672
+ Wx::RichTextEvent],
673
+ EventType['evt_richtext_delete', 1,
674
+ Wx::EVT_COMMAND_RICHTEXT_DELETE,
675
+ Wx::RichTextEvent],
676
+ EventType['evt_richtext_left_click', 1,
677
+ Wx::EVT_COMMAND_RICHTEXT_LEFT_CLICK,
678
+ Wx::RichTextEvent],
679
+ EventType['evt_richtext_left_dclick', 1,
680
+ Wx::EVT_COMMAND_RICHTEXT_LEFT_DCLICK,
681
+ Wx::RichTextEvent],
682
+ EventType['evt_richtext_middle_click', 1,
683
+ Wx::EVT_COMMAND_RICHTEXT_MIDDLE_CLICK,
684
+ Wx::RichTextEvent],
685
+ EventType['evt_richtext_return', 1,
686
+ Wx::EVT_COMMAND_RICHTEXT_RETURN,
687
+ Wx::RichTextEvent],
688
+ EventType['evt_richtext_right_click', 1,
689
+ Wx::EVT_COMMAND_RICHTEXT_RIGHT_CLICK,
690
+ Wx::RichTextEvent],
691
+ EventType['evt_richtext_selection_changed', 1,
692
+ Wx::EVT_COMMAND_RICHTEXT_SELECTION_CHANGED,
693
+ Wx::RichTextEvent],
694
+ EventType['evt_richtext_style_changed', 1,
695
+ Wx::EVT_COMMAND_RICHTEXT_STYLE_CHANGED,
696
+ Wx::RichTextEvent],
697
+ EventType['evt_richtext_stylesheet_changed', 1,
698
+ Wx::EVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED,
699
+ Wx::RichTextEvent],
700
+ EventType['evt_richtext_stylesheet_changing', 1,
701
+ Wx::EVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING,
702
+ Wx::RichTextEvent],
703
+ EventType['evt_richtext_stylesheet_replaced', 1,
704
+ Wx::EVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED,
705
+ Wx::RichTextEvent],
706
+ EventType['evt_richtext_stylesheet_replacing', 1,
707
+ Wx::EVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING,
708
+ Wx::RichTextEvent],
652
709
  EventType['evt_right_dclick', 0,
653
710
  Wx::EVT_RIGHT_DCLICK,
654
711
  Wx::MouseEvent],
@@ -816,10 +873,16 @@ class Wx::EvtHandler
816
873
  Wx::TimerEvent],
817
874
  EventType['evt_togglebutton', 1,
818
875
  Wx::EVT_COMMAND_TOGGLEBUTTON_CLICKED,
819
- Wx::Event],
876
+ Wx::CommandEvent],
820
877
  EventType['evt_tool', 1,
821
878
  Wx::EVT_COMMAND_TOOL_CLICKED,
822
879
  Wx::CommandEvent],
880
+ EventType['evt_toolbook_page_changed', 1,
881
+ Wx::EVT_COMMAND_TOOLBOOK_PAGE_CHANGED,
882
+ Wx::ToolbookEvent],
883
+ EventType['evt_toolbook_page_changing', 1,
884
+ Wx::EVT_COMMAND_TOOLBOOK_PAGE_CHANGING,
885
+ Wx::ToolbookEvent],
823
886
  EventType['evt_tool_enter', 1,
824
887
  Wx::EVT_COMMAND_TOOL_ENTER,
825
888
  Wx::CommandEvent],
@@ -895,6 +958,18 @@ class Wx::EvtHandler
895
958
  EventType['evt_tree_state_image_click', 1,
896
959
  Wx::EVT_COMMAND_TREE_STATE_IMAGE_CLICK,
897
960
  Wx::TreeEvent],
961
+ EventType['evt_treebook_node_collapsed', 1,
962
+ Wx::EVT_COMMAND_TREEBOOK_NODE_COLLAPSED,
963
+ Wx::TreebookEvent],
964
+ EventType['evt_treebook_node_expanded', 1,
965
+ Wx::EVT_COMMAND_TREEBOOK_NODE_EXPANDED,
966
+ Wx::TreebookEvent],
967
+ EventType['evt_treebook_page_changed', 1,
968
+ Wx::EVT_COMMAND_TREEBOOK_PAGE_CHANGED,
969
+ Wx::TreebookEvent],
970
+ EventType['evt_treebook_page_changing', 1,
971
+ Wx::EVT_COMMAND_TREEBOOK_PAGE_CHANGING,
972
+ Wx::TreebookEvent],
898
973
  EventType['evt_update_ui', 1,
899
974
  Wx::EVT_UPDATE_UI,
900
975
  Wx::UpdateUIEvent],
@@ -0,0 +1,36 @@
1
+ # Bottom-up implementation of a Directory lister
2
+ class Wx::GenericDirCtrl
3
+ module DirCtrlTree
4
+ # The TreeCtrl contained in a GenericDirCtrl already has C++ data
5
+ # associated with the items. If these are returned to Ruby crashes
6
+ # will result. So this module sets the TreeCtrl to return the path
7
+ # string.
8
+ def get_item_data(tree_id)
9
+ root_id = get_root_item
10
+ return "" if tree_id == root_id
11
+
12
+ path = item_text(tree_id)
13
+ while tree_id = item_parent(tree_id) and tree_id != root_id
14
+ path = item_text(tree_id) + "/#{path}"
15
+ end
16
+ unless Wx::PLATFORM == 'WXMSW'
17
+ path = "/" + path
18
+ end
19
+ path
20
+ end
21
+
22
+ alias :get_item_path :get_item_data
23
+
24
+ # Not allowed
25
+ def set_item_data(tree_id, data)
26
+ Kernel.raise "Item data cannot be set for a GenericDirCtrl's Tree"
27
+ end
28
+ end
29
+
30
+ wx_get_tree_ctrl = instance_method(:get_tree_ctrl)
31
+ define_method(:get_tree_ctrl) do
32
+ tree = wx_get_tree_ctrl.bind(self).call
33
+ tree.extend(DirCtrlTree)
34
+ tree
35
+ end
36
+ end
@@ -35,6 +35,14 @@ class Wx::Grid
35
35
  @__grid_table = table
36
36
  end
37
37
 
38
+ # Store the renderers / editors associated with types, if used
39
+ alias :__register_data_type :register_data_type
40
+ def register_data_type(type_name, renderer, editor)
41
+ __register_data_type(type_name, renderer, editor)
42
+ @__named_type_info ||= {}
43
+ @__named_type_info[type_name] = [ renderer, editor ]
44
+ end
45
+
38
46
  # store default editor
39
47
  wx_set_default_editor = self.instance_method(:set_default_editor)
40
48
  define_method(:set_default_editor) do | editr |
@@ -0,0 +1,6 @@
1
+ # Just a shortcut version for creating a horizontal box sizer
2
+ class Wx::HBoxSizer < Wx::BoxSizer
3
+ def initialize
4
+ super(Wx::HORIZONTAL)
5
+ end
6
+ end
@@ -1,4 +1,10 @@
1
+ # Specific type of platform-dependent image used for frames on Windows and
2
+ # Linux. Normally Bitmap is used
1
3
  class Wx::Icon
4
+ # Load the type-guessing hash from Wx::Bitmap
5
+ require 'wx/classes/bitmap'
6
+ BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
7
+
2
8
  # Analogous to Image.from_bitmap
3
9
  def self.from_bitmap(bmp)
4
10
  ico = new
@@ -8,13 +14,18 @@ class Wx::Icon
8
14
 
9
15
  # Redefine the initialize method so it raises an exception if a
10
16
  # non-existent file is given to the constructor; otherwise, wx Widgets
11
- # just carries on with an empty icon, which may cause faults later
17
+ # just carries on with an empty icon, which may cause faults
18
+ # later. Also guess icon type from filename, if not specified.
12
19
  wx_init = self.instance_method(:initialize)
13
20
  define_method(:initialize) do | *args |
14
21
  if args[0].kind_of? String
15
22
  if not File.exist?( File.expand_path(args[0]) )
16
23
  Kernel.raise(ArgumentError, "Icon file does not exist: #{args[0]}")
17
24
  end
25
+ # If type not specified, try to guess it from the file extension
26
+ if not args[1] and ( file_ext = args[0][/\w+$/] )
27
+ args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
28
+ end
18
29
  end
19
30
  wx_init.bind(self).call(*args)
20
31
  end
@@ -1,4 +1,10 @@
1
+ # A platform-independent image; can be manipulated more extensively than
2
+ # Bitmap, but must be converted to a Bitmap for drawing.
1
3
  class Wx::Image
4
+ # Load the type-guessing hash from Wx::Bitmap
5
+ require 'wx/classes/bitmap'
6
+ BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
7
+
2
8
  # Load a new image from an IO-like object that supports "read"
3
9
  def self.read(an_io, type_or_mime, index = -1)
4
10
  img = new
@@ -13,13 +19,19 @@ class Wx::Image
13
19
 
14
20
  # Redefine the initialize method so it raises an exception if a
15
21
  # non-existent file is given to the constructor; otherwise, wx Widgets
16
- # just carries on with an invalid image, which may cause faults later
22
+ # just carries on with an invalid image, which may cause faults
23
+ # later. Also, if loading from a file, and the type is not specified,
24
+ # try to guess it from the filename extension
17
25
  wx_init = self.instance_method(:initialize)
18
26
  define_method(:initialize) do | *args |
19
27
  if args[0].kind_of? String
20
28
  if not File.exist?( File.expand_path(args[0]) )
21
29
  Kernel.raise(ArgumentError, "Image file does not exist: #{args[0]}")
22
30
  end
31
+ # If type not specified, try to guess it from the file extension
32
+ if not args[1] and file_ext = args[0][/\w+$/]
33
+ args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
34
+ end
23
35
  end
24
36
  wx_init.bind(self).call(*args)
25
37
  end
@@ -7,6 +7,18 @@ class Wx::ListCtrl
7
7
  0.upto(item_count - 1) { | i | yield i }
8
8
  end
9
9
 
10
+ # Returns an Array containing the indexes of the currently selected
11
+ # items
12
+ def get_selections
13
+ selections = []
14
+ item = get_next_item(-1, Wx::LIST_NEXT_BELOW, Wx::LIST_STATE_SELECTED)
15
+ while item >= 0
16
+ selections << item
17
+ item = get_next_item(item, Wx::LIST_NEXT_BELOW, Wx::LIST_STATE_SELECTED)
18
+ end
19
+ selections
20
+ end
21
+
10
22
  # Stub version for LC_VIRTUAL controls that does nothing; may be
11
23
  # overridden in subclasses.
12
24
  def on_get_item_attr(i)
@@ -4,6 +4,14 @@ class Wx::Point
4
4
  "#<Wx::Point: (#{x}, #{y})>"
5
5
  end
6
6
 
7
+ # Correct comparison for Points - same if same x and y
8
+ def ==(other)
9
+ unless other.kind_of?(Wx::Point)
10
+ Kernel.raise TypeError, "Cannot compare Point to #{other}"
11
+ end
12
+ x == other.x and y == other.y
13
+ end
14
+
7
15
  # Return a new Wx::Point with the x and y parameters both divided by
8
16
  # parameter +div+, which should be a Numeric
9
17
  def /(div)
@@ -4,7 +4,16 @@ class Wx::Rect
4
4
  def to_s
5
5
  "#<Wx::Rect: (#{get_left}, #{get_top}) (#{get_right}, #{get_bottom})>"
6
6
  end
7
-
7
+
8
+ # Correct comparison for Wx::Rect, are the same if have the same
9
+ # position and the same size
10
+ def ==(other)
11
+ unless other.kind_of?(Wx::Rect)
12
+ Kernel.raise TypeError, "Cannot compare Rect to #{other}"
13
+ end
14
+ get_left == other.get_left and get_top == other.get_top and
15
+ get_right = other.get_right and get_bottom == other.get_bottom
16
+ end
8
17
  # More ruby-ish names
9
18
  alias :contains? :contains
10
19
  end
@@ -0,0 +1,63 @@
1
+ # Text editor supporting various formatting, intended for editing
2
+ # natural language texts
3
+ class Wx::RichTextCtrl
4
+ # These three methods return the styles applicable at certain points
5
+ # in the document. However, the standard wx signature is to accept the
6
+ # value of some kind of TextAttr class that will hold the return as an
7
+ # argument. The return value is a boolean for success/failure. In
8
+ # Ruby, we only support returning the value as a RichTextAttr, and do
9
+ # so as a proper return value, having accepted a single argument
10
+ # specifying where to get the style from. If retrieval is not
11
+ # successful, raise an exception.
12
+ wx_get_style = self.instance_method(:get_style)
13
+ define_method(:get_style) do | pos |
14
+ style = Wx::RichTextAttr.new
15
+ if wx_get_style.bind(self).call(pos, style)
16
+ return style
17
+ else
18
+ Kernel.raise RuntimeError, "Could not retrieve style at position #{pos}"
19
+ end
20
+ end
21
+
22
+ wx_get_style_for_range = self.instance_method(:get_style_for_range)
23
+ define_method(:get_style_for_range) do | rng |
24
+ style = Wx::RichTextAttr.new
25
+ if wx_get_style_for_range.bind(self).call(rng, style)
26
+ return style
27
+ else
28
+ Kernel.raise RuntimeError, "Could not retrieve style for range #{rng}"
29
+ end
30
+ end
31
+
32
+ wx_get_uncombined_style = self.instance_method(:get_uncombined_style)
33
+ define_method(:get_uncombined_style) do | pos |
34
+ style = Wx::RichTextAttr.new
35
+ if wx_get_uncombined_style.bind(self).call(pos, style)
36
+ return style
37
+ else
38
+ Kernel.raise RuntimeError, "Could not retrieve style at position #{pos}"
39
+ end
40
+ end
41
+
42
+ # Fix to accept a single +pos+ argument and return a Wx::Rect
43
+ wx_car_pos_for_index = self.instance_method(:get_caret_position_for_index)
44
+ define_method(:get_caret_position_for_index) do | pos |
45
+ rect = Wx::Rect.new
46
+ if wx_car_pos_for_index.bind(self).call(pos, rect)
47
+ return rect
48
+ else
49
+ Kernel.raise RuntimeError, "Could not rect for position #{pos}"
50
+ end
51
+ end
52
+
53
+ # Fix to return a pair of col, row values
54
+ wx_pos_to_xy = self.instance_method(:position_to_xy)
55
+ define_method(:position_to_xy) do | pos |
56
+ success, x, y = wx_pos_to_xy.bind(self).call(pos)
57
+ if success
58
+ return x, y
59
+ else
60
+ Kernel.raise RuntimeError, "Could not convert position #{pos} to x, y"
61
+ end
62
+ end
63
+ end