wxruby3 0.9.8 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +23 -1
  3. data/README.md +13 -27
  4. data/ext/mkrf_conf_ext.rb +11 -7
  5. data/lib/wx/core/app.rb +16 -0
  6. data/lib/wx/core/colour.rb +36 -28
  7. data/lib/wx/core/const.rb +19 -0
  8. data/lib/wx/core/enum.rb +17 -1
  9. data/lib/wx/core/geometry.rb +121 -0
  10. data/lib/wx/core/graphics_pen_info.rb +18 -0
  11. data/lib/wx/core/image.rb +49 -0
  12. data/lib/wx/core/menu_bar.rb +11 -0
  13. data/lib/wx/core/paintdc.rb +9 -3
  14. data/lib/wx/doc/app.rb +97 -41
  15. data/lib/wx/doc/bitmap.rb +4 -0
  16. data/lib/wx/doc/client_dc.rb +2 -2
  17. data/lib/wx/doc/clipboard.rb +1 -1
  18. data/lib/wx/doc/colour.rb +12 -0
  19. data/lib/wx/doc/const.rb +16 -0
  20. data/lib/wx/doc/cursor.rb +4 -0
  21. data/lib/wx/doc/dc_overlay.rb +34 -0
  22. data/lib/wx/doc/enum.rb +7 -1
  23. data/lib/wx/doc/event_blocker.rb +1 -1
  24. data/lib/wx/doc/evthandler.rb +25 -3
  25. data/lib/wx/doc/functions.rb +3 -6
  26. data/lib/wx/doc/gc_dc.rb +13 -4
  27. data/lib/wx/doc/geometry.rb +136 -0
  28. data/lib/wx/doc/graphics_context.rb +25 -7
  29. data/lib/wx/doc/icon.rb +4 -0
  30. data/lib/wx/doc/image.rb +56 -0
  31. data/lib/wx/doc/list_ctrl.rb +6 -6
  32. data/lib/wx/doc/memory_dc.rb +2 -11
  33. data/lib/wx/doc/mirror_dc.rb +1 -1
  34. data/lib/wx/doc/pen.rb +26 -0
  35. data/lib/wx/doc/persistence_manager.rb +1 -1
  36. data/lib/wx/doc/persistent_object.rb +1 -1
  37. data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
  38. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  39. data/lib/wx/doc/region_iterator.rb +1 -1
  40. data/lib/wx/doc/scaled_dc.rb +1 -1
  41. data/lib/wx/doc/screen_dc.rb +1 -1
  42. data/lib/wx/doc/svg_file_dc.rb +1 -1
  43. data/lib/wx/doc/textctrl.rb +1 -1
  44. data/lib/wx/doc/tree_ctrl.rb +2 -2
  45. data/lib/wx/doc/validator.rb +6 -6
  46. data/lib/wx/doc/variant.rb +2 -2
  47. data/lib/wx/doc/window.rb +5 -4
  48. data/lib/wx/grid/keyword_defs.rb +1 -1
  49. data/lib/wx/html/keyword_defs.rb +3 -3
  50. data/lib/wx/keyword_defs.rb +76 -71
  51. data/lib/wx/pg/keyword_defs.rb +2 -2
  52. data/lib/wx/pg/pg_property.rb +12 -0
  53. data/lib/wx/rbn/keyword_defs.rb +1 -1
  54. data/lib/wx/rtc/keyword_defs.rb +1 -1
  55. data/lib/wx/stc/keyword_defs.rb +1 -1
  56. data/lib/wx/version.rb +1 -1
  57. data/lib/wx/wxruby/cmd/setup.rb +3 -0
  58. data/rakelib/configure.rb +7 -0
  59. data/rakelib/gem.rake +3 -2
  60. data/rakelib/gem.rb +3 -2
  61. data/rakelib/lib/config/linux.rb +1 -1
  62. data/rakelib/lib/config/mingw.rb +4 -101
  63. data/rakelib/lib/config/pkgman/linux.rb +31 -8
  64. data/rakelib/lib/config/pkgman/mingw.rb +112 -0
  65. data/rakelib/lib/config/unixish.rb +6 -7
  66. data/rakelib/lib/config.rb +25 -4
  67. data/rakelib/lib/core/include/enum.inc +31 -1
  68. data/rakelib/lib/director/affine_matrix.rb +51 -0
  69. data/rakelib/lib/director/app.rb +29 -13
  70. data/rakelib/lib/director/art_provider.rb +4 -0
  71. data/rakelib/lib/director/cursor.rb +6 -2
  72. data/rakelib/lib/director/dc.rb +1 -6
  73. data/rakelib/lib/director/derived_dc.rb +88 -31
  74. data/rakelib/lib/director/dialog.rb +0 -8
  75. data/rakelib/lib/director/geometry.rb +142 -0
  76. data/rakelib/lib/director/graphics_context.rb +3 -2
  77. data/rakelib/lib/director/graphics_object.rb +18 -25
  78. data/rakelib/lib/director/image.rb +59 -0
  79. data/rakelib/lib/director/menu.rb +2 -3
  80. data/rakelib/lib/director/menu_bar.rb +0 -3
  81. data/rakelib/lib/director/pen.rb +1 -1
  82. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  83. data/rakelib/lib/director/system_settings.rb +1 -1
  84. data/rakelib/lib/director/window.rb +9 -3
  85. data/rakelib/lib/extractor/function.rb +1 -1
  86. data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
  87. data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
  88. data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
  89. data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
  90. data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
  91. data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
  92. data/rakelib/lib/generate/doc/icon.yaml +10 -0
  93. data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
  94. data/rakelib/lib/generate/doc/log.yaml +1 -1
  95. data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
  96. data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
  97. data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
  98. data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
  99. data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
  100. data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
  101. data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
  102. data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
  103. data/rakelib/lib/generate/doc/wizard.yaml +27 -0
  104. data/rakelib/lib/generate/doc.rb +4 -4
  105. data/rakelib/lib/generate/interface.rb +1 -1
  106. data/rakelib/lib/specs/interfaces.rb +3 -0
  107. data/rakelib/lib/swig_runner.rb +24 -3
  108. data/rakelib/lib/typemap/points_list.rb +8 -2
  109. data/rakelib/lib/typemap/richtext.rb +17 -0
  110. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
  111. data/samples/dialogs/wizard.rb +20 -19
  112. data/samples/drawing/art/drawing/image.bmp +0 -0
  113. data/samples/drawing/art/drawing/mask.bmp +0 -0
  114. data/samples/drawing/art/drawing/pat35.bmp +0 -0
  115. data/samples/drawing/art/drawing/pat36.bmp +0 -0
  116. data/samples/drawing/art/drawing/pat4.bmp +0 -0
  117. data/samples/drawing/art/drawing/smile.xpm +42 -0
  118. data/samples/drawing/drawing.rb +2276 -0
  119. data/samples/drawing/tn_drawing.png +0 -0
  120. data/samples/html/html.rb +1 -1
  121. data/samples/propgrid/propgrid.rb +1 -1
  122. data/samples/propgrid/propgrid_minimal.rb +1 -1
  123. data/samples/propgrid/sample_props.rb +1 -1
  124. data/samples/sampler/editor.rb +13 -11
  125. data/samples/sampler.rb +14 -10
  126. data/samples/text/richtext.rb +53 -0
  127. data/samples/text/scintilla.rb +1 -1
  128. data/samples/text/unicode.rb +4 -4
  129. data/tests/test_ext_controls.rb +12 -5
  130. data/tests/test_gdi_object.rb +2 -2
  131. data/tests/test_std_controls.rb +12 -12
  132. metadata +33 -32
  133. data/lib/wx/doc/extra/00_starting.md +0 -154
  134. data/lib/wx/doc/extra/01_packages.md +0 -180
  135. data/lib/wx/doc/extra/02_lifecycles.md +0 -166
  136. data/lib/wx/doc/extra/03_dialogs.md +0 -57
  137. data/lib/wx/doc/extra/04_enums.md +0 -143
  138. data/lib/wx/doc/extra/05_event-handling.md +0 -191
  139. data/lib/wx/doc/extra/06_geometry.md +0 -62
  140. data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
  141. data/lib/wx/doc/extra/08_extensions.md +0 -144
  142. data/lib/wx/doc/extra/09_exceptions.md +0 -54
  143. data/lib/wx/doc/extra/10_art.md +0 -111
  144. data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
  145. data/lib/wx/doc/extra/12_client_data.md +0 -89
  146. data/lib/wx/doc/extra/13_validators.md +0 -139
  147. data/lib/wx/doc/extra/14_config.md +0 -101
  148. data/lib/wx/doc/extra/15_persistence.md +0 -148
  149. data/samples/sampler/back.xpm +0 -21
  150. data/samples/sampler/copy.xpm +0 -44
  151. data/samples/sampler/cut.xpm +0 -46
  152. data/samples/sampler/filesave.xpm +0 -42
  153. data/samples/sampler/find.xpm +0 -62
  154. data/samples/sampler/findrepl.xpm +0 -63
  155. data/samples/sampler/forward.xpm +0 -21
  156. data/samples/sampler/paste.xpm +0 -46
  157. data/samples/sampler/redo.xpm +0 -58
  158. data/samples/sampler/undo.xpm +0 -58
