wxruby 1.9.3-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/LICENSE +53 -0
  2. data/README +299 -0
  3. data/lib/wx.rb +42 -0
  4. data/lib/wx/accessors.rb +52 -0
  5. data/lib/wx/classes/app.rb +45 -0
  6. data/lib/wx/classes/artprovider.rb +31 -0
  7. data/lib/wx/classes/bitmap.rb +23 -0
  8. data/lib/wx/classes/checklistbox.rb +45 -0
  9. data/lib/wx/classes/choice.rb +4 -0
  10. data/lib/wx/classes/clientdc.rb +13 -0
  11. data/lib/wx/classes/clipboard.rb +16 -0
  12. data/lib/wx/classes/colour.rb +47 -0
  13. data/lib/wx/classes/combobox.rb +4 -0
  14. data/lib/wx/classes/commandevent.rb +7 -0
  15. data/lib/wx/classes/controlwithitems.rb +10 -0
  16. data/lib/wx/classes/event.rb +5 -0
  17. data/lib/wx/classes/evthandler.rb +894 -0
  18. data/lib/wx/classes/font.rb +118 -0
  19. data/lib/wx/classes/grid.rb +129 -0
  20. data/lib/wx/classes/helpcontroller.rb +5 -0
  21. data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
  22. data/lib/wx/classes/htmlwindow.rb +6 -0
  23. data/lib/wx/classes/icon.rb +14 -0
  24. data/lib/wx/classes/image.rb +14 -0
  25. data/lib/wx/classes/listbox.rb +4 -0
  26. data/lib/wx/classes/listctrl.rb +21 -0
  27. data/lib/wx/classes/locale.rb +28 -0
  28. data/lib/wx/classes/mediactrl.rb +22 -0
  29. data/lib/wx/classes/menu.rb +62 -0
  30. data/lib/wx/classes/menuitem.rb +7 -0
  31. data/lib/wx/classes/object.rb +7 -0
  32. data/lib/wx/classes/paintdc.rb +12 -0
  33. data/lib/wx/classes/point.rb +48 -0
  34. data/lib/wx/classes/previewframe.rb +13 -0
  35. data/lib/wx/classes/rect.rb +5 -0
  36. data/lib/wx/classes/size.rb +49 -0
  37. data/lib/wx/classes/sound.rb +23 -0
  38. data/lib/wx/classes/styledtextctrl.rb +92 -0
  39. data/lib/wx/classes/textctrl.rb +14 -0
  40. data/lib/wx/classes/texturlevent.rb +6 -0
  41. data/lib/wx/classes/timer.rb +69 -0
  42. data/lib/wx/classes/treectrl.rb +44 -0
  43. data/lib/wx/classes/window.rb +49 -0
  44. data/lib/wx/classes/xmlresource.rb +16 -0
  45. data/lib/wx/keyword_ctors.rb +219 -0
  46. data/lib/wx/keyword_defs.rb +485 -0
  47. data/lib/wx/version.rb +3 -0
  48. data/lib/wxruby2.so +0 -0
  49. data/samples/SAMPLES-LICENSE.TXT +18 -0
  50. data/samples/aui/aui.rb +1360 -0
  51. data/samples/bigdemo/About.rbw +39 -0
  52. data/samples/bigdemo/ColorPanel.rbw +25 -0
  53. data/samples/bigdemo/GridSimple.rbw +80 -0
  54. data/samples/bigdemo/MDIDemo.rbw +59 -0
  55. data/samples/bigdemo/PopupMenu.rbw +151 -0
  56. data/samples/bigdemo/ShapedWindow.rbw +135 -0
  57. data/samples/bigdemo/Sizers.rbw +545 -0
  58. data/samples/bigdemo/bigdemo.rb +826 -0
  59. data/samples/bigdemo/demoTemplate.rbw +37 -0
  60. data/samples/bigdemo/helpfile.htb +0 -0
  61. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  62. data/samples/bigdemo/icons/Test 015.png +0 -0
  63. data/samples/bigdemo/icons/choice.bmp +0 -0
  64. data/samples/bigdemo/icons/choice.xpm +27 -0
  65. data/samples/bigdemo/icons/combo.bmp +0 -0
  66. data/samples/bigdemo/icons/combo.xpm +27 -0
  67. data/samples/bigdemo/icons/copy.xpm +25 -0
  68. data/samples/bigdemo/icons/cut.xpm +24 -0
  69. data/samples/bigdemo/icons/gauge.bmp +0 -0
  70. data/samples/bigdemo/icons/gauge.xpm +27 -0
  71. data/samples/bigdemo/icons/help.xpm +25 -0
  72. data/samples/bigdemo/icons/list.bmp +0 -0
  73. data/samples/bigdemo/icons/list.xpm +27 -0
  74. data/samples/bigdemo/icons/mondrian.ico +0 -0
  75. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  76. data/samples/bigdemo/icons/new.xpm +24 -0
  77. data/samples/bigdemo/icons/ogl.ico +0 -0
  78. data/samples/bigdemo/icons/ogl.xpm +45 -0
  79. data/samples/bigdemo/icons/open.xpm +26 -0
  80. data/samples/bigdemo/icons/paste.bmp +0 -0
  81. data/samples/bigdemo/icons/paste.xpm +38 -0
  82. data/samples/bigdemo/icons/pointy.png +0 -0
  83. data/samples/bigdemo/icons/preview.xpm +26 -0
  84. data/samples/bigdemo/icons/print.xpm +26 -0
  85. data/samples/bigdemo/icons/radio.bmp +0 -0
  86. data/samples/bigdemo/icons/radio.xpm +27 -0
  87. data/samples/bigdemo/icons/robert.xpm +415 -0
  88. data/samples/bigdemo/icons/ruby.png +0 -0
  89. data/samples/bigdemo/icons/sashtest.ico +0 -0
  90. data/samples/bigdemo/icons/save.xpm +25 -0
  91. data/samples/bigdemo/icons/smiles.bmp +0 -0
  92. data/samples/bigdemo/icons/smiles.xpm +39 -0
  93. data/samples/bigdemo/icons/smiley.ico +0 -0
  94. data/samples/bigdemo/icons/smiley.xpm +42 -0
  95. data/samples/bigdemo/icons/stattext.xpm +24 -0
  96. data/samples/bigdemo/icons/test2.bmp +0 -0
  97. data/samples/bigdemo/icons/test2.png +0 -0
  98. data/samples/bigdemo/icons/test2.xpm +79 -0
  99. data/samples/bigdemo/icons/text.bmp +0 -0
  100. data/samples/bigdemo/icons/text.xpm +27 -0
  101. data/samples/bigdemo/icons/tog1.bmp +0 -0
  102. data/samples/bigdemo/icons/tog1.xpm +38 -0
  103. data/samples/bigdemo/icons/tog2.bmp +0 -0
  104. data/samples/bigdemo/icons/tog2.xpm +38 -0
  105. data/samples/bigdemo/icons/wxwin.ico +0 -0
  106. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  107. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  108. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  109. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  110. data/samples/bigdemo/run.rb +94 -0
  111. data/samples/bigdemo/tips.txt +7 -0
  112. data/samples/bigdemo/utils.rb +12 -0
  113. data/samples/bigdemo/wxArtProvider.rbw +285 -0
  114. data/samples/bigdemo/wxBitmapButton.rbw +64 -0
  115. data/samples/bigdemo/wxButton.rbw +66 -0
  116. data/samples/bigdemo/wxCalendarCtrl.rbw +72 -0
  117. data/samples/bigdemo/wxCheckBox.rbw +52 -0
  118. data/samples/bigdemo/wxCheckListBox.rbw +77 -0
  119. data/samples/bigdemo/wxChoice.rbw +49 -0
  120. data/samples/bigdemo/wxChoicebook.rbw +80 -0
  121. data/samples/bigdemo/wxColourDialog.rbw +34 -0
  122. data/samples/bigdemo/wxComboBox.rbw +79 -0
  123. data/samples/bigdemo/wxCursor.rbw +140 -0
  124. data/samples/bigdemo/wxDialog.rbw +92 -0
  125. data/samples/bigdemo/wxDirDialog.rbw +32 -0
  126. data/samples/bigdemo/wxDragImage.rbw +74 -0
  127. data/samples/bigdemo/wxFileDialog.rbw +39 -0
  128. data/samples/bigdemo/wxFileDialog_Save.rbw +38 -0
  129. data/samples/bigdemo/wxFindReplaceDialog.rbw +85 -0
  130. data/samples/bigdemo/wxFontDialog.rbw +176 -0
  131. data/samples/bigdemo/wxFrame.rbw +55 -0
  132. data/samples/bigdemo/wxGauge.rbw +73 -0
  133. data/samples/bigdemo/wxGenericDirCtrl.rbw +78 -0
  134. data/samples/bigdemo/wxGrid.rbw +68 -0
  135. data/samples/bigdemo/wxHtmlHelpController.rbw +57 -0
  136. data/samples/bigdemo/wxListBox.rbw +142 -0
  137. data/samples/bigdemo/wxListCtrl_virtual.rbw +109 -0
  138. data/samples/bigdemo/wxMDIWindows.rbw +52 -0
  139. data/samples/bigdemo/wxMenu.rbw +238 -0
  140. data/samples/bigdemo/wxMessageDialog.rbw +30 -0
  141. data/samples/bigdemo/wxMiniFrame.rbw +74 -0
  142. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +34 -0
  143. data/samples/bigdemo/wxNotebook.rbw +138 -0
  144. data/samples/bigdemo/wxProgressDialog.rbw +45 -0
  145. data/samples/bigdemo/wxRadioBox.rbw +74 -0
  146. data/samples/bigdemo/wxRadioButton.rbw +127 -0
  147. data/samples/bigdemo/wxSashWindow.rbw +145 -0
  148. data/samples/bigdemo/wxScrolledMessageDialog.rbw +59 -0
  149. data/samples/bigdemo/wxScrolledWindow.rbw +201 -0
  150. data/samples/bigdemo/wxSingleChoiceDialog.rbw +35 -0
  151. data/samples/bigdemo/wxSlider.rbw +44 -0
  152. data/samples/bigdemo/wxSpinButton.rbw +52 -0
  153. data/samples/bigdemo/wxSpinCtrl.rbw +53 -0
  154. data/samples/bigdemo/wxSplitterWindow.rbw +65 -0
  155. data/samples/bigdemo/wxStaticBitmap.rbw +53 -0
  156. data/samples/bigdemo/wxStaticText.rbw +57 -0
  157. data/samples/bigdemo/wxStatusBar.rbw +128 -0
  158. data/samples/bigdemo/wxTextCtrl.rbw +151 -0
  159. data/samples/bigdemo/wxTextEntryDialog.rbw +34 -0
  160. data/samples/bigdemo/wxToggleButton.rbw +51 -0
  161. data/samples/bigdemo/wxToolBar.rbw +133 -0
  162. data/samples/bigdemo/wxTreeCtrl.rbw +192 -0
  163. data/samples/calendar/calendar.rb +275 -0
  164. data/samples/caret/caret.rb +286 -0
  165. data/samples/caret/mondrian.xpm +44 -0
  166. data/samples/controls/controls.rb +1140 -0
  167. data/samples/controls/get_item_sample.rb +87 -0
  168. data/samples/controls/icons/choice.xpm +27 -0
  169. data/samples/controls/icons/combo.xpm +27 -0
  170. data/samples/controls/icons/gauge.xpm +27 -0
  171. data/samples/controls/icons/list.xpm +27 -0
  172. data/samples/controls/icons/radio.xpm +27 -0
  173. data/samples/controls/icons/stattext.xpm +24 -0
  174. data/samples/controls/icons/text.xpm +27 -0
  175. data/samples/controls/mondrian.ico +0 -0
  176. data/samples/controls/mondrian.xpm +44 -0
  177. data/samples/controls/test2.bmp +0 -0
  178. data/samples/dialogs/dialogs.rb +724 -0
  179. data/samples/dialogs/tips.txt +18 -0
  180. data/samples/drawing/graphics_drawing.rb +232 -0
  181. data/samples/drawing/images.rb +48 -0
  182. data/samples/drawing/paperclip.png +0 -0
  183. data/samples/etc/activation.rb +108 -0
  184. data/samples/etc/choice.rb +72 -0
  185. data/samples/etc/miniframe.rb +84 -0
  186. data/samples/etc/sash.rb +135 -0
  187. data/samples/etc/scrollwin.rb +116 -0
  188. data/samples/etc/system_settings.rb +258 -0
  189. data/samples/etc/threaded.rb +81 -0
  190. data/samples/etc/wizard.rb +79 -0
  191. data/samples/event/event.rb +184 -0
  192. data/samples/grid/grid.rb +202 -0
  193. data/samples/html/html.rb +264 -0
  194. data/samples/listbook/listbook.rb +181 -0
  195. data/samples/listbook/listbook.xrc +370 -0
  196. data/samples/mdi/mdi.rb +87 -0
  197. data/samples/media/mediactrl.rb +173 -0
  198. data/samples/minimal/minimal.rb +85 -0
  199. data/samples/minimal/mondrian.ico +0 -0
  200. data/samples/minimal/mondrian.png +0 -0
  201. data/samples/minimal/nothing.rb +21 -0
  202. data/samples/opengl/cube.rb +123 -0
  203. data/samples/printing/mondrian.ico +0 -0
  204. data/samples/printing/mondrian.xpm +44 -0
  205. data/samples/printing/printing.rb +484 -0
  206. data/samples/sockets/SocketPackets.rb +27 -0
  207. data/samples/sockets/res/message-new.png +0 -0
  208. data/samples/sockets/res/user.png +0 -0
  209. data/samples/sockets/wxClient.rb +395 -0
  210. data/samples/sockets/wxServer.rb +422 -0
  211. data/samples/sockets/wxSocketGUI.rb +97 -0
  212. data/samples/text/mondrian.ico +0 -0
  213. data/samples/text/mondrian.xpm +44 -0
  214. data/samples/text/scintilla.rb +174 -0
  215. data/samples/text/textctrl.rb +124 -0
  216. data/samples/text/unicode.rb +238 -0
  217. data/samples/text/utf8.txt +15 -0
  218. data/samples/treectrl/icon1.xpm +79 -0
  219. data/samples/treectrl/icon2.xpm +53 -0
  220. data/samples/treectrl/icon3.xpm +79 -0
  221. data/samples/treectrl/icon4.xpm +43 -0
  222. data/samples/treectrl/icon5.xpm +79 -0
  223. data/samples/treectrl/treectrl.rb +1180 -0
  224. data/samples/xrc/samples.xrc +46 -0
  225. data/samples/xrc/xrc_sample.rb +107 -0
  226. metadata +303 -0
