wxruby3 0.9.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +183 -42
  3. data/README.md +40 -48
  4. data/ext/mkrf_conf_ext.rb +72 -0
  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/core/secret_store.rb +38 -0
  15. data/lib/wx/doc/app.rb +97 -41
  16. data/lib/wx/doc/bitmap.rb +4 -0
  17. data/lib/wx/doc/client_dc.rb +2 -2
  18. data/lib/wx/doc/clipboard.rb +1 -1
  19. data/lib/wx/doc/colour.rb +12 -0
  20. data/lib/wx/doc/const.rb +16 -0
  21. data/lib/wx/doc/cursor.rb +4 -0
  22. data/lib/wx/doc/dc_overlay.rb +34 -0
  23. data/lib/wx/doc/enum.rb +7 -1
  24. data/lib/wx/doc/event_blocker.rb +1 -1
  25. data/lib/wx/doc/evthandler.rb +25 -3
  26. data/lib/wx/doc/functions.rb +3 -6
  27. data/lib/wx/doc/gc_dc.rb +13 -4
  28. data/lib/wx/doc/geometry.rb +136 -0
  29. data/lib/wx/doc/graphics_context.rb +25 -7
  30. data/lib/wx/doc/icon.rb +4 -0
  31. data/lib/wx/doc/image.rb +56 -0
  32. data/lib/wx/doc/list_ctrl.rb +6 -6
  33. data/lib/wx/doc/memory_dc.rb +2 -11
  34. data/lib/wx/doc/mirror_dc.rb +1 -1
  35. data/lib/wx/doc/pen.rb +26 -0
  36. data/lib/wx/doc/persistence_manager.rb +1 -1
  37. data/lib/wx/doc/persistent_object.rb +1 -1
  38. data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
  39. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  40. data/lib/wx/doc/region_iterator.rb +1 -1
  41. data/lib/wx/doc/scaled_dc.rb +1 -1
  42. data/lib/wx/doc/screen_dc.rb +1 -1
  43. data/lib/wx/doc/secret_store.rb +55 -0
  44. data/lib/wx/doc/svg_file_dc.rb +1 -1
  45. data/lib/wx/doc/textctrl.rb +1 -1
  46. data/lib/wx/doc/tree_ctrl.rb +2 -2
  47. data/lib/wx/doc/validator.rb +6 -6
  48. data/lib/wx/doc/variant.rb +2 -2
  49. data/lib/wx/doc/window.rb +5 -4
  50. data/lib/wx/grid/keyword_defs.rb +1 -1
  51. data/lib/wx/html/keyword_defs.rb +3 -3
  52. data/lib/wx/keyword_defs.rb +76 -71
  53. data/lib/wx/pg/keyword_defs.rb +2 -2
  54. data/lib/wx/pg/pg_property.rb +12 -0
  55. data/lib/wx/rbn/keyword_defs.rb +1 -1
  56. data/lib/wx/rtc/keyword_defs.rb +1 -1
  57. data/lib/wx/stc/keyword_defs.rb +1 -1
  58. data/lib/wx/version.rb +1 -1
  59. data/lib/wx/wxruby/base.rb +3 -5
  60. data/lib/wx/wxruby/cmd/check.rb +182 -0
  61. data/lib/wx/wxruby/cmd/sampler.rb +1 -1
  62. data/lib/wx/wxruby/cmd/setup.rb +9 -3
  63. data/lib/wx/wxruby/cmd/test.rb +1 -1
  64. data/rakelib/configure.rb +67 -52
  65. data/rakelib/gem.rake +97 -66
  66. data/rakelib/gem.rb +294 -41
  67. data/rakelib/install.rb +3 -3
  68. data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
  69. data/rakelib/lib/config/linux.rb +4 -2
  70. data/rakelib/lib/config/macosx.rb +42 -11
  71. data/rakelib/lib/config/mingw.rb +2 -2
  72. data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
  73. data/rakelib/lib/config/pkgman/macosx.rb +17 -78
  74. data/rakelib/lib/config/unixish.rb +17 -8
  75. data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
  76. data/rakelib/lib/config.rb +74 -33
  77. data/rakelib/lib/core/include/enum.inc +31 -1
  78. data/rakelib/lib/director/affine_matrix.rb +51 -0
  79. data/rakelib/lib/director/app.rb +29 -13
  80. data/rakelib/lib/director/art_provider.rb +4 -0
  81. data/rakelib/lib/director/aui_manager.rb +1 -1
  82. data/rakelib/lib/director/cursor.rb +6 -2
  83. data/rakelib/lib/director/dc.rb +1 -6
  84. data/rakelib/lib/director/derived_dc.rb +88 -31
  85. data/rakelib/lib/director/geometry.rb +142 -0
  86. data/rakelib/lib/director/graphics_context.rb +3 -2
  87. data/rakelib/lib/director/graphics_object.rb +18 -25
  88. data/rakelib/lib/director/grid_ctrl.rb +2 -2
  89. data/rakelib/lib/director/image.rb +59 -0
  90. data/rakelib/lib/director/menu.rb +2 -3
  91. data/rakelib/lib/director/menu_bar.rb +0 -3
  92. data/rakelib/lib/director/pen.rb +1 -1
  93. data/rakelib/lib/director/richtext_composite_object.rb +2 -4
  94. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  95. data/rakelib/lib/director/secret_store.rb +117 -0
  96. data/rakelib/lib/director/system_settings.rb +1 -1
  97. data/rakelib/lib/director/tree_event.rb +2 -2
  98. data/rakelib/lib/director/window.rb +4 -3
  99. data/rakelib/lib/extractor/function.rb +1 -1
  100. data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
  101. data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
  102. data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
  103. data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
  104. data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
  105. data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
  106. data/rakelib/lib/generate/doc/icon.yaml +10 -0
  107. data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
  108. data/rakelib/lib/generate/doc/log.yaml +1 -1
  109. data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
  110. data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
  111. data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
  112. data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
  113. data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
  114. data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
  115. data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
  116. data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
  117. data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
  118. data/rakelib/lib/generate/doc/wizard.yaml +27 -0
  119. data/rakelib/lib/generate/doc.rb +5 -5
  120. data/rakelib/lib/generate/interface.rb +1 -1
  121. data/rakelib/lib/specs/interfaces.rb +4 -0
  122. data/rakelib/lib/swig_runner.rb +24 -3
  123. data/rakelib/lib/typemap/common.rb +10 -0
  124. data/rakelib/lib/typemap/points_list.rb +8 -2
  125. data/rakelib/lib/typemap/richtext.rb +17 -0
  126. data/rakelib/prepost.rake +8 -1
  127. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
  128. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
  129. data/samples/dialogs/wizard.rb +20 -19
  130. data/samples/drawing/art/drawing/image.bmp +0 -0
  131. data/samples/drawing/art/drawing/mask.bmp +0 -0
  132. data/samples/drawing/art/drawing/pat35.bmp +0 -0
  133. data/samples/drawing/art/drawing/pat36.bmp +0 -0
  134. data/samples/drawing/art/drawing/pat4.bmp +0 -0
  135. data/samples/drawing/art/drawing/smile.xpm +42 -0
  136. data/samples/drawing/drawing.rb +2276 -0
  137. data/samples/drawing/tn_drawing.png +0 -0
  138. data/samples/html/html.rb +1 -1
  139. data/samples/propgrid/propgrid.rb +1 -1
  140. data/samples/propgrid/propgrid_minimal.rb +1 -1
  141. data/samples/propgrid/sample_props.rb +1 -1
  142. data/samples/sampler/editor.rb +13 -11
  143. data/samples/sampler/sample.rb +2 -0
  144. data/samples/sampler.rb +14 -10
  145. data/samples/text/richtext.rb +53 -0
  146. data/samples/text/scintilla.rb +1 -1
  147. data/samples/text/unicode.rb +4 -4
  148. data/tests/lib/wxapp_runner.rb +1 -1
  149. data/tests/test_config.rb +7 -4
  150. data/tests/test_ext_controls.rb +12 -5
  151. data/tests/test_secret_store.rb +83 -0
  152. data/tests/test_std_controls.rb +12 -12
  153. metadata +66 -47
  154. data/lib/wx/doc/extra/00_starting.md +0 -154
  155. data/lib/wx/doc/extra/01_packages.md +0 -180
  156. data/lib/wx/doc/extra/02_lifecycles.md +0 -166
  157. data/lib/wx/doc/extra/03_dialogs.md +0 -57
  158. data/lib/wx/doc/extra/04_enums.md +0 -143
  159. data/lib/wx/doc/extra/05_event-handling.md +0 -191
  160. data/lib/wx/doc/extra/06_geometry.md +0 -62
  161. data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
  162. data/lib/wx/doc/extra/08_extensions.md +0 -144
  163. data/lib/wx/doc/extra/09_exceptions.md +0 -54
  164. data/lib/wx/doc/extra/10_art.md +0 -111
  165. data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
  166. data/lib/wx/doc/extra/12_client_data.md +0 -89
  167. data/lib/wx/doc/extra/13_validators.md +0 -139
  168. data/lib/wx/doc/extra/14_config.md +0 -101
  169. data/lib/wx/doc/extra/15_persistence.md +0 -148
  170. data/rakefile +0 -14
  171. data/rakelib/lib/config/pkgman/arch.rb +0 -53
  172. data/rakelib/lib/config/pkgman/debian.rb +0 -66
  173. data/rakelib/lib/config/pkgman/rhel.rb +0 -54
  174. data/rakelib/lib/config/pkgman/suse.rb +0 -54
  175. data/samples/sampler/back.xpm +0 -21
  176. data/samples/sampler/copy.xpm +0 -44
  177. data/samples/sampler/cut.xpm +0 -46
  178. data/samples/sampler/filesave.xpm +0 -42
  179. data/samples/sampler/find.xpm +0 -62
  180. data/samples/sampler/findrepl.xpm +0 -63
  181. data/samples/sampler/forward.xpm +0 -21
  182. data/samples/sampler/paste.xpm +0 -46
  183. data/samples/sampler/redo.xpm +0 -58
  184. data/samples/sampler/undo.xpm +0 -58