@@ -32,3 +32,15 @@
32
32
  end
33
33
  end
34
34
  ```
35
+ :wxGraphicsPenInfo:
36
+ :detail:
37
+ :pre:
38
+ :programlisting:
39
+ - :pattern: !ruby/regexp /.*/
40
+ :replace: |
41
+
42
+ ```ruby
43
+ ctx = Wx::GraphicsContext.create(dc)
44
+
45
+ ctx.set_pen(Wx::GraphicsPenInfo.new(Wx::BLUE).width(1.25).style(Wx::PENSTYLE_DOT))
46
+ ```
@@ -0,0 +1,12 @@
1
+ ---
2
+ :wxGraphicsRenderer:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ # path = Wx::GraphicsPath from somewhere
11
+ brush = path.get_renderer.create_brush(Wx::BLACK_BRUSH)
12
+ ```
@@ -23,3 +23,28 @@
23
23
 
24
24
  end
25
25
  ```
26
+ :wxGrid.GetSelectedBlocks:
27
+ :detail:
28
+ :pre:
29
+ :programlisting:
30
+ - :pattern: !ruby/regexp /.*/
31
+ :replace: |
32
+
33
+ ```ruby
34
+ grid.get_selected_blocks.each do |gbc|
35
+ break if gbc.intersects(my_block)
36
+ end
37
+ ```
38
+ :post:
39
+ - :pattern: !ruby/regexp /,\s+e\.g\.\s+with\s+range-for\s+loop:/
40
+ :subst: ':'
41
+ :wxGridFitMode:
42
+ :detail:
43
+ :pre:
44
+ :programlisting:
45
+ - :pattern: !ruby/regexp /.*/
46
+ :replace: |
47
+
48
+ ```ruby
49
+ grid.set_default_cell_fit_mode(Wx::GRID::GridFitMode.clip)
50
+ ```
@@ -0,0 +1,91 @@
1
+ ---
2
+ :wxHeaderCtrl.Create:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ Wx::HD_DEFAULT_STYLE & ~Wx::HD_ALLOW_REORDER
11
+ ```
12
+ :wxHeaderCtrl.AddColumnsItems:
13
+ :detail:
14
+ :pre:
15
+ :programlisting:
16
+ - :pattern: !ruby/regexp /.*/
17
+ :replace: |
18
+
19
+ ```ruby
20
+ menu = Wx::Menu.new
21
+ menu.append(100, 'Some custom command')
22
+ menu.append_separator
23
+ add_columns_items(menu, 200)
24
+ rc = get_popup_menu_selection_from_user(menu, pt)
25
+ if rc >= 200
26
+ # ... toggle visibility of the column rc-200 ...
27
+ end
28
+ ```
29
+ :wxHeaderCtrl.UpdateColumnWidthToFit:
30
+ :detail:
31
+ :pre:
32
+ :programlisting:
33
+ - :pattern: !ruby/regexp /.*/
34
+ :replace: |
35
+
36
+ ```ruby
37
+ class MyHeaderColumn < Wx::HeaderColumn
38
+ # ...
39
+
40
+ def set_width(width)
41
+ @width = width
42
+ end
43
+
44
+ def get_width
45
+ @width
46
+ end
47
+
48
+ end
49
+
50
+ class MyHeaderCtrl < Wx::HeaderCtrl
51
+ # ...
52
+
53
+ protected
54
+
55
+ def get_column(idx)
56
+ # @cols = Array<MyHeaderColumn>
57
+ @cols[idx]
58
+ end
59
+
60
+ def update_column_width_to_fit(idx, widthTitle)
61
+ widthContents = # ... compute minimal width for column idx ...
62
+ @cols[idx].set_width([widthContents, widthTitle].max)
63
+ true
64
+ end
65
+
66
+ end
67
+ ```
68
+ :wxHeaderCtrlSimple.HideColumn:
69
+ :detail:
70
+ :pre:
71
+ :programlisting:
72
+ - :pattern: !ruby/regexp /.*/
73
+ :replace: |
74
+
75
+ ```ruby
76
+ show_column(idx, false)
77
+ ```
78
+ :wxHeaderColumnSimple:
79
+ :detail:
80
+ :pre:
81
+ :programlisting:
82
+ - :pattern: !ruby/regexp /.*/
83
+ :replace: |
84
+
85
+ ```ruby
86
+ header = Wx::HeaderCtrlSimple.new(...)
87
+ col = Wx::HeaderColumnSimple.new('Title')
88
+ col.set_width(100)
89
+ col.set_sortable(100)
90
+ header.append_column(col)
91
+ ```
@@ -9,3 +9,13 @@
9
9
  ```ruby
10
10
  get_icon(Wx::Size.new(size,size))
11
11
  ```
