wxruby3 0.9.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +183 -42
- data/README.md +40 -48
- data/ext/mkrf_conf_ext.rb +72 -0
- data/lib/wx/core/app.rb +16 -0
- data/lib/wx/core/colour.rb +36 -28
- data/lib/wx/core/const.rb +19 -0
- data/lib/wx/core/enum.rb +17 -1
- data/lib/wx/core/geometry.rb +121 -0
- data/lib/wx/core/graphics_pen_info.rb +18 -0
- data/lib/wx/core/image.rb +49 -0
- data/lib/wx/core/menu_bar.rb +11 -0
- data/lib/wx/core/paintdc.rb +9 -3
- data/lib/wx/core/secret_store.rb +38 -0
- data/lib/wx/doc/app.rb +97 -41
- data/lib/wx/doc/bitmap.rb +4 -0
- data/lib/wx/doc/client_dc.rb +2 -2
- data/lib/wx/doc/clipboard.rb +1 -1
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/const.rb +16 -0
- data/lib/wx/doc/cursor.rb +4 -0
- data/lib/wx/doc/dc_overlay.rb +34 -0
- data/lib/wx/doc/enum.rb +7 -1
- data/lib/wx/doc/event_blocker.rb +1 -1
- data/lib/wx/doc/evthandler.rb +25 -3
- data/lib/wx/doc/functions.rb +3 -6
- data/lib/wx/doc/gc_dc.rb +13 -4
- data/lib/wx/doc/geometry.rb +136 -0
- data/lib/wx/doc/graphics_context.rb +25 -7
- data/lib/wx/doc/icon.rb +4 -0
- data/lib/wx/doc/image.rb +56 -0
- data/lib/wx/doc/list_ctrl.rb +6 -6
- data/lib/wx/doc/memory_dc.rb +2 -11
- data/lib/wx/doc/mirror_dc.rb +1 -1
- data/lib/wx/doc/pen.rb +26 -0
- data/lib/wx/doc/persistence_manager.rb +1 -1
- data/lib/wx/doc/persistent_object.rb +1 -1
- data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/region_iterator.rb +1 -1
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/screen_dc.rb +1 -1
- data/lib/wx/doc/secret_store.rb +55 -0
- data/lib/wx/doc/svg_file_dc.rb +1 -1
- data/lib/wx/doc/textctrl.rb +1 -1
- data/lib/wx/doc/tree_ctrl.rb +2 -2
- data/lib/wx/doc/validator.rb +6 -6
- data/lib/wx/doc/variant.rb +2 -2
- data/lib/wx/doc/window.rb +5 -4
- data/lib/wx/grid/keyword_defs.rb +1 -1
- data/lib/wx/html/keyword_defs.rb +3 -3
- data/lib/wx/keyword_defs.rb +76 -71
- data/lib/wx/pg/keyword_defs.rb +2 -2
- data/lib/wx/pg/pg_property.rb +12 -0
- data/lib/wx/rbn/keyword_defs.rb +1 -1
- data/lib/wx/rtc/keyword_defs.rb +1 -1
- data/lib/wx/stc/keyword_defs.rb +1 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/base.rb +3 -5
- data/lib/wx/wxruby/cmd/check.rb +182 -0
- data/lib/wx/wxruby/cmd/sampler.rb +1 -1
- data/lib/wx/wxruby/cmd/setup.rb +9 -3
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/rakelib/configure.rb +67 -52
- data/rakelib/gem.rake +97 -66
- data/rakelib/gem.rb +294 -41
- data/rakelib/install.rb +3 -3
- data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
- data/rakelib/lib/config/linux.rb +4 -2
- data/rakelib/lib/config/macosx.rb +42 -11
- data/rakelib/lib/config/mingw.rb +2 -2
- data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
- data/rakelib/lib/config/pkgman/macosx.rb +17 -78
- data/rakelib/lib/config/unixish.rb +17 -8
- data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
- data/rakelib/lib/config.rb +74 -33
- data/rakelib/lib/core/include/enum.inc +31 -1
- data/rakelib/lib/director/affine_matrix.rb +51 -0
- data/rakelib/lib/director/app.rb +29 -13
- data/rakelib/lib/director/art_provider.rb +4 -0
- data/rakelib/lib/director/aui_manager.rb +1 -1
- data/rakelib/lib/director/cursor.rb +6 -2
- data/rakelib/lib/director/dc.rb +1 -6
- data/rakelib/lib/director/derived_dc.rb +88 -31
- data/rakelib/lib/director/geometry.rb +142 -0
- data/rakelib/lib/director/graphics_context.rb +3 -2
- data/rakelib/lib/director/graphics_object.rb +18 -25
- data/rakelib/lib/director/grid_ctrl.rb +2 -2
- data/rakelib/lib/director/image.rb +59 -0
- data/rakelib/lib/director/menu.rb +2 -3
- data/rakelib/lib/director/menu_bar.rb +0 -3
- data/rakelib/lib/director/pen.rb +1 -1
- data/rakelib/lib/director/richtext_composite_object.rb +2 -4
- data/rakelib/lib/director/richtext_ctrl.rb +1 -1
- data/rakelib/lib/director/secret_store.rb +117 -0
- data/rakelib/lib/director/system_settings.rb +1 -1
- data/rakelib/lib/director/tree_event.rb +2 -2
- data/rakelib/lib/director/window.rb +4 -3
- data/rakelib/lib/extractor/function.rb +1 -1
- data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
- data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
- data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
- data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
- data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
- data/rakelib/lib/generate/doc/icon.yaml +10 -0
- data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
- data/rakelib/lib/generate/doc/log.yaml +1 -1
- data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
- data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
- data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
- data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
- data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
- data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
- data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
- data/rakelib/lib/generate/doc/wizard.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +5 -5
- data/rakelib/lib/generate/interface.rb +1 -1
- data/rakelib/lib/specs/interfaces.rb +4 -0
- data/rakelib/lib/swig_runner.rb +24 -3
- data/rakelib/lib/typemap/common.rb +10 -0
- data/rakelib/lib/typemap/points_list.rb +8 -2
- data/rakelib/lib/typemap/richtext.rb +17 -0
- data/rakelib/prepost.rake +8 -1
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
- data/samples/dialogs/wizard.rb +20 -19
- data/samples/drawing/art/drawing/image.bmp +0 -0
- data/samples/drawing/art/drawing/mask.bmp +0 -0
- data/samples/drawing/art/drawing/pat35.bmp +0 -0
- data/samples/drawing/art/drawing/pat36.bmp +0 -0
- data/samples/drawing/art/drawing/pat4.bmp +0 -0
- data/samples/drawing/art/drawing/smile.xpm +42 -0
- data/samples/drawing/drawing.rb +2276 -0
- data/samples/drawing/tn_drawing.png +0 -0
- data/samples/html/html.rb +1 -1
- data/samples/propgrid/propgrid.rb +1 -1
- data/samples/propgrid/propgrid_minimal.rb +1 -1
- data/samples/propgrid/sample_props.rb +1 -1
- data/samples/sampler/editor.rb +13 -11
- data/samples/sampler/sample.rb +2 -0
- data/samples/sampler.rb +14 -10
- data/samples/text/richtext.rb +53 -0
- data/samples/text/scintilla.rb +1 -1
- data/samples/text/unicode.rb +4 -4
- data/tests/lib/wxapp_runner.rb +1 -1
- data/tests/test_config.rb +7 -4
- data/tests/test_ext_controls.rb +12 -5
- data/tests/test_secret_store.rb +83 -0
- data/tests/test_std_controls.rb +12 -12
- metadata +66 -47
- data/lib/wx/doc/extra/00_starting.md +0 -154
- data/lib/wx/doc/extra/01_packages.md +0 -180
- data/lib/wx/doc/extra/02_lifecycles.md +0 -166
- data/lib/wx/doc/extra/03_dialogs.md +0 -57
- data/lib/wx/doc/extra/04_enums.md +0 -143
- data/lib/wx/doc/extra/05_event-handling.md +0 -191
- data/lib/wx/doc/extra/06_geometry.md +0 -62
- data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
- data/lib/wx/doc/extra/08_extensions.md +0 -144
- data/lib/wx/doc/extra/09_exceptions.md +0 -54
- data/lib/wx/doc/extra/10_art.md +0 -111
- data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
- data/lib/wx/doc/extra/12_client_data.md +0 -89
- data/lib/wx/doc/extra/13_validators.md +0 -139
- data/lib/wx/doc/extra/14_config.md +0 -101
- data/lib/wx/doc/extra/15_persistence.md +0 -148
- data/rakefile +0 -14
- data/rakelib/lib/config/pkgman/arch.rb +0 -53
- data/rakelib/lib/config/pkgman/debian.rb +0 -66
- data/rakelib/lib/config/pkgman/rhel.rb +0 -54
- data/rakelib/lib/config/pkgman/suse.rb +0 -54
- data/samples/sampler/back.xpm +0 -21
- data/samples/sampler/copy.xpm +0 -44
- data/samples/sampler/cut.xpm +0 -46
- data/samples/sampler/filesave.xpm +0 -42
- data/samples/sampler/find.xpm +0 -62
- data/samples/sampler/findrepl.xpm +0 -63
- data/samples/sampler/forward.xpm +0 -21
- data/samples/sampler/paste.xpm +0 -46
- data/samples/sampler/redo.xpm +0 -58
- data/samples/sampler/undo.xpm +0 -58
data/lib/wx/core/colour.rb
CHANGED
@@ -6,37 +6,45 @@
|
|
6
6
|
# Copyright 2004-2007, wxRuby development team
|
7
7
|
# released under the MIT-like wxRuby2 license
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
9
|
+
require_relative 'ext'
|
10
|
+
|
11
|
+
module Wx
|
12
|
+
|
13
|
+
Wx.add_delayed_constant(self, :TRANSPARENT_COLOUR, 'Wx::Colour.new(0, 0, 0, Wx::ALPHA_TRANSPARENT)') { Wx::Colour.new(0, 0, 0, Wx::ALPHA_TRANSPARENT) }
|
14
|
+
|
15
|
+
class Colour
|
16
|
+
# Redefine the initialize method so it raises an exception if an
|
17
|
+
# invalid colour value is given. This might be an unknown colour
|
18
|
+
# string (eg 'dark blue') or out-of-bounds integer values (<0 or >255)
|
19
|
+
wx_init = self.instance_method(:initialize)
|
20
|
+
define_method(:initialize) do | *args |
|
21
|
+
begin
|
22
|
+
wx_init.bind(self).call(*args)
|
23
|
+
# Invalid integer values raise SWIG 'no matching func'
|
24
|
+
rescue ArgumentError, TypeError
|
25
|
+
Kernel.raise ArgumentError, "Invalid colour values #{args.inspect}"
|
26
|
+
end
|
20
27
|
end
|
21
|
-
end
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
# Missing Standard colour
|
30
|
+
Wx::MAGENTA = new(255, 0, 255)
|
31
|
+
|
32
|
+
# Colours are equal to one another if they have the same red, green
|
33
|
+
# and blue intensity, and the same alpha
|
34
|
+
def ==(other)
|
35
|
+
case other
|
36
|
+
when Wx::Colour
|
37
|
+
[ self.red, self.green, self.blue, self.alpha ] ==
|
38
|
+
[ other.red, other.green, other.blue, other.alpha ]
|
39
|
+
else
|
40
|
+
false
|
41
|
+
end
|
35
42
|
end
|
36
|
-
end
|
37
43
|
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
# More informative output for inspect etc
|
45
|
+
def to_s
|
46
|
+
"#<Wx::Colour: (#{red}, #{green}, #{blue} *#{alpha})>"
|
47
|
+
end
|
41
48
|
end
|
49
|
+
|
42
50
|
end
|
data/lib/wx/core/const.rb
CHANGED
@@ -68,8 +68,14 @@ module Wx
|
|
68
68
|
TREE_LIST_CTRL_NAME_STR = 'wxTreeListCtrl'
|
69
69
|
HTML_LIST_BOX_NAME_STR = 'htmlListBox'
|
70
70
|
SIMPLE_HTML_LIST_BOX_NAME_STR = 'simpleHtmlListBox'
|
71
|
+
HTML_WINDOW_NAME_STR = 'htmlWindow'
|
71
72
|
EDITABLE_LIST_BOX_NAME_STR = 'editableListBox'
|
72
73
|
V_LIST_BOX_NAME_STR = 'wxVListBox'
|
74
|
+
ACTIVITY_INDICATOR_NAME_STR = 'activityindicator'
|
75
|
+
TIME_PICKER_CTRL_NAME_STR = 'timectrl'
|
76
|
+
DATE_PICKER_CTRL_NAME_STR = 'datectrl'
|
77
|
+
CALENDAR_NAME_STR = 'CalendarCtrl'
|
78
|
+
SPIN_BUTTON_NAME_STR = 'wxSpinButton'
|
73
79
|
|
74
80
|
if Wx::PLATFORM == 'WXMSW'
|
75
81
|
# wxMSW only
|
@@ -80,4 +86,17 @@ module Wx
|
|
80
86
|
PROPERTY_GRID_NAME_STR = 'wxPropertyGrid'
|
81
87
|
STC_NAME_STR = 'stcwindow'
|
82
88
|
|
89
|
+
# custom wxRuby addition
|
90
|
+
MEDIA_CTRL_NAME_STR = 'mediaCtrl'
|
91
|
+
SPIN_CTRL_NAME_STR = 'wxSpinCtrl'
|
92
|
+
SPIN_CTRL_DOUBLE_NAME_STR = 'wxSpinCtrlDouble'
|
93
|
+
SPLITTER_WINDOW_NAME_STR = 'splitter'
|
94
|
+
CHOICEBOOK_NAME_STR = 'choicebook'
|
95
|
+
LISTBOOK_NAME_STR = 'listbook'
|
96
|
+
TOOLBOOK_NAME_STR = 'toolbook'
|
97
|
+
TREEBOOK_NAME_STR = 'treebook'
|
98
|
+
SASH_WINDOW_NAME_STR = 'sashWindow'
|
99
|
+
SASH_LAYOUT_WINDOW_NAME_STR = 'layoutWindow'
|
100
|
+
SCROLLED_NAME_STR = 'SCROLLED_WINDOW'
|
101
|
+
|
83
102
|
end
|
data/lib/wx/core/enum.rb
CHANGED
@@ -48,8 +48,24 @@ class Wx::Enum
|
|
48
48
|
@value.hash
|
49
49
|
end
|
50
50
|
|
51
|
+
def bitmask_to_s
|
52
|
+
return '' if to_i == 0
|
53
|
+
enums = []
|
54
|
+
mask = to_i
|
55
|
+
self.class.values.each_value do |enum|
|
56
|
+
if enum != 0 && mask.allbits?(enum)
|
57
|
+
enums << enum.to_s
|
58
|
+
mask &= ~enum
|
59
|
+
break if mask == 0
|
60
|
+
end
|
61
|
+
end
|
62
|
+
enums << mask.to_s if mask != 0
|
63
|
+
enums.join('|')
|
64
|
+
end
|
65
|
+
private :bitmask_to_s
|
66
|
+
|
51
67
|
def to_s
|
52
|
-
to_i.
|
68
|
+
self.class.values.has_key?(to_i) ? "#{self.class.name}::#{self.class.names_by_value[self]}" : bitmask_to_s
|
53
69
|
end
|
54
70
|
|
55
71
|
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
module Wx
|
6
|
+
|
7
|
+
def self.deg_to_rad(deg)
|
8
|
+
(deg * Math::PI) / 180.0
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.rad_to_deg(rad)
|
12
|
+
(rad * 180.0) / Math::PI
|
13
|
+
end
|
14
|
+
|
15
|
+
class Point2DInt
|
16
|
+
|
17
|
+
alias :x :get_x
|
18
|
+
alias :x= :set_x
|
19
|
+
alias :y :get_y
|
20
|
+
alias :y= :set_y
|
21
|
+
|
22
|
+
# make wrappers private
|
23
|
+
private :add, :sub, :mul, :div
|
24
|
+
|
25
|
+
wx_assign = instance_method :assign
|
26
|
+
define_method :assign do |pt|
|
27
|
+
wx_assign.bind(self).call(pt)
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
def add!(pt)
|
32
|
+
add(pt)
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def sub!(pt)
|
37
|
+
sub(pt)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def mul!(v)
|
42
|
+
mul(v)
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def div!(v)
|
47
|
+
div(v)
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def +(pt)
|
52
|
+
Point2DInt.new(self).add!(pt)
|
53
|
+
end
|
54
|
+
|
55
|
+
def -(pt)
|
56
|
+
Point2DInt.new(self).sub!(pt)
|
57
|
+
end
|
58
|
+
|
59
|
+
def *(v)
|
60
|
+
Point2DInt.new(self).mul!(v)
|
61
|
+
end
|
62
|
+
|
63
|
+
def /(v)
|
64
|
+
Point2DInt.new(self).div!(v)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
class Point2DDouble
|
69
|
+
|
70
|
+
alias :x :get_x
|
71
|
+
alias :x= :set_x
|
72
|
+
alias :y :get_y
|
73
|
+
alias :y= :set_y
|
74
|
+
|
75
|
+
# make wrappers private
|
76
|
+
private :add, :sub, :mul, :div
|
77
|
+
|
78
|
+
wx_assign = instance_method :assign
|
79
|
+
define_method :assign do |pt|
|
80
|
+
wx_assign.bind(self).call(pt)
|
81
|
+
self
|
82
|
+
end
|
83
|
+
|
84
|
+
def add!(pt)
|
85
|
+
add(pt)
|
86
|
+
self
|
87
|
+
end
|
88
|
+
|
89
|
+
def sub!(pt)
|
90
|
+
sub(pt)
|
91
|
+
self
|
92
|
+
end
|
93
|
+
|
94
|
+
def mul!(v)
|
95
|
+
mul(v)
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
def div!(v)
|
100
|
+
div(v)
|
101
|
+
self
|
102
|
+
end
|
103
|
+
|
104
|
+
def +(pt)
|
105
|
+
Point2DDouble.new(self).add!(pt)
|
106
|
+
end
|
107
|
+
|
108
|
+
def -(pt)
|
109
|
+
Point2DDouble.new(self).sub!(pt)
|
110
|
+
end
|
111
|
+
|
112
|
+
def *(v)
|
113
|
+
Point2DDouble.new(self).mul!(v)
|
114
|
+
end
|
115
|
+
|
116
|
+
def /(v)
|
117
|
+
Point2DDouble.new(self).div!(v)
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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
|
+
class Wx::GraphicsPenInfo
|
10
|
+
|
11
|
+
# make Wx::GraphicsPenInfo#dashes return self
|
12
|
+
wx_dashes = instance_method :dashes
|
13
|
+
define_method :dashes do |*args|
|
14
|
+
wx_dashes.bind(self).call(*args)
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/lib/wx/core/image.rb
CHANGED
@@ -108,6 +108,55 @@ module Wx
|
|
108
108
|
hist_hash.extend Histogram
|
109
109
|
hist_hash
|
110
110
|
end
|
111
|
+
|
112
|
+
# import flattened nested classes
|
113
|
+
HSVValue = Wx::HSVValue
|
114
|
+
RGBValue = Wx::RGBValue
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
class HSVValue
|
119
|
+
|
120
|
+
# More informative output when converted to string
|
121
|
+
def to_s
|
122
|
+
"#<Wx::Image::HSVValue: (#{self.hue}, #{self.saturation}, #{self.value})>"
|
123
|
+
end
|
124
|
+
|
125
|
+
def inspect
|
126
|
+
to_s
|
127
|
+
end
|
128
|
+
|
129
|
+
# make HSVValue usable for parallel assignments like `x, y = pt`
|
130
|
+
def to_ary
|
131
|
+
[self.hue, self.saturation, self.value]
|
132
|
+
end
|
133
|
+
|
134
|
+
def to_rgb
|
135
|
+
Image::hsv_to_rgb(self)
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
class RGBValue
|
141
|
+
|
142
|
+
# More informative output when converted to string
|
143
|
+
def to_s
|
144
|
+
"#<Wx::Image::RGBValue: (#{self.red}, #{self.green}, #{self.blue})>"
|
145
|
+
end
|
146
|
+
|
147
|
+
def inspect
|
148
|
+
to_s
|
149
|
+
end
|
150
|
+
|
151
|
+
# make RGBValue usable for parallel assignments like `x, y = pt`
|
152
|
+
def to_ary
|
153
|
+
[self.red, self.green, self.blue]
|
154
|
+
end
|
155
|
+
|
156
|
+
def to_hsv
|
157
|
+
Image::rgb_to_hsv(self)
|
158
|
+
end
|
159
|
+
|
111
160
|
end
|
112
161
|
|
113
162
|
def self.Image(name, bmp_type = nil, *rest, art_path: nil, art_section: nil)
|
data/lib/wx/core/menu_bar.rb
CHANGED
@@ -12,6 +12,17 @@ class Wx::MenuBar
|
|
12
12
|
|
13
13
|
def initialize(*args, &block)
|
14
14
|
wx_initialize(*args)
|
15
|
+
if Wx::PLATFORM == 'WXOSX'
|
16
|
+
# OSX's standard Apple/Application menu gets titled with the executables name by default
|
17
|
+
# which is 'ruby' for wxRuby and this title is near impossible to reliably change.
|
18
|
+
# Therefor we implemented (a little stunted) workaround here to deal with Apple's crap.
|
19
|
+
# We insert a disabled item at the start of this menu with the AppDisplayName and follow
|
20
|
+
# it up with a nice separator. This way at least we will always be able to see which wxRuby
|
21
|
+
# app the visible menu belongs to.
|
22
|
+
apple_menu = osx_get_apple_menu
|
23
|
+
apple_menu.insert(0, Wx::ID_NONE, Wx.get_app.get_app_display_name).enable(false)
|
24
|
+
apple_menu.insert_separator(1)
|
25
|
+
end
|
15
26
|
if block
|
16
27
|
if block.arity == -1 or block.arity == 0
|
17
28
|
self.instance_eval(&block)
|
data/lib/wx/core/paintdc.rb
CHANGED
@@ -6,10 +6,16 @@
|
|
6
6
|
# Copyright 2004-2007, wxRuby development team
|
7
7
|
# released under the MIT-like wxRuby2 license
|
8
8
|
|
9
|
-
|
9
|
+
module Wx
|
10
|
+
|
11
|
+
class PaintDC
|
12
|
+
|
13
|
+
def self.draw_on(win, &block)
|
14
|
+
win.paint(&block) if block
|
15
|
+
end
|
10
16
|
|
11
|
-
def self.draw_on(win, &block)
|
12
|
-
win.paint(&block) if block
|
13
17
|
end
|
14
18
|
|
19
|
+
AutoBufferedPaintDC = PaintDC.has_native_double_buffer ? Wx::PaintDC : Wx::BufferedPaintDC
|
20
|
+
|
15
21
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
module Wx
|
6
|
+
|
7
|
+
class SecretStore
|
8
|
+
|
9
|
+
# Wipes the secret data.
|
10
|
+
def self.wipe(secret)
|
11
|
+
if ::String === secret
|
12
|
+
secret.bytesize.times { |i| secret.setbyte(i, 0) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class SecretValue
|
19
|
+
|
20
|
+
# Redefine the initialize method to auto-convert UTF-16/-32 strings to UTF-8 if possible.
|
21
|
+
wx_init = self.instance_method(:initialize)
|
22
|
+
define_method(:initialize) do | *args |
|
23
|
+
if args.size == 1 && ::String === args.first
|
24
|
+
unless args.first.encoding == ::Encoding::UTF_8 || args.first.encoding == ::Encoding::ASCII_8BIT
|
25
|
+
# convert in place unless frozen
|
26
|
+
if !args.first.frozen?
|
27
|
+
args.first.encode!(::Encoding::UTF_8) rescue nil
|
28
|
+
else # create converted copy
|
29
|
+
(args = [args.first.encode(::Encoding::UTF_8)]) rescue nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
wx_init.bind(self).call(*args)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/lib/wx/doc/app.rb
CHANGED
@@ -9,47 +9,103 @@ module Wx
|
|
9
9
|
|
10
10
|
class App
|
11
11
|
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# @
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
12
|
+
# Run the (main loop for) the application instance.
|
13
|
+
# Optionally runs a given block as the applications #on_init callback
|
14
|
+
# if no actual #on_init method has been defined.
|
15
|
+
# A given block will be ignored if an actual #on_init method has been defined.
|
16
|
+
# @yieldreturn [Boolean] return true if init block succeeded, false otherwise
|
17
|
+
# @return [Integer] return code from the #on_exit callback (`0` if no #on_exit defined or called)
|
18
|
+
def run(&block) end
|
19
|
+
|
20
|
+
# Convenience method to instantiate an application object of the class
|
21
|
+
# and call the {Wx::App#run} method for that application object.
|
22
|
+
# @yieldreturn [Boolean] return true if init block succeeded, false otherwise
|
23
|
+
# @return [Integer] return code from {Wx::App#run}
|
24
|
+
def self.run(&block) end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
|
28
|
+
# Set the menu item id for the About menu item.
|
29
|
+
# Default is {Wx::ID_ABOUT}. Setting to {Wx::ID_NONE} will disable moving the About item to the Application menu.
|
30
|
+
# @param [Integer] id
|
31
|
+
# @wxrb_require WXOSX
|
32
|
+
# @see Wx::App.get_mac_about_menu_itemid
|
33
|
+
def set_mac_about_menu_itemid(id) end
|
34
|
+
alias :mac_about_menu_itemid= :set_mac_about_menu_itemid
|
35
|
+
|
36
|
+
# Get the current menu item id for the About menu item.
|
37
|
+
# Default is {Wx::ID_ABOUT}
|
38
|
+
# @return [Integer]
|
39
|
+
# @wxrb_require WXOSX
|
40
|
+
# @see Wx::App.set_mac_about_menu_itemid
|
41
|
+
def get_mac_about_menu_itemid; end
|
42
|
+
alias :mac_about_menu_itemid :get_mac_about_menu_itemid
|
43
|
+
|
44
|
+
# Set the menu item id for the Preferences menu item.
|
45
|
+
# Default is {Wx::ID_PREFERENCES}
|
46
|
+
# @param [Integer] id
|
47
|
+
# @wxrb_require WXOSX
|
48
|
+
# @see Wx::App.get_mac_preferences_menu_itemid
|
49
|
+
def set_mac_preferences_menu_itemid(id) end
|
50
|
+
alias :mac_preferences_menu_itemid= :set_mac_preferences_menu_itemid
|
51
|
+
|
52
|
+
# Get the current menu item id for the Preferences menu item.
|
53
|
+
# Default is {Wx::ID_PREFERENCES}
|
54
|
+
# @return [Integer]
|
55
|
+
# @wxrb_require WXOSX
|
56
|
+
# @see Wx::App.set_mac_preferences_menu_itemid
|
57
|
+
def get_mac_preferences_menu_itemid; end
|
58
|
+
alias :mac_preferences_menu_itemid :get_mac_preferences_menu_itemid
|
59
|
+
|
60
|
+
# Set the menu item id for the Exit menu item.
|
61
|
+
# Default is {Wx::ID_EXIT}. Setting to {Wx::ID_NONE} will disable hiding the exit item. Standard item will still be added to Application menu.
|
62
|
+
# @param [Integer] id
|
63
|
+
# @wxrb_require WXOSX
|
64
|
+
# @see Wx::App.get_mac_exit_menu_itemid
|
65
|
+
def set_mac_exit_menu_itemid(id) end
|
66
|
+
alias :mac_exit_menu_itemid= :set_mac_exit_menu_itemid
|
67
|
+
|
68
|
+
# Get the current menu item id for the Exit menu item.
|
69
|
+
# Default is {Wx::ID_EXIT}
|
70
|
+
# @return [Integer]
|
71
|
+
# @wxrb_require WXOSX
|
72
|
+
# @see Wx::App.set_mac_exit_menu_itemid
|
73
|
+
def get_mac_exit_menu_itemid; end
|
74
|
+
alias :mac_exit_menu_itemid :get_mac_exit_menu_itemid
|
75
|
+
|
76
|
+
# Set the menu title for the Help menu.
|
77
|
+
# Default is '&Help'
|
78
|
+
# @param [String] title
|
79
|
+
# @wxrb_require WXOSX
|
80
|
+
# @see Wx::App.get_mac_help_menu_title
|
81
|
+
def set_mac_help_menu_title(title) end
|
82
|
+
alias :mac_help_menu_title= :set_mac_help_menu_title
|
83
|
+
|
84
|
+
# Get the current title for the Help menu.
|
85
|
+
# Default is '&Help'
|
86
|
+
# @return [String]
|
87
|
+
# @wxrb_require WXOSX
|
88
|
+
# @see Wx::App.set_mac_help_menu_title
|
89
|
+
def get_mac_help_menu_title; end
|
90
|
+
alias :mac_help_menu_title :get_mac_help_menu_title
|
91
|
+
|
92
|
+
# Set the menu title for the Window menu.
|
93
|
+
# Default is '&Window'
|
94
|
+
# @param [String] title
|
95
|
+
# @wxrb_require WXOSX
|
96
|
+
# @see Wx::App.get_mac_window_menu_title
|
97
|
+
def set_mac_window_menu_title(title) end
|
98
|
+
alias :mac_window_menu_title= :set_mac_window_menu_title
|
99
|
+
|
100
|
+
# Get the current title for the Window menu.
|
101
|
+
# Default is '&Window'
|
102
|
+
# @return [String]
|
103
|
+
# @wxrb_require WXOSX
|
104
|
+
# @see Wx::App.set_mac_window_menu_title
|
105
|
+
def get_mac_window_menu_title; end
|
106
|
+
alias :mac_window_menu_title :get_mac_window_menu_title
|
107
|
+
|
108
|
+
end
|
53
109
|
|
54
110
|
end
|
55
111
|
|
data/lib/wx/doc/bitmap.rb
CHANGED
@@ -14,6 +14,8 @@ module Wx
|
|
14
14
|
# Default BitmapType for current platform. Actual value is platform dependent.
|
15
15
|
CURSOR_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
|
16
16
|
|
17
|
+
# @!group Art creation methods
|
18
|
+
|
17
19
|
# Searches for an art file with basename 'name' and creates a Bitmap if found.
|
18
20
|
# Raises an ArgumentError if not found.
|
19
21
|
# Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
|
@@ -28,4 +30,6 @@ module Wx
|
|
28
30
|
# @see Wx::ArtLocator::find_art
|
29
31
|
def self.Bitmap(name, bmp_type = nil, art_path: nil, art_section: nil); end
|
30
32
|
|
33
|
+
# @!endgroup
|
34
|
+
|
31
35
|
end
|
data/lib/wx/doc/client_dc.rb
CHANGED
@@ -13,7 +13,7 @@ module Wx
|
|
13
13
|
# it's single argument.
|
14
14
|
# @param [Wx::Window] win window to draw on
|
15
15
|
# @yieldparam [Wx::ClientDC] dc the ClientDC instance to paint on
|
16
|
-
# @return [Object] result of the block
|
16
|
+
# @return [::Object] result of the block
|
17
17
|
def self.draw_on(win) end
|
18
18
|
|
19
19
|
end
|
@@ -26,7 +26,7 @@ module Wx
|
|
26
26
|
# @note In wxRuby this method mostly exists to be consistent with the other DC classes. It is however recommended to use Wx::Window#paint instead.
|
27
27
|
# @param [Wx::Window] win window to draw on
|
28
28
|
# @yieldparam [Wx::PaintDC] dc the PaintDC instance to paint on
|
29
|
-
# @return [Object] result of the block
|
29
|
+
# @return [::Object] result of the block
|
30
30
|
def self.draw_on(win) end
|
31
31
|
|
32
32
|
end
|
data/lib/wx/doc/clipboard.rb
CHANGED
@@ -14,7 +14,7 @@ module Wx
|
|
14
14
|
|
15
15
|
# Opens the global clipboard and passes the clipboard object to the block.
|
16
16
|
# @yieldparam [Wx::Clipboard] clip the global clipboard object
|
17
|
-
# @return [Object] block result
|
17
|
+
# @return [::Object] block result
|
18
18
|
def self.open; end
|
19
19
|
|
20
20
|
end
|
data/lib/wx/doc/const.rb
CHANGED
@@ -71,8 +71,14 @@ module Wx
|
|
71
71
|
TREE_LIST_CTRL_NAME_STR = 'wxTreeListCtrl'
|
72
72
|
HTML_LIST_BOX_NAME_STR = 'htmlListBox'
|
73
73
|
SIMPLE_HTML_LIST_BOX_NAME_STR = 'simpleHtmlListBox'
|
74
|
+
HTML_WINDOW_NAME_STR = 'htmlWindow'
|
74
75
|
EDITABLE_LIST_BOX_NAME_STR = 'editableListBox'
|
75
76
|
V_LIST_BOX_NAME_STR = 'wxVListBox'
|
77
|
+
ACTIVITY_INDICATOR_NAME_STR = 'activityindicator'
|
78
|
+
TIME_PICKER_CTRL_NAME_STR = 'timectrl'
|
79
|
+
DATE_PICKER_CTRL_NAME_STR = 'datectrl'
|
80
|
+
CALENDAR_NAME_STR = 'CalendarCtrl'
|
81
|
+
SPIN_BUTTON_NAME_STR = 'wxSpinButton'
|
76
82
|
|
77
83
|
# wxMSW only
|
78
84
|
MSW_HEADER_CTRL_NAME_STR = 'wxMSWHeaderCtrl'
|
@@ -81,4 +87,14 @@ module Wx
|
|
81
87
|
PROPERTY_GRID_NAME_STR = 'wxPropertyGrid'
|
82
88
|
STC_NAME_STR = 'stcwindow'
|
83
89
|
|
90
|
+
MEDIA_CTRL_NAME_STR = 'mediaCtrl'
|
91
|
+
SPIN_CTRL_NAME_STR = 'spinCtrl'
|
92
|
+
SPIN_CTRL_DOUBLE_NAME_STR = 'wxSpinCtrlDouble'
|
93
|
+
SPLITTER_WINDOW_NAME_STR = 'splitter'
|
94
|
+
TOOLBOOK_NAME_STR = 'toolbook'
|
95
|
+
TREEBOOK_NAME_STR = 'treebook'
|
96
|
+
SASH_WINDOW_NAME_STR = 'sashWindow'
|
97
|
+
SASH_LAYOUT_WINDOW_NAME_STR = 'layoutWindow'
|
98
|
+
SCROLLED_NAME_STR = 'SCROLLED_WINDOW'
|
99
|
+
|
84
100
|
end
|
data/lib/wx/doc/cursor.rb
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
class Wx
|
9
9
|
|
10
|
+
# @!group Art creation methods
|
11
|
+
|
10
12
|
# Searches for an art file with basename 'name' and creates a Cursor if found.
|
11
13
|
# Raises an ArgumentError if not found.
|
12
14
|
# Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
|
@@ -21,4 +23,6 @@ class Wx
|
|
21
23
|
# @see Wx::ArtLocator::find_art
|
22
24
|
def self.Cursor(name, bmp_type = nil, art_path: nil, art_section: nil); end
|
23
25
|
|
26
|
+
# @!endgroup
|
27
|
+
|
24
28
|
end
|