@@ -0,0 +1,117 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ module WXRuby3
10
+
11
+ class Director
12
+
13
+ class SecretStore < Director
14
+
15
+ def setup
16
+ super
17
+ spec.items << 'wxSecretValue'
18
+ spec.gc_as_untracked # don't even track SecretStore and SecretValue objects
19
+ # there is no possibility of SecretStore derivatives
20
+ # not least because wxRuby only ever allows a single global SecretStore
21
+ spec.disable_proxies
22
+ spec.make_abstract 'wxSecretStore'
23
+
24
+ spec.include 'ruby/encoding.h'
25
+
26
+ spec.ignore 'wxSecretValue::GetAsString',
27
+ 'wxSecretValue::GetSize',
28
+ 'wxSecretValue::GetData',
29
+ 'wxSecretValue::Wipe',
30
+ 'wxSecretValue::WipeString',
31
+ 'wxSecretValue::wxSecretValue(const wxString&)',
32
+ 'wxSecretValue::wxSecretValue(size_t, const void *)'
33
+ spec.regard 'wxSecretValue::wxSecretValue()',
34
+ 'wxSecretValue::wxSecretValue(const wxSecretValue&)',
35
+ regard_doc: false
36
+ # customize string arg ctor
37
+ spec.add_extend_code 'wxSecretValue', <<~__HEREDOC
38
+ wxSecretValue(VALUE secret_string)
39
+ {
40
+ if (RTEST(secret_string) && TYPE(secret_string) == T_STRING)
41
+ {
42
+ if (ENCODING_GET(secret_string) == rb_utf8_encindex())
43
+ {
44
+ return new wxSecretValue(RSTR_TO_WXSTR(secret_string));
45
+ }
46
+ else
47
+ {
48
+ return new wxSecretValue(RSTRING_LEN(secret_string), (void*)StringValuePtr(secret_string));
49
+ }
50
+ }
51
+ else
52
+ {
53
+ rb_raise(rb_eArgError, "Expected String or Wx::SecretValue for #0");
54
+ }
55
+ }
56
+ __HEREDOC
57
+
58
+ # customize GetData
59
+ spec.map 'const void*' => 'String', swig: false do
60
+ map_out code: ''
61
+ end
62
+ spec.add_extend_code 'wxSecretValue', <<~__HEREDOC
63
+ VALUE get_data()
64
+ {
65
+ size_t sz = $self->GetSize();
66
+ const void* data = $self->GetData();
67
+ return rb_enc_str_new(static_cast<const char*>(data), sz, rb_ascii8bit_encoding());
68
+ }
69
+
70
+ VALUE get_as_string()
71
+ {
72
+ size_t sz = $self->GetSize();
73
+ const void* data = $self->GetData();
74
+ return rb_utf8_str_new(static_cast<const char*>(data), sz);
75
+ }
76
+ __HEREDOC
77
+
78
+ # customize GetDefault
79
+ spec.ignore 'wxSecretStore::GetDefault', ignore_doc: false
80
+ spec.add_extend_code 'wxSecretStore', <<~__HEREDOC
81
+ static VALUE get_default()
82
+ {
83
+ wxSecretStore* result = new wxSecretStore(wxSecretStore::GetDefault());
84
+ return SWIG_NewPointerObj(result, SWIGTYPE_p_wxSecretStore, SWIG_POINTER_OWN);
85
+ }
86
+ __HEREDOC
87
+ spec.map 'wxString *errmsg' => 'String' do
88
+ map_in ignore: true, temp: 'wxString tmp', code: '$1 = &tmp;'
89
+ map_argout code: <<~__CODE
90
+ if ($result == Qfalse)
91
+ {
92
+ $result = SWIG_Ruby_AppendOutput($result, WXSTR_TO_RSTR(tmp$argnum));
93
+ }
94
+ __CODE
95
+ end
96
+ spec.map 'wxString& username' => 'String' do
97
+ map_in ignore: true, temp: 'wxString tmp', code: '$1 = &tmp;'
98
+ map_argout code: <<~__CODE
99
+ if ($result == Qtrue)
100
+ {
101
+ $result = SWIG_Ruby_AppendOutput($result, WXSTR_TO_RSTR(tmp$argnum));
102
+ }
103
+ __CODE
104
+ end
105
+ # the type matching of the username argument is tricky here since there only is the const difference
106
+ # have to explicitly overrule here for Save() incl. explicitly negating the argout mapping
107
+ spec.map 'const wxString& username' => 'String' do
108
+ map_in temp: 'wxString tmp', code: 'tmp = RSTR_TO_WXSTR($input); $1 = &tmp;'
109
+ map_argout by_ref: true
110
+ end
111
+ end
112
+
113
+ end # class SecretStore
114
+
115
+ end # class Director
116
+
117
+ end # module WXRuby3
@@ -22,7 +22,7 @@ module WXRuby3
22
22
  'wxSystemSettings::HasFeature',