12
+ :wxIconBundle.GetIcon:
13
+ :detail:
14
+ :pre:
15
+ :programlisting:
16
+ - :pattern: !ruby/regexp /.*/
17
+ :replace: |
18
+
19
+ ```ruby
20
+ get_icon(Wx::Size.new(size,size))
21
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ :wxInfoBar:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ class MyFrame < Wx::Frame
11
+
12
+ def initialize()
13
+ # ...
14
+ @infoBar = Wx::InfoBar.new(self)
15
+
16
+ sizer = Wx::VBoxSizer.new
17
+ sizer.add(@infoBar, Wx::SizerFlags.new.expand)
18
+ # ... add other frame controls to the sizer ...
19
+ set_sizer(sizer)
20
+ end
21
+
22
+ def some_method
23
+ @infoBar.show_message('Something happened', Wx::ICON_INFORMATION)
24
+ end
25
+
26
+ end
27
+ ```
@@ -7,7 +7,7 @@
7
7
  :replace: |
8
8
 
9
9
  ```ruby
10
- wxLog.set_component_level("wx/net", Wx::LOG_Error)
10
+ Wx::Log.set_component_level('wx/net', Wx::LOG_Error)
11
11
  ```
12
12
  :wxLog.LogRecord:
13
13
  :detail:
