wxruby64 2.0.1-x64-mingw32

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 (279) hide show
  1. checksums.yaml +7 -0
  2. data/INSTALL +254 -0
  3. data/LICENSE +53 -0
  4. data/README +198 -0
  5. data/art/wxruby-128x128.png +0 -0
  6. data/art/wxruby-256x256.png +0 -0
  7. data/art/wxruby-64x64.png +0 -0
  8. data/art/wxruby.png +0 -0
  9. data/lib/wx.rb +53 -0
  10. data/lib/wx/accessors.rb +68 -0
  11. data/lib/wx/classes/acceleratortable.rb +28 -0
  12. data/lib/wx/classes/animation.rb +18 -0
  13. data/lib/wx/classes/app.rb +51 -0
  14. data/lib/wx/classes/artprovider.rb +31 -0
  15. data/lib/wx/classes/auinotebook.rb +9 -0
  16. data/lib/wx/classes/bitmap.rb +59 -0
  17. data/lib/wx/classes/busycursor.rb +12 -0
  18. data/lib/wx/classes/checklistbox.rb +46 -0
  19. data/lib/wx/classes/choice.rb +4 -0
  20. data/lib/wx/classes/clientdc.rb +13 -0
  21. data/lib/wx/classes/clipboard.rb +56 -0
  22. data/lib/wx/classes/colour.rb +49 -0
  23. data/lib/wx/classes/combobox.rb +4 -0
  24. data/lib/wx/classes/commandevent.rb +7 -0
  25. data/lib/wx/classes/controlwithitems.rb +10 -0
  26. data/lib/wx/classes/data_object.rb +14 -0
  27. data/lib/wx/classes/data_object_simple.rb +6 -0
  28. data/lib/wx/classes/dataformat.rb +23 -0
  29. data/lib/wx/classes/dc.rb +57 -0
  30. data/lib/wx/classes/event.rb +5 -0
  31. data/lib/wx/classes/evthandler.rb +1039 -0
  32. data/lib/wx/classes/font.rb +118 -0
  33. data/lib/wx/classes/functions.rb +44 -0
  34. data/lib/wx/classes/gauge.rb +12 -0
  35. data/lib/wx/classes/genericdirctrl.rb +36 -0
  36. data/lib/wx/classes/grid.rb +146 -0
  37. data/lib/wx/classes/hboxsizer.rb +6 -0
  38. data/lib/wx/classes/helpcontroller.rb +5 -0
  39. data/lib/wx/classes/helpcontrollerhelpprovider.rb +23 -0
  40. data/lib/wx/classes/helpprovider.rb +15 -0
  41. data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
  42. data/lib/wx/classes/htmlwindow.rb +14 -0
  43. data/lib/wx/classes/icon.rb +32 -0
  44. data/lib/wx/classes/iconbundle.rb +3 -0
  45. data/lib/wx/classes/image.rb +53 -0
  46. data/lib/wx/classes/imagelist.rb +3 -0
  47. data/lib/wx/classes/listbox.rb +4 -0
  48. data/lib/wx/classes/listctrl.rb +33 -0
  49. data/lib/wx/classes/locale.rb +28 -0
  50. data/lib/wx/classes/mediactrl.rb +48 -0
  51. data/lib/wx/classes/menu.rb +62 -0
  52. data/lib/wx/classes/menuitem.rb +7 -0
  53. data/lib/wx/classes/notebook.rb +9 -0
  54. data/lib/wx/classes/object.rb +14 -0
  55. data/lib/wx/classes/paintdc.rb +12 -0
  56. data/lib/wx/classes/point.rb +56 -0
  57. data/lib/wx/classes/previewframe.rb +13 -0
  58. data/lib/wx/classes/rect.rb +19 -0
  59. data/lib/wx/classes/richtextctrl.rb +63 -0
  60. data/lib/wx/classes/simplehelpprovider.rb +38 -0
  61. data/lib/wx/classes/size.rb +58 -0
  62. data/lib/wx/classes/sizer.rb +43 -0
  63. data/lib/wx/classes/sound.rb +23 -0
  64. data/lib/wx/classes/splitterwindow.rb +10 -0
  65. data/lib/wx/classes/standardpaths.rb +9 -0
  66. data/lib/wx/classes/styledtextctrl.rb +92 -0
  67. data/lib/wx/classes/textctrl.rb +14 -0
  68. data/lib/wx/classes/texturlevent.rb +18 -0
  69. data/lib/wx/classes/timer.rb +96 -0
  70. data/lib/wx/classes/toolbar.rb +36 -0
  71. data/lib/wx/classes/toolbartool.rb +4 -0
  72. data/lib/wx/classes/treectrl.rb +44 -0
  73. data/lib/wx/classes/validator.rb +7 -0
  74. data/lib/wx/classes/vboxsizer.rb +6 -0
  75. data/lib/wx/classes/window.rb +89 -0
  76. data/lib/wx/classes/xmlresource.rb +54 -0
  77. data/lib/wx/helpers.rb +54 -0
  78. data/lib/wx/keyword_ctors.rb +204 -0
  79. data/lib/wx/keyword_defs.rb +585 -0
  80. data/lib/wx/version.rb +3 -0
  81. data/lib/wxruby2.so +0 -0
  82. data/samples/SAMPLES-LICENSE.TXT +18 -0
  83. data/samples/aui/aui.rb +1356 -0
  84. data/samples/bigdemo/About.rbw +39 -0
  85. data/samples/bigdemo/ColorPanel.rbw +23 -0
  86. data/samples/bigdemo/GridSimple.rbw +78 -0
  87. data/samples/bigdemo/MDIDemo.rbw +57 -0
  88. data/samples/bigdemo/PopupMenu.rbw +149 -0
  89. data/samples/bigdemo/ShapedWindow.rbw +128 -0
  90. data/samples/bigdemo/Sizers.rbw +543 -0
  91. data/samples/bigdemo/bigdemo.rb +823 -0
  92. data/samples/bigdemo/demoTemplate.rbw +33 -0
  93. data/samples/bigdemo/helpfile.htb +0 -0
  94. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  95. data/samples/bigdemo/icons/Test 015.png +0 -0
  96. data/samples/bigdemo/icons/choice.bmp +0 -0
  97. data/samples/bigdemo/icons/choice.xpm +27 -0
  98. data/samples/bigdemo/icons/combo.bmp +0 -0
  99. data/samples/bigdemo/icons/combo.xpm +27 -0
  100. data/samples/bigdemo/icons/copy.xpm +25 -0
  101. data/samples/bigdemo/icons/cut.xpm +24 -0
  102. data/samples/bigdemo/icons/gauge.bmp +0 -0
  103. data/samples/bigdemo/icons/gauge.xpm +27 -0
  104. data/samples/bigdemo/icons/help.xpm +25 -0
  105. data/samples/bigdemo/icons/list.bmp +0 -0
  106. data/samples/bigdemo/icons/list.xpm +27 -0
  107. data/samples/bigdemo/icons/mondrian.ico +0 -0
  108. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  109. data/samples/bigdemo/icons/new.xpm +24 -0
  110. data/samples/bigdemo/icons/ogl.ico +0 -0
  111. data/samples/bigdemo/icons/ogl.xpm +45 -0
  112. data/samples/bigdemo/icons/open.xpm +26 -0
  113. data/samples/bigdemo/icons/paste.bmp +0 -0
  114. data/samples/bigdemo/icons/paste.xpm +38 -0
  115. data/samples/bigdemo/icons/pointy.png +0 -0
  116. data/samples/bigdemo/icons/preview.xpm +26 -0
  117. data/samples/bigdemo/icons/print.xpm +26 -0
  118. data/samples/bigdemo/icons/radio.bmp +0 -0
  119. data/samples/bigdemo/icons/radio.xpm +27 -0
  120. data/samples/bigdemo/icons/robert.xpm +415 -0
  121. data/samples/bigdemo/icons/sashtest.ico +0 -0
  122. data/samples/bigdemo/icons/save.xpm +25 -0
  123. data/samples/bigdemo/icons/smiles.bmp +0 -0
  124. data/samples/bigdemo/icons/smiles.xpm +39 -0
  125. data/samples/bigdemo/icons/smiley.ico +0 -0
  126. data/samples/bigdemo/icons/smiley.xpm +42 -0
  127. data/samples/bigdemo/icons/stattext.xpm +24 -0
  128. data/samples/bigdemo/icons/test2.bmp +0 -0
  129. data/samples/bigdemo/icons/test2.png +0 -0
  130. data/samples/bigdemo/icons/test2.xpm +79 -0
  131. data/samples/bigdemo/icons/text.bmp +0 -0
  132. data/samples/bigdemo/icons/text.xpm +27 -0
  133. data/samples/bigdemo/icons/tog1.bmp +0 -0
  134. data/samples/bigdemo/icons/tog1.xpm +38 -0
  135. data/samples/bigdemo/icons/tog2.bmp +0 -0
  136. data/samples/bigdemo/icons/tog2.xpm +38 -0
  137. data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
  138. data/samples/bigdemo/icons/wxwin.ico +0 -0
  139. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  140. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  141. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  142. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  143. data/samples/bigdemo/run.rb +90 -0
  144. data/samples/bigdemo/tips.txt +7 -0
  145. data/samples/bigdemo/utils.rb +12 -0
  146. data/samples/bigdemo/wxArtProvider.rbw +281 -0
  147. data/samples/bigdemo/wxBitmapButton.rbw +65 -0
  148. data/samples/bigdemo/wxButton.rbw +64 -0
  149. data/samples/bigdemo/wxCalendarCtrl.rbw +60 -0
  150. data/samples/bigdemo/wxCheckBox.rbw +50 -0
  151. data/samples/bigdemo/wxCheckListBox.rbw +65 -0
  152. data/samples/bigdemo/wxChoice.rbw +47 -0
  153. data/samples/bigdemo/wxChoicebook.rbw +78 -0
  154. data/samples/bigdemo/wxColourDialog.rbw +31 -0
  155. data/samples/bigdemo/wxComboBox.rbw +77 -0
  156. data/samples/bigdemo/wxCursor.rbw +136 -0
  157. data/samples/bigdemo/wxDialog.rbw +74 -0
  158. data/samples/bigdemo/wxDirDialog.rbw +29 -0
  159. data/samples/bigdemo/wxDragImage.rbw +70 -0
  160. data/samples/bigdemo/wxFileDialog.rbw +37 -0
  161. data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
  162. data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
  163. data/samples/bigdemo/wxFontDialog.rbw +173 -0
  164. data/samples/bigdemo/wxFrame.rbw +53 -0
  165. data/samples/bigdemo/wxGauge.rbw +71 -0
  166. data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
  167. data/samples/bigdemo/wxGrid.rbw +66 -0
  168. data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
  169. data/samples/bigdemo/wxListBox.rbw +140 -0
  170. data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -0
  171. data/samples/bigdemo/wxMDIWindows.rbw +50 -0
  172. data/samples/bigdemo/wxMenu.rbw +236 -0
  173. data/samples/bigdemo/wxMessageDialog.rbw +27 -0
  174. data/samples/bigdemo/wxMiniFrame.rbw +70 -0
  175. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -0
  176. data/samples/bigdemo/wxNotebook.rbw +136 -0
  177. data/samples/bigdemo/wxProgressDialog.rbw +43 -0
  178. data/samples/bigdemo/wxRadioBox.rbw +72 -0
  179. data/samples/bigdemo/wxRadioButton.rbw +125 -0
  180. data/samples/bigdemo/wxSashWindow.rbw +141 -0
  181. data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
  182. data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
  183. data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
  184. data/samples/bigdemo/wxSlider.rbw +42 -0
  185. data/samples/bigdemo/wxSpinButton.rbw +50 -0
  186. data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
  187. data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
  188. data/samples/bigdemo/wxStaticBitmap.rbw +47 -0
  189. data/samples/bigdemo/wxStaticText.rbw +55 -0
  190. data/samples/bigdemo/wxStatusBar.rbw +126 -0
  191. data/samples/bigdemo/wxTextCtrl.rbw +149 -0
  192. data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
  193. data/samples/bigdemo/wxToggleButton.rbw +49 -0
  194. data/samples/bigdemo/wxToolBar.rbw +131 -0
  195. data/samples/bigdemo/wxTreeCtrl.rbw +191 -0
  196. data/samples/calendar/calendar.rb +348 -0
  197. data/samples/caret/caret.rb +282 -0
  198. data/samples/caret/mondrian.xpm +44 -0
  199. data/samples/controls/controls.rb +1136 -0
  200. data/samples/controls/get_item_sample.rb +87 -0
  201. data/samples/controls/icons/choice.xpm +27 -0
  202. data/samples/controls/icons/combo.xpm +27 -0
  203. data/samples/controls/icons/gauge.xpm +27 -0
  204. data/samples/controls/icons/list.xpm +27 -0
  205. data/samples/controls/icons/radio.xpm +27 -0
  206. data/samples/controls/icons/stattext.xpm +24 -0
  207. data/samples/controls/icons/text.xpm +27 -0
  208. data/samples/controls/mondrian.ico +0 -0
  209. data/samples/controls/mondrian.xpm +44 -0
  210. data/samples/controls/test2.bmp +0 -0
  211. data/samples/dialogs/dialogs.rb +797 -0
  212. data/samples/dialogs/tips.txt +18 -0
  213. data/samples/dragdrop/dragdrop.rb +177 -0
  214. data/samples/drawing/bitmap.rb +49 -0
  215. data/samples/drawing/bitmap_image.rb +92 -0
  216. data/samples/drawing/graphics_drawing.rb +235 -0
  217. data/samples/drawing/maths_images.rb +265 -0
  218. data/samples/drawing/rmagic_bitmap_image.rb +110 -0
  219. data/samples/drawing/ruby-logo.jpg +0 -0
  220. data/samples/etc/activation.rb +102 -0
  221. data/samples/etc/choice.rb +67 -0
  222. data/samples/etc/miniframe.rb +79 -0
  223. data/samples/etc/sash.rb +130 -0
  224. data/samples/etc/scrollwin.rb +110 -0
  225. data/samples/etc/system_settings.rb +252 -0
  226. data/samples/etc/threaded.rb +72 -0
  227. data/samples/etc/toolbar_sizer_additem.rb +55 -0
  228. data/samples/etc/wizard.rb +74 -0
  229. data/samples/event/event.rb +182 -0
  230. data/samples/event/update_ui_event.rb +70 -0
  231. data/samples/grid/grid.rb +198 -0
  232. data/samples/grid/gridtablebase.rb +148 -0
  233. data/samples/html/html.rb +262 -0
  234. data/samples/listbook/listbook.rb +174 -0
  235. data/samples/listbook/listbook.xrc +370 -0
  236. data/samples/mdi/mdi.rb +85 -0
  237. data/samples/media/mediactrl.rb +167 -0
  238. data/samples/minimal/minimal.rb +77 -0
  239. data/samples/minimal/mondrian.ico +0 -0
  240. data/samples/minimal/mondrian.png +0 -0
  241. data/samples/minimal/nothing.rb +16 -0
  242. data/samples/opengl/cube.rb +130 -0
  243. data/samples/opengl/cube_anim_lighting.rb +191 -0
  244. data/samples/printing/mondrian.ico +0 -0
  245. data/samples/printing/mondrian.xpm +44 -0
  246. data/samples/printing/printing.rb +487 -0
  247. data/samples/sockets/SocketPackets.rb +27 -0
  248. data/samples/sockets/res/message-new.png +0 -0
  249. data/samples/sockets/res/user.png +0 -0
  250. data/samples/sockets/wxClient.rb +395 -0
  251. data/samples/sockets/wxServer.rb +422 -0
  252. data/samples/sockets/wxSocketGUI.rb +97 -0
  253. data/samples/text/document-open.png +0 -0
  254. data/samples/text/document-save.png +0 -0
  255. data/samples/text/edit-copy.png +0 -0
  256. data/samples/text/edit-cut.png +0 -0
  257. data/samples/text/edit-paste.png +0 -0
  258. data/samples/text/edit-redo.png +0 -0
  259. data/samples/text/edit-undo.png +0 -0
  260. data/samples/text/format-text-bold.png +0 -0
  261. data/samples/text/format-text-italic.png +0 -0
  262. data/samples/text/format-text-underline.png +0 -0
  263. data/samples/text/mondrian.ico +0 -0
  264. data/samples/text/mondrian.xpm +44 -0
  265. data/samples/text/preferences-desktop-font.png +0 -0
  266. data/samples/text/rich_textctrl.rb +290 -0
  267. data/samples/text/scintilla.rb +169 -0
  268. data/samples/text/textctrl.rb +111 -0
  269. data/samples/text/unicode.rb +242 -0
  270. data/samples/text/utf8.txt +15 -0
  271. data/samples/treectrl/icon1.xpm +79 -0
  272. data/samples/treectrl/icon2.xpm +53 -0
  273. data/samples/treectrl/icon3.xpm +79 -0
  274. data/samples/treectrl/icon4.xpm +43 -0
  275. data/samples/treectrl/icon5.xpm +79 -0
  276. data/samples/treectrl/treectrl.rb +1166 -0
  277. data/samples/xrc/samples.xrc +46 -0
  278. data/samples/xrc/xrc_sample.rb +76 -0
  279. metadata +330 -0