@@ -0,0 +1,31 @@
1
+ # Class which can supply icons and bitmaps
2
+ class Wx::ArtProvider
3
+ # Keep a note of supplied ArtProviders to prevent them being GC'd
4
+ @__art_provs = []
5
+
6
+ class << self
7
+ wx_insert = instance_method(:insert)
8
+ define_method(:insert) do | art_prov |
9
+ wx_insert.bind(self).call(art_prov)
10
+ @__art_provs.unshift(art_prov)
11
+ end
12
+
13
+ wx_pop = instance_method(:pop)
14
+ define_method(:pop) do
15
+ wx_pop.bind(self).call
16
+ @__art_provs.pop
17
+ end
18
+
19
+ wx_push = instance_method(:push)
20
+ define_method(:push) do | art_prov |
21
+ wx_push.bind(self).call(art_prov)
22
+ @__art_provs.push(art_prov)
23
+ end
24
+
25
+ wx_remove = instance_method(:remove)
26
+ define_method(:remove) do | art_prov |
27
+ wx_push.bind(self).call(art_prov)
28
+ @__art_provs.delete(art_prov)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ class Wx::Bitmap
2
+ # Redefine the initialize method so it raises an exception if a
3
+ # non-existent file is given to the constructor; otherwise, wx Widgets
4
+ # just carries on with an empty bitmap, which may cause faults later
5
+ wx_init = self.instance_method(:initialize)
6
+ define_method(:initialize) do | *args |
7
+ if args[0].kind_of? String
8
+ if not File.exist?( File.expand_path(args[0]) )
9
+ Kernel.raise(ArgumentError, "Bitmap file does not exist: #{args[0]}")
10
+ end
11
+ end
12
+ wx_init.bind(self).call(*args)
13
+ end
14
+
15
+ # Accepts a block, which will be passed a device context which can be
16
+ # used to draw upon the Bitmap
17
+ def draw
18
+ dc = Wx::MemoryDC.new
19
+ dc.select_object(self)
20
+ yield dc
21
+ dc.select_object( Wx::NULL_BITMAP )
22
+ end
23
+ end
@@ -0,0 +1,45 @@
1
+ # A ListBox, where each item has a checkbox next to it
2
+ class Wx::CheckListBox
3
+ # wxRuby redefinitions of core methods to add item data support (not
4
+ # available in wxWidgets). Use a private method to initialize and
5
+ # access the data, rather than in initialize(), b/c can't guarantee
6
+ # that initialize will be called (eg when loaded from XRC)
7
+ def __wx_item_data
8
+ @__wx_item_data ||= []
9
+ end
10
+ private :__wx_item_data
11
+
12
+ # Call method in ControlWithItems, then sync item data
13
+ def append(item, data = nil)
14
+ super(item)
15
+ __wx_item_data[count - 1] = data
16
+ end
17
+
18
+ # Call method in ControlWithItems, then sync item data
19
+ def clear
20
+ super
21
+ __wx_item_data.clear
22
+ end
23
+
24
+ # delete is defined in Wx::CheckListBox, so must be called in this class
25
+ wx_delete = self.instance_method(:delete)
26
+ define_method(:delete) do | n |
27
+ wx_delete.bind(self).call(n)
28
+ __wx_item_data.delete_at(n)
29
+ end
30
+
31
+ # Returns an array of indices of items that are currently checked.
32
+ def get_checked_items
33
+ find_all { | i | checked?(i) }
34
+ end
35
+
36
+ # Wholly redefined here
37
+ def get_item_data(n)
38
+ __wx_item_data[n]
39
+ end
40
+
41
+ # Wholly redefined here
42
+ def set_item_data(n, data)
43
+ __wx_item_data[n] = data
44
+ end
45
+ end
@@ -0,0 +1,4 @@
1
+ class Wx::Choice
2
+ alias :get_item_data :get_client_data
3
+ alias :set_item_data :set_client_data
4
+ end
@@ -0,0 +1,13 @@
1
+ # Device Context to paint on a window outside an on_paint handler. It is
2
+ # recommended that PaintDC is used in preference to this class.
3
+ class Wx::ClientDC
4
+ # This class should not be instantiated directly in wxRuby; it should
5
+ # always be used via Window#paint, which takes a block receiving the
6
+ # DC. This ensures that the DC is cleaned up at the correct time,
7
+ # avoiding errors and segfaults on exit.
8
+ define_method(:initialize) do | *args |
9
+ Kernel.raise RuntimeError,
10
+ "Do not instantiate ClientDC directly; use Window#paint",
11
+ caller[1..-1]
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class Wx::Clipboard
2
+ class << self
3
+ # Class method to provide access to the clipboard within a ruby
4
+ # block. Tests that the clipboard could be accessed, and ensures
5
+ # that it is closed when the block is finished.
6
+ def open
7
+ clip = Wx::Clipboard.new
8
+ unless clip.open
9
+ Kernel.raise "Could not open clipboard"
10
+ end
11
+ yield clip
12
+ ensure
13
+ clip.close
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,47 @@
1
+ class Wx::Colour
2
+ # Redefine the initialize method so it raises an exception if an
3
+ # invalid colour value is given. This might be an unknown colour
4
+ # string (eg 'dark blue') or out-of-bounds integer values (<0 or >255)
5
+ wx_init = self.instance_method(:initialize)
6
+ define_method(:initialize) do | *args |
7
+ begin
8
+ wx_init.bind(self).call(*args)
9
+ # Invalid integer values raise SWIG 'no matching func'
10
+ rescue ArgumentError
11
+ Kernel.raise ArgumentError, "Invalid colour values #{args.inspect}"
12
+ end
13
+
14
+ if not is_ok
15
+ Kernel.raise ArgumentError, "Invalid colour values #{args.inspect}"
16
+ end
17
+ end
18
+
19
+ # Standard colours, corresponding to WxWidgets stock colours.
20
+ Wx::WHITE = new(255, 255, 255)
21
+ Wx::BLACK = new(0, 0, 0)
22
+
23
+ Wx::RED = new(255, 0, 0)
24
+ Wx::GREEN = new(0, 255, 0)
25
+ Wx::BLUE = new(0, 0, 255)
26
+
27
+ Wx::YELLOW = new(255, 255, 0)
28
+ Wx::MAGENTA = new(255, 0, 255)
29
+ Wx::CYAN = new(0, 255, 255)
30
+
31
+ Wx::LIGHT_GREY = new(192, 192, 192)
32
+
33
+ # Colours are equal to one another if they have the same red, green
34
+ # and blue intensity, and the same alpha
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 ] ==
40
+ [ other.red, other.green, other.blue, other.alpha ]
41
+ end
42
+
43
+ # More informative output for inspect etc
44
+ def to_s
45
+ "#<Wx::Colour: (#{red}, #{green}, #{blue} *#{alpha})>"
46
+ end
47
+ end
@@ -0,0 +1,4 @@
1
+ class Wx::ComboBox
2
+ alias :get_item_data :get_client_data
3
+ alias :set_item_data :set_client_data
4
+ end
@@ -0,0 +1,7 @@
1
+ # Class representing interactions with controls such as ListBox
2
+ class Wx::CommandEvent
3
+ # get_int and get_selection are already synonyms, but neither name
4
+ # accurately describes what the method does as the event may be a
5
+ # (de)selection or a check in a CheckListBox
6
+ alias :get_index :get_int
7
+ end
@@ -0,0 +1,10 @@
1
+ # Superclass of a variety of controls that display lists of items (eg
2
+ # Choice, ListBox, CheckListBox)
3
+ class Wx::ControlWithItems
4
+ # Make these ruby enumerables so find, find_all, map etc are available
5
+ include Enumerable
6
+ # Passes each valid item index into the passed block
7
+ def each
8
+ 0.upto(count - 1) { | i | yield i }
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ # Base class for all events
2
+ class Wx::Event
3
+ # Get the Wx id, not Ruby's deprecated Object#id
4
+ alias :id :get_id
5
+ end
@@ -0,0 +1,894 @@
1
+ # All classes which are capable of handling events inherit from
2
+ # EvtHandler. This includes all Wx::Window subclasses and Wx::App.
3
+
4
+ class Wx::EvtHandler
5
+ # EventType is an internal class that's used to set up event handlers
6
+ # and mappings.
7
+ # * 'name' is the name of the event handler method in ruby
8
+ # * 'arity' is the number of id arguments that method should accept
9
+ # * 'const' is the Wx EventType constant that identifies the event
10
+ # * 'evt_class' is the WxRuby event class which is passed to the event
11
+ # handler block
12
+ #
13
+ # NB: Some event types currently pass a Wx::Event into the event
14
+ # handler block; when the appropriate classes are added to wxRuby, the
15
+ # binding can be updated here.
16
+ EventType = Struct.new(:name, :arity, :const, :evt_class)
17
+
18
+ # Fast look-up hash to map event type ids to ruby event classes
19
+ EVENT_TYPE_CLASS_MAP = {}
20
+ # Hash to look up EVT constants from symbol names of evt handler
21
+ # methods; used internally by disconnect (see EvtHandler.i)
22
+ EVENT_NAME_TYPE_MAP = {}
23
+
24
+ # Given a Wx EventType id (eg Wx::EVT_MENU), returns a WxRuby Event
25
+ # class which should be passed to event handler blocks. The actual
26
+ # EVT_XXX constants themselves are in the compiled library, defined in
27
+ # swig/classes/Event.i
28
+ def self.event_class_for_type(id)
29
+ if evt_klass = EVENT_TYPE_CLASS_MAP[id]
30
+ return evt_klass
31
+ else
32
+ warn "No event class defined for event type #{id}"
33
+ return Wx::Event
34
+ end
35
+ end
36
+
37
+ # Given the symbol name of an evt_xxx handler method, returns the
38
+ # Integer Wx::EVT_XXX constant associated with that handler.
39
+ def self.event_type_for_name(name)
40
+ EVENT_NAME_TYPE_MAP[name]
41
+ end
42
+
43
+ # Given the Integer constant Wx::EVT_XXX, returns the convenience
44
+ # handler method name associated with that type of event.
45
+
46
+ def self.event_name_for_type(name)
47
+ EVENT_NAME_TYPE_MAP.index(name)
48
+ end
49
+
50
+ # Public method to register the mapping of a custom event type
51
+ # +konstant+ (which should be a unique integer; one will be created if
52
+ # not supplied) to a custom event class +klass+. If +meth+ and +arity+
53
+ # are given, a convenience evt_handler method called +meth+ will be
54
+ # created, which accepts +arity+ arguments.
55
+ def self.register_class( klass, konstant = nil,
56
+ meth = nil, arity = nil)
57
+ konstant ||= Wx::Event.new_event_type
58
+ unless klass < Wx::Event
59
+ Kernel.raise TypeError, "Event class should be a subclass of Wx::Event"
60
+ end
61
+ ev_type = EventType.new(meth, arity, konstant, klass)
62
+ register_event_type(ev_type)
63
+ return konstant
64
+ end
65
+
66
+ # Registers the event type +ev_type+, which should be an instance of
67
+ # the Struct class +Wx::EvtHandler::EventType+. This sets up the
68
+ # mapping of events of that type (identified by integer id) to the
69
+ # appropriate ruby event class, and defines a convenience evt_xxx
70
+ # instance method in the class EvtHandler.
71
+ def self.register_event_type(ev_type)
72
+ # set up the event type mapping
73
+ EVENT_TYPE_CLASS_MAP[ev_type.const] = ev_type.evt_class
74
+ EVENT_NAME_TYPE_MAP[ev_type.name.intern] = ev_type.const
75
+
76
+ unless ev_type.arity and ev_type.name
77
+ return
78
+ end
79
+
80
+ # set up the evt_xxx method
81
+ case ev_type.arity
82
+ when 0 # events without an id
83
+ class_eval %Q|
84
+ def #{ev_type.name}(meth = nil, &block)
85
+ handler = acquire_handler(meth, block)
86
+ connect(Wx::ID_ANY, Wx::ID_ANY, #{ev_type.const}, &handler)
87
+ end |
88
+ when 1 # events with an id
89
+ class_eval %Q|
90
+ def #{ev_type.name}(id, meth = nil, &block)
91
+ handler = acquire_handler(meth, block)
92
+ id = acquire_id(id)
93
+ connect(id, Wx::ID_ANY, #{ev_type.const}, &handler)
94
+ end |
95
+ when 2 # events with id range
96
+ class_eval %Q|
97
+ def #{ev_type.name}(first_id, last_id, meth = nil, &block)
98
+ handler = acquire_handler(meth, block)
99
+ first_id = acquire_id(first_id)
100
+ last_id = acquire_id(last_id)
101
+ connect( first_id, last_id, #{ev_type.const}, &handler)
102
+ end |
103
+ end
104
+ end
105
+
106
+ # Not for external use; determines whether to use a block or call a
107
+ # method in self to handle an event, passed to connect. Makes evt_xxx
108
+ # liberal about what it accepts - aside from a block, it can be a
109
+ # method name (as Symbol or String), a (bound) method object, or a
110
+ # Proc object
111
+ def acquire_handler(meth, block)
112
+ if block and not meth
113
+ return block
114
+ elsif meth and not block
115
+ h_meth = case meth
116
+ when Symbol, String then self.method(meth)
117
+ when Proc then meth
118
+ when Method then meth.to_proc
119
+ end
120
+ if h_meth.arity == 1
121
+ return lambda { | evt | h_meth.call(evt) }
122
+ else
123
+ return lambda { h_meth.call }
124
+ end
125
+ else
126
+ Kernel.raise ArgumentError,
127
+ "Specify event handler with a method, name, proc OR block"
128
+ caller
129
+ end
130
+ end
131
+
132
+ # Not for external use; acquires an id either from an explicit Fixnum
133
+ # parameter or by calling the wx_id method of a passed Window.
134
+ def acquire_id(window_or_id)
135
+ case window_or_id
136
+ when Fixnum then window_or_id
137
+ when Wx::Window, Wx::MenuItem then window_or_id.wx_id
138
+ else Kernel.raise ArgumentError,
139
+ "Must specify Wx::Window event source or its Wx id, " +
140
+ "not '#{window_or_id.inspect}'",
141
+ caller
142
+ end
143
+ end
144
+ private :acquire_id, :acquire_handler
145
+
146
+ # Definitions for all event types that are part by core wxRuby. Events
147
+ # that are mapped to class Wx::Event are TODO as they are not
148
+ # currently wrapped by the correct class.
149
+
150
+ # All StyledTextCtrl (Scintilla) events with prefix EVT_STC are dealt
151
+ # with in the separate styledtextctrl.rb file.
152
+ #
153
+ # All MediaCtrl events with prefix EVT_MEDIA are dealt with in the
154
+ # separate mediactrl.rb file
155
+ EVENT_DEFINITIONS = [
156
+ EventType['evt_activate', 0,
157
+ Wx::EVT_ACTIVATE,
158
+ Wx::ActivateEvent],
159
+ EventType['evt_activate_app', 0,
160
+ Wx::EVT_ACTIVATE_APP,
161
+ Wx::ActivateEvent],
162
+ EventType['evt_auinotebook_allow_dnd', 1,
163
+ Wx::EVT_COMMAND_AUINOTEBOOK_ALLOW_DND,
164
+ Wx::AuiNotebookEvent],
165
+ EventType['evt_auinotebook_begin_drag', 1,
166
+ Wx::EVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG,
167
+ Wx::AuiNotebookEvent],
168
+ EventType['evt_auinotebook_button', 1,
169
+ Wx::EVT_COMMAND_AUINOTEBOOK_BUTTON,
170
+ Wx::AuiNotebookEvent],
171
+ EventType['evt_auinotebook_drag_motion', 1,
172
+ Wx::EVT_COMMAND_AUINOTEBOOK_DRAG_MOTION,
173
+ Wx::AuiNotebookEvent],
174
+ EventType['evt_auinotebook_end_drag', 1,
175
+ Wx::EVT_COMMAND_AUINOTEBOOK_END_DRAG,
176
+ Wx::AuiNotebookEvent],
177
+ EventType['evt_auinotebook_page_changed', 1,
178
+ Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,
179
+ Wx::AuiNotebookEvent],
180
+ EventType['evt_auinotebook_page_changing', 1,
181
+ Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING,
182
+ Wx::AuiNotebookEvent],
183
+ EventType['evt_auinotebook_page_close', 1,
184
+ Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE,
185
+ Wx::AuiNotebookEvent],
186
+ EventType['evt_aui_find_manager', 0,
187
+ Wx::EVT_AUI_FIND_MANAGER,
188
+ Wx::AuiManagerEvent],
189
+ EventType['evt_aui_pane_button', 0,
190
+ Wx::EVT_AUI_PANE_BUTTON,
191
+ Wx::AuiManagerEvent],
192
+ EventType['evt_aui_pane_close', 0,
193
+ Wx::EVT_AUI_PANE_CLOSE,
194
+ Wx::AuiManagerEvent],
195
+ EventType['evt_aui_pane_maximize', 0,
196
+ Wx::EVT_AUI_PANE_MAXIMIZE,
197
+ Wx::AuiManagerEvent],
198
+ EventType['evt_aui_pane_restore', 0,
199
+ Wx::EVT_AUI_PANE_RESTORE,
200
+ Wx::AuiManagerEvent],
201
+ EventType['evt_aui_render', 0,
202
+ Wx::EVT_AUI_RENDER,
203
+ Wx::AuiManagerEvent],
204
+ EventType['evt_button', 1,
205
+ Wx::EVT_COMMAND_BUTTON_CLICKED,
206
+ Wx::CommandEvent],
207
+ EventType['evt_calculate_layout', 0,
208
+ Wx::EVT_CALCULATE_LAYOUT,
209
+ Wx::CalculateLayoutEvent],
210
+ EventType['evt_calendar', 1,
211
+ Wx::EVT_CALENDAR_DOUBLECLICKED,
212
+ Wx::CalendarEvent],
213
+ EventType['evt_calendar_day', 1,
214
+ Wx::EVT_CALENDAR_DAY_CHANGED,
215
+ Wx::CalendarEvent],
216
+ EventType['evt_calendar_month', 1,
217
+ Wx::EVT_CALENDAR_MONTH_CHANGED,
218
+ Wx::CalendarEvent],
219
+ EventType['evt_calendar_sel_changed', 1,
220
+ Wx::EVT_CALENDAR_SEL_CHANGED,
221
+ Wx::CalendarEvent],
222
+ EventType['evt_calendar_weekday_clicked', 1,
223
+ Wx::EVT_CALENDAR_WEEKDAY_CLICKED,
224
+ Wx::CalendarEvent],
225
+ EventType['evt_calendar_year', 1,
226
+ Wx::EVT_CALENDAR_YEAR_CHANGED,
227
+ Wx::CalendarEvent],
228
+ EventType['evt_char', 0,
229
+ Wx::EVT_CHAR,
230
+ Wx::KeyEvent],
231
+ EventType['evt_char_hook', 0,
232
+ Wx::EVT_CHAR_HOOK,
233
+ Wx::KeyEvent],
234
+ EventType['evt_checkbox', 1,
235
+ Wx::EVT_COMMAND_CHECKBOX_CLICKED,
236
+ Wx::CommandEvent],
237
+ EventType['evt_checklistbox', 1,
238
+ Wx::EVT_COMMAND_CHECKLISTBOX_TOGGLED,
239
+ Wx::CommandEvent],
240
+ EventType['evt_child_focus', 0,
241
+ Wx::EVT_CHILD_FOCUS,
242
+ Wx::ChildFocusEvent],
243
+ EventType['evt_choice', 1,
244
+ Wx::EVT_COMMAND_CHOICE_SELECTED,
245
+ Wx::CommandEvent],
246
+ EventType['evt_choicebook_page_changed', 1,
247
+ Wx::EVT_COMMAND_CHOICEBOOK_PAGE_CHANGED,
248
+ Wx::ChoicebookEvent],
249
+ EventType['evt_choicebook_page_changing', 1,
250
+ Wx::EVT_COMMAND_CHOICEBOOK_PAGE_CHANGING,
251
+ Wx::ChoicebookEvent],
252
+ EventType['evt_close', 0,
253
+ Wx::EVT_CLOSE_WINDOW,
254
+ Wx::CloseEvent],
255
+ EventType['evt_collapsiblepane_changed', 1,
256
+ Wx::EVT_COMMAND_COLLPANE_CHANGED,
257
+ Wx::CollapsiblePaneEvent],
258
+ EventType['evt_combobox', 1,
259
+ Wx::EVT_COMMAND_COMBOBOX_SELECTED,
260
+ Wx::CommandEvent],
261
+ EventType['evt_command', 0,
262
+ Wx::EVT_NULL,
263
+ Wx::Event],
264
+ EventType['evt_command_enter', 1,
265
+ Wx::EVT_COMMAND_ENTER,
266
+ Wx::Event],
267
+ EventType['evt_command_kill_focus', 1,
268
+ Wx::EVT_COMMAND_KILL_FOCUS,
269
+ Wx::Event],
270
+ EventType['evt_command_left_click', 1,
271
+ Wx::EVT_COMMAND_LEFT_CLICK,
272
+ Wx::Event],
273
+ EventType['evt_command_left_dclick', 1,
274
+ Wx::EVT_COMMAND_LEFT_DCLICK,
275
+ Wx::Event],
276
+ EventType['evt_command_range', 2,
277
+ Wx::EVT_NULL,
278
+ Wx::Event],
279
+ EventType['evt_command_right_click', 1,
280
+ Wx::EVT_COMMAND_RIGHT_CLICK,
281
+ Wx::Event],
282
+ EventType['evt_command_set_focus', 1,
283
+ Wx::EVT_COMMAND_SET_FOCUS,
284
+ Wx::Event],
285
+ EventType['evt_context_menu', 0,
286
+ Wx::EVT_CONTEXT_MENU,
287
+ Wx::ContextMenuEvent],
288
+ EventType['evt_drop_files', 0,
289
+ Wx::EVT_DROP_FILES,
290
+ Wx::Event],
291
+ EventType['evt_end_process', 1,
292
+ Wx::EVT_END_PROCESS,
293
+ Wx::Event],
294
+ EventType['evt_end_session', 0,
295
+ Wx::EVT_END_SESSION,
296
+ Wx::Event],
297
+ EventType['evt_enter_window', 0,
298
+ Wx::EVT_ENTER_WINDOW,
299
+ Wx::MouseEvent],
300
+ EventType['evt_erase_background', 0,
301
+ Wx::EVT_ERASE_BACKGROUND,
302
+ Wx::EraseEvent],
303
+ EventType['evt_find', 1,
304
+ Wx::EVT_COMMAND_FIND,
305
+ Wx::FindDialogEvent],
306
+ EventType['evt_find_close', 1,
307
+ Wx::EVT_COMMAND_FIND_CLOSE,
308
+ Wx::FindDialogEvent],
309
+ EventType['evt_find_next', 1,
310
+ Wx::EVT_COMMAND_FIND_NEXT,
311
+ Wx::FindDialogEvent],
312
+ EventType['evt_find_replace', 1,
313
+ Wx::EVT_COMMAND_FIND_REPLACE,
314
+ Wx::FindDialogEvent],
315
+ EventType['evt_find_replace_all', 1,
316
+ Wx::EVT_COMMAND_FIND_REPLACE_ALL,
317
+ Wx::FindDialogEvent],
318
+ EventType['evt_grid_cell_change', 0,
319
+ Wx::EVT_GRID_CELL_CHANGE,
320
+ Wx::GridEvent],
321
+ EventType['evt_grid_cell_left_click', 0,
322
+ Wx::EVT_GRID_CELL_LEFT_CLICK,
323
+ Wx::GridEvent],
324
+ EventType['evt_grid_cell_left_dclick', 0,
325
+ Wx::EVT_GRID_CELL_LEFT_DCLICK,
326
+ Wx::GridEvent],
327
+ EventType['evt_grid_cell_right_click', 0,
328
+ Wx::EVT_GRID_CELL_RIGHT_CLICK,
329
+ Wx::GridEvent],
330
+ EventType['evt_grid_cell_right_dclick', 0,
331
+ Wx::EVT_GRID_CELL_RIGHT_DCLICK,
332
+ Wx::GridEvent],
333
+ EventType['evt_grid_cmd_cell_change', 1,
334
+ Wx::EVT_GRID_CELL_CHANGE,
335
+ Wx::GridEvent],
336
+ EventType['evt_grid_cmd_cell_left_click', 1,
337
+ Wx::EVT_GRID_CELL_LEFT_CLICK,
338
+ Wx::GridEvent],
339
+ EventType['evt_grid_cmd_cell_left_dclick', 1,
340
+ Wx::EVT_GRID_CELL_LEFT_DCLICK,
341
+ Wx::GridEvent],
342
+ EventType['evt_grid_cmd_cell_right_click', 1,
343
+ Wx::EVT_GRID_CELL_RIGHT_CLICK,
344
+ Wx::GridEvent],
345
+ EventType['evt_grid_cmd_cell_right_dclick', 1,
346
+ Wx::EVT_GRID_CELL_RIGHT_DCLICK,
347
+ Wx::GridEvent],
348
+ EventType['evt_grid_cmd_col_size', 1,
349
+ Wx::EVT_GRID_COL_SIZE,
350
+ Wx::GridSizeEvent],
351
+ EventType['evt_grid_cmd_editor_created', 1,
352
+ Wx::EVT_GRID_EDITOR_CREATED,
353
+ Wx::GridEditorCreatedEvent],
354
+ EventType['evt_grid_cmd_editor_hidden', 1,
355
+ Wx::EVT_GRID_EDITOR_HIDDEN,
356
+ Wx::GridEvent],
357
+ EventType['evt_grid_cmd_editor_shown', 1,
358
+ Wx::EVT_GRID_EDITOR_SHOWN,
359
+ Wx::GridEvent],
360
+ EventType['evt_grid_cmd_label_left_click', 1,
361
+ Wx::EVT_GRID_LABEL_LEFT_CLICK,
362
+ Wx::GridEvent],
363
+ EventType['evt_grid_cmd_label_left_dclick', 1,
364
+ Wx::EVT_GRID_LABEL_LEFT_DCLICK,
365
+ Wx::GridEvent],
366
+ EventType['evt_grid_cmd_label_right_click', 1,
367
+ Wx::EVT_GRID_LABEL_RIGHT_CLICK,
368
+ Wx::GridEvent],
369
+ EventType['evt_grid_cmd_label_right_dclick', 1,
370
+ Wx::EVT_GRID_LABEL_RIGHT_DCLICK,
371
+ Wx::GridEvent],
372
+ EventType['evt_grid_cmd_range_select', 1,
373
+ Wx::EVT_GRID_RANGE_SELECT,
374
+ Wx::GridRangeSelectEvent],
375
+ EventType['evt_grid_cmd_row_size', 1,
376
+ Wx::EVT_GRID_ROW_SIZE,
377
+ Wx::GridSizeEvent],
378
+ EventType['evt_grid_cmd_select_cell', 1,
379
+ Wx::EVT_GRID_SELECT_CELL,
380
+ Wx::GridEvent],
381
+ EventType['evt_grid_col_size', 0,
382
+ Wx::EVT_GRID_COL_SIZE,
383
+ Wx::GridSizeEvent],
384
+ EventType['evt_grid_editor_created', 0,
385
+ Wx::EVT_GRID_EDITOR_CREATED,
386
+ Wx::GridEditorCreatedEvent],
387
+ EventType['evt_grid_editor_hidden', 0,
388
+ Wx::EVT_GRID_EDITOR_HIDDEN,
389
+ Wx::GridEvent],
390
+ EventType['evt_grid_editor_shown', 0,
391
+ Wx::EVT_GRID_EDITOR_SHOWN,
392
+ Wx::GridEvent],
393
+ EventType['evt_grid_label_left_click', 0,
394
+ Wx::EVT_GRID_LABEL_LEFT_CLICK,
395
+ Wx::GridEvent],
396
+ EventType['evt_grid_label_left_dclick', 0,
397
+ Wx::EVT_GRID_LABEL_LEFT_DCLICK,
398
+ Wx::GridEvent],
399
+ EventType['evt_grid_label_right_click', 0,
400
+ Wx::EVT_GRID_LABEL_RIGHT_CLICK,
401
+ Wx::GridEvent],
402
+ EventType['evt_grid_label_right_dclick', 0,
403
+ Wx::EVT_GRID_LABEL_RIGHT_DCLICK,
404
+ Wx::GridEvent],
405
+ EventType['evt_grid_range_select', 0,
406
+ Wx::EVT_GRID_RANGE_SELECT,
407
+ Wx::GridRangeSelectEvent],
408
+ EventType['evt_grid_row_size', 0,
409
+ Wx::EVT_GRID_ROW_SIZE,
410
+ Wx::GridSizeEvent],
411
+ EventType['evt_grid_select_cell', 0,
412
+ Wx::EVT_GRID_SELECT_CELL,
413
+ Wx::GridEvent],
414
+ EventType['evt_help', 1,
415
+ Wx::EVT_HELP,
416
+ Wx::Event],
417
+ EventType['evt_help_range', 2,
418
+ Wx::EVT_HELP,
419
+ Wx::Event],
420
+ EventType['evt_hyperlink', 1,
421
+ Wx::EVT_COMMAND_HYPERLINK,
422
+ Wx::HyperlinkEvent],
423
+ EventType['evt_iconize', 0,
424
+ Wx::EVT_ICONIZE,
425
+ Wx::IconizeEvent],
426
+ EventType['evt_idle', 0,
427
+ Wx::EVT_IDLE,
428
+ Wx::IdleEvent],
429
+ EventType['evt_init_dialog', 0,
430
+ Wx::EVT_INIT_DIALOG,
431
+ Wx::Event],
432
+ EventType['evt_joy_button_down', 0,
433
+ Wx::EVT_JOY_BUTTON_DOWN,
434
+ Wx::Event],
435
+ EventType['evt_joy_button_up', 0,
436
+ Wx::EVT_JOY_BUTTON_UP,
437
+ Wx::Event],
438
+ EventType['evt_joy_move', 0,
439
+ Wx::EVT_JOY_MOVE,
440
+ Wx::Event],
441
+ EventType['evt_joy_zmove', 0,
442
+ Wx::EVT_JOY_ZMOVE,
443
+ Wx::Event],
444
+ EventType['evt_key_down', 0,
445
+ Wx::EVT_KEY_DOWN,
446
+ Wx::KeyEvent],
447
+ EventType['evt_key_up', 0,
448
+ Wx::EVT_KEY_UP,
449
+ Wx::KeyEvent],
450
+ EventType['evt_kill_focus', 0,
451
+ Wx::EVT_KILL_FOCUS,
452
+ Wx::FocusEvent],
453
+ EventType['evt_leave_window', 0,
454
+ Wx::EVT_LEAVE_WINDOW,
455
+ Wx::MouseEvent],
456
+ EventType['evt_left_dclick', 0,
457
+ Wx::EVT_LEFT_DCLICK,
458
+ Wx::MouseEvent],
459
+ EventType['evt_left_down', 0,
460
+ Wx::EVT_LEFT_DOWN,
461
+ Wx::MouseEvent],
462
+ EventType['evt_left_up', 0,
463
+ Wx::EVT_LEFT_UP,
464
+ Wx::MouseEvent],
465
+ EventType['evt_listbook_page_changed', 1,
466
+ Wx::EVT_COMMAND_LISTBOOK_PAGE_CHANGED,
467
+ Wx::ListbookEvent],
468
+ EventType['evt_listbook_page_changing', 1,
469
+ Wx::EVT_COMMAND_LISTBOOK_PAGE_CHANGING,
470
+ Wx::ListbookEvent],
471
+ EventType['evt_listbox', 1,
472
+ Wx::EVT_COMMAND_LISTBOX_SELECTED,
473
+ Wx::CommandEvent],
474
+ EventType['evt_listbox_dclick', 1,
475
+ Wx::EVT_COMMAND_LISTBOX_DOUBLECLICKED,
476
+ Wx::CommandEvent],
477
+ EventType['evt_list_begin_drag', 1,
478
+ Wx::EVT_COMMAND_LIST_BEGIN_DRAG,
479
+ Wx::ListEvent],
480
+ EventType['evt_list_begin_label_edit', 1,
481
+ Wx::EVT_COMMAND_LIST_BEGIN_LABEL_EDIT,
482
+ Wx::ListEvent],
483
+ EventType['evt_list_begin_rdrag', 1,
484
+ Wx::EVT_COMMAND_LIST_BEGIN_RDRAG,
485
+ Wx::ListEvent],
486
+ EventType['evt_list_cache_hint', 1,
487
+ Wx::EVT_COMMAND_LIST_CACHE_HINT,
488
+ Wx::ListEvent],
489
+ EventType['evt_list_col_begin_drag', 1,
490
+ Wx::EVT_COMMAND_LIST_COL_BEGIN_DRAG,
491
+ Wx::ListEvent],
492
+ EventType['evt_list_col_click', 1,
493
+ Wx::EVT_COMMAND_LIST_COL_CLICK,
494
+ Wx::ListEvent],
495
+ EventType['evt_list_col_dragging', 1,
496
+ Wx::EVT_COMMAND_LIST_COL_DRAGGING,
497
+ Wx::ListEvent],
498
+ EventType['evt_list_col_end_drag', 1,
499
+ Wx::EVT_COMMAND_LIST_COL_END_DRAG,
500
+ Wx::ListEvent],
501
+ EventType['evt_list_col_right_click', 1,
502
+ Wx::EVT_COMMAND_LIST_COL_RIGHT_CLICK,
503
+ Wx::ListEvent],
504
+ EventType['evt_list_delete_all_items', 1,
505
+ Wx::EVT_COMMAND_LIST_DELETE_ALL_ITEMS,
506
+ Wx::ListEvent],
507
+ EventType['evt_list_delete_item', 1,
508
+ Wx::EVT_COMMAND_LIST_DELETE_ITEM,
509
+ Wx::ListEvent],
510
+ EventType['evt_list_end_label_edit', 1,
511
+ Wx::EVT_COMMAND_LIST_END_LABEL_EDIT,
512
+ Wx::ListEvent],
513
+ EventType['evt_list_insert_item', 1,
514
+ Wx::EVT_COMMAND_LIST_INSERT_ITEM,
515
+ Wx::ListEvent],
516
+ EventType['evt_list_item_activated', 1,
517
+ Wx::EVT_COMMAND_LIST_ITEM_ACTIVATED,
518
+ Wx::ListEvent],
519
+ EventType['evt_list_item_deselected', 1,
520
+ Wx::EVT_COMMAND_LIST_ITEM_DESELECTED,
521
+ Wx::ListEvent],
522
+ EventType['evt_list_item_focused', 1,
523
+ Wx::EVT_COMMAND_LIST_ITEM_FOCUSED,
524
+ Wx::ListEvent],
525
+ EventType['evt_list_item_middle_click', 1,
526
+ Wx::EVT_COMMAND_LIST_ITEM_MIDDLE_CLICK,
527
+ Wx::ListEvent],
528
+ EventType['evt_list_item_right_click', 1,
529
+ Wx::EVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
530
+ Wx::ListEvent],
531
+ EventType['evt_list_item_selected', 1,
532
+ Wx::EVT_COMMAND_LIST_ITEM_SELECTED,
533
+ Wx::ListEvent],
534
+ EventType['evt_list_key_down', 1,
535
+ Wx::EVT_COMMAND_LIST_KEY_DOWN,
536
+ Wx::ListEvent],
537
+ EventType['evt_maximize', 0,
538
+ Wx::EVT_MAXIMIZE,
539
+ Wx::Event],
540
+ EventType['evt_menu', 1,
541
+ Wx::EVT_COMMAND_MENU_SELECTED,
542
+ Wx::CommandEvent],
543
+ EventType['evt_menu_close', 0,
544
+ Wx::EVT_MENU_CLOSE,
545
+ Wx::MenuEvent],
546
+ EventType['evt_menu_highlight', 1,
547
+ Wx::EVT_MENU_HIGHLIGHT,
548
+ Wx::MenuEvent],
549
+ EventType['evt_menu_highlight_all', 0,
550
+ Wx::EVT_MENU_HIGHLIGHT,
551
+ Wx::MenuEvent],
552
+ EventType['evt_menu_open', 0,
553
+ Wx::EVT_MENU_OPEN,
554
+ Wx::MenuEvent],
555
+ EventType['evt_menu_range', 2,
556
+ Wx::EVT_COMMAND_MENU_SELECTED,
557
+ Wx::CommandEvent],
558
+ EventType['evt_middle_dclick', 0,
559
+ Wx::EVT_MIDDLE_DCLICK,
560
+ Wx::MouseEvent],
561
+ EventType['evt_middle_down', 0,
562
+ Wx::EVT_MIDDLE_DOWN,
563
+ Wx::MouseEvent],
564
+ EventType['evt_middle_up', 0,
565
+ Wx::EVT_MIDDLE_UP,
566
+ Wx::MouseEvent],
567
+ EventType['evt_motion', 0,
568
+ Wx::EVT_MOTION,
569
+ Wx::MouseEvent],
570
+ EventType['evt_mousewheel', 0,
571
+ Wx::EVT_MOUSEWHEEL,
572
+ Wx::MouseEvent],
573
+ EventType['evt_mouse_capture_changed', 0,
574
+ Wx::EVT_MOUSE_CAPTURE_CHANGED,
575
+ Wx::Event],
576
+ EventType['evt_move', 0,
577
+ Wx::EVT_MOVE,
578
+ Wx::MoveEvent],
579
+ EventType['evt_nc_paint', 0,
580
+ Wx::EVT_NC_PAINT,
581
+ Wx::Event],
582
+ EventType['evt_notebook_page_changed', 1,
583
+ Wx::EVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
584
+ Wx::NotebookEvent],
585
+ EventType['evt_notebook_page_changing', 1,
586
+ Wx::EVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
587
+ Wx::NotebookEvent],
588
+ EventType['evt_paint', 0,
589
+ Wx::EVT_PAINT,
590
+ Wx::PaintEvent],
591
+ EventType['evt_query_end_session', 0,
592
+ Wx::EVT_QUERY_END_SESSION,
593
+ Wx::Event],
594
+ EventType['evt_query_layout_info', 0,
595
+ Wx::EVT_QUERY_LAYOUT_INFO,
596
+ Wx::QueryLayoutInfoEvent],
597
+ EventType['evt_radiobox', 1,
598
+ Wx::EVT_COMMAND_RADIOBOX_SELECTED,
599
+ Wx::CommandEvent],
600
+ EventType['evt_radiobutton', 1,
601
+ Wx::EVT_COMMAND_RADIOBUTTON_SELECTED,
602
+ Wx::CommandEvent],
603
+ EventType['evt_right_dclick', 0,
604
+ Wx::EVT_RIGHT_DCLICK,
605
+ Wx::MouseEvent],
606
+ EventType['evt_right_down', 0,
607
+ Wx::EVT_RIGHT_DOWN,
608
+ Wx::MouseEvent],
609
+ EventType['evt_right_up', 0,
610
+ Wx::EVT_RIGHT_UP,
611
+ Wx::MouseEvent],
612
+ EventType['evt_sash_dragged', 1,
613
+ Wx::EVT_SASH_DRAGGED,
614
+ Wx::SashEvent],
615
+ EventType['evt_sash_dragged_range', 2,
616
+ Wx::EVT_SASH_DRAGGED,
617
+ Wx::SashEvent],
618
+ EventType['evt_scrollbar', 1,
619
+ Wx::EVT_COMMAND_SCROLLBAR_UPDATED,
620
+ Wx::CommandEvent],
621
+ EventType['evt_scrollwin_bottom', 0,
622
+ Wx::EVT_SCROLLWIN_TOP,
623
+ Wx::ScrollWinEvent],
624
+ EventType['evt_scrollwin_linedown', 0,
625
+ Wx::EVT_SCROLLWIN_LINEDOWN,
626
+ Wx::ScrollWinEvent],
627
+ EventType['evt_scrollwin_lineup', 0,
628
+ Wx::EVT_SCROLLWIN_LINEUP,
629
+ Wx::ScrollWinEvent],
630
+ EventType['evt_scrollwin_pagedown', 0,
631
+ Wx::EVT_SCROLLWIN_PAGEDOWN,
632
+ Wx::ScrollWinEvent],
633
+ EventType['evt_scrollwin_pageup', 0,
634
+ Wx::EVT_SCROLLWIN_PAGEUP,
635
+ Wx::ScrollWinEvent],
636
+ EventType['evt_scrollwin_thumbrelease', 0,
637
+ Wx::EVT_SCROLLWIN_THUMBRELEASE,
638
+ Wx::ScrollWinEvent],
639
+ EventType['evt_scrollwin_thumbtrack', 0,
640
+ Wx::EVT_SCROLLWIN_THUMBTRACK,
641
+ Wx::ScrollWinEvent],
642
+ EventType['evt_scrollwin_top', 0,
643
+ Wx::EVT_SCROLLWIN_TOP,
644
+ Wx::ScrollWinEvent],
645
+ EventType['evt_scroll_bottom', 0,
646
+ Wx::EVT_SCROLL_BOTTOM,
647
+ Wx::ScrollEvent],
648
+ EventType['evt_scroll_linedown', 0,
649
+ Wx::EVT_SCROLL_LINEDOWN,
650
+ Wx::ScrollEvent],
651
+ EventType['evt_scroll_lineup', 0,
652
+ Wx::EVT_SCROLL_LINEUP,
653
+ Wx::ScrollEvent],
654
+ EventType['evt_scroll_pagedown', 0,
655
+ Wx::EVT_SCROLL_PAGEDOWN,
656
+ Wx::ScrollEvent],
657
+ EventType['evt_scroll_pageup', 0,
658
+ Wx::EVT_SCROLL_PAGEUP,
659
+ Wx::ScrollEvent],
660
+ EventType['evt_scroll_thumbrelease', 0,
661
+ Wx::EVT_SCROLL_THUMBRELEASE,
662
+ Wx::ScrollEvent],
663
+ EventType['evt_scroll_thumbtrack', 0,
664
+ Wx::EVT_SCROLL_THUMBTRACK,
665
+ Wx::ScrollEvent],
666
+ EventType['evt_scroll_top', 0,
667
+ Wx::EVT_SCROLL_TOP,
668
+ Wx::ScrollEvent],
669
+ EventType['evt_searchctrl_cancel_btn', 1,
670
+ Wx::EVT_COMMAND_SEARCHCTRL_CANCEL_BTN,
671
+ Wx::CommandEvent],
672
+ EventType['evt_searchctrl_search_btn', 1,
673
+ Wx::EVT_COMMAND_SEARCHCTRL_SEARCH_BTN,
674
+ Wx::CommandEvent],
675
+ EventType['evt_set_cursor', 0,
676
+ Wx::EVT_SET_CURSOR,
677
+ Wx::SetCursorEvent],
678
+ EventType['evt_set_focus', 0,
679
+ Wx::EVT_SET_FOCUS,
680
+ Wx::FocusEvent],
681
+ EventType['evt_size', 0,
682
+ Wx::EVT_SIZE,
683
+ Wx::SizeEvent],
684
+ EventType['evt_sizing', 0,
685
+ Wx::EVT_SIZING,
686
+ Wx::SizeEvent],
687
+ EventType['evt_slider', 1,
688
+ Wx::EVT_COMMAND_SLIDER_UPDATED,
689
+ Wx::CommandEvent],
690
+ EventType['evt_socket', 1,
691
+ Wx::EVT_SOCKET,
692
+ Wx::Event],
693
+ EventType['evt_spin', 1,
694
+ Wx::EVT_SCROLL_THUMBTRACK,
695
+ Wx::ScrollEvent],
696
+ EventType['evt_spinctrl', 1,
697
+ Wx::EVT_COMMAND_SPINCTRL_UPDATED,
698
+ Wx::SpinEvent],
699
+ EventType['evt_spin_down', 1,
700
+ Wx::EVT_SCROLL_LINEDOWN,
701
+ Wx::ScrollEvent],
702
+ EventType['evt_spin_up', 1,
703
+ Wx::EVT_SCROLL_LINEUP,
704
+ Wx::ScrollEvent],
705
+ EventType['evt_splitter_dclick', 1,
706
+ Wx::EVT_COMMAND_SPLITTER_DOUBLECLICKED,
707
+ Wx::SplitterEvent],
708
+ EventType['evt_splitter_sash_pos_changed', 1,
709
+ Wx::EVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
710
+ Wx::SplitterEvent],
711
+ EventType['evt_splitter_sash_pos_changing', 1,
712
+ Wx::EVT_COMMAND_SPLITTER_SASH_POS_CHANGING,
713
+ Wx::SplitterEvent],
714
+ EventType['evt_splitter_unsplit', 1,
715
+ Wx::EVT_COMMAND_SPLITTER_UNSPLIT,
716
+ Wx::SplitterEvent],
717
+ EventType['evt_sys_colour_changed', 0,
718
+ Wx::EVT_SYS_COLOUR_CHANGED,
719
+ Wx::Event],
720
+ EventType['evt_taskbar_left_dclick', 0,
721
+ Wx::EVT_TASKBAR_LEFT_DCLICK,
722
+ Wx::Event],
723
+ EventType['evt_taskbar_left_down', 0,
724
+ Wx::EVT_TASKBAR_LEFT_DOWN,
725
+ Wx::Event],
726
+ EventType['evt_taskbar_left_up', 0,
727
+ Wx::EVT_TASKBAR_LEFT_UP,
728
+ Wx::Event],
729
+ EventType['evt_taskbar_move', 0,
730
+ Wx::EVT_TASKBAR_MOVE,
731
+ Wx::Event],
732
+ EventType['evt_taskbar_right_dclick', 0,
733
+ Wx::EVT_TASKBAR_RIGHT_DCLICK,
734
+ Wx::Event],
735
+ EventType['evt_taskbar_right_down', 0,
736
+ Wx::EVT_TASKBAR_RIGHT_DOWN,
737
+ Wx::Event],
738
+ EventType['evt_taskbar_right_up', 0,
739
+ Wx::EVT_TASKBAR_RIGHT_UP,
740
+ Wx::Event],
741
+ EventType['evt_text', 1,
742
+ Wx::EVT_COMMAND_TEXT_UPDATED,
743
+ Wx::CommandEvent],
744
+ EventType['evt_text_enter', 1,
745
+ Wx::EVT_COMMAND_TEXT_ENTER,
746
+ Wx::CommandEvent],
747
+ EventType['evt_text_maxlen', 1,
748
+ Wx::EVT_COMMAND_TEXT_MAXLEN,
749
+ Wx::CommandEvent],
750
+ EventType['evt_text_url', 1,
751
+ Wx::EVT_COMMAND_TEXT_URL,
752
+ Wx::TextUrlEvent],
753
+ EventType['evt_timer', 1,
754
+ Wx::EVT_TIMER,
755
+ Wx::TimerEvent],
756
+ EventType['evt_togglebutton', 1,
757
+ Wx::EVT_COMMAND_TOGGLEBUTTON_CLICKED,
758
+ Wx::Event],
759
+ EventType['evt_tool', 1,
760
+ Wx::EVT_COMMAND_TOOL_CLICKED,
761
+ Wx::CommandEvent],
762
+ EventType['evt_tool_enter', 1,
763
+ Wx::EVT_COMMAND_TOOL_ENTER,
764
+ Wx::CommandEvent],
765
+ EventType['evt_tool_range', 2,
766
+ Wx::EVT_COMMAND_TOOL_CLICKED,
767
+ Wx::CommandEvent],
768
+ EventType['evt_tool_rclicked', 1,
769
+ Wx::EVT_COMMAND_TOOL_RCLICKED,
770
+ Wx::CommandEvent],
771
+ EventType['evt_tool_rclicked_range', 2,
772
+ Wx::EVT_COMMAND_TOOL_RCLICKED,
773
+ Wx::CommandEvent],
774
+ EventType['evt_tree_begin_drag', 1,
775
+ Wx::EVT_COMMAND_TREE_BEGIN_DRAG,
776
+ Wx::TreeEvent],
777
+ EventType['evt_tree_begin_label_edit', 1,
778
+ Wx::EVT_COMMAND_TREE_BEGIN_LABEL_EDIT,
779
+ Wx::TreeEvent],
780
+ EventType['evt_tree_begin_rdrag', 1,
781
+ Wx::EVT_COMMAND_TREE_BEGIN_RDRAG,
782
+ Wx::TreeEvent],
783
+ EventType['evt_tree_delete_item', 1,
784
+ Wx::EVT_COMMAND_TREE_DELETE_ITEM,
785
+ Wx::TreeEvent],
786
+ EventType['evt_tree_end_drag', 1,
787
+ Wx::EVT_COMMAND_TREE_END_DRAG,
788
+ Wx::TreeEvent],
789
+ EventType['evt_tree_end_label_edit', 1,
790
+ Wx::EVT_COMMAND_TREE_END_LABEL_EDIT,
791
+ Wx::TreeEvent],
792
+ EventType['evt_tree_get_info', 1,
793
+ Wx::EVT_COMMAND_TREE_GET_INFO,
794
+ Wx::TreeEvent],
795
+ EventType['evt_tree_item_activated', 1,
796
+ Wx::EVT_COMMAND_TREE_ITEM_ACTIVATED,
797
+ Wx::TreeEvent],
798
+ EventType['evt_tree_item_collapsed', 1,
799
+ Wx::EVT_COMMAND_TREE_ITEM_COLLAPSED,
800
+ Wx::TreeEvent],
801
+ EventType['evt_tree_item_collapsing', 1,
802
+ Wx::EVT_COMMAND_TREE_ITEM_COLLAPSING,
803
+ Wx::TreeEvent],
804
+ EventType['evt_tree_item_expanded', 1,
805
+ Wx::EVT_COMMAND_TREE_ITEM_EXPANDED,
806
+ Wx::TreeEvent],
807
+ EventType['evt_tree_item_expanding', 1,
808
+ Wx::EVT_COMMAND_TREE_ITEM_EXPANDING,
809
+ Wx::TreeEvent],
810
+ EventType['evt_tree_item_middle_click', 1,
811
+ Wx::EVT_COMMAND_TREE_ITEM_MIDDLE_CLICK,
812
+ Wx::TreeEvent],
813
+ EventType['evt_tree_item_right_click', 1,
814
+ Wx::EVT_COMMAND_TREE_ITEM_RIGHT_CLICK,
815
+ Wx::TreeEvent],
816
+ EventType['evt_tree_key_down', 1,
817
+ Wx::EVT_COMMAND_TREE_KEY_DOWN,
818
+ Wx::TreeEvent],
819
+ EventType['evt_tree_sel_changed', 1,
820
+ Wx::EVT_COMMAND_TREE_SEL_CHANGED,
821
+ Wx::TreeEvent],
822
+ EventType['evt_tree_sel_changing', 1,
823
+ Wx::EVT_COMMAND_TREE_SEL_CHANGING,
824
+ Wx::TreeEvent],
825
+ EventType['evt_tree_set_info', 1,
826
+ Wx::EVT_COMMAND_TREE_SET_INFO,
827
+ Wx::TreeEvent],
828
+ EventType['evt_update_ui', 1,
829
+ Wx::EVT_UPDATE_UI,
830
+ Wx::UpdateUIEvent],
831
+ EventType['evt_update_ui_range', 2,
832
+ Wx::EVT_UPDATE_UI,
833
+ Wx::UpdateUIEvent],
834
+ EventType['evt_window_create', 0,
835
+ Wx::EVT_CREATE,
836
+ Wx::WindowCreateEvent],
837
+ EventType['evt_window_destroy', 0,
838
+ Wx::EVT_DESTROY,
839
+ Wx::WindowDestroyEvent],
840
+ EventType['evt_wizard_cancel', 1,
841
+ Wx::EVT_WIZARD_CANCEL,
842
+ Wx::WizardEvent],
843
+ EventType['evt_wizard_finished', 1,
844
+ Wx::EVT_WIZARD_FINISHED,
845
+ Wx::WizardEvent],
846
+ EventType['evt_wizard_help', 1,
847
+ Wx::EVT_WIZARD_HELP,
848
+ Wx::WizardEvent],
849
+ EventType['evt_wizard_page_changed', 1,
850
+ Wx::EVT_WIZARD_PAGE_CHANGED,
851
+ Wx::WizardEvent],
852
+ EventType['evt_wizard_page_changing', 1,
853
+ Wx::EVT_WIZARD_PAGE_CHANGING,
854
+ Wx::WizardEvent]
855
+ ]
856
+
857
+ # Loop over the event definitions to set up two things:
858
+ # 1) A hash mapping Event Type ids to event classes, used when events
859
+ # are fired to quickly look up the right type to yield
860
+ # 2) EvtHandler instance methods like evt_xxx to conveniently set
861
+ # up event handlers
862
+ EVENT_DEFINITIONS.each { | ev_type | register_event_type(ev_type) }
863
+
864
+
865
+ # convenience evt_handler to listen to all mouse events
866
+ def evt_mouse_events(&block)
867
+ evt_left_down(&block)
868
+ evt_left_up(&block)
869
+ evt_middle_down(&block)
870
+ evt_middle_up(&block)
871
+ evt_right_down(&block)
872
+ evt_right_up(&block)
873
+ evt_motion(&block)
874
+ evt_left_dclick(&block)
875
+ evt_middle_dclick(&block)
876
+ evt_right_dclick(&block)
877
+ evt_leave_window(&block)
878
+ evt_enter_window(&block)
879
+ evt_mousewheel(&block)
880
+ end
881
+
882
+ # convenience evt handler to listen to all scrollwin events
883
+ def evt_scrollwin(&block)
884
+ evt_scrollwin_top(&block)
885
+ evt_scrollwin_bottom(&block)
886
+ evt_scrollwin_lineup(&block)
887
+ evt_scrollwin_linedown(&block)
888
+ evt_scrollwin_pageup(&block)
889
+ evt_scrollwin_pagedown(&block)
890
+ evt_scrollwin_thumbtrack(&block)
891
+ evt_scrollwin_thumbrelease(&block)
892
+ end
893
+ end
894
+