@@ -0,0 +1,27 @@
1
+ ---
2
+ :wxMediaCtrl:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ class MyFrame < Wx::Frame
11
+
12
+ def initialize()
13
+ # ... setup frame controls ...
14
+ # bind events
15
+ # ...
16
+ evt_media_stop MY_ID, :on_media_stop
17
+ end
18
+
19
+ def on_media_stop(evt)
20
+ if @userWantsToSeek
21
+ @mediactrl.seek(@mediactrl.length - 1)
22
+ evt.veto
23
+ end
24
+ end
25
+
26
+ end
27
+ ```
@@ -0,0 +1,22 @@
1
+ ---
2
+ :wxPersistentComboBox:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ # Suppose you need to ask the user to select their favourite Linux
11
+ # distribution, for some reason:
12
+ combo = Wx::ComboBox.new(self, Wx::ID_ANY)
13
+ unless Wx.persistent_register_and_restore(combo, 'distribution')
14
+ # Seed it with some default contents.
15
+ combo.append("Debian")
16
+ combo.append("Fedora")
17
+ combo.append("Ubuntu")
18
+ end
19
+
20
+ # Optionally, you might want to restore the last used entry:
21
+ combo.set_selection(0)
22
+ ```
@@ -6,6 +6,6 @@
6
6
  - :pattern: !ruby/regexp /.*/
7
7
  :replace: |
8
8
 
9
- ```
9
+ ```ruby
10
10
  editor = Wx::PG::PropertyGrid.register_editor_class(MyEditorClass.new)
11
11
  ```
@@ -138,7 +138,7 @@
138
138
  - :pattern: !ruby/regexp /class.*MyProperty.*:.*public.*wxPGProperty/
139
139
  :replace: |
140
140
 
141
- ``` ruby
141
+ ```ruby
142
142
  class MyProperty < Wx::PG::PGProperty
143
143
 
144
144
  # All arguments of this ctor must have a default value -
@@ -171,10 +171,10 @@
171
171
  end
172
172
  ```
173
173
  :post:
174
- - :pattern: !ruby/regexp /==\swxIntProperty.*==\swxUIntProperty/m
174
+ - :pattern: !ruby/regexp /\#\#\swxIntProperty.*\#\#\swxUIntProperty/m
175
175
  :subst: |
176
176
 
177
- == wxIntProperty
177
+ ## Wx::PG::IntProperty
178
178
 
