wxruby3 0.9.0.pre.rc.2 → 0.9.0.pre.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +30 -8
- data/README.md +3 -3
- data/ext/wxruby3/swig/wx.i +2 -0
- data/lib/wx/core/event_loop.rb +7 -0
- data/lib/wx/core/image.rb +33 -0
- data/lib/wx/core/listctrl.rb +17 -13
- data/lib/wx/core/log.rb +90 -0
- data/lib/wx/doc/bitmap.rb +11 -15
- data/lib/wx/doc/event_loop.rb +7 -0
- data/lib/wx/doc/extra/00_starting.md +6 -6
- data/lib/wx/doc/extra/02_lifecycles.md +9 -8
- data/lib/wx/doc/extra/09_exceptions.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +4 -4
- data/lib/wx/doc/font.rb +1 -1
- data/lib/wx/doc/functions.rb +51 -23
- data/lib/wx/doc/gc_dc.rb +1 -1
- data/lib/wx/doc/image.rb +42 -12
- data/lib/wx/doc/list_ctrl.rb +32 -0
- data/lib/wx/doc/log.rb +28 -0
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/text_validator.rb +12 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/core/mapping.rb +15 -10
- data/rakelib/lib/core/package.rb +3 -0
- data/rakelib/lib/core/spec.rb +21 -10
- data/rakelib/lib/core/spec_helper.rb +6 -0
- data/rakelib/lib/director/dialog.rb +25 -0
- data/rakelib/lib/director/event_loop.rb +26 -0
- data/rakelib/lib/director/functions.rb +44 -48
- data/rakelib/lib/director/image.rb +32 -0
- data/rakelib/lib/director/list_ctrl.rb +3 -2
- data/rakelib/lib/director/log.rb +64 -4
- data/rakelib/lib/director/text_entry.rb +25 -0
- data/rakelib/lib/director/text_validator.rb +8 -2
- data/rakelib/lib/director/variant.rb +17 -4
- data/rakelib/lib/extractor/function.rb +7 -7
- data/rakelib/lib/extractor/variable.rb +6 -6
- data/rakelib/lib/generate/doc/aui_manager.yaml +21 -0
- data/rakelib/lib/generate/doc/font.yaml +29 -0
- data/rakelib/lib/generate/doc/frame.yaml +23 -0
- data/rakelib/lib/generate/doc/fs_file.yaml +11 -0
- data/rakelib/lib/generate/doc/gdi_common.yaml +36 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +34 -0
- data/rakelib/lib/generate/doc/gui_event_loop.yaml +12 -0
- data/rakelib/lib/generate/doc/help_controller.yaml +24 -0
- data/rakelib/lib/generate/doc/icon.yaml +11 -0
- data/rakelib/lib/generate/doc/image.yaml +87 -0
- data/rakelib/lib/generate/doc/keyboard_state.yaml +19 -0
- data/rakelib/lib/generate/doc/list_ctrl.yaml +77 -0
- data/rakelib/lib/generate/doc/locale.yaml +12 -0
- data/rakelib/lib/generate/doc/log.yaml +86 -0
- data/rakelib/lib/generate/doc/mdi_frame.yaml +12 -0
- data/rakelib/lib/generate/doc/memory_dc.yaml +42 -0
- data/rakelib/lib/generate/doc/menu.yaml +17 -0
- data/rakelib/lib/generate/doc/menu_item.yaml +43 -0
- data/rakelib/lib/generate/doc/message_dialog.yaml +36 -0
- data/rakelib/lib/generate/doc/non_owned_window.yaml +14 -0
- data/rakelib/lib/generate/doc/notebook.yaml +18 -0
- data/rakelib/lib/generate/doc/pen.yaml +11 -0
- data/rakelib/lib/generate/doc/picker_base.yaml +19 -0
- data/rakelib/lib/generate/doc/platform_info.yaml +15 -0
- data/rakelib/lib/generate/doc/property_sheet_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/scroll_bar.yaml +11 -0
- data/rakelib/lib/generate/doc/scrolled_canvas.yaml +37 -0
- data/rakelib/lib/generate/doc/scrolled_control.yaml +37 -0
- data/rakelib/lib/generate/doc/scrolled_window.yaml +37 -0
- data/rakelib/lib/generate/doc/sizer.yaml +69 -0
- data/rakelib/lib/generate/doc/splash_screen.yaml +18 -0
- data/rakelib/lib/generate/doc/static_box.yaml +52 -0
- data/rakelib/lib/generate/doc/static_box_sizer.yaml +22 -0
- data/rakelib/lib/generate/doc/svg_file_dc.yaml +11 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +19 -0
- data/rakelib/lib/generate/doc/text_entry.yaml +42 -0
- data/rakelib/lib/generate/doc/text_entry_dialog.yaml +17 -0
- data/rakelib/lib/generate/doc/timer_event.yaml +28 -0
- data/rakelib/lib/generate/doc/tool_bar.yaml +35 -0
- data/rakelib/lib/generate/doc/top_level_window.yaml +23 -0
- data/rakelib/lib/generate/doc/validator.yaml +12 -0
- data/rakelib/lib/generate/doc/variant.yaml +29 -0
- data/rakelib/lib/generate/doc/window.yaml +249 -0
- data/rakelib/lib/generate/doc/wizard_page_simple.yaml +14 -0
- data/rakelib/lib/generate/doc/xml_node.yaml +7 -0
- data/rakelib/lib/generate/doc/xml_resource.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +35 -1
- data/rakelib/lib/specs/interfaces.rb +1 -0
- data/rakelib/lib/swig_runner.rb +37 -0
- data/tests/test_art.rb +9 -0
- data/tests/test_box_sizer.rb +161 -0
- data/tests/test_grid_sizer.rb +148 -0
- data/tests/test_list_ctrl.rb +53 -0
- data/tests/test_log.rb +163 -0
- data/tests/test_std_controls.rb +58 -0
- data/tests/test_timer.rb +95 -0
- metadata +59 -2
data/rakelib/lib/director/log.rb
CHANGED
@@ -10,19 +10,79 @@ module WXRuby3
|
|
10
10
|
class Log < Director
|
11
11
|
|
12
12
|
def setup
|
13
|
-
spec.gc_as_object
|
14
|
-
spec.items.concat(%w[wxLogBuffer wxLogChain wxLogGui wxLogStderr wxLogStream wxLogTextCtrl wxLogInterposer wxLogInterposerTemp wxLogWindow])
|
15
|
-
spec.no_proxy(%w[wxLogBuffer
|
13
|
+
spec.gc_as_object %w[wxLog wxLogChain wxLogInterposer wxLogInterposerTemp]
|
14
|
+
spec.items.concat(%w[wxLogBuffer wxLogChain wxLogGui wxLogStderr wxLogStream wxLogTextCtrl wxLogInterposer wxLogInterposerTemp wxLogWindow wxLogNull wxLogRecordInfo])
|
15
|
+
spec.no_proxy(%w[wxLogBuffer wxLogGui wxLogStderr wxLogTextCtrl wxLogWindow])
|
16
|
+
spec.force_proxy(%w[wxLogInterposer wxLogInterposerTemp])
|
17
|
+
spec.regard %w[wxLog::DoLogRecord wxLog::DoLogTextAtLevel wxLog::DoLogText]
|
16
18
|
spec.ignore 'wxLogBuffer::Flush'
|
17
19
|
spec.ignore 'wxLogGui::Flush'
|
18
20
|
if Config.instance.features_set?(%w[wxUSE_STD_IOSTREAM])
|
19
21
|
spec.ignore 'wxLogStream'
|
20
22
|
end
|
23
|
+
# wxLogStderr
|
24
|
+
spec.ignore 'wxLogStderr::wxLogStderr'
|
25
|
+
spec.add_extend_code 'wxLogStderr', <<~__HEREDOC
|
26
|
+
wxLogStderr(int fh=2)
|
27
|
+
{
|
28
|
+
if (fh == 2)
|
29
|
+
{ return new wxLogStderr(); }
|
30
|
+
else if (fh == 1)
|
31
|
+
{ return new wxLogStderr(stdout); }
|
32
|
+
rb_raise(rb_eArgError, "Expected 1 (for stdout) or 2 (for stderr).");
|
33
|
+
}
|
34
|
+
__HEREDOC
|
35
|
+
# for wxLogChain
|
36
|
+
spec.disown 'wxLog *logger'
|
37
|
+
spec.ignore 'wxLogChain::DetachOldLog' # too much potential trouble
|
38
|
+
# add override decl missing from xml specs
|
39
|
+
spec.extend_interface 'wxLogChain',
|
40
|
+
'virtual void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) override',
|
41
|
+
visibility: 'protected'
|
42
|
+
# wxLogChain and derivatives need to be allocated disowned because new instances of these classes
|
43
|
+
# are installed as ActiveTarget on construction and so wxWidgets has ownership
|
44
|
+
spec.allocate_disowned 'wxLogChain'
|
45
|
+
spec.allocate_disowned 'wxLogInterposer'
|
46
|
+
spec.allocate_disowned 'wxLogInterposerTemp'
|
47
|
+
spec.allocate_disowned 'wxLogWindow'
|
48
|
+
# for ActiveTarget methods
|
21
49
|
spec.ignore 'wxLog::SetThreadActiveTarget'
|
22
50
|
spec.disown 'wxLog *logtarget'
|
51
|
+
spec.new_object 'wxLog::SetActiveTarget'
|
23
52
|
spec.do_not_generate(:functions)
|
24
53
|
spec.make_concrete('wxLog')
|
25
|
-
spec.extend_interface('wxLog', '
|
54
|
+
spec.extend_interface('wxLog', 'virtual ~wxLog ()')
|
55
|
+
spec.gc_as_untracked 'wxLogRecordInfo'
|
56
|
+
spec.add_extend_code 'wxLogRecordInfo', <<~__HEREDOC
|
57
|
+
VALUE filename()
|
58
|
+
{
|
59
|
+
return $self->filename ? WXSTR_TO_RSTR(wxString($self->filename)) : Qnil;
|
60
|
+
}
|
61
|
+
VALUE line()
|
62
|
+
{
|
63
|
+
return INT2NUM($self->line);
|
64
|
+
}
|
65
|
+
VALUE func()
|
66
|
+
{
|
67
|
+
return $self->func ? WXSTR_TO_RSTR(wxString($self->func)) : Qnil;
|
68
|
+
}
|
69
|
+
VALUE component()
|
70
|
+
{
|
71
|
+
return $self->component ? WXSTR_TO_RSTR(wxString($self->component)) : Qnil;
|
72
|
+
}
|
73
|
+
__HEREDOC
|
74
|
+
spec.make_abstract 'wxLogNull'
|
75
|
+
spec.ignore 'wxLogNull::wxLogNull'
|
76
|
+
spec.add_extend_code 'wxLogNull', <<~__HEREDOC__
|
77
|
+
static void no_log()
|
78
|
+
{
|
79
|
+
if (rb_block_given_p ())
|
80
|
+
{
|
81
|
+
wxLogNull noLog;
|
82
|
+
rb_yield(Qnil);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
__HEREDOC__
|
26
86
|
super
|
27
87
|
end
|
28
88
|
end # class Log
|
@@ -23,6 +23,31 @@ module WXRuby3
|
|
23
23
|
spec.add_header_code '#define wxTextEntry wxTextEntryBase'
|
24
24
|
spec.disown 'wxTextCompleter *completer' # managed by wxWidgets after passing in
|
25
25
|
spec.map_apply 'long * OUTPUT' => 'long *' # for GetSelection
|
26
|
+
# for wxTextCompleterSimple::GetCompletions
|
27
|
+
spec.map 'wxArrayString &res' => 'Array<String>' do
|
28
|
+
|
29
|
+
map_in ignore: true, temp: 'wxArrayString tmp', code: '$1 = &tmp;'
|
30
|
+
|
31
|
+
map_argout code: <<~__CODE
|
32
|
+
$result = rb_ary_new();
|
33
|
+
for (size_t i = 0; i < $1->GetCount(); i++)
|
34
|
+
{
|
35
|
+
rb_ary_push($result,WXSTR_TO_RSTR( $1->Item(i) ) );
|
36
|
+
}
|
37
|
+
__CODE
|
38
|
+
|
39
|
+
map_directorargout code: <<~__CODE
|
40
|
+
if (result != Qnil && TYPE(result) == T_ARRAY)
|
41
|
+
{
|
42
|
+
for (int i = 0, n = RARRAY_LEN(result); i < n ;i++)
|
43
|
+
{
|
44
|
+
VALUE rb_comp = rb_ary_entry(result, i);
|
45
|
+
wxString comp = RSTR_TO_WXSTR(rb_comp);
|
46
|
+
$1.Add(comp);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
__CODE
|
50
|
+
end
|
26
51
|
end
|
27
52
|
end # class TextEntry
|
28
53
|
|
@@ -20,8 +20,8 @@ module WXRuby3
|
|
20
20
|
public:
|
21
21
|
WXRubyTextValidator(const wxTextValidator& v)
|
22
22
|
: wxTextValidator(v) {}
|
23
|
-
WXRubyTextValidator(long style=wxFILTER_NONE
|
24
|
-
: wxTextValidator(style
|
23
|
+
WXRubyTextValidator(long style=wxFILTER_NONE)
|
24
|
+
: wxTextValidator(style) {}
|
25
25
|
virtual ~WXRubyTextValidator()
|
26
26
|
{
|
27
27
|
wxRuby_ReleaseEvtHandlerProcs(this);
|
@@ -29,6 +29,12 @@ module WXRuby3
|
|
29
29
|
};
|
30
30
|
__HEREDOC
|
31
31
|
spec.use_class_implementation 'wxTextValidator', 'WXRubyTextValidator'
|
32
|
+
# ignore copy ctor doc
|
33
|
+
spec.regard 'wxTextValidator::wxTextValidator(const wxTextValidator&)', regard_doc: false
|
34
|
+
# ignore this ctor
|
35
|
+
spec.ignore 'wxTextValidator::wxTextValidator(long, wxString*)'
|
36
|
+
# add alternative
|
37
|
+
spec.extend_interface 'wxTextValidator', 'wxTextValidator(long style=wxFILTER_NONE)'
|
32
38
|
spec.no_proxy 'wxTextValidator::Clone'
|
33
39
|
spec.new_object 'wxTextValidator::Clone'
|
34
40
|
# handle clone mapping
|
@@ -437,10 +437,6 @@ module WXRuby3
|
|
437
437
|
return true;
|
438
438
|
}
|
439
439
|
|
440
|
-
//#if wxUSE_ANY
|
441
|
-
// // Converts value to wxAny, if possible. Return true if successful.
|
442
|
-
// virtual bool GetAsAny(wxAny* WXUNUSED(any)) const { return false; }
|
443
|
-
//#endif
|
444
440
|
protected:
|
445
441
|
VALUE m_value;
|
446
442
|
};
|
@@ -462,6 +458,21 @@ module WXRuby3
|
|
462
458
|
}
|
463
459
|
__HEREDOC
|
464
460
|
spec.add_init_code 'wxRuby_AppendMarker(wxRuby_markRbValueVariants);'
|
461
|
+
# ignore GetType (not doc)
|
462
|
+
spec.ignore 'wxVariant::GetType', ignore_doc: false
|
463
|
+
# replace with custom implementation
|
464
|
+
spec.add_extend_code 'wxVariant', <<~__HEREDOC
|
465
|
+
VALUE get_type()
|
466
|
+
{
|
467
|
+
wxString ts = self->GetType();
|
468
|
+
if (ts == WXRBValueVariantData::type_name_)
|
469
|
+
{
|
470
|
+
VALUE klass = CLASS_OF(((WXRBValueVariantData*)self->GetData())->GetValue());
|
471
|
+
return rb_str_new2(rb_class2name(CLASS_OF(klass)));
|
472
|
+
}
|
473
|
+
return WXSTR_TO_RSTR(ts);
|
474
|
+
}
|
475
|
+
__HEREDOC
|
465
476
|
# add custom extension methods 'assign' as replacement for operator=
|
466
477
|
spec.add_extend_code 'wxVariant', <<~__HEREDOC
|
467
478
|
void assign(const wxVariant& v)
|
@@ -504,6 +515,7 @@ module WXRuby3
|
|
504
515
|
if (ts == wxS("ulonglong")) return ULL2NUM(self->GetULongLong().GetValue());
|
505
516
|
if (ts == wxS("double")) return rb_funcall(SWIG_From_double(self->GetDouble()), to_i_id(), 0);
|
506
517
|
if (ts == wxS("datetime")) return rb_funcall(wxRuby_wxDateTimeToRuby(self->GetDateTime()), to_i_id(), 0);
|
518
|
+
if (ts == WXRBValueVariantData::type_name_) return rb_funcall(((WXRBValueVariantData*)self->GetData())->GetValue(), to_i_id(), 0);
|
507
519
|
rb_raise(rb_eTypeError, "Cannot convert Variant<%s> to Integer", (const char*)ts.ToAscii());
|
508
520
|
return Qnil;
|
509
521
|
}
|
@@ -519,6 +531,7 @@ module WXRuby3
|
|
519
531
|
if (ts == wxS("ulonglong")) return rb_funcall(ULL2NUM(self->GetULongLong().GetValue()), to_f_id(), 0);
|
520
532
|
if (ts == wxS("double")) return SWIG_From_double(self->GetDouble());
|
521
533
|
if (ts == wxS("datetime")) return rb_funcall(wxRuby_wxDateTimeToRuby(self->GetDateTime()), to_f_id(), 0);
|
534
|
+
if (ts == WXRBValueVariantData::type_name_) return rb_funcall(((WXRBValueVariantData*)self->GetData())->GetValue(), to_f_id(), 0);
|
522
535
|
rb_raise(rb_eTypeError, "Cannot convert Variant<%s> to Integer", (const char*)ts.ToAscii());
|
523
536
|
return Qnil;
|
524
537
|
}
|
@@ -109,7 +109,7 @@ module WXRuby3
|
|
109
109
|
else
|
110
110
|
rb_param_name(paramdef.name)
|
111
111
|
end
|
112
|
-
params << { name: pnm, type: arg.type }
|
112
|
+
params << { name: pnm, type: arg.type || xml_trans.type_to_doc(paramdef.type) }
|
113
113
|
if paramdef.default
|
114
114
|
defexp = rb_constant_expression(paramdef.default, xml_trans.constants_xref_db)
|
115
115
|
# in case the default expression dereferences a pointer or passes an address clean it up
|
@@ -142,7 +142,7 @@ module WXRuby3
|
|
142
142
|
params.each do |p|
|
143
143
|
doclns << ('@param ' << p[:name] << ' [' << p[:type] << '] ' << (p[:doc] ? ' '+(p[:doc].split("\n").join("\n ")) : ''))
|
144
144
|
end
|
145
|
-
result = [rb_return_type(type_maps)]
|
145
|
+
result = [rb_return_type(type_maps, xml_trans)]
|
146
146
|
result.concat(mapped_ret_args.collect { |mra| mra.type }) if mapped_ret_args
|
147
147
|
result.compact! # remove nil values (possible ignored output)
|
148
148
|
case result.size
|
@@ -156,9 +156,9 @@ module WXRuby3
|
|
156
156
|
[rb_decl_name, paramlist, doclns]
|
157
157
|
end
|
158
158
|
|
159
|
-
def rb_return_type(type_maps)
|
160
|
-
mapped_type = type_maps.map_output(type)
|
161
|
-
|
159
|
+
def rb_return_type(type_maps, xml_trans)
|
160
|
+
mapped_type = type_maps.map_output(type) || xml_trans.type_to_doc(type)
|
161
|
+
mapped_type == 'void' ? nil : mapped_type
|
162
162
|
end
|
163
163
|
|
164
164
|
def argument_list
|
@@ -304,9 +304,9 @@ module WXRuby3
|
|
304
304
|
end
|
305
305
|
end
|
306
306
|
|
307
|
-
def rb_return_type(type_maps)
|
307
|
+
def rb_return_type(type_maps, xml_trans)
|
308
308
|
if is_ctor
|
309
|
-
|
309
|
+
xml_trans.type_to_doc(class_name)
|
310
310
|
else
|
311
311
|
super
|
312
312
|
end
|
@@ -80,9 +80,9 @@ module WXRuby3
|
|
80
80
|
ignore # ignore all member variables by default (trust on availability of accessor methods)
|
81
81
|
end
|
82
82
|
|
83
|
-
def rb_return_type(type_maps)
|
84
|
-
mapped_type = type_maps.map_output(type)
|
85
|
-
|
83
|
+
def rb_return_type(type_maps, xml_trans)
|
84
|
+
mapped_type = type_maps.map_output(type) || xml_trans.type_to_doc(type)
|
85
|
+
mapped_type == 'void' ? nil : mapped_type
|
86
86
|
end
|
87
87
|
private :rb_return_type
|
88
88
|
|
@@ -97,7 +97,7 @@ module WXRuby3
|
|
97
97
|
doc = []
|
98
98
|
# first document the reader
|
99
99
|
doc << [var_doc.dup]
|
100
|
-
doc.last << "@return [#{rb_return_type(type_maps)}]"
|
100
|
+
doc.last << "@return [#{rb_return_type(type_maps, xml_trans)}]"
|
101
101
|
doc << "def #{is_static ? 'self.' : ''}#{rb_method_name(rb_name || name)}; end"
|
102
102
|
# next document the writer (if any)
|
103
103
|
unless no_setter
|
@@ -108,9 +108,9 @@ module WXRuby3
|
|
108
108
|
array: false)]
|
109
109
|
mapped_args, _ = type_maps.map_input(parms)
|
110
110
|
if mapped_args.empty? # something went wrong!
|
111
|
-
doc.last << "@param val [#{
|
111
|
+
doc.last << "@param val [#{xml_trans.type_to_doc(type)}]"
|
112
112
|
else
|
113
|
-
doc.last << "@param val [#{mapped_args.first.type}]"
|
113
|
+
doc.last << "@param val [#{mapped_args.first.type || xml_trans.type_to_doc(type)}]"
|
114
114
|
end
|
115
115
|
doc.last << "@return [void]"
|
116
116
|
doc << "def #{is_static ? 'self.' : ''}#{rb_method_name(rb_name || name)}=(val); end"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
:wxAuiManager:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /AddPane/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@text1 = Wx::TextCtrl.new(self, -1)
|
11
|
+
@text2 = Wx::TextCtrl.new(self, -1)
|
12
|
+
@mgr.add_pane(@text1, Wx::LEFT, 'Pane Caption')
|
13
|
+
@mgr.add_pane(@text2, Wx::BOTTOM, 'Pane Caption')
|
14
|
+
@mgr.update
|
15
|
+
```
|
16
|
+
- :pattern: !ruby/regexp /GetPane/
|
17
|
+
:replace: |
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@mgr.get_pane(@text1).float
|
21
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:wxFont.wxFont:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /wxFontInfo/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
font = Wx::Font.new(Wx::FontInfo.new(10).bold().underlined())
|
11
|
+
```
|
12
|
+
- :pattern: !ruby/regexp /wxFONTFAMILY_DEFAULT/
|
13
|
+
:replace: |
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
font = Wx::Font.new(10, Wx::FontFamily::FONTFAMILY_DEFAULT,
|
17
|
+
Wx::FontStyle::FONTSTYLE_NORMAL,
|
18
|
+
Wx::FontWeight::FONTWEIGHT_BOLD, true)
|
19
|
+
```
|
20
|
+
:wxFontInfo:
|
21
|
+
:detail:
|
22
|
+
:pre:
|
23
|
+
:programlisting:
|
24
|
+
- :pattern: !ruby/regexp /.*/
|
25
|
+
:replace: |
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
font = Wx::Font.new(Wx::FontInfo.new(12).face_name('Helvetica').italic())
|
29
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
:wxFrame:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx::DEFAULT_FRAME_STYLE & ~(Wx::RESIZE_BORDER | Wx::MAXIMIZE_BOX)
|
11
|
+
```
|
12
|
+
:wxFrame.MSWGetTaskBarButton:
|
13
|
+
:detail:
|
14
|
+
:pre:
|
15
|
+
:programlisting:
|
16
|
+
- :pattern: !ruby/regexp /.*/
|
17
|
+
:replace: |
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
if Wx::PLATFORM == 'WXMSW'
|
21
|
+
#...
|
22
|
+
end
|
23
|
+
```
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
:wxPoint.SetDefaults:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
if !pos.is_fully_specified
|
11
|
+
pos.set_defaults(get_default_position)
|
12
|
+
end
|
13
|
+
```
|
14
|
+
:wxPoint.wxPoint:
|
15
|
+
:detail:
|
16
|
+
:pre:
|
17
|
+
:programlisting:
|
18
|
+
- :pattern: !ruby/regexp /.*/
|
19
|
+
:replace: |
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
real_point = ...
|
23
|
+
p = Wx::Point.new(real_point.x.round, real_point.y.round)
|
24
|
+
```
|
25
|
+
:wxSize.SetDefaults:
|
26
|
+
:detail:
|
27
|
+
:pre:
|
28
|
+
:programlisting:
|
29
|
+
- :pattern: !ruby/regexp /.*/
|
30
|
+
:replace: |
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
if !size.is_fully_specified
|
34
|
+
size.set_defaults(get_default_size)
|
35
|
+
end
|
36
|
+
```
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
:wxGraphicsContext:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyCanvas < Wx::ScrolledWindow
|
11
|
+
|
12
|
+
def on_paint(event)
|
13
|
+
# Create paint DC
|
14
|
+
self.paint do |dc|
|
15
|
+
# Create graphics context from it
|
16
|
+
Wx::GraphicsContext.draw_on(dc) do |gc|
|
17
|
+
# make a path that contains a circle and some lines
|
18
|
+
gc.set_pen(Wx::RED_PEN)
|
19
|
+
path = gc.create_path
|
20
|
+
path.add_circle(50.0, 50.0, 50.0)
|
21
|
+
path.move_to_point(0.0, 50.0)
|
22
|
+
path.add_line_to_point(100.0, 50.0)
|
23
|
+
path.move_to_point(50.0, 0.0)
|
24
|
+
path.add_line_to_point(50.0, 100.0)
|
25
|
+
path.close_sub_path
|
26
|
+
path.add_rectangle(25.0, 25.0, 50.0, 50.0)
|
27
|
+
|
28
|
+
gc.stroke_path(path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
:wxHelpController.SetViewer:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@help.set_viewer('kdehelp')
|
11
|
+
@help.set_viewer('gnome-help-browser')
|
12
|
+
@help.set_viewer('netscape', Wx::HELP_NETSCAPE)
|
13
|
+
```
|
14
|
+
:wxHelpController:
|
15
|
+
:detail:
|
16
|
+
:pre:
|
17
|
+
:para:
|
18
|
+
- :pattern: !ruby/regexp /Note\s+that\s+if\s+you\s+use\s+\.zip.*application\s+initialization:/
|
19
|
+
:subst: 'Note that in Ruby the required filesystem handlers for .zip or .htb books are always loaded.'
|
20
|
+
- :pattern: !ruby/regexp / or\s+nothing\s+will\s+be\s+shown\s+in\s+your\s+help\s+window./
|
21
|
+
:subst: ''
|
22
|
+
:programlisting:
|
23
|
+
- :pattern: !ruby/regexp /.*/
|
24
|
+
:replace: ''
|
@@ -0,0 +1,87 @@
|
|
1
|
+
---
|
2
|
+
:wxImage.Scale:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
# get the bitmap from somewhere
|
11
|
+
bmp = ...
|
12
|
+
|
13
|
+
# rescale it to have size of 32*32
|
14
|
+
if bmp.width != 32 || bmp.height != 32
|
15
|
+
image = bmp.convert_to_image
|
16
|
+
bmp = Wx::Bitmap.new(image.scale(32, 32))
|
17
|
+
|
18
|
+
# another possibility:
|
19
|
+
image.rescale(32, 32)
|
20
|
+
bmp = image.to_bitmap
|
21
|
+
end
|
22
|
+
```
|
23
|
+
:wxImage.LoadFile:
|
24
|
+
:detail:
|
25
|
+
:pre:
|
26
|
+
:programlisting:
|
27
|
+
- :pattern: !ruby/regexp /.*/
|
28
|
+
:replace: |
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
hotspot_x = image.get_option_int(Wx::IMAGE_OPTION_CUR_HOTSPOT_X)
|
32
|
+
hotspot_y = image.get_option_int(Wx::IMAGE_OPTION_CUR_HOTSPOT_Y)
|
33
|
+
```
|
34
|
+
:wxImage.SaveFile:
|
35
|
+
:detail:
|
36
|
+
:pre:
|
37
|
+
:programlisting:
|
38
|
+
- :pattern: !ruby/regexp /.*/
|
39
|
+
:replace: |
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
image.set_option(Wx::IMAGE_OPTION_CUR_HOTSPOT_X, hotspot_x)
|
43
|
+
image.set_option(Wx::IMAGE_OPTION_CUR_HOTSPOT_Y, hotspot_y)
|
44
|
+
```
|
45
|
+
:wxImage.SetLoadFlags:
|
46
|
+
:detail:
|
47
|
+
:pre:
|
48
|
+
:programlisting:
|
49
|
+
- :pattern: !ruby/regexp /.*/
|
50
|
+
:replace: |
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
image = Wx::Image.new
|
54
|
+
image.set_load_flags(image.get_load_flags & ~Wx::Image::Load_Verbose)
|
55
|
+
image.load_file(...)
|
56
|
+
```
|
57
|
+
:wxImage.wxImage:
|
58
|
+
:detail:
|
59
|
+
:pre:
|
60
|
+
:programlisting:
|
61
|
+
- :pattern: !ruby/regexp /.*/
|
62
|
+
:replace: |
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
hotspot_x = image.get_option_int(Wx::IMAGE_OPTION_CUR_HOTSPOT_X)
|
66
|
+
hotspot_y = image.get_option_int(Wx::IMAGE_OPTION_CUR_HOTSPOT_Y)
|
67
|
+
```
|
68
|
+
:wxImage.GetImageExtWildcard:
|
69
|
+
:detail:
|
70
|
+
:pre:
|
71
|
+
:programlisting:
|
72
|
+
- :pattern: !ruby/regexp /.*/
|
73
|
+
:replace: |
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
Wx::FileDialog(self, 'Choose Image', Dir.getwd, '',
|
77
|
+
'Image Files ' + Wx::Image.get_image_ext_wildcard,
|
78
|
+
Wx::FD_OPEN) do |file_dlg|
|
79
|
+
# ...
|
80
|
+
end
|
81
|
+
```
|
82
|
+
:wxImage:
|
83
|
+
:detail:
|
84
|
+
:pre:
|
85
|
+
:para:
|
86
|
+
- :pattern: !ruby/regexp /To\s+use\s+other\s+image\s+formats,.*or\s+call\s+.*\./
|
87
|
+
:subst: 'In wxRuby all image handlers are loaded by default at startup by {init_all_image_handlers}.'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:wxKeyboardState.GetModifiers:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /ControlDown/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
if control_down && !alt_down && !shift_down && !meta_down
|
11
|
+
... handle Ctrl-XXX ...
|
12
|
+
```
|
13
|
+
- :pattern: !ruby/regexp /GetModifiers/
|
14
|
+
:replace: |
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
if get_modifiers == Wx::MOD_CONTROL
|
18
|
+
... handle Ctrl-XXX ...
|
19
|
+
```
|
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
:wxListCtrl.GetNextItem:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
item = -1
|
11
|
+
while (item = list_ctrl.get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)) != -1
|
12
|
+
# item is selected - do whatever is needed with it
|
13
|
+
Wx.log_message("Item #{item} is selected.")
|
14
|
+
end
|
15
|
+
|
16
|
+
# alternatively in wxRuby you could do
|
17
|
+
list_ctrl.each_selected do |item|
|
18
|
+
Wx.log_message("Item #{item} is selected.")
|
19
|
+
end
|
20
|
+
```
|
21
|
+
:wxListCtrl.SetItemState:
|
22
|
+
:detail:
|
23
|
+
:pre:
|
24
|
+
:programlisting:
|
25
|
+
- :pattern: !ruby/regexp /item.*wxLIST_STATE_SELECTED.*wxLIST_STATE_SELECTED/
|
26
|
+
:replace: |
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
list.set_item_state(item, Wx::LIST_STATE_SELECTED, Wx::LIST_STATE_SELECTED)
|
30
|
+
```
|
31
|
+
- :pattern: !ruby/regexp /item.*0.*wxLIST_STATE_SELECTED/
|
32
|
+
:replace: |
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
list.set_item_state(item, 0, Wx::LIST_STATE_SELECTED)
|
36
|
+
```
|
37
|
+
:wxListCtrl.GetUpdatedAscendingSortIndicator:
|
38
|
+
:detail:
|
39
|
+
:pre:
|
40
|
+
:programlisting:
|
41
|
+
- :pattern: !ruby/regexp /.*/
|
42
|
+
:replace: |
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
class MyListCtrl
|
46
|
+
|
47
|
+
def on_col_click(event)
|
48
|
+
col = event.column
|
49
|
+
if col == -1
|
50
|
+
return # clicked outside any column.
|
51
|
+
|
52
|
+
ascending = get_updated_ascending_sort_indicator(col)
|
53
|
+
sort_items(ascending) { |itm1_data, itm2_data, data| ... }
|
54
|
+
show_sort_indicator(col, ascending)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
```
|
59
|
+
:wxListCtrl:
|
60
|
+
:detail:
|
61
|
+
:pre:
|
62
|
+
:programlisting:
|
63
|
+
- :pattern: !ruby/regexp /.*/
|
64
|
+
:replace: |
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
list = Wx::ListCtrl.new(...)
|
68
|
+
3.times { |i| list.insert_column(i, "Column #{i}") }
|
69
|
+
|
70
|
+
order = [2, 0, 1]
|
71
|
+
list.set_columns_order(order)
|
72
|
+
|
73
|
+
# now list.get_columns_order() will return order and
|
74
|
+
# list.get_column_index_from_order(n) will return order[n] and
|
75
|
+
# list.get_column_order() will return 1, 2 and 0 for the column 0,
|
76
|
+
# 1 and 2 respectively
|
77
|
+
```
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:wxLocale:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: ''
|
8
|
+
- :pattern: !ruby/regexp /.*/
|
9
|
+
:replace: ''
|
10
|
+
:para:
|
11
|
+
- :pattern: !ruby/regexp /If\s+you\s+need\s+to\s+translate\s+a\s+lot\s+of\s+strings.*/
|
12
|
+
:replace: ''
|