wxruby3 1.3.0 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +16 -12
  3. data/README.md +4 -3
  4. data/ext/wxruby3/include/wxRubyApp.h +9 -9
  5. data/ext/wxruby3/swig/custom/director.swg +11 -3
  6. data/ext/wxruby3/swig/custom/rubyapi.swg +15 -1
  7. data/ext/wxruby3/swig/mark_free_impl.i +47 -11
  8. data/ext/wxruby3/swig/wx.i +30 -12
  9. data/lib/wx/aui/auifloatframe.rb +1 -1
  10. data/lib/wx/aui/auimanager.rb +50 -14
  11. data/lib/wx/aui/auinotebook.rb +1 -1
  12. data/lib/wx/aui/require.rb +0 -2
  13. data/lib/wx/core/acceleratortable.rb +1 -1
  14. data/lib/wx/core/animation.rb +2 -2
  15. data/lib/wx/core/app.rb +1 -1
  16. data/lib/wx/core/array_ext.rb +1 -0
  17. data/lib/wx/core/artprovider.rb +4 -4
  18. data/lib/wx/core/bitmap.rb +1 -1
  19. data/lib/wx/core/bitmap_combobox.rb +2 -2
  20. data/lib/wx/core/brush.rb +8 -0
  21. data/lib/wx/core/clientdc.rb +1 -1
  22. data/lib/wx/core/clipboard.rb +4 -4
  23. data/lib/wx/core/colour.rb +1 -1
  24. data/lib/wx/core/combobox.rb +1 -1
  25. data/lib/wx/core/config.rb +7 -7
  26. data/lib/wx/core/controlwithitems.rb +3 -3
  27. data/lib/wx/core/data_object.rb +4 -4
  28. data/lib/wx/core/dataformat.rb +9 -3
  29. data/lib/wx/core/defs.rb +49 -0
  30. data/lib/wx/core/dialog.rb +3 -2
  31. data/lib/wx/core/enum.rb +16 -3
  32. data/lib/wx/core/event.rb +3 -3
  33. data/lib/wx/core/evthandler.rb +317 -289
  34. data/lib/wx/core/file_dialog.rb +1 -1
  35. data/lib/wx/core/find_replace_dialog.rb +2 -2
  36. data/lib/wx/core/font.rb +14 -0
  37. data/lib/wx/core/functions.rb +1 -1
  38. data/lib/wx/core/genericdirctrl.rb +1 -1
  39. data/lib/wx/core/geometry.rb +2 -2
  40. data/lib/wx/core/graphics_pen_info.rb +1 -1
  41. data/lib/wx/core/hboxsizer.rb +24 -4
  42. data/lib/wx/core/helpprovider.rb +1 -1
  43. data/lib/wx/core/icon.rb +1 -1
  44. data/lib/wx/core/image.rb +2 -2
  45. data/lib/wx/core/imagelist.rb +1 -1
  46. data/lib/wx/core/locale.rb +5 -5
  47. data/lib/wx/core/log.rb +8 -8
  48. data/lib/wx/core/menu.rb +3 -3
  49. data/lib/wx/core/module_ext.rb +16 -0
  50. data/lib/wx/core/owner_drawn_combobox.rb +3 -3
  51. data/lib/wx/core/pen.rb +20 -0
  52. data/lib/wx/core/pen_info.rb +1 -1
  53. data/lib/wx/core/persistence_manager.rb +2 -2
  54. data/lib/wx/core/real_point.rb +1 -0
  55. data/lib/wx/core/rect.rb +1 -1
  56. data/lib/wx/core/secret_store.rb +1 -1
  57. data/lib/wx/core/simplehelpprovider.rb +1 -1
  58. data/lib/wx/core/sizer.rb +166 -39
  59. data/lib/wx/core/splash_screen.rb +1 -1
  60. data/lib/wx/core/standard_paths.rb +1 -1
  61. data/lib/wx/core/task_bar_button.rb +1 -1
  62. data/lib/wx/core/text_entry.rb +1 -1
  63. data/lib/wx/core/textctrl.rb +2 -2
  64. data/lib/wx/core/timer.rb +2 -2
  65. data/lib/wx/core/tree_ctrl.rb +1 -1
  66. data/lib/wx/core/v_list_box.rb +1 -1
  67. data/lib/wx/core/validator.rb +2 -2
  68. data/lib/wx/core/variant.rb +2 -2
  69. data/lib/wx/core/vboxsizer.rb +24 -4
  70. data/lib/wx/core/window.rb +48 -2
  71. data/lib/wx/core/xmlresource.rb +4 -4
  72. data/lib/wx/core.rb +2 -0
  73. data/lib/wx/doc/array_ext.rb +1 -0
  74. data/lib/wx/doc/aui/auimanager.rb +2 -0
  75. data/lib/wx/doc/enum.rb +26 -0
  76. data/lib/wx/doc/evthandler.rb +1 -0
  77. data/lib/wx/doc/gdi_common.rb +1 -0
  78. data/lib/wx/doc/tip_window.rb +22 -0
  79. data/lib/wx/grid/grid.rb +3 -3
  80. data/lib/wx/grid/require.rb +0 -2
  81. data/lib/wx/html/htmlhelpcontroller.rb +1 -1
  82. data/lib/wx/html/htmlwindow.rb +1 -1
  83. data/lib/wx/html/require.rb +0 -2
  84. data/lib/wx/html/simple_html_listbox.rb +3 -3
  85. data/lib/wx/keyword_ctors.rb +14 -7
  86. data/lib/wx/keyword_defs.rb +7 -7
  87. data/lib/wx/pg/pg_properties.rb +1 -1
  88. data/lib/wx/pg/pg_property.rb +3 -3
  89. data/lib/wx/pg/property_grid.rb +2 -2
  90. data/lib/wx/pg/property_grid_interface.rb +2 -2
  91. data/lib/wx/pg/require.rb +0 -2
  92. data/lib/wx/prt/previewframe.rb +1 -1
  93. data/lib/wx/prt/require.rb +0 -2
  94. data/lib/wx/rbn/ribbon_control.rb +1 -1
  95. data/lib/wx/rbn/ribbon_page.rb +1 -1
  96. data/lib/wx/rbn/ribbon_panel.rb +1 -1
  97. data/lib/wx/rtc/require.rb +0 -2
  98. data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
  99. data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
  100. data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
  101. data/lib/wx/rtc/richtext_buffer.rb +3 -3
  102. data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
  103. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
  104. data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
  105. data/lib/wx/stc/require.rb +0 -2
  106. data/lib/wx/stc/styled_text_ctrl.rb +1 -1
  107. data/lib/wx/version.rb +1 -1
  108. data/lib/wx/wxruby/base.rb +8 -2
  109. data/lib/wx/wxruby/cmd/setup.rb +61 -37
  110. data/rakelib/gem.rb +8 -4
  111. data/rakelib/lib/config/mingw.rb +1 -1
  112. data/rakelib/lib/core/include/swigrubyrun.inc +2 -2
  113. data/rakelib/lib/director/about_dialog_info.rb +1 -0
  114. data/rakelib/lib/director/aui_manager.rb +124 -3
  115. data/rakelib/lib/director/aui_notebook.rb +7 -0
  116. data/rakelib/lib/director/colour.rb +1 -1
  117. data/rakelib/lib/director/data_format.rb +1 -1
  118. data/rakelib/lib/director/dialog.rb +4 -2
  119. data/rakelib/lib/director/event.rb +1 -0
  120. data/rakelib/lib/director/event_handler.rb +82 -46
  121. data/rakelib/lib/director/functions.rb +0 -3
  122. data/rakelib/lib/director/list_ctrl.rb +14 -10
  123. data/rakelib/lib/director/locale.rb +2 -0
  124. data/rakelib/lib/director/num_validator.rb +7 -0
  125. data/rakelib/lib/director/pgproperties.rb +2 -2
  126. data/rakelib/lib/director/property_grid_interface.rb +4 -3
  127. data/rakelib/lib/director/textctrl.rb +7 -0
  128. data/rakelib/lib/director/tip_window.rb +34 -0
  129. data/rakelib/lib/director/variant.rb +2 -2
  130. data/rakelib/lib/director/window.rb +9 -1
  131. data/rakelib/lib/director.rb +0 -1
  132. data/rakelib/lib/extractor/function.rb +5 -0
  133. data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
  134. data/rakelib/lib/specs/interfaces.rb +1 -0
  135. data/rakelib/lib/typemap/common.rb +2 -2
  136. data/samples/dialogs/dialogs.rb +1 -1
  137. data/tests/test_combo_ctrl.rb +1 -0
  138. data/tests/test_event_handling.rb +158 -31
  139. metadata +7 -5