179
179
  It derives from {Wx::PG::NumericProperty} and displays value as a signed long integer.
180
180
  Supported special attributes:
@@ -182,7 +182,7 @@
182
182
  - {Wx::PG::PG_ATTR_MIN}, {Wx::PG::PG_ATTR_MAX} to specify acceptable value range.
183
183
  - {Wx::PG::PG_ATTR_SPINCTRL_STEP}, {Wx::PG::PG_ATTR_SPINCTRL_WRAP}, {Wx::PG::PG_ATTR_SPINCTRL_MOTION}: Sets SpinCtrl editor parameters.
184
184
 
185
- == wxUIntProperty
185
+ ## Wx::PG::UIntProperty
186
186
 
187
187
  - :pattern: !ruby/regexp /Since\s\{Wx::PG::PGProperty\}\sderives.*For\sinstance:/m
188
188
  :subst: ''
@@ -0,0 +1,14 @@
1
+ ---
2
+ :wxRearrangeList:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ order = [
11
+ 0, # checked item #0
12
+ ~1 # unchecked item #1
13
+ ]
14
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ :wxRibbonPanel:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ panel = @ribbon.get_page(0).get_panel_by_id(ID_EDITOR_PANEL)
11
+ panel.show(!panel.is_shown) if panel
12
+ # Update the UI
13
+ @ribbon.realise
14
+ @ribbon.layout
15
+ ```
@@ -0,0 +1,26 @@
1
+ ---
2
+ :wxRichTextFormattingDialog:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ range = if @richTextCtrl.has_selection
11
+ @richTextCtrl.get_selection_range
12
+ else
13
+ (0..@richTextCtrl.get_last_position+1)
14
+ end
15
+
16
+ pages = Wx::RTC::RICHTEXT_FORMAT_FONT|Wx::RTC::RICHTEXT_FORMAT_INDENTS_SPACING|
17
+ Wx::RTC::RICHTEXT_FORMAT_TABS|Wx::RTC::RICHTEXT_FORMAT_BULLETS
18
+
19
+ Wx::RTC.RichTextFormattingDialog(pages, self) do |formatDlg|
20
+ formatDlg.GetStyle(m_richTextCtrl, range);
21
+
22
+ if formatDlg.show_modal == Wx::ID_OK
23
+ formatDlg.apply_style(@richTextCtrl, range)
24
+ end
25
+ end
26
+ ```
@@ -15,5 +15,5 @@
15
15
  text.append_text("Blue on grey text\n")
16
16
  ```
17
17
  :post:
18
- - :pattern: !ruby/regexp /==\s+wxTextCtrl\s+and\s+C\+\+\s+Streams.*See\s+\{Wx::StreamToTextRedirector\}\s+for\s+more\s+details\./m
18
+ - :pattern: !ruby/regexp /\#\#\s+wxTextCtrl\s+and\s+C\+\+\s+Streams.*See\s+\{Wx::StreamToTextRedirector\}\s+for\s+more\s+details\./m
19
19
  :subst: ''
@@ -0,0 +1,27 @@
1
+ ---
2
+ :wxWizard:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ class MyFrame < Wx::Frame
11
+
12
+ # ...
13
+
14
+ def on_run_wizard(_event)
15
+ Wx.Wizard(self) do |wizard|
16
+
17
+ wizard.run_wizard(get_initial_page_from_some_where)
18
+
19
+ # The wizard is destroyed when the block ends.
20
+ end
21
+ end
22
+
23
+ end
24
+ ```
25
+ :post:
26
+ - :pattern: !ruby/regexp /Note\s+that\s+\{Wx::Wizard\}\s+inherits\s+from\s+\{Wx::Dialog\}.*typically\s+you\s+would\s+use\s+like\s+this:/
27
+ :subst: 'Note that {Wx::Wizard} inherits from {Wx::Dialog} so that typically you would use it like this:'
@@ -494,9 +494,10 @@ module WXRuby3
494
494
  when /The following event handler macros redirect.*(\{.*})/
495
495
  event_ref = $1
496
496
  "The following event-handler methods redirect the events to member method or handler blocks for #{event_ref} events."
497
- when /\AEVT_[A-Z]+/
498
- if event_list? && /\A(EVT_[_A-Z]+)\((.*,)\s+\w+\):(.*)/ =~ para
497
+ when /\AEVT_[_A-Z0-9]+/
498
+ if event_list? && /\A(EVT_[_A-Z0-9]+)\((.*,)\s+\w+\):(.*)/ =~ para
499
499
  evthnd_name = $1.downcase