@@ -0,0 +1,3 @@
1
+ class Wx::IconBundle
2
+ alias :<< :add_icon
3
+ end
@@ -0,0 +1,53 @@
1
+ # A platform-independent image; can be manipulated more extensively than
2
+ # Bitmap, but must be converted to a Bitmap for drawing.
3
+ class Wx::Image
4
+
5
+ # alias for backward compatibility
6
+ alias :get_data :get_rgb_data
7
+ alias :set_data :set_rgb_data
8
+
9
+ # Load the type-guessing hash from Wx::Bitmap
10
+ require 'wx/classes/bitmap'
11
+ BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
12
+
13
+ # Load a new image from an IO-like object that supports "read"
14
+ def self.read(an_io, type_or_mime, index = -1)
15
+ img = new
16
+ img.load_stream(an_io, type_or_mime, index)
17
+ img
18
+ end
19
+
20
+ # Create a new image from Wx::Bitmap, preserving mask information
21
+ def self.from_bitmap(bmp)
22
+ bmp.convert_to_image
23
+ end
24
+
25
+ # Ruby methods that switch class are conventionally named to_foo
26
+ def to_bitmap
27
+ Wx::Bitmap.from_image(self)
28
+ end
29
+
30
+ # Redefine the initialize method so it raises an exception if a
31
+ # non-existent file is given to the constructor; otherwise, wx Widgets
32
+ # just carries on with an invalid image, which may cause faults
33
+ # later. Also, if loading from a file, and the type is not specified,
34
+ # try to guess it from the filename extension
35
+ wx_init = self.instance_method(:initialize)
36
+ define_method(:initialize) do | *args |
37
+ if args[0].kind_of? String
38
+ if not File.exist?( File.expand_path(args[0]) )
39
+ Kernel.raise(ArgumentError, "Image file does not exist: #{args[0]}")
40
+ end
41
+ # If type not specified, try to guess it from the file extension
42
+ if not args[1] and file_ext = args[0][/\w+$/]
43
+ args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
44
+ end
45
+ end
46
+ wx_init.bind(self).call(*args)
47
+ end
48
+
49
+ # Convert to bitmap
50
+ def convert_to_bitmap
51
+ Wx::Bitmap.from_image(self)
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ class Wx::ImageList
2
+ alias :<< :add
3
+ end
@@ -0,0 +1,4 @@
1
+ class Wx::ListBox
2
+ alias :get_item_data :get_client_data
3
+ alias :set_item_data :set_client_data
4
+ end
@@ -0,0 +1,33 @@
1
+ # Multi-item control with numerous possible view styles
2
+ class Wx::ListCtrl
3
+ # Make these ruby enumerables so find, find_all, map are available
4
+ include Enumerable
5
+ # Passes each valid item index into the passed block
6
+ def each
7
+ 0.upto(item_count - 1) { | i | yield i }
8
+ end
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_ALL, Wx::LIST_STATE_SELECTED)
15
+ while item >= 0
16
+ selections << item
17
+ item = get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)
18
+ end
19
+ selections
20
+ end
21
+
22
+ # Stub version for LC_VIRTUAL controls that does nothing; may be
23
+ # overridden in subclasses.
24
+ def on_get_item_attr(i)
25
+ nil
26
+ end
27
+
28
+ # Stub version for LC_VIRTUAL|LC_REPORT controls that does nothing;
29
+ # may be overridden in subclasses.
30
+ def on_get_item_column_image(i, col)
31
+ -1
32
+ end
33
+ end
@@ -0,0 +1,28 @@
1
+ class Wx::Locale
2
+ class << self
3
+ def get_system_language_name
4
+ get_language_name( get_system_language )
5
+ end
6
+
7
+ def get_system_encoding_name
8
+ Wx::Font::ENCODING_NAMES[ get_system_encoding ]
9
+ end
10
+
11
+ # Set the current locale by a name, canonical name, or Wx::LANGUAGE_
12
+ # constant; mainly here because it seems a bit strange in Ruby to
13
+ # have global side-effects in a constructor
14
+ def set_locale(locale)
15
+ if locale.kind_of?(Fixnum)
16
+ new(locale)
17
+ elsif locale.kind_of?(String) and lang_info = find_language_info(locale)
18
+ new(lang_info.language)
19
+ else
20
+ raise ArgumentError, "Unknown language #{locale}"
21
+ end
22
+ end
23
+ end
24
+
25
+ def get_language_name
26
+ self.class.get_language_name(get_language)
27
+ end
28
+ end
@@ -0,0 +1,48 @@
1
+ # Functionality here must be loaded first to add custom events
2
+ require 'wx/classes/evthandler'
3
+
4
+ # These event handlers should only be defined if MediaCtrl is actually
5
+ # available; some builds may not include it
6
+ if defined?(Wx::MediaCtrl)
7
+ evt_type = Wx::EvtHandler::EventType
8
+ mediactrl_event_types = [
9
+ evt_type['evt_media_finished', 1,
10
+ Wx::EVT_MEDIA_FINISHED,
11
+ Wx::MediaEvent],
12
+ evt_type['evt_media_loaded', 1,
13
+ Wx::EVT_MEDIA_LOADED,
14
+ Wx::MediaEvent],
15
+ evt_type['evt_media_pause', 1,
16
+ Wx::EVT_MEDIA_PAUSE,
17
+ Wx::MediaEvent],
18
+ evt_type['evt_media_play', 1,
19
+ Wx::EVT_MEDIA_PLAY,
20
+ Wx::MediaEvent],
21
+ evt_type['evt_media_statechanged', 1,
22
+ Wx::EVT_MEDIA_STATECHANGED,
23
+ Wx::MediaEvent],
24
+ evt_type['evt_media_stop', 1,
25
+ Wx::EVT_MEDIA_STOP,
26
+ Wx::MediaEvent]
27
+ ]
28
+ mediactrl_event_types.each do | ev_type |
29
+ Wx::EvtHandler.register_event_type(ev_type)
30
+ end
31
+
32
+ # Extend with a nicer interface to get_state
33
+ class Wx::MediaCtrl
34
+ # Returns true if the media is currently paused, else false
35
+ def is_paused
36
+ get_state == Wx::MEDIASTATE_PAUSED
37
+ end
38
+ # Returns true if the media is currently playing, else false
39
+ def is_playing
40
+ get_state == Wx::MEDIASTATE_PLAYING
41
+ end
42
+ # Returns true if the media is currently stopped, else false
43
+ def is_stopped
44
+ get_state == Wx::MEDIASTATE_STOPPED
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,62 @@
1
+ # A single labelled list within a drop-down menu, or a popup menu
2
+ class Wx::Menu
3
+
4
+ # In the standard WxWidgets API, the methods append, prepend, insert
5
+ # (and their variants) require a constant integer id as the identifier
6
+ # of the menu item. This is then used in event handling.
7
+ #
8
+ # In WxRuby the use of explicit ids can be avoided in most cases,
9
+ # being a most unruby-ish practice. So, by analogy with the general
10
+ # use of Wx::Window classes and event handlers, where the id is
11
+ # implicit in the constructor, and the window can be passed direct to
12
+ # the event handler setup method, the below sets up a similar facility
13
+ # for adding items to Wx::Menu.
14
+ #
15
+ # For all these methods, the only required argument is the string name
16
+ # of the menu item; a system-default id will be supplied if no
17
+ # explicit one is given. The return value of these methods in all
18
+ # cases is a Wx::MenuItem object, which can be passed directly as the
19
+ # first argument to an evt_menu handler.
20
+ def self.methods_with_optional_ids(*meth_names)
21
+ class_eval do
22
+ meth_names.each do | meth |
23
+ old_meth = instance_method(meth)
24
+ define_method(meth) do | *args |
25
+ case args.first
26
+ when Fixnum then old_meth.bind(self).call(*args)
27
+ when String then old_meth.bind(self).call(Wx::ID_ANY, *args)
28
+ when Wx::MenuItem then old_meth.bind(self).call(args.first)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ # Create the optional-id methods
36
+ methods_with_optional_ids :append, :prepend,
37
+ :append_check_item, :prepend_check_item,
38
+ :append_radio_item, :prepend_radio_item
39
+
40
+ # This is much the same as above, except for insert and variants,
41
+ # which take an additional first argument, the position at which to
42
+ # insert the new item.
43
+ def self.methods_with_optional_ids_and_pos(*meth_names)
44
+ class_eval do
45
+ meth_names.each do | meth |
46
+ old_meth = instance_method(meth)
47
+ define_method(meth) do | pos, *args |
48
+ case args.first
49
+ when Fixnum then old_meth.bind(self).call(pos, *args)
50
+ when String then old_meth.bind(self).call(pos, Wx::ID_ANY, *args)
51
+ when Wx::MenuItem then old_meth.bind(self).call(pos, args.first)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ # Create the optional-id methods
59
+ methods_with_optional_ids_and_pos :insert,
60
+ :insert_check_item,
61
+ :insert_radio_item
62
+ end
@@ -0,0 +1,7 @@
1
+ # An individual item within a frame or popup menu
2
+ class Wx::MenuItem
3
+ # Get the Wx id, not Ruby's deprecated Object#id
4
+ alias :id :get_id
5
+ # In case a more explicit option is preferred.
6
+ alias :wx_id :get_id
7
+ end
@@ -0,0 +1,9 @@
1
+ # Displays a set of pages in parallel using tabs
2
+ class Wx::Notebook
3
+ # Convenience method for iterating pages
4
+ def each_page
5
+ 0.upto(get_page_count - 1) do | i |
6
+ yield get_page(i)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ # The root class for most (not all) WxRuby classes
2
+ class Wx::Object
3
+ # Massage the output of inspect to show the public module name (Wx),
4
+ # instead of the internal name (Wxruby2)
5
+ def to_s
6
+ super.sub('ruby2', '')
7
+ end
8
+
9
+ # Returns a string containing the C++ pointer address of this
10
+ # object. Only useful for debugging.
11
+ def ptr_addr
12
+ Wx::ptr_addr(self)
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # Device Context to paint within an on_paint handler
2
+ class Wx::PaintDC
3
+ # This class should not be instantiated directly in wxRuby; it should
4
+ # always be used via Window#paint, which takes a block receiving the
5
+ # DC. This ensures that the DC is cleaned up at the correct time,
6
+ # preventing serious errors on some platforms.
7
+ define_method(:initialize) do | *args |
8
+ Kernel.raise RuntimeError,
9
+ "Do not instantiate PaintDC directly; use Window#paint",
10
+ caller[1..-1]
11
+ end
12
+ end
@@ -0,0 +1,56 @@
1
+ class Wx::Point
2
+ # More informative output when converted to string
3
+ def to_s
4
+ "#<Wx::Point: (#{x}, #{y})>"
5
+ end
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
+
15
+ # Return a new Wx::Point with the x and y parameters both divided by
16
+ # parameter +div+, which should be a Numeric
17
+ def /(div)
18
+ self.class.new( (get_x / div).to_i, (get_y / div).to_i )
19
+ end
20
+
21
+ # Return a new Wx::Point with the x and y values both multiplied by
22
+ # parameter +mul+, which should be a Numeric
23
+ def *(mul)
24
+ self.class.new( (get_x * mul).to_i, (get_y * mul).to_i )
25
+ end
26
+
27
+ # Return a new Wx::Point with the x and y values both reduced by
28
+ # parameter +arg+. If +arg+ is another Wx::Point, reduce x by the
29
+ # other's x and y by the other's y; if +arg+ is a numeric value,
30
+ # reduce x and y both by that value.
31
+ def -(arg)
32
+ case arg
33
+ when self.class
34
+ self.class.new( get_x - arg.get_x, get_y - arg.get_y )
35
+ when Numeric
36
+ self.class.new( (get_x - arg).to_i, (get_y - arg).to_i )
37
+ else
38
+ Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
39
+ end
40
+ end
41
+
42
+ # Return a new Wx::Point with the x and y values both increased by
43
+ # parameter +arg+. If +arg+ is another Wx::Point, increase x by the
44
+ # other's x and y by the other's y; if +arg+ is a numeric value,
45
+ # increase both x and y by that value.
46
+ def +(arg)
47
+ case arg
48
+ when self.class
49
+ self.class.new( get_x + arg.get_x, get_y + arg.get_y )
50
+ when Numeric
51
+ self.class.new( (get_x + arg).to_i, (get_y + arg).to_i )
52
+ else
53
+ Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,13 @@
1
+ # Frame that displays a print preview
2
+ class Wx::PreviewFrame
3
+ # a PreviewFrame has a preview associated with it that must be
4
+ # protected from Ruby's GC. However, there is no C++ method to access
5
+ # the Wx::PrintPreview (only a protected member), so instead we have
6
+ # to assign it to an instance variable so it is marked correctly when
7
+ # the frame displaying it is marked.
8
+ wx_init = self.instance_method(:initialize)
9
+ define_method(:initialize) do | *args |
10
+ wx_init.bind(self).call(*args)
11
+ @__preview = args[0]
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ # Class representing a rectangular shape
2
+ class Wx::Rect
3
+ # Nicely readable inspect output for Rect
4
+ def to_s
5
+ "#<Wx::Rect: (#{get_left}, #{get_top}) (#{get_right}, #{get_bottom})>"
6
+ end
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
17
+ # More ruby-ish names
18
+ alias :contains? :contains
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