23
23
  'wxSystemSettings::GetScreenType'
24
24
  spec.ignore 'wxSystemSettings::GetAppearance'
25
- spec.add_extend_code <<~__HEREDOC
25
+ spec.add_extend_code 'wxSystemSettings', <<~__HEREDOC
26
26
  static wxString GetAppearanceName()
27
27
  {
28
28
  return wxSystemSettings::GetAppearance().GetName();
@@ -55,9 +55,9 @@ module WXRuby3
55
55
  static const rb_data_type_t __wxTreeItemId_type = {
56
56
  "TreeItemId",
57
57
  #if RUBY_API_VERSION_MAJOR >= 3
58
- { NULL, NULL, __wxTreeItemId_size, 0, 0},
58
+ { NULL, NULL, __wxTreeItemId_size, 0, {}},
59
59
  #else
60
- { NULL, NULL, __wxTreeItemId_size, 0},
60
+ { NULL, NULL, __wxTreeItemId_size, {}},
61
61
  #endif
62
62
  NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
63
63
  };
@@ -150,13 +150,14 @@ module WXRuby3
150
150
  static VALUE do_paint_buffered(wxWindow* ptr)
151
151
  {
152
152
  VALUE rc = Qnil;
153
- wxAutoBufferedPaintDC dc(ptr);
154
153
  #if wxALWAYS_NATIVE_DOUBLE_BUFFER
154
+ wxPaintDC dc(ptr);
155
155
  wxPaintDC* ptr_dc = &dc;
156
156
  VALUE r_class = rb_const_get(mWxCore, rb_intern("PaintDC"));
157
157
  #else
158
- wxMemoryDC* ptr_dc = &dc;
159
- VALUE r_class = rb_const_get(mWxCore, rb_intern("MemoryDC"));
158
+ wxBufferedPaintDC dc(ptr);
159
+ wxBufferedPaintDC* ptr_dc = &dc;
160
+ VALUE r_class = rb_const_get(mWxCore, rb_intern("BufferedPaintDC"));
160
161
  #endif
161
162
  swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
162
163
  VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ptr_dc), swig_type, 0);