@@ -42,7 +42,7 @@ module Wx
42
42
 
43
43
  # add protection against exceptions raised in blocks
44
44
  wx_for_path = instance_method :for_path
45
- define_method :for_path do |path, &block|
45
+ wx_redefine_method :for_path do |path, &block|
46
46
  if block
47
47
  ex = nil
48
48
  rc = wx_for_path.bind(self).call(path) do |cfg, key|
@@ -64,7 +64,7 @@ module Wx
64
64
  # add Enumerator support
65
65
 
66
66
  wx_each_entry = instance_method :each_entry
67
- define_method :each_entry do |&block|
67
+ wx_redefine_method :each_entry do |&block|
68
68
  if block_given?
69
69
  wx_each_entry.bind(self).call { |k| block.call(k, read(k)) }
70
70
  else
@@ -73,7 +73,7 @@ module Wx
73
73
  end
74
74
 
75
75
  wx_each_group = instance_method :each_group
76
- define_method :each_group do |&block|
76
+ wx_redefine_method :each_group do |&block|
77
77
  if block_given?
78
78
  wx_each_group.bind(self).call { |k| block.call(k, Group.new(self, self.path.dup.push(k))) }
79
79
  else
@@ -83,20 +83,20 @@ module Wx
83
83
 
84
84
  # make this return a path array