500
+ docstr = $3.lstrip
500
501
  if override_spec = get_event_override(evthnd_name)
501
502
  evthnd_name, evt_type, evt_arity, evt_klass = override_spec
502
503
  idarg = case evt_arity
@@ -511,10 +512,9 @@ module WXRuby3
511
512
  else
512
513
  arglist = "#{$2} meth = nil, &block"
513
514
  end
514
- docstr = $3.lstrip
515
515
  package.event_docs[evthnd_name] = [arglist, docstr.dup] # register for eventlist doc gen
516
516
  "{Wx::EvtHandler\##{evthnd_name}}(#{arglist}): #{docstr}"
517
- elsif event_list? && /\A(EVT_[_A-Z]+)(\*)?\(\w+\):(.*)/ =~ para
517
+ elsif event_list? && /\A(EVT_[_A-Z0-9]+)(\*)?\(\w+\):(.*)/ =~ para
518
518
  wildcard = ($2 == '*')
519
519
  evthnd_name = $1.downcase
520
520
  arglist = "meth = nil, &block"
@@ -511,7 +511,7 @@ module WXRuby3
511
511
 
512
512
  def gen_interface_enum(fout, member, classdef)
513
513
  fout.puts " // from #{classdef.name}::#{member.name}"
514
- fout.puts " enum #{member.is_anonymous ? '' : member.name} {"
514
+ fout.puts " enum #{member.strong ? 'class ' : ''}#{member.is_anonymous ? '' : member.name} {"
515
515
  enum_size = member.items.size
516
516
  member.items.each_with_index do |e, i|
517
517
  fout.puts " #{e.name}#{(i+1)<enum_size ? ',' : ''}" unless e.ignored
@@ -234,6 +234,9 @@ module WXRuby3
234
234
  Director.Spec(pkg, 'wxPersistentObject', requirements: %w[USE_CONFIG])
235
235
  Director.Spec(pkg, 'wxPersistentWindow', requirements: %w[USE_CONFIG])
236
236
  Director.Spec(pkg, 'wxSecretStore', requirements: %w[USE_SECRETSTORE])
237
+ Director.Spec(pkg, 'wxDCOverlay', director: Director::DerivedDC)
238
+ Director.Spec(pkg, 'wxGeometry', requirements: %w[USE_GEOMETRY])
239
+ Director.Spec(pkg, 'wxAffineMatrix2D', requirements: %w[USE_GEOMETRY])
237
240
  }
238
241
 
239
242
  Director.Package('Wx::PRT', 'USE_PRINTING_ARCHITECTURE') do |pkg|
@@ -264,8 +264,13 @@ module WXRuby3
264
264
  when Extractor::EnumDef
265
265
  item.items.each { |e| enumerators["#{rb_wx_name(item.name)}_#{e.name}"] = item } if item.is_type
266
266
  when Extractor::ClassDef
267
- item.items.select { |itm| Extractor::EnumDef === itm }.each do |enum|
268
- enum.items.each { |e| enumerators[rb_wx_name(e.name)] = enum } if enum.is_type
267
+ item.items.select { |itm| Extractor::EnumDef === itm && itm.is_type }.each do |enum|
268
+ if enum.strong
269
+ enum_pfx = rb_wx_name(enum.name)
270
+ enum.items.each { |e| enumerators["#{enum_pfx}_#{rb_wx_name(e.name)}"] = enum }
271
+ else
272
+ enum.items.each { |e| enumerators[rb_wx_name(e.name)] = enum }
273
+ end
269
274
  end
270
275
  end
271
276
  end
@@ -295,9 +300,25 @@ module WXRuby3
295
300
  line.sub!(/\"Wx#{core_name}::wx#{$1}/, "\"#{package.fullname}::#{$1}")
296
301
  end
297
302
 
