wxruby3 1.2.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/wxruby3/swig/custom/director.swg +16 -22
- data/ext/wxruby3/swig/custom/rubyapi.swg +15 -1
- data/lib/wx/aui/auimanager.rb +61 -14
- data/lib/wx/core/animation.rb +35 -14
- data/lib/wx/core/array_ext.rb +1 -0
- data/lib/wx/core/brush.rb +8 -0
- data/lib/wx/core/choicedlg.rb +7 -10
- data/lib/wx/core/colour.rb +10 -0
- data/lib/wx/core/defs.rb +49 -0
- data/lib/wx/core/dialog.rb +2 -2
- data/lib/wx/core/enum.rb +16 -3
- data/lib/wx/core/event.rb +7 -0
- data/lib/wx/core/file_dialog.rb +25 -0
- data/lib/wx/core/font.rb +14 -0
- data/lib/wx/core/gdi_object.rb +24 -0
- data/lib/wx/core/hboxsizer.rb +24 -4
- data/lib/wx/core/object.rb +26 -11
- data/lib/wx/core/pen.rb +20 -0
- data/lib/wx/core/real_point.rb +1 -0
- data/lib/wx/core/sizer.rb +166 -39
- data/lib/wx/core/variant.rb +108 -51
- data/lib/wx/core/vboxsizer.rb +24 -4
- data/lib/wx/doc/array_ext.rb +1 -0
- data/lib/wx/doc/aui/auimanager.rb +2 -0
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/enum.rb +26 -0
- data/lib/wx/doc/evthandler.rb +6 -0
- data/lib/wx/doc/functions.rb +35 -3
- data/lib/wx/doc/gdi_common.rb +1 -0
- data/lib/wx/doc/gdi_object.rb +22 -0
- data/lib/wx/doc/object.rb +24 -0
- data/lib/wx/doc/variant.rb +8 -0
- data/lib/wx/helpers.rb +2 -3
- data/lib/wx/keyword_defs.rb +7 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/config.rb +1 -1
- data/rakelib/lib/core/include/funcall.inc +9 -24
- data/rakelib/lib/core/include/swigdirector.inc +29 -11
- data/rakelib/lib/core/include/swigrubyrun.inc +2 -2
- data/rakelib/lib/director/animation_ctrl.rb +6 -0
- data/rakelib/lib/director/aui_manager.rb +118 -3
- data/rakelib/lib/director/defs.rb +3 -0
- data/rakelib/lib/director/dialog.rb +17 -7
- data/rakelib/lib/director/file_dialog_customize_hook.rb +77 -1
- data/rakelib/lib/director/functions.rb +0 -12
- data/rakelib/lib/director/pgproperties.rb +2 -2
- data/rakelib/lib/director/property_grid_interface.rb +4 -3
- data/rakelib/lib/director/textctrl.rb +7 -0
- data/rakelib/lib/director/validator.rb +7 -42
- data/rakelib/lib/director/variant.rb +2 -2
- data/rakelib/lib/extractor/function.rb +5 -0
- data/rakelib/lib/generate/doc/credential_entry_dialog.yaml +10 -0
- data/rakelib/lib/generate/doc/generic_about_dialog.yaml +46 -0
- data/rakelib/lib/specs/interfaces.rb +2 -0
- data/rakelib/lib/swig_runner.rb +6 -3
- data/rakelib/lib/typemap/common.rb +2 -2
- data/rakelib/lib/util/string.rb +7 -6
- data/samples/animate/anitest.rb +13 -9
- data/samples/dialogs/dialogs.rb +1 -1
- data/tests/lib/leaked_overload_exception_test.rb +25 -0
- data/tests/lib/leaked_process_event_exception_test.rb +33 -0
- data/tests/lib/leaked_queued_event_exception_test.rb +34 -0
- data/tests/lib/overload_type_exception_test.rb +25 -0
- data/tests/test_exceptions.rb +24 -24
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43cace6f097af04e2d856782258313acd4e340719cf7794db36534e6d5e644b
|
4
|
+
data.tar.gz: 2f93d3489b95ca1a49ce2734222088aab5574841dd337d19fef58ec7a84587fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1db323073fdde9896d9ea6d8ffb9dee71e3f52f52d2836603ff5e6f7274003bb252bc4cff832574454ad4390686a79b1ef01467d5e3b7362aad36d464c67f5ac
|
7
|
+
data.tar.gz: 0057e4f8462c5b4e2dd79e736ca417cea70305b38efdc796bcc32a8f22fd12d178824ebe92e5d4cca219e1e1dbcafcb9200b5d00d7052d89ddd8f905729af4a0
|
@@ -147,20 +147,14 @@ namespace Swig {
|
|
147
147
|
|
148
148
|
DirectorTypeMismatchException(VALUE self, const char *method, VALUE error, const char *msg="");
|
149
149
|
|
150
|
-
static
|
151
|
-
{
|
152
|
-
throw DirectorTypeMismatchException(error, msg);
|
153
|
-
}
|
150
|
+
static void raise(VALUE error, const char *msg);
|
154
151
|
|
155
|
-
static
|
156
|
-
{
|
157
|
-
throw DirectorTypeMismatchException(msg);
|
158
|
-
}
|
152
|
+
static void raise(const char *msg);
|
159
153
|
|
160
|
-
static
|
161
|
-
|
162
|
-
|
163
|
-
|
154
|
+
static void raise(VALUE self, const char* method, VALUE error, const char *msg);
|
155
|
+
|
156
|
+
private:
|
157
|
+
static void print(const DirectorTypeMismatchException& ex);
|
164
158
|
};
|
165
159
|
|
166
160
|
/* Any Ruby exception that occurs during a director method call */
|
@@ -195,13 +189,8 @@ namespace Swig {
|
|
195
189
|
}
|
196
190
|
};
|
197
191
|
|
198
|
-
|
199
|
-
|
200
|
-
{
|
201
|
-
public:
|
202
|
-
DirectorRubyException(VALUE error, VALUE rcvr, ID fn_id);
|
203
|
-
|
204
|
-
};
|
192
|
+
// SWIG < 4.3.0
|
193
|
+
#if SWIG_VERSION < 0x040300
|
205
194
|
|
206
195
|
/* Simple thread abstraction for pthreads on win32 */
|
207
196
|
#ifdef __THREAD__
|
@@ -233,8 +222,14 @@ namespace Swig {
|
|
233
222
|
}
|
234
223
|
};
|
235
224
|
# define SWIG_GUARD(mutex) Guard _guard(mutex)
|
225
|
+
# define SWIG_GUARD_DEFINITION(_cls, _mutex) pthread_mutex_t _cls::_mutex
|
226
|
+
# define SWIG_GUARD_DECLARATION(_mutex) static pthread_mutex_t _mutex
|
236
227
|
#else
|
237
228
|
# define SWIG_GUARD(mutex)
|
229
|
+
# define SWIG_GUARD_DEFINITION(_cls, _mutex)
|
230
|
+
# define SWIG_GUARD_DECLARATION(_mutex)
|
231
|
+
#endif
|
232
|
+
|
238
233
|
#endif
|
239
234
|
|
240
235
|
/* director base class */
|
@@ -272,9 +267,7 @@ namespace Swig {
|
|
272
267
|
private:
|
273
268
|
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
274
269
|
mutable swig_ownership_map swig_owner;
|
275
|
-
|
276
|
-
static pthread_mutex_t swig_mutex_own;
|
277
|
-
#endif
|
270
|
+
SWIG_GUARD_DECLARATION(swig_mutex_own);
|
278
271
|
|
279
272
|
public:
|
280
273
|
template <typename Type>
|
@@ -301,4 +294,5 @@ namespace Swig {
|
|
301
294
|
|
302
295
|
swig_ruby_owntype swig_release_ownership(void *vptr) const;
|
303
296
|
};
|
297
|
+
SWIG_GUARD_DEFINITION(Director, swig_mutex_own);
|
304
298
|
}
|
@@ -12,8 +12,22 @@ extern "C" {
|
|
12
12
|
#endif
|
13
13
|
|
14
14
|
WXRUBY_EXPORT VALUE
|
15
|
-
|
15
|
+
SWIG_wxRuby_AppendOutput(VALUE target, VALUE o, int is_void);
|
16
16
|
|
17
17
|
#ifdef __cplusplus
|
18
18
|
}
|
19
19
|
#endif
|
20
|
+
|
21
|
+
/* SWIG >= 4.3.0 version */
|
22
|
+
inline VALUE
|
23
|
+
SWIG_Ruby_AppendOutput(VALUE target, VALUE o, int is_void)
|
24
|
+
{
|
25
|
+
return SWIG_wxRuby_AppendOutput(target, o, is_void);
|
26
|
+
}
|
27
|
+
|
28
|
+
/* SWIG < 4.3.0 version */
|
29
|
+
inline VALUE
|
30
|
+
SWIG_Ruby_AppendOutput(VALUE target, VALUE o)
|
31
|
+
{
|
32
|
+
return SWIG_wxRuby_AppendOutput(target, o, -1);
|
33
|
+
}
|
data/lib/wx/aui/auimanager.rb
CHANGED
@@ -2,19 +2,66 @@
|
|
2
2
|
#
|
3
3
|
# This software is released under the MIT license.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
module Wx
|
6
|
+
module AUI
|
7
|
+
|
8
|
+
class AuiManager
|
9
|
+
|
10
|
+
wx_each_pane = instance_method(:each_pane)
|
11
|
+
define_method(:each_pane) do |&block|
|
12
|
+
if block
|
13
|
+
wx_each_pane.bind(self).call(&block)
|
14
|
+
else
|
15
|
+
::Enumerator.new { |y| wx_each_pane.bind(self).call { |p| y << p } }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_all_panes
|
20
|
+
each_pane.to_a
|
21
|
+
end
|
22
|
+
alias :all_panes :get_all_panes
|
23
|
+
|
24
|
+
unless Wx::EvtHandler.event_type_for_name(:evt_aui_find_manager)
|
25
|
+
# missing from XML API refs
|
26
|
+
Wx::EvtHandler.register_event_type Wx::EvtHandler::EventType[
|
27
|
+
'evt_aui_find_manager', 0,
|
28
|
+
Wx::AUI::EVT_AUI_FIND_MANAGER,
|
29
|
+
Wx::AUI::AuiManagerEvent
|
30
|
+
] if Wx::AUI.const_defined?(:EVT_AUI_FIND_MANAGER)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if WXWIDGETS_VERSION >= '3.3.0'
|
35
|
+
|
36
|
+
class AuiDockInfo
|
19
37
|
|
38
|
+
wx_each_pane = instance_method(:each_pane)
|
39
|
+
define_method(:each_pane) do |&block|
|
40
|
+
if block
|
41
|
+
wx_each_pane.bind(self).call(&block)
|
42
|
+
else
|
43
|
+
::Enumerator.new { |y| wx_each_pane.bind(self).call { |p| y << p } }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_panes
|
48
|
+
each_pane.to_a
|
49
|
+
end
|
50
|
+
alias :panes :get_panes
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class AuiDeserializer
|
55
|
+
|
56
|
+
wx_initialize = instance_method(:initialize)
|
57
|
+
define_method(:initialize) do |manager|
|
58
|
+
wx_initialize.bind(self).call(manager)
|
59
|
+
@manager = manager # prevent GC for lifetime of deserializer
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
20
67
|
end
|
data/lib/wx/core/animation.rb
CHANGED
@@ -6,21 +6,42 @@
|
|
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
|
-
|
9
|
+
module Wx
|
10
|
+
|
11
|
+
class Animation
|
12
|
+
# Redefine the initialize method so it raises an exception if a
|
13
|
+
# non-existent file is given to the constructor; otherwise, wx Widgets
|
14
|
+
# just carries on with an empty bitmap, which may cause faults later
|
15
|
+
wx_init = self.instance_method(:initialize)
|
16
|
+
define_method(:initialize) do | *args |
|
17
|
+
if args[0].kind_of? String
|
18
|
+
if not File.exist?( File.expand_path(args[0]) )
|
19
|
+
Kernel.raise( ArgumentError,
|
20
|
+
"Animation file does not exist: #{args[0]}" )
|
21
|
+
end
|
22
|
+
res = wx_init.bind(self).call()
|
23
|
+
res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY)
|
24
|
+
else
|
25
|
+
wx_init.bind(self).call(*args)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if Wx::WXWIDGETS_VERSION >= '3.3.0'
|
31
|
+
|
32
|
+
class AnimationCtrl
|
33
|
+
|
34
|
+
# Redefine this method to accept either a single animation or an animation bundle
|
35
|
+
wx_set_animation = self.instance_method(:set_animation)
|
36
|
+
define_method(:set_animation) do | arg |
|
37
|
+
if Wx::Animation === arg
|
38
|
+
arg = Wx::AnimationBundle.new(arg)
|
39
|
+
end
|
40
|
+
wx_set_animation.bind(self).call(arg)
|
19
41
|
end
|
20
|
-
|
21
|
-
res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY)
|
22
|
-
else
|
23
|
-
wx_init.bind(self).call(*args)
|
42
|
+
|
24
43
|
end
|
44
|
+
|
25
45
|
end
|
46
|
+
|
26
47
|
end
|
data/lib/wx/core/array_ext.rb
CHANGED
data/lib/wx/core/brush.rb
CHANGED
@@ -6,8 +6,16 @@
|
|
6
6
|
# Copyright 2004-2007, wxRuby development team
|
7
7
|
# released under the MIT-like wxRuby2 license
|
8
8
|
|
9
|
+
require_relative './enum'
|
10
|
+
|
9
11
|
module Wx
|
10
12
|
|
11
13
|
TheBrushList = Wx::Brush
|
12
14
|
|
15
|
+
class BrushStyle < Wx::Enum
|
16
|
+
|
17
|
+
set_non_distinct(%i[BRUSHSTYLE_INVALID BRUSHSTYLE_FIRST_HATCH BRUSHSTYLE_LAST_HATCH])
|
18
|
+
|
19
|
+
end
|
20
|
+
|
13
21
|
end
|
data/lib/wx/core/choicedlg.rb
CHANGED
@@ -14,9 +14,8 @@ module Wx
|
|
14
14
|
choices,
|
15
15
|
parent = nil,
|
16
16
|
initial_selection: 0,
|
17
|
-
|
18
|
-
|
19
|
-
dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, nil, Wx::CHOICEDLG_STYLE, [x, y])
|
17
|
+
pos: Wx::DEFAULT_POSITION)
|
18
|
+
dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, pos)
|
20
19
|
|
21
20
|
dialog.selection = initial_selection
|
22
21
|
return dialog.show_modal == Wx::ID_OK ? dialog.get_string_selection : ''
|
@@ -28,9 +27,8 @@ module Wx
|
|
28
27
|
choices,
|
29
28
|
parent = nil,
|
30
29
|
initial_selection: 0,
|
31
|
-
|
32
|
-
|
33
|
-
dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, nil, Wx::CHOICEDLG_STYLE, [x, y])
|
30
|
+
pos: Wx::DEFAULT_POSITION)
|
31
|
+
dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, pos)
|
34
32
|
|
35
33
|
dialog.selection = initial_selection
|
36
34
|
return dialog.show_modal == Wx::ID_OK ? dialog.get_selection : -1
|
@@ -43,16 +41,15 @@ module Wx
|
|
43
41
|
choices,
|
44
42
|
parent = nil,
|
45
43
|
initial_selections: [],
|
46
|
-
|
47
|
-
|
48
|
-
dialog = Wx::MultiChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, [x, y])
|
44
|
+
pos: Wx::DEFAULT_POSITION)
|
45
|
+
dialog = Wx::MultiChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, pos)
|
49
46
|
|
50
47
|
# call this even if selections array is empty and this then (correctly)
|
51
48
|
# deselects the first item which is selected by default
|
52
49
|
dialog.selections = initial_selections
|
53
50
|
|
54
51
|
if dialog.show_modal != Wx::ID_OK
|
55
|
-
return
|
52
|
+
return nil
|
56
53
|
end
|
57
54
|
|
58
55
|
dialog.get_selections
|
data/lib/wx/core/colour.rb
CHANGED
data/lib/wx/core/defs.rb
ADDED
@@ -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
|
data/lib/wx/core/dialog.rb
CHANGED
@@ -25,8 +25,8 @@ class Wx::Dialog
|
|
25
25
|
scope = klass.name.split('::')
|
26
26
|
functor_nm = scope.pop
|
27
27
|
code = <<~__CODE
|
28
|
-
def #{functor_nm}(*args, &block)
|
29
|
-
dlg = #{klass.name}.new(*args)
|
28
|
+
def #{functor_nm}(*args, **kwargs, &block)
|
29
|
+
dlg = #{klass.name}.new(*args, **kwargs)
|
30
30
|
begin
|
31
31
|
if block_given?
|
32
32
|
return block.call(dlg)
|
data/lib/wx/core/enum.rb
CHANGED
@@ -10,10 +10,23 @@ class Wx::Enum
|
|
10
10
|
|
11
11
|
class << self
|
12
12
|
|
13
|
-
def
|
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
|
-
|
16
|
-
|
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
data/lib/wx/core/file_dialog.rb
CHANGED
@@ -20,4 +20,29 @@ module Wx
|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
|
+
class FileDialogCustomizeHook
|
24
|
+
|
25
|
+
# prevent construction of abstract base
|
26
|
+
if RUBY_VERSION < '2.7.0'
|
27
|
+
def self.new(*)
|
28
|
+
raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
|
29
|
+
super
|
30
|
+
end
|
31
|
+
else
|
32
|
+
def self.new(*, **)
|
33
|
+
raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# provide default no-ops
|
39
|
+
|
40
|
+
def add_custom_controls(customizer) end
|
41
|
+
|
42
|
+
def update_custom_controls; end
|
43
|
+
|
44
|
+
def transfer_data_from_custom_controls; end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
23
48
|
end
|
data/lib/wx/core/font.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
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
|
1
8
|
|
2
9
|
require_relative './font/encoding'
|
10
|
+
require_relative './enum'
|
3
11
|
|
4
12
|
module Wx
|
5
13
|
|
@@ -27,4 +35,10 @@ module Wx
|
|
27
35
|
# can be accessed through that name too.
|
28
36
|
TheFontList = Font
|
29
37
|
|
38
|
+
class FontFlag < Wx::Enum
|
39
|
+
|
40
|
+
set_non_distinct(%i[FONTFLAG_MASK])
|
41
|
+
|
42
|
+
end
|
43
|
+
|
30
44
|
end
|
@@ -0,0 +1,24 @@
|
|
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
|
+
module Wx
|
10
|
+
|
11
|
+
class GDIObject < Object
|
12
|
+
|
13
|
+
# GDIObjects have safe, working (and relatively cheap) copy ctors.
|
14
|
+
def dup
|
15
|
+
self.class.new(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
def clone
|
19
|
+
dup
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/wx/core/hboxsizer.rb
CHANGED
@@ -9,14 +9,34 @@
|
|
9
9
|
# Just a shortcut version for creating a horizontal box sizer
|
10
10
|
|
11
11
|
class Wx::HBoxSizer < Wx::BoxSizer
|
12
|
-
def initialize
|
13
|
-
super(Wx::HORIZONTAL)
|
12
|
+
def initialize(&block)
|
13
|
+
super(Wx::HORIZONTAL, &nil)
|
14
|
+
if block
|
15
|
+
if block.arity == -1 or block.arity == 0
|
16
|
+
self.instance_eval(&block)
|
17
|
+
elsif block.arity == 1
|
18
|
+
block.call(self)
|
19
|
+
else
|
20
|
+
Kernel.raise ArgumentError,
|
21
|
+
"Block to initialize should accept a single argument or none"
|
22
|
+
end
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
16
26
|
|
17
27
|
# Just a shortcut version for creating a horizontal wrap sizer
|
18
28
|
class Wx::HWrapSizer < Wx::WrapSizer
|
19
|
-
def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS)
|
20
|
-
super(Wx::HORIZONTAL)
|
29
|
+
def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS, &block)
|
30
|
+
super(Wx::HORIZONTAL, &nil)
|
31
|
+
if block
|
32
|
+
if block.arity == -1 or block.arity == 0
|
33
|
+
self.instance_eval(&block)
|
34
|
+
elsif block.arity == 1
|
35
|
+
block.call(self)
|
36
|
+
else
|
37
|
+
Kernel.raise ArgumentError,
|
38
|
+
"Block to initialize should accept a single argument or none"
|
39
|
+
end
|
40
|
+
end
|
21
41
|
end
|
22
42
|
end
|
data/lib/wx/core/object.rb
CHANGED
@@ -8,16 +8,31 @@
|
|
8
8
|
|
9
9
|
# The root class for most (not all) WxRuby classes
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
module Wx
|
12
|
+
|
13
|
+
class Object
|
14
|
+
# Massage the output of inspect to show the public module name (Wx),
|
15
|
+
# instead of the internal name (Wxruby2)
|
16
|
+
# def to_s
|
17
|
+
# super.sub('ruby2', '')
|
18
|
+
# end
|
19
|
+
|
20
|
+
# Returns a string containing the C++ pointer address of this
|
21
|
+
# object. Only useful for debugging.
|
22
|
+
def ptr_addr
|
23
|
+
Wx::ptr_addr(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
# By default Wx:::Object derived class instances cannot be #dup-licated.
|
27
|
+
def dup
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
# By default Wx::Object derived class instances cannot be cloned but instead return self.
|
32
|
+
def clone
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
22
36
|
end
|
37
|
+
|
23
38
|
end
|
data/lib/wx/core/pen.rb
CHANGED
@@ -6,8 +6,28 @@
|
|
6
6
|
# Copyright 2004-2007, wxRuby development team
|
7
7
|
# released under the MIT-like wxRuby2 license
|
8
8
|
|
9
|
+
require_relative './enum'
|
10
|
+
|
9
11
|
module Wx
|
10
12
|
|
11
13
|
ThePenList = Wx::Pen
|
12
14
|
|
15
|
+
class PenStyle < Wx::Enum
|
16
|
+
|
17
|
+
set_non_distinct(%i[PENSTYLE_INVALID PENSTYLE_FIRST_HATCH PENSTYLE_LAST_HATCH])
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class PenJoin < Wx::Enum
|
22
|
+
|
23
|
+
set_non_distinct(%i[JOIN_INVALID])
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
class PenCap < Wx::Enum
|
28
|
+
|
29
|
+
set_non_distinct(%i[CAP_INVALID])
|
30
|
+
|
31
|
+
end
|
32
|
+
|
13
33
|
end
|