85
85
  wx_path = instance_method :path
86
- define_method :path do
86
+ wx_redefine_method :path do
87
87
  wx_path.bind(self).call.split(ConfigBase::SEPARATOR)
88
88
  end
89
89
 
90
90
  # protect against attempts to rename complete paths
91
91
  wx_rename = instance_method :rename
92
- define_method :rename do |old_key, new_key|
92
+ wx_redefine_method :rename do |old_key, new_key|
93
93
  raise ArgumentError, 'No paths allowed' if old_key.index(ConfigBase::SEPARATOR) || new_key.index(ConfigBase::SEPARATOR)
94
94
  wx_rename.bind(self).call(old_key, new_key)
95
95
  end
96
96
 
97
97
  # fix recursive number_of_xxx methods as wxRegConfig does not support this currently
98
98
  wx_number_of_entries = instance_method :number_of_entries
99
- define_method :number_of_entries do |recurse=false|
99
+ wx_redefine_method :number_of_entries do |recurse=false|
100
100
  if recurse
101
101
  each_group.inject(wx_number_of_entries.bind(self).call) { |c, (_, g)| c + g.number_of_entries(true) }
102
102
  else
@@ -105,7 +105,7 @@ module Wx
105
105
  end
106
106
 
107
107
  wx_number_of_groups = instance_method :number_of_groups
108
- define_method :number_of_groups do |recurse=false|
108
+ wx_redefine_method :number_of_groups do |recurse=false|
109
109
  if recurse
110
110
  each_group.inject(wx_number_of_groups.bind(self).call) { |c, (_, g)| c + g.number_of_groups(true) }
111
111
  else
@@ -15,7 +15,7 @@ module Wx
15
15
 
16
16
  # make sure to honor the inherited common overloads
17
17
  wx_get_client_object = instance_method :get_client_object