303
+ # check for default reference value initializations based on temporary objects
304
+ # (prevent dangling references)
305
+ if line =~ /^(\s+)(wx\w+)\s+const\s+\&(\w+_defvalue)\s+=\s+(.*);$/
306
+
307
+ def_pfx = $1
308
+ def_type = $2
309
+ def_var = $3
310
+ def_val = $4.strip
311
+ if def_type == 'wxString'
312
+ if def_val =~ /(wxString|_|wxGetTranslation)?\(?\"[^\"]*\"\)?/
313
+ line = "#{def_pfx}#{def_type} #{def_var} = #{def_val};"
314
+ end
315
+ elsif def_val =~ /^#{def_type}\(.*\)/
316
+ line = "#{def_pfx}#{def_type} #{def_var} = #{def_val};"
317
+ end
318
+
298
319
  # at the top of our Init_ function, make sure we only initialize
299
320
  # ourselves once
300
- if /void\s+Init_(wx|Wx)#{core_name}\(/ =~ line
321
+ elsif /void\s+Init_(wx|Wx)#{core_name}\(/ =~ line
301
322
  line += "\n static bool initialized;\n"
302
323
  line += " if(initialized) return;\n"
303
324
  line += " initialized = true;\n"
@@ -47,7 +47,8 @@ module WXRuby3
47
47
  }
48
48
  else
49
49
  {
50
- rb_raise(rb_eTypeError, "Wrong type for wxPoint parameter %i", i);
50
+ VALUE str = rb_inspect(rb_item);
51
+ rb_raise(rb_eTypeError, "Wrong type for wxPoint parameter %i (%s)", i, StringValuePtr(str));
51
52
  }
52
53
  }
53
54
  }
@@ -101,7 +102,12 @@ module WXRuby3
101
102
  // array of all the points
102
103
  VALUE all_points = rb_funcall($input, rb_intern("flatten"), 0);
103
104
  point_arr = std::make_unique<wxPoint[]>(RARRAY_LEN(all_points));
104
- wxRuby_PointArrayRubyToC(all_points, point_arr.get());
105
+ wxPoint* point_ptr = point_arr.get();
106
+ for ( int i = 0; i < RARRAY_LEN($input); i++ )
107
+ {
108
+ wxRuby_PointArrayRubyToC(rb_ary_entry($input, i), point_ptr);
109
+ point_ptr += count_arr[i];
110
+ }
105
111
  $3 = point_arr.get();
106
112
  }
107
113
  __CODE
@@ -23,6 +23,23 @@ module WXRuby3
23
23
  # ranges of text selections with a special class. It doesn't add
24
24
  # anything much that Ruby's own range class doesn't, so deal with using
25
25
  # typemaps
26
+ map 'const wxRichTextRange&' => 'Range' do
27
+
28
+ map_in temp: 'wxRichTextRange rng', code: <<~__CODE
29
+ int start = NUM2INT( rb_funcall( $input, rb_intern("begin"), 0));
30
+ int end = NUM2INT( rb_funcall( $input, rb_intern("end"), 0));
31
+ rng = wxRichTextRange(start, end);
32
+ $1 = &rng;
33
+ __CODE
34
+
35
+ map_typecheck precedence: 1, code: '$1 = ( CLASS_OF($input) == rb_cRange );'
36
+
37
+ map_out code: '$result = rb_range_new (LONG2NUM($1->GetStart()),LONG2NUM($1->GetEnd()),0);'
38
+
39
+ map_directorin code: '$input = rb_range_new (LONG2NUM($1.GetStart()),LONG2NUM($1.GetEnd()),0);'
40
+
41
+ end
42
+
26
43
  map 'wxRichTextRange&' => 'Range' do
27
44
 
28
45
  map_in temp: 'wxRichTextRange rng', code: <<~__CODE
@@ -4,16 +4,16 @@ def init
4
4
  # It seems YARD messes things up so that a lot of classes, modules and constants are not properly
5
5
  # registered in their enclosing namespaces.
6
6
  # This hack makes sure that if that is the case we fix that here.
7
- all_objects = Registry.all(:class, :constant, :module)
7
+ all_objects = Registry.all(:class, :constant, :module, :method)
8
8
  all_objects.each do |c|
9
9
  if (ns = c.namespace)
10
10
  unless ns.children.any? { |nsc| nsc.path == c.path }
11
- ns.children << c # class/module/constant missing from child list of enclosing namespace -> add here
11
+ ns.children << c # class/module/constant/method missing from child list of enclosing namespace -> add here
12
12
  end
13
13
  end
14
14
  if (ns = Registry[c.namespace.path])
15
15
  unless ns.children.any? { |nsc| nsc.path == c.path }
16
- ns.children << c # class/module/constant missing from child list of enclosing namespace -> add here
16
+ ns.children << c # class/module/constant/method missing from child list of enclosing namespace -> add here
17
17
  end
18
18
  end
19
19
  end
@@ -32,25 +32,26 @@ module Wizard
32
32
  evt_menu Wx::ID_EXIT, :on_quit