@@ -293,7 +293,7 @@ module WXRuby3
293
293
  @is_static = element['static'] == 'yes'
294
294
  @is_virtual = %w[virtual pure-virtual].include?(element['virt'])
295
295
  @is_pure_virtual = (element['virt'] == 'pure-virtual')
296
- @args_string.sub!(/\s*=0/, '') if @is_pure_virtual
296
+ @args_string.sub!(/\)(\s*const)?\s*=0/, ')\1') if @is_pure_virtual
297
297
  @is_override = !!element.at_xpath('reimplements')
298
298
  @is_const = (element['const'] == 'yes')
299
299
  @is_ctor = (@name == @class_name)
@@ -13,3 +13,13 @@
13
13
  animations.add("throbber_2x.gif")
14
14
  animationCtrl.play if animationCtrl.set_animation(animations)
15
15
  ```
16
+ :wxAnimationCtrl.SetAnimation:
17
+ :detail:
18
+ :pre:
19
+ :programlisting:
20
+ - :pattern: !ruby/regexp /.*/
21
+ :replace: |
22
+
23
+ ```ruby
24
+ animationCtrl.set_animation(Wx::AnimationBundle.new('progress.gif'))
25
+ ```
@@ -0,0 +1,35 @@
1
+ ---
2
+ :wxBannerWindow:
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
+ # ... create the frame itself ...
15
+
16
+ # Create and initialize the banner.
17
+ banner = Wx::BannerWindow.new(self, Wx::TOP)
18
+ banner.set_text("Welcome to my wonderful program",
19
+ " Before doing anything else, you need to connect to the online server.\n" +
20
+ " Please enter your credentials in the controls below.")
21
+
22
+ # And position it along the top edge of the window.
23
+ sizer = Wx::VBoxSizer.new
24
+ sizer.add(banner, Wx::SizerFlags.new.expand)
25
+
26
+ # ... add the rest of the window contents to the same sizer ...
27
+
28
+ set_sizer_and_fit(sizer)
29
+
30
+ end
31
+
32
+ # ...
33
+
34
+ end
35
+ ```
@@ -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
+ ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ :wxSecretStore:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /\!store\..*Save.*username.*password\)/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ store = Wx::SecretStore.get_default
11
+ rc, err = store.ok?
12
+ if rc
13
+ unless store.save('MyApp/MyService', username, password)
14
+ Wx.log_warning('Failed to save credentials to the system secret store.')
15
+ end
16
+ else
17
+ Wx.log_warning("This system doesn't support storing passwords securely (#{err}).")
18
+ end
19
+ ```
20
+ - :pattern: !ruby/regexp /store\..*Load.*username.*password\)/
21
+ :replace: |
22
+
23
+ ```ruby
24
+ store = Wx::SecretStore.get_default
25
+ rc, _ = store.ok?
26
+ if rc
27
+ password = Wx::SecretValue.new
28
+ rc, username = store.load('MyApp/MyService', password)
29
+ if rc
30
+ # ... use the password ...
31
+ end
32
+ end
33
+ ```
34
+ :wxSecretStore.IsOk:
35
+ :brief:
36
+ :replace:
37
+ :text: |
38
+ Check if this object can actually be used.
39
+ Returns true if the object can be used.
40
+ Returns false and an error message describing the reason if not.
41
+
42
+ :wxSecretStore.Load:
43
+ :detail:
44
+ :post:
45
+ - :pattern: !ruby/regexp /Otherwise\s+the\s+function.*arguments\./
46
+ :subst: |
47
+ Otherwise the function returns true and the username and updates the provided password argument.
48
+
49
+ :wxSecretValue:
50
+ :detail:
51
+ :post:
52
+ - :pattern: !ruby/regexp /\s+\Z/
53
+ :subst: |
54
+
55
+ @note Due to a bug using binary secrets will not work for WXGTK wxWidgets<=3.2.4 (WXOSX and WXMSW work fine). This has been fixed for later versions.
@@ -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:'