18
- define_method :get_client_object do |*args|
18
+ wx_redefine_method :get_client_object do |*args|
19
19
  if args.empty?
20
20
  super()
21
21
  else
@@ -23,7 +23,7 @@ module Wx
23
23
  end
24
24
  end
25
25
  wx_set_client_object = instance_method :set_client_object
26
- define_method :set_client_object do |*args|
26
+ wx_redefine_method :set_client_object do |*args|
27
27
  if args.size < 2
28
28
  super(*args)
29
29
  else
@@ -45,7 +45,7 @@ module Wx
45
45
 
46
46
  # Overload to provide Enumerator without block
47
47
  wx_each_string = instance_method :each_string
48
- define_method :each_string do |&block|
48
+ wx_redefine_method :each_string do |&block|
49
49
  if block
50
50
  wx_each_string.bind(self).call(&block)
51
51
  else
@@ -25,17 +25,17 @@ module Wx
25
25
  # using pure Ruby
26
26
 
27
27
  wx_get_data_size = instance_method :get_data_size
28
- define_method :get_data_size do |format = nil|
28
+ wx_redefine_method :get_data_size do |format = nil|
29
29
  wx_get_data_size.bind(self).call(format || self.get_format)
30
30
  end
31
31
 
32
32
  wx_get_data_here = instance_method :get_data_here
33
- define_method :get_data_here do |format = nil|
33
+ wx_redefine_method :get_data_here do |format = nil|
34
34
  wx_get_data_here.bind(self).call(format || self.get_format)
35
35
  end
36
36
 
37
37
  wx_set_data = instance_method :set_data
38
- define_method :set_data do |*args|
38
+ wx_redefine_method :set_data do |*args|
39
39
  if args.size>1
40
40
  format, buf = args
41
41
  else
@@ -66,7 +66,7 @@ module Wx
66
66
  self._set_data(buf)
67
67
  end
68
68
 
69
- def _get_data_size
69
+ wx_redefine_method :_get_data_size do
70
70
  (_get_data || '').bytesize
71
71
  end
72
72
  protected :_get_data_size
@@ -11,10 +11,16 @@
11
11
 
12
12
  class Wx::DataFormat
13
13
  def ==(other)
14
- if self.get_type > Wx::DataFormatId::DF_INVALID
15
- self.get_type == other.get_type
14
+ if other.is_a?(Wx::DataFormatId)
15
+ self.get_type == other
16
+ elsif other.is_a?(self.class)
17
+ if self.get_type > Wx::DataFormatId::DF_INVALID
18
+ self.get_type == other.get_type
19
+ else
20
+ self.id == other.id
21
+ end
16
22
  else
17
- self.id == other.id
23
+ false
18
24
  end
19
25
  end
20
26
  end
@@ -0,0 +1,49 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+ #
5
+ # Some parts are
6
+ # Copyright 2004-2007, wxRuby development team
7
+ # released under the MIT-like wxRuby2 license
8
+
9
+ require_relative './enum'
10
+
11
+ module Wx
12
+
13
+ class Orientation < Wx::Enum
14
+
15
+ set_non_distinct(%i[ORIENTATION_MASK])
16
+
17
+ end
18
+
19
+ class Direction < Wx::Enum
20
+
21
+ set_non_distinct(%i[TOP BOTTOM NORTH SOUTH WEST EAST ALL DIRECTION_MASK])
22
+
23
+ end
24
+
25
+ class Alignment < Wx::Enum
26
+
27
+ set_non_distinct(%i[ALIGN_INVALID ALIGN_CENTRE_HORIZONTAL ALIGN_LEFT ALIGN_TOP ALIGN_CENTRE_VERTICAL ALIGN_CENTER ALIGN_MASK])
28
+
29
+ end
30
+
31
+ class SizerFlagBits < Wx::Enum
32
+
33
+ set_non_distinct(%i[SIZER_FLAG_BITS_MASK])
34
+
35
+ end
36
+
37
+ class Stretch < Wx::Enum
38
+
39
+ set_non_distinct(%i[GROW STRETCH_MASK])
40
+
41
+ end
42
+
43
+ class Border < Wx::Enum
44
+
45
+ set_non_distinct(%i[BORDER_THEME BORDER_MASK])
46
+
47
+ end
48
+
49
+ end
@@ -13,9 +13,10 @@ class Wx::Dialog
13
13
  class << self