33
33
  evt_menu Wx::ID_ABOUT, :on_about
34
34
 
35
- w = Wx::Wizard.new(self, :title => 'The WxRuby Wizard')
36
- p1 = Wx::WizardPageSimple.new(w)
37
- s = Wx::StaticText.new(p1, :label => 'This is the first page')
38
-
39
- p2 = Wx::WizardPageSimple.new(w, p1)
40
- p1.set_next(p2)
41
- s = Wx::StaticText.new(p2, :label => 'This is the second page')
42
-
43
- p3 = Wx::WizardPageSimple.new(w, p2)
44
- p2.set_next(p3)
45
- s = Wx::StaticText.new(p3, :label => 'This is the final page')
46
-
47
- evt_wizard_page_changed(w) { p "page changed" }
48
- evt_wizard_page_changing(w) { p "page changing" }
49
- evt_wizard_help(w) { p "wizard help" }
50
- evt_wizard_cancel(w) { p "wizard cancelled" }
51
- evt_wizard_finished(w) { p "wizard finished" }
52
-
53
- w.run_wizard(p1)
35
+ Wx.Wizard(self, :title => 'The WxRuby Wizard') do |w|
36
+ p1 = Wx::WizardPageSimple.new(w)
37
+ s = Wx::StaticText.new(p1, :label => 'This is the first page')
38
+
39
+ p2 = Wx::WizardPageSimple.new(w, p1)
40
+ p1.set_next(p2)
41
+ s = Wx::StaticText.new(p2, :label => 'This is the second page')
42
+
43
+ p3 = Wx::WizardPageSimple.new(w, p2)
44
+ p2.set_next(p3)
45
+ s = Wx::StaticText.new(p3, :label => 'This is the final page')
46
+
47
+ evt_wizard_page_changed(w) { p "page changed" }
48
+ evt_wizard_page_changing(w) { p "page changing" }
49
+ evt_wizard_help(w) { p "wizard help" }
50
+ evt_wizard_cancel(w) { p "wizard cancelled" }
51
+ evt_wizard_finished(w) { p "wizard finished" }
52
+
53
+ w.run_wizard(p1)
54
+ end
54
55
  end
55
56
 
56
57
  def on_quit
@@ -0,0 +1,42 @@
1
+ /* XPM */
2
+ static const char *const smile_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 4 1",
5
+ ". c Black",
6
+ "X c #FFFF00",
7
+ " c None",
8
+ "o c #C00000",
9
+ /* pixels */
10
+ " ",
11
+ " ..... ",
12
+ " ...XXXXX... ",
13
+ " ..XXXXXXXXXXX.. ",
14
+ " .XXXXXXXXXXXXXXX. ",
15
+ " ..XXXXXXXXXXXXXXXXX.. ",
16
+ " .XXXXXXXXXXXXXXXXXXXX. ",
17
+ " .XXXXXX.XXXXXXX.XXXXXX. ",
18
+ " .XXXXXX.X.XXXXX.X.XXXXXX. ",
19
+ " .XXXXX.XXX.XXX.XXX.XXXXXX. ",
20
+ " .XXXXX.XXXXXXXXXXXXX.XXXXX. ",
21
+ " .XXXXXXXX.XXXXXXX.XXXXXXXX. ",
22
+ " .XXXXXXXX.XXXXXXX.XXXXXXXX. ",
23
+ " .XXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
24
+ " .XXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
25
+ " .XXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
26
+ " .XXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
27
+ " .XXXXXXX.XXXXXXXXXXX.XXXXXXX. ",
28
+ " .XXXXXX...XXXXXXX...XXXXXX. ",
29
+ " .XXXXXX.oo..XXX..oo.XXXXXX. ",
30
+ " .XXXXXXX.ooo...ooo.XXXXXXX. ",
31
+ " .XXXXXXX.ooooooo.XXXXXXXX. ",
32
+ " .XXXXXXXX..ooo..XXXXXXXX. ",
33
+ " .XXXXXXXXX...XXXXXXXXX. ",
34
+ " .XXXXXXXXXXXXXXXXXXXX. ",
35
+ " ..XXXXXXXXXXXXXXXXX.. ",
36
+ " .XXXXXXXXXXXXXXX. ",
37
+ " ..XXXXXXXXXXX.. ",
38
+ " ...XXXXX... ",
39
+ " ..... ",
40
+ " ",
41
+ " "
42
+ };