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
@@ -0,0 +1,86 @@
|
|
1
|
+
---
|
2
|
+
:wxLog.SetComponentLevel:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
wxLog.set_component_level("wx/net", Wx::LOG_Error)
|
11
|
+
```
|
12
|
+
:wxLog.LogRecord:
|
13
|
+
:detail:
|
14
|
+
:pre:
|
15
|
+
:programlisting:
|
16
|
+
- :pattern: !ruby/regexp /.*/
|
17
|
+
:replace: |
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class Wx::LogChain
|
21
|
+
|
22
|
+
def do_log_record(level, msg, info)
|
23
|
+
# let the previous logger show it
|
24
|
+
if m_logOld && is_passing_messages
|
25
|
+
m_logOld.log_record(level, msg, info)
|
26
|
+
|
27
|
+
# and also send it to the new one
|
28
|
+
if m_logNew && m_logNew != self
|
29
|
+
m_logNew.log_record(level, msg, info)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
```
|
34
|
+
:wxLogChain:
|
35
|
+
:detail:
|
36
|
+
:pre:
|
37
|
+
:programlisting:
|
38
|
+
- :pattern: !ruby/regexp /.*/
|
39
|
+
:replace: |
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
logChain = Wx::LogChain.new(Wx::LogStderr.new)
|
43
|
+
|
44
|
+
# all the log messages are sent to stderr and also processed as usually
|
45
|
+
...
|
46
|
+
```
|
47
|
+
:wxLogNull:
|
48
|
+
:detail:
|
49
|
+
:pre:
|
50
|
+
:programlisting:
|
51
|
+
- :pattern: !ruby/regexp /wxFile.Open/
|
52
|
+
:replace: |
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
mime_type = ... # retrieved from somewhere
|
56
|
+
img = Wx::Image.new
|
57
|
+
Wx::LogNull.no_log do # suspend logging
|
58
|
+
|
59
|
+
|
60
|
+
# Wx::Image#load_stream will complain if there is no handler for the given mimetype and fail
|
61
|
+
if !img.load_stream(File.open('file.img'), mime_type)
|
62
|
+
# handle problem
|
63
|
+
end
|
64
|
+
|
65
|
+
end # old log sink restored
|
66
|
+
|
67
|
+
Wx.log_message('...') # ok
|
68
|
+
```
|
69
|
+
- :pattern: !ruby/regexp /wxFile::Exists/
|
70
|
+
:replace: |
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
mime_type = ... # retrieved from somewhere
|
74
|
+
|
75
|
+
# check the condition that makes your code complain
|
76
|
+
if Wx::Image.mime_types.include?(mime_type)
|
77
|
+
img.load_stream(File.open('file.img'), mime_type)
|
78
|
+
...
|
79
|
+
else
|
80
|
+
# do something else
|
81
|
+
...
|
82
|
+
end
|
83
|
+
```
|
84
|
+
:para:
|
85
|
+
- :pattern: !ruby/regexp /thread-safe/
|
86
|
+
:replace: ''
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
:wxMemoryDC:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /\(test_bitmap\);/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx::MemoryDC.draw_on(test_bitmap) do |mem_dc|
|
11
|
+
# We can now draw into the memory DC...
|
12
|
+
|
13
|
+
# Copy from this DC to another DC.
|
14
|
+
old_dc.blit(250, 50, BITMAP_WIDTH, BITMAP_HEIGHT, mem_dc, 0, 0)
|
15
|
+
end
|
16
|
+
```
|
17
|
+
- :pattern: !ruby/regexp /wxNullBitmap/
|
18
|
+
:replace: ''
|
19
|
+
- :pattern: !ruby/regexp /MyWindow::OnPaint/
|
20
|
+
:replace: |
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
class MyWindow
|
24
|
+
|
25
|
+
def on_paint(_)
|
26
|
+
bmp = Wx::Bitmap.new
|
27
|
+
bmp.create_with_dip_size(get_client_size, get_dpi_scale_factor)
|
28
|
+
Wx::MemoryDC.draw_on(bmp) do |mem_dc|
|
29
|
+
... use mem_dc to draw on the bitmap ...
|
30
|
+
end
|
31
|
+
self.paint do |dc|
|
32
|
+
dc.draw_bitmap(bmp, Wx::Point.new(0, 0))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
```
|
38
|
+
:para:
|
39
|
+
- :pattern: !ruby/regexp /out of the memory DC:/
|
40
|
+
:subst: 'out of the memory DC. Note that when using the `.draw_on` method this will happen automatically when the block returns.'
|
41
|
+
- :pattern: !ruby/regexp /This\s+happens\s+automatically.*goes\s+out\s+of\s+scope\./
|
42
|
+
:replace: ''
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:wxMenu.Append:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /ID_NEW_FILE/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
file_menu.append(ID_NEW_FILE, "&New file\tCTRL+N", "Creates a new XYZ document")
|
11
|
+
```
|
12
|
+
- :pattern: !ruby/regexp /wxID_NEW/
|
13
|
+
:replace: |
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
file_menu.append(Wx::ID_NEW, "", "Creates a new XYZ document")
|
17
|
+
```
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
:wxMenuItem.SetItemLabel:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@my_menu_item.set_item_label("My &item\tCTRL+I")
|
11
|
+
@my_menu_item2.set_item_label("Clean && build\tF7")
|
12
|
+
@my_menu_item3.set_item_label("Simple item")
|
13
|
+
@my_menu_item4.set_item_label("Item with &accelerator")
|
14
|
+
```
|
15
|
+
:wxMenuItem.wxMenuItem:
|
16
|
+
:detail:
|
17
|
+
:pre:
|
18
|
+
:programlisting:
|
19
|
+
- :pattern: !ruby/regexp /.*/
|
20
|
+
:replace: |
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# use all stock properties:
|
24
|
+
helpMenu.append(wxID_ABOUT)
|
25
|
+
|
26
|
+
# use the stock label and the stock accelerator but not the stock help string:
|
27
|
+
helpMenu.append(Wx::ID_ABOUT, "", "My custom help string")
|
28
|
+
|
29
|
+
# use all stock properties except for the bitmap:
|
30
|
+
mymenu = Wx::MenuItem.new(helpMenu, Wx::ID_ABOUT)
|
31
|
+
mymenu.set_bitmap(Wx::ArtProvider.get_bitmap(Wx::ART_WARNING))
|
32
|
+
helpMenu.append(mymenu)
|
33
|
+
```
|
34
|
+
:wxMenuItem.GetLabelText:
|
35
|
+
:detail:
|
36
|
+
:pre:
|
37
|
+
:programlisting:
|
38
|
+
- :pattern: !ruby/regexp /.*/
|
39
|
+
:replace: |
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
Wx::MenuItem.get_label_text("&Hello\tCtrl-h")
|
43
|
+
```
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
:wxMessageDialog.SetYesNoLabels:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /wxID_SAVE/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx.MessageDialog(...) do |dlg|
|
11
|
+
dlg.set_yes_no_labels(Wx::ID_SAVE, "&Don't save")
|
12
|
+
end
|
13
|
+
```
|
14
|
+
- :pattern: !ruby/regexp /Quit/
|
15
|
+
:replace: |
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Wx.MessageDialog(...) do |dlg|
|
19
|
+
if dlg.set_yes_no_labels("&Quit, "&Don't quit")
|
20
|
+
dlg.set_message('What do you want to do?')
|
21
|
+
else # buttons have standard "Yes"/"No" values, so rephrase the question
|
22
|
+
dlg.set_message('Do you really want to quit?')
|
23
|
+
end
|
24
|
+
```
|
25
|
+
:wxMessageBox:
|
26
|
+
:detail:
|
27
|
+
:pre:
|
28
|
+
:programlisting:
|
29
|
+
- :pattern: !ruby/regexp /.*/
|
30
|
+
:replace: |
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
answer = Wx.message_box("Quit program?", "Confirm",
|
34
|
+
Wx::YES_NO | Wx::CANCEL, main_frame)
|
35
|
+
main_frame.close if answer == Wx::YES
|
36
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
:wxNonOwnedWindow.SetShape:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
size = get_size
|
11
|
+
path = Wx::GraphicsRenderer.get_default_renderer.create_path
|
12
|
+
path.add_circle(size.x/2, size.y/2, 30)
|
13
|
+
set_shape(path)
|
14
|
+
```
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:wxNotebook:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /wxSystemOptions/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx::SystemOptions.set_option("msw.notebook.themed-background", 0)
|
11
|
+
```
|
12
|
+
- :pattern: !ruby/regexp /GetThemeBackgroundColour/
|
13
|
+
:replace: |
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
col = notebook.get_theme_background_colour
|
17
|
+
page.set_background_colour(col) if col.ok?
|
18
|
+
```
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:wxPickerBase.GetPickerCtrl:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
if Wx::PLATFORM == 'WXMSW'
|
11
|
+
# wxMSW is one of the platforms where the generic implementation
|
12
|
+
# of Wx::FilePickerCtrl is used...
|
13
|
+
|
14
|
+
butt = myFilePickerCtrl.get_picker_ctrl
|
15
|
+
if butt
|
16
|
+
butt.set_label("Custom browse string")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:wxPlatformInfo:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:para:
|
6
|
+
- :pattern: !ruby/regexp /In\s+general\s+however\s+you\s+only\s+need\s+to\s+use\s+the\s+static.*for\s+the\s+current\s+platform:/
|
7
|
+
:subst: 'In general however you only need to use the static {Wx::PlatformInfo.instance} method and then access the various information for the current platform:'
|
8
|
+
:programlisting:
|
9
|
+
- :pattern: !ruby/regexp /.*/
|
10
|
+
:replace: |
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
Wx.log_message("This application is running under %s.",
|
14
|
+
Wx::PlatformInfo.instance.get_operating_system_id_name)
|
15
|
+
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
:wxPropertySheetDialog:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyPropertySheetDialog < Wx::PropertySheetDialog
|
11
|
+
|
12
|
+
def create(...)
|
13
|
+
return false if !super
|
14
|
+
|
15
|
+
create_buttons(Wx::OK|Wx::CANCEL|Wx::HELP)
|
16
|
+
|
17
|
+
# Add page
|
18
|
+
panel = Wx::Panel.new(get_book_ctrl, ...)
|
19
|
+
get_book_ctrl.add_page(panel, "General")
|
20
|
+
|
21
|
+
layout_dialog
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
```
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
:wxScrolled.DoPrepareDC:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyWindow < Wx::ScrolledCanvas
|
11
|
+
|
12
|
+
def on_event(event)
|
13
|
+
Wx::ClientDC.draw_on(self) do |dc|
|
14
|
+
do_prepare_dc(dc)
|
15
|
+
|
16
|
+
dc.set_pen(Wx::BLACK_PEN)
|
17
|
+
pos = event.position
|
18
|
+
if xpos > -1 && ypos > -1 && event.dragging
|
19
|
+
dc.draw_line(xpos, ypos, pos.x, pos.y)
|
20
|
+
end
|
21
|
+
xpos = pos.x
|
22
|
+
ypos = pos.y
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
```
|
28
|
+
:wxScrolled.SetScrollbars:
|
29
|
+
:detail:
|
30
|
+
:pre:
|
31
|
+
:programlisting:
|
32
|
+
- :pattern: !ruby/regexp /.*/
|
33
|
+
:replace: |
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
window.set_scrollbars(20, 20, 50, 50)
|
37
|
+
```
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
:wxScrolled.DoPrepareDC:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyWindow < Wx::ScrolledControl
|
11
|
+
|
12
|
+
def on_event(event)
|
13
|
+
Wx::ClientDC.draw_on(self) do |dc|
|
14
|
+
do_prepare_dc(dc)
|
15
|
+
|
16
|
+
dc.set_pen(Wx::BLACK_PEN)
|
17
|
+
pos = event.position
|
18
|
+
if xpos > -1 && ypos > -1 && event.dragging
|
19
|
+
dc.draw_line(xpos, ypos, pos.x, pos.y)
|
20
|
+
end
|
21
|
+
xpos = pos.x
|
22
|
+
ypos = pos.y
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
```
|
28
|
+
:wxScrolled.SetScrollbars:
|
29
|
+
:detail:
|
30
|
+
:pre:
|
31
|
+
:programlisting:
|
32
|
+
- :pattern: !ruby/regexp /.*/
|
33
|
+
:replace: |
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
window.set_scrollbars(20, 20, 50, 50)
|
37
|
+
```
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
:wxScrolled.DoPrepareDC:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyWindow < Wx::ScrolledWindow
|
11
|
+
|
12
|
+
def on_event(event)
|
13
|
+
Wx::ClientDC.draw_on(self) do |dc|
|
14
|
+
do_prepare_dc(dc)
|
15
|
+
|
16
|
+
dc.set_pen(Wx::BLACK_PEN)
|
17
|
+
pos = event.position
|
18
|
+
if xpos > -1 && ypos > -1 && event.dragging
|
19
|
+
dc.draw_line(xpos, ypos, pos.x, pos.y)
|
20
|
+
end
|
21
|
+
xpos = pos.x
|
22
|
+
ypos = pos.y
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
```
|
28
|
+
:wxScrolled.SetScrollbars:
|
29
|
+
:detail:
|
30
|
+
:pre:
|
31
|
+
:programlisting:
|
32
|
+
- :pattern: !ruby/regexp /.*/
|
33
|
+
:replace: |
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
window.set_scrollbars(20, 20, 50, 50)
|
37
|
+
```
|
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
:wxSizer.AddSpacer:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx::Sizer::add(size, size, 0)
|
11
|
+
```
|
12
|
+
:wxSizer.AddStretchSpacer:
|
13
|
+
:detail:
|
14
|
+
:pre:
|
15
|
+
:programlisting:
|
16
|
+
- :pattern: !ruby/regexp /.*/
|
17
|
+
:replace: |
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
Wx::Sizer::add(0, 0, prop)
|
21
|
+
```
|
22
|
+
:wxSizer.SetSizeHints:
|
23
|
+
:detail:
|
24
|
+
:pre:
|
25
|
+
:programlisting:
|
26
|
+
- :pattern: !ruby/regexp /.*/
|
27
|
+
:replace: |
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
class MyFrame < Wx::Frame
|
31
|
+
def initialize(...)
|
32
|
+
super
|
33
|
+
panel = Wx::Panel.new(self)
|
34
|
+
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
35
|
+
sizer.add(...)
|
36
|
+
sizer.add(...)
|
37
|
+
panel.set_sizer(sizer)
|
38
|
+
|
39
|
+
# Use the panel sizer to set the initial and minimal size of the
|
40
|
+
# frame to fit its contents.
|
41
|
+
sizer.set_size_hints(this)
|
42
|
+
end
|
43
|
+
```
|
44
|
+
:wxSizerFlags:
|
45
|
+
:detail:
|
46
|
+
:pre:
|
47
|
+
:programlisting:
|
48
|
+
- :pattern: !ruby/regexp /wxEXPAND/
|
49
|
+
:replace: |
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
sizer.add(ctrl, 0, Wx::EXPAND | Wx::ALL, 10)
|
53
|
+
```
|
54
|
+
- :pattern: !ruby/regexp /wxSizerFlags.*\(\)/
|
55
|
+
:replace: |
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
sizer.add(ctrl, Wx::SizerFlags.new.expand.border(Wx::ALL, 10))
|
59
|
+
```
|
60
|
+
- :pattern: !ruby/regexp /flagsExpand/
|
61
|
+
:replace: |
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
flagsExpand = Wx::SizerFlags.new(1)
|
65
|
+
flagsExpand.expand.border(Wx::ALL, 10)
|
66
|
+
|
67
|
+
sizer.add(ctrl1, flagsExpand)
|
68
|
+
sizer.add(ctrl2, flagsExpand)
|
69
|
+
```
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:wxSplashScreen:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
bitmap Wx::Bitmap.new
|
11
|
+
if bitmap.load_file("splash16.png", Wx::BITMAP_TYPE_PNG))
|
12
|
+
splash = Wx::SplashScreen.new(bitmap,
|
13
|
+
Wx::SPLASH_CENTRE_ON_SCREEN|Wx::SPLASH_TIMEOUT,
|
14
|
+
6000, nil, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
15
|
+
Wx::BORDER_SIMPLE|Wx::STAY_ON_TOP)
|
16
|
+
end
|
17
|
+
Wx.get_app.yield
|
18
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
:wxStaticBox.wxStaticBox:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyFrame < Wx::Frame
|
11
|
+
|
12
|
+
def create_controls
|
13
|
+
panel = Wx::Panel.new(self)
|
14
|
+
checkbox = Wx::CheckBox.new(panel, Wx::ID_ANY, "Box checkbox")
|
15
|
+
box = Wx::StaticBox.new(panel, Wx::ID_ANY, checkbox)
|
16
|
+
...
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
```
|
21
|
+
:wxStaticBox.Enable:
|
22
|
+
:detail:
|
23
|
+
:pre:
|
24
|
+
:programlisting:
|
25
|
+
- :pattern: !ruby/regexp /.*/
|
26
|
+
:replace: |
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
check = Wx::CheckBox.new(parent, Wx::ID_ANY, "Use the box")
|
30
|
+
box = Wx::StaticBox.new(parent, Wx::ID_ANY, check)
|
31
|
+
check.evt_checkbox { |event| box.enable(event.checked? }
|
32
|
+
```
|
33
|
+
:wxStaticBox:
|
34
|
+
:detail:
|
35
|
+
:pre:
|
36
|
+
:programlisting:
|
37
|
+
- :pattern: !ruby/regexp /.*/
|
38
|
+
:replace: |
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
class MyFrame < Wx::Frame
|
42
|
+
|
43
|
+
def create_controls
|
44
|
+
panel = Wx::Panel.new(self)
|
45
|
+
box = Wx::StaticBox.new(panel, Wx::ID_ANY, 'StaticBox')
|
46
|
+
|
47
|
+
Wx::StaticText.new(box, Wx::ID_ANY, "This window is a child of the staticbox")
|
48
|
+
...
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
```
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:wxStaticBoxSizer:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyFrame < Wx::Frame
|
11
|
+
|
12
|
+
def create_controls
|
13
|
+
panel = Wx::Panel.new(self)
|
14
|
+
...
|
15
|
+
sz = Wx::StaticBoxSizer.new(Wx::VERTICAL, panel, "Box")
|
16
|
+
sz.add(Wx::StaticText.new(sz.get_static_box, Wx::ID_ANY,
|
17
|
+
"This window is a child of the staticbox"))
|
18
|
+
...
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
```
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:wxTextCtrl:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /SetDefaultStyle.*wxRED/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
text.set_default_style(Wx::TextAttr.new(Wx::RED))
|
11
|
+
text.append_text("Red text\n")
|
12
|
+
text.set_default_style(Wx::TextAttr.new(Wx::NULL_COLOUR, Wx::LIGHT_GREY))
|
13
|
+
text.append_text("Red on grey text\n")
|
14
|
+
text.set_default_style(Wx::TextAttr.new(Wx::BLUE))
|
15
|
+
text.append_text("Blue on grey text\n")
|
16
|
+
```
|
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
|
19
|
+
:subst: ''
|