14
14
 
15
15
  wx_set_layout_adapter = instance_method :set_layout_adapter
16
- define_method :set_layout_adapter do |adapter|
16
+ wx_redefine_method :set_layout_adapter do |adapter|
17
17
  prev_adapter = wx_set_layout_adapter.bind(self).call(adapter)
18
18
  @adapter = adapter # cache here to prevent premature GC collection
19
+ prev_adapter
19
20
  end
20
21
 
21
22
  end
@@ -50,7 +51,7 @@ class Wx::Dialog
50
51
  def self.inherited(sub)
51
52
  sub.include Wx::Dialog::Functor
52
53
  end
53
- end
54
+ end unless klass.singleton_class.method_defined?(:inherited)
54
55
  end
55
56
  end
56
57
 
data/lib/wx/core/enum.rb CHANGED
@@ -10,10 +10,23 @@ class Wx::Enum
10
10
 
11
11
  class << self
12
12
 
13
- def enumerators
13
+ def set_non_distinct(lst)
14
+ raise TypeError, 'Expected Array of Symbols' unless lst.is_a?(Array) && lst.all? { |e| e.is_a?(Symbol) }
15
+ @non_distinct = lst
16
+ end
17
+ alias :non_distinct= :set_non_distinct
18
+
19
+ def non_distinct
20
+ @non_distinct || []
21
+ end
22
+
23
+ def enumerators(excludes = nil)
24
+ excludes ||= self.non_distinct
14
25
  self.constants(false).inject({}) do |tbl, cn|
15
- cv = self.const_get(cn)
16
- tbl[cv.to_i] = cn if self === cv
26
+ unless excludes&.include?(cn)
27
+ cv = self.const_get(cn)
28
+ tbl[cv.to_i] = cn if self === cv
29
+ end
17
30
  tbl
18
31
  end
19
32
  end
data/lib/wx/core/event.rb CHANGED
@@ -16,7 +16,7 @@ module Wx
16
16
  # overload the #initialize method to add a check on a
17
17
  # correct match between EventType and event class
18
18
  wx_init = self.instance_method(:initialize)
19
- define_method :initialize do |evt_type = Wx::EVT_NULL, *rest|
19
+ wx_redefine_method :initialize do |evt_type = Wx::EVT_NULL, *rest|
20
20
  evt_klass = Wx::EvtHandler.event_class_for_type(evt_type)
21
21
  if evt_klass >= self.class
22
22
  wx_init.bind(self).call(evt_type, *rest)
@@ -34,7 +34,7 @@ module Wx
34
34
  # overload the #initialize method to add a check on a
35
35
  # correct match between EventType and event class
36
36
  wx_init = self.instance_method(:initialize)
37
- define_method :initialize do |evt_type = Wx::EVT_NULL, *rest|
37
+ wx_redefine_method :initialize do |evt_type = Wx::EVT_NULL, *rest|
38
38
  evt_klass = Wx::EvtHandler.event_class_for_type(evt_type)
39
39
  if evt_klass >= self.class
40
40
  wx_init.bind(self).call(evt_type, *rest)
@@ -58,7 +58,7 @@ module Wx
58
58
  Wx::EVT_NC_PAINT,
59
59
  Wx::NcPaintEvent
60
60
  ]
61
- if Wx.const_defined?(:EVT_HOTKEY)
61
+ if Wx.has_feature?(:USE_HOTKEY) && Wx.const_defined?(:EVT_HOTKEY)
62
62
  EvtHandler.register_event_type EvtHandler::EventType[
63
63
  'evt_hotkey', 1,
64
64
  Wx::EVT_HOTKEY,