wxruby3 0.9.0.pre.beta.14 → 0.9.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +47 -4
- data/assets/hello_button.png +0 -0
- data/assets/hello_button_clicked.png +0 -0
- data/assets/hello_world.png +0 -0
- data/assets/repo-social-preview.png +0 -0
- data/ext/wxruby3/include/wxruby-runtime.h +1 -0
- data/ext/wxruby3/swig/memory_management.i +6 -10
- data/ext/wxruby3/swig/wx.i +17 -6
- data/lib/wx/core/art_locator.rb +2 -2
- data/lib/wx/core/artprovider.rb +2 -2
- data/lib/wx/core/bitmap.rb +6 -5
- data/lib/wx/core/bitmap_combobox.rb +34 -0
- data/lib/wx/core/controlwithitems.rb +52 -14
- data/lib/wx/core/cursor.rb +1 -1
- data/lib/wx/core/dc.rb +0 -20
- data/lib/wx/core/event_blocker.rb +14 -0
- data/lib/wx/core/evthandler.rb +36 -0
- data/lib/wx/core/find_replace_dialog.rb +24 -0
- data/lib/wx/core/icon.rb +1 -1
- data/lib/wx/core/image.rb +1 -1
- data/lib/wx/core/paintdc.rb +8 -0
- data/lib/wx/core/text_entry.rb +15 -0
- data/lib/wx/core/v_list_box.rb +13 -0
- data/lib/wx/core/window.rb +1 -1
- data/lib/wx/doc/busy_info.rb +21 -0
- data/lib/wx/doc/client_dc.rb +28 -0
- data/lib/wx/doc/controlwithitems.rb +11 -0
- data/lib/wx/doc/dc.rb +0 -14
- data/lib/wx/doc/event_blocker.rb +27 -0
- data/lib/wx/doc/evthandler.rb +4 -0
- data/lib/wx/doc/extra/02_lifecycles.md +49 -0
- data/lib/wx/doc/extra/10_art.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
- data/lib/wx/doc/memory_dc.rb +75 -0
- data/lib/wx/doc/mirror_dc.rb +16 -0
- data/lib/wx/doc/prt/printer_dc.rb +26 -0
- data/lib/wx/doc/screen_dc.rb +10 -6
- data/lib/wx/doc/svg_file_dc.rb +20 -0
- data/lib/wx/doc/v_list_box.rb +9 -0
- data/lib/wx/doc/window_disabler.rb +10 -0
- data/lib/wx/html/keyword_defs.rb +6 -7
- data/lib/wx/html/require.rb +1 -0
- data/lib/wx/html/simple_html_listbox.rb +105 -0
- data/lib/wx/keyword_defs.rb +7 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/rakelib/install.rb +3 -1
- data/rakelib/lib/core/mapping.rb +5 -5
- data/rakelib/lib/core/spec.rb +7 -3
- data/rakelib/lib/core/spec_helper.rb +9 -1
- data/rakelib/lib/director/accelerator.rb +1 -1
- data/rakelib/lib/director/app.rb +25 -3
- data/rakelib/lib/director/art_provider.rb +5 -1
- data/rakelib/lib/director/aui_pane_info.rb +1 -1
- data/rakelib/lib/director/aui_tab_ctrl.rb +1 -1
- data/rakelib/lib/director/bitmap.rb +2 -1
- data/rakelib/lib/director/bitmap_combobox.rb +32 -0
- data/rakelib/lib/director/brush.rb +1 -0
- data/rakelib/lib/director/busy_info.rb +1 -1
- data/rakelib/lib/director/choice.rb +1 -0
- data/rakelib/lib/director/clipboard.rb +1 -1
- data/rakelib/lib/director/colour.rb +1 -0
- data/rakelib/lib/director/colour_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/combobox.rb +1 -2
- data/rakelib/lib/director/ctrl_with_items.rb +3 -0
- data/rakelib/lib/director/cursor.rb +1 -0
- data/rakelib/lib/director/data_object.rb +5 -7
- data/rakelib/lib/director/dc.rb +5 -1
- data/rakelib/lib/director/defs.rb +3 -0
- data/rakelib/lib/director/derived_dc.rb +278 -27
- data/rakelib/lib/director/dialog.rb +4 -1
- data/rakelib/lib/director/dir_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/event.rb +3 -3
- data/rakelib/lib/director/event_blocker.rb +41 -0
- data/rakelib/lib/director/event_filter.rb +20 -0
- data/rakelib/lib/director/event_handler.rb +29 -2
- data/rakelib/lib/director/file_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/find_replace_data.rb +1 -0
- data/rakelib/lib/director/font.rb +2 -1
- data/rakelib/lib/director/font_data.rb +1 -0
- data/rakelib/lib/director/font_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/gdi_object.rb +1 -0
- data/rakelib/lib/director/graphics_context.rb +6 -6
- data/rakelib/lib/director/grid_table_message.rb +1 -1
- data/rakelib/lib/director/html_cell.rb +1 -1
- data/rakelib/lib/director/html_data_object.rb +5 -7
- data/rakelib/lib/director/html_listbox.rb +65 -1
- data/rakelib/lib/director/icon.rb +2 -0
- data/rakelib/lib/director/listbox.rb +1 -0
- data/rakelib/lib/director/locale.rb +2 -1
- data/rakelib/lib/director/palette.rb +1 -0
- data/rakelib/lib/director/pen.rb +2 -1
- data/rakelib/lib/director/pgproperties.rb +1 -1
- data/rakelib/lib/director/pgproperty.rb +1 -1
- data/rakelib/lib/director/pgvalidation_info.rb +1 -1
- data/rakelib/lib/director/platform_info.rb +1 -1
- data/rakelib/lib/director/print_data.rb +1 -1
- data/rakelib/lib/director/property_grid_interface.rb +1 -1
- data/rakelib/lib/director/property_grid_page_state.rb +1 -1
- data/rakelib/lib/director/region.rb +1 -0
- data/rakelib/lib/director/ribbon_art_provider.rb +1 -1
- data/rakelib/lib/director/richtext_buffer_data_object.rb +5 -7
- data/rakelib/lib/director/richtext_header_footer_data.rb +1 -1
- data/rakelib/lib/director/searchctrl.rb +24 -0
- data/rakelib/lib/director/sizer.rb +2 -2
- data/rakelib/lib/director/styled_text_ctrl.rb +2 -0
- data/rakelib/lib/director/text_entry.rb +2 -2
- data/rakelib/lib/director/tree_ctrl.rb +6 -3
- data/rakelib/lib/director/uiaction_simulator.rb +20 -0
- data/rakelib/lib/director/variant.rb +1 -1
- data/rakelib/lib/director/vlistbox.rb +25 -0
- data/rakelib/lib/director/window.rb +0 -6
- data/rakelib/lib/director/with_images.rb +1 -1
- data/rakelib/lib/director/xml_node.rb +1 -1
- data/rakelib/lib/extractor/function.rb +5 -3
- data/rakelib/lib/generate/doc/about_dialog_info.yaml +46 -0
- data/rakelib/lib/generate/doc/accelerator.yaml +21 -0
- data/rakelib/lib/generate/doc/art_provider.yaml +35 -0
- data/rakelib/lib/generate/doc/bitmap.yaml +37 -0
- data/rakelib/lib/generate/doc/box_sizer.yaml +15 -0
- data/rakelib/lib/generate/doc/busy_info.yaml +74 -0
- data/rakelib/lib/generate/doc/client_dc.yaml +19 -0
- data/rakelib/lib/generate/doc/clipboard.yaml +43 -0
- data/rakelib/lib/generate/doc/collapsible_pane.yaml +21 -0
- data/rakelib/lib/generate/doc/colour_dialog.yaml +32 -0
- data/rakelib/lib/generate/doc/control.yaml +46 -0
- data/rakelib/lib/generate/doc/cursor.yaml +40 -0
- data/rakelib/lib/generate/doc/data_object.yaml +55 -0
- data/rakelib/lib/generate/doc/dc.yaml +14 -0
- data/rakelib/lib/generate/doc/dialog.yaml +36 -0
- data/rakelib/lib/generate/doc/dir_dialog.yaml +25 -0
- data/rakelib/lib/generate/doc/events.yaml +152 -0
- data/rakelib/lib/generate/doc/evt_handler.yaml +63 -0
- data/rakelib/lib/generate/doc.rb +76 -13
- data/rakelib/lib/generate/interface.rb +11 -0
- data/rakelib/lib/specs/interfaces.rb +5 -4
- data/rakelib/lib/swig_runner.rb +3 -3
- data/rakelib/lib/typemap/common.rb +15 -3
- data/rakelib/lib/util/string.rb +1 -0
- data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
- data/samples/bigdemo/wxArtProvider.rbw +5 -4
- data/samples/controls/controls.rb +2 -2
- data/samples/controls/htlbox.rb +411 -0
- data/samples/controls/tn_htlbox.png +0 -0
- data/samples/drawing/graphics_drawing.rb +1 -2
- data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
- data/samples/drawing/tn_image_prt.png +0 -0
- data/samples/propgrid/propgrid.rb +23 -21
- data/samples/ribbon/ribbon.rb +47 -46
- data/tests/lib/wxapp_runner.rb +3 -3
- data/tests/lib/wxframe_runner.rb +59 -0
- data/tests/test_app_event_filter.rb +74 -0
- data/tests/test_art_provider.rb +52 -0
- data/tests/test_clipboard.rb +2 -1
- data/tests/test_event_handling.rb +199 -16
- data/tests/test_events.rb +4 -11
- data/tests/test_gdi_object.rb +161 -0
- data/tests/test_intl.rb +11 -14
- data/tests/test_item_data.rb +33 -1
- data/tests/test_std_controls.rb +147 -0
- metadata +56 -4
- data/samples/drawing/tn_svgtest.png +0 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
class Wx::ControlWithItems
|
3
|
+
|
4
|
+
# Returns true if the items in the control are sorted
|
5
|
+
# (style Wx::LB_SORT for list boxes or Wx::CB_SORT for combo boxes).
|
6
|
+
# This method is mostly meant for internal use only.
|
7
|
+
# @return [Boolean] true is sorted, false otherwise
|
8
|
+
def is_sorted; end
|
9
|
+
alias :sorted? :is_sorted
|
10
|
+
|
11
|
+
end
|
data/lib/wx/doc/dc.rb
CHANGED
@@ -49,18 +49,4 @@ module Wx
|
|
49
49
|
|
50
50
|
end
|
51
51
|
|
52
|
-
class MemoryDC
|
53
|
-
|
54
|
-
# Creates a Memory DC and passes that to the given block to draw on.
|
55
|
-
# Automatically unselects any source object of the MemoryDC after the block finishes.
|
56
|
-
# @overload self.draw_on(bitmap)
|
57
|
-
# @param [Wx::Bitmap]
|
58
|
-
# @yieldparam [WxMemoryDC] dc
|
59
|
-
# @overload self.draw_on(dc)
|
60
|
-
# @param [Wx::DC]
|
61
|
-
# @yieldparam [WxMemoryDC] dc
|
62
|
-
def self.draw_on(arg, &block) end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
52
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class EventBlocker
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
# Constructs the blocker for the given window and for the given event type and passes the blocker to the
|
9
|
+
# given block. The blocker is destroyed after the block returns.
|
10
|
+
#
|
11
|
+
# If type is Wx::EVT_ANY, then all events for that window are blocked. You can call #block after creation to
|
12
|
+
# add other event types to the list of events to block.
|
13
|
+
#
|
14
|
+
# @note Note that the win window must remain alive until the given block returns (i.e. until Wx::EventBlocker's
|
15
|
+
# object destruction).
|
16
|
+
# @param [Wx::Window] win the window to block events for
|
17
|
+
# @param [Integer] evt_type the event type to block
|
18
|
+
# @yieldparam [Wx::EventBlocker] blkr the blocker object
|
19
|
+
# @return [Object] the value returned by the block
|
20
|
+
def blocked_for(win, evt_type=Wx::EVT_ANY) end
|
21
|
+
alias :block_for :blocked_for
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/wx/doc/evthandler.rb
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
|
4
4
|
class Wx::EvtHandler
|
5
5
|
|
6
|
+
# Removes all (Ruby) installed EventFilter-s.
|
7
|
+
# @return [void]
|
8
|
+
def self.clear_filters; end
|
9
|
+
|
6
10
|
# Public method to register the mapping of a custom event type
|
7
11
|
# +konstant+ (which should be a unique integer; one will be created if
|
8
12
|
# not supplied) to a custom event class +klass+. If +meth+ and +arity+
|
@@ -114,3 +114,52 @@ destroy these on a regular basis when not used (closed) possibly re-creating the
|
|
114
114
|
|
115
115
|
Dialogs are special cases of toplevel windows which are not automatically destroyed when closed. The wxRuby library
|
116
116
|
therefor provides special support to ease handling the destruction of these. See [here](03_dialogs.md) for more details.
|
117
|
+
|
118
|
+
## Object identities
|
119
|
+
|
120
|
+
One of the trickier things to handle correctly in the kind of native extensions like wxRuby is maintaining object
|
121
|
+
identities i.e. keeping native instances synced with their Ruby wrapper counter parts.
|
122
|
+
|
123
|
+
Whenever a native extension is allowed to call back into Ruby space we encounter the problem the we need to map any
|
124
|
+
native object data provided for the call to the right Ruby types and when necessary to the right Ruby instance (object
|
125
|
+
identity).
|
126
|
+
|
127
|
+
Objects that are considered POD types (*plain old data* types) like numerics, booleans, strings, arrays and hashes do
|
128
|
+
not require maintaining *object identity*. For these objects it is enough to map them to the right Ruby type before
|
129
|
+
passing them on to Ruby space.
|
130
|
+
|
131
|
+
For a lot of other objects though it is essential to not only map to the right **most derived** class type but also to
|
132
|
+
the exact Ruby instance which was originally instantiated as wrapper for the native object if any exists (in case no
|
133
|
+
Ruby instance existed yet a new instance of the correct **most derived** class should be instantiated at that point).
|
134
|
+
The reason this is important is 1. because the Ruby instance may have been used to identify, link to or otherwise
|
135
|
+
reference other data and/or functionality related to that specific Ruby/native pair and 2. the Ruby instance could
|
136
|
+
contain data elements (instance variables) related to that specific Ruby/native pair.<br>
|
137
|
+
In the case of wxRuby Window instance for example it is common to derive custom Window classes with custom behaviour and
|
138
|
+
corresponding instance variables that drive that behaviour. When an event handler or an overloaded native method is passed
|
139
|
+
a native window object we absolutely need to be able to map that native object to the correct Ruby wrapper instance so
|
140
|
+
all information stays in sync.
|
141
|
+
|
142
|
+
For this purpose wxRuby uses *object tracking* i.e. maintaining hash tables mapping native object pointers to Ruby object
|
143
|
+
values. Whenever a tracked object is instantiated it is registered and can from than on be resolved whenever needed to map
|
144
|
+
from native object to Ruby object.<br>
|
145
|
+
Of course this also means wxRuby has to track object destruction so mappings can be removed when a native object is
|
146
|
+
destructed.<br>
|
147
|
+
Additionally the tracking tables are also used to mark Ruby objects during the GC marking phase so they do not get garbage
|
148
|
+
collected whenever they are not referenced in Ruby space anymore but still functioning in native space (this is for example
|
149
|
+
a common situation for many child windows created but not permanently referenced in Ruby space).
|
150
|
+
|
151
|
+
Tracking and resolving mappings from tracking tables produces a certain computing overhead but testing has shown this to be
|
152
|
+
absolutely acceptable for normal applications.
|
153
|
+
|
154
|
+
There are however quite a lot of wrapped native objects in wxRuby for which *object identity* is not essential. For these
|
155
|
+
object tracking has been disabled for their classes. This means these kind of classes/object should **not** be derived from
|
156
|
+
(if even possible and/or useful) to add functionality/information or their identity used as key to link other information.<br>
|
157
|
+
These classes include:
|
158
|
+
- classes considered POD types like Wx::Size, Wx::Point, Wx::RealPoint, Wx::Rect, Wx::GBSpan, Wx::GBPosition, Wx::BusyInfoFlags,
|
159
|
+
Wx::AboutDialogInfo
|
160
|
+
- final non-instantiatable classes like the Wx::DC (Device Context) class family, Wx::GraphicsContext, Wx::WindowsDisabler,
|
161
|
+
Wx::EventBlocker, Wx::BusyInfo
|
162
|
+
- classes with native singleton objects like Wx::Clipboard
|
163
|
+
- the reference counted GDI objects like Wx::Pen, Wx::Brush, Wx::Colour, Wx::Cursor, Wx::Bitmap, Wx::Icon
|
164
|
+
|
165
|
+
The reference documentation will note untracked object classes.
|
data/lib/wx/doc/extra/10_art.md
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
<!--
|
2
|
+
# @markup markdown
|
3
|
+
# @title 11. wxRuby Drawing and Device Contexts
|
4
|
+
-->
|
5
|
+
|
6
|
+
# 11. wxRuby Drawing and Device Contexts (DC)
|
7
|
+
|
8
|
+
In wxRuby the Wx::DC class family provides functionality for drawing to windows, bitmaps, printers etc.
|
9
|
+
|
10
|
+
What most of these classes have in common is that actual drawing output is buffered until the time the
|
11
|
+
device context object is destroyed.
|
12
|
+
For this reason the common practice in wxWidgets C++ code would be to create temporary DC objects on the
|
13
|
+
stack and draw on them while they are in scope (for several classes it is even strongly advised to never create
|
14
|
+
them any other way and to never keep objects alive out of scope). When leaving the scope these object would than be
|
15
|
+
automatically destroyed and the any buffered output flushed to the final target.
|
16
|
+
|
17
|
+
In Ruby this approach is impossible as Ruby is a purely dynamic language and does not **this kind** of scope bound
|
18
|
+
life cycles. Any DC object created would have to be dynamically created and due to the properties of the GC driven
|
19
|
+
life cycles could well be kept alive beyond the scope of it's creation. This will not always cause problems but could
|
20
|
+
and does not really have an upside.
|
21
|
+
|
22
|
+
To prevent confusion and potential problems wxRuby defines all `Wx::DC` derived classes to be abstract classes that
|
23
|
+
cannot be instantiated using `new`. Rather all `Wx::DC` derived classes provide `::draw_on` factory methods to create
|
24
|
+
temporary dc objects that will be passed on to blocks given and will only exist for the duration of the execution of
|
25
|
+
the block. This will guarantee proper DC cleanup when leaving it's usage scope.
|
26
|
+
|
27
|
+
> Note that it is a **BAD** idea to think about storing the dc reference provide to the block for later access!
|
28
|
+
|
29
|
+
A typical usage of a `::draw_on` method would be:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
myTestBitmap1x = Wx::Bitmap.new(60, 15, 32)
|
33
|
+
Wx::MemoryDC.draw_on(myTestBitmap1x) do |mdc|
|
34
|
+
mdc.set_background(Wx::WHITE_BRUSH)
|
35
|
+
mdc.clear
|
36
|
+
mdc.set_pen(Wx::BLACK_PEN)
|
37
|
+
mdc.set_brush(Wx::WHITE_BRUSH)
|
38
|
+
mdc.draw_rectangle(0, 0, 60, 15)
|
39
|
+
mdc.draw_line(0, 0, 59, 14)
|
40
|
+
mdc.set_text_foreground(Wx::BLACK)
|
41
|
+
mdc.draw_text("x1", 0, 0)
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
## Windows, Wx::PaintDC and Wx::AutoBufferedPaintDC
|
46
|
+
|
47
|
+
The `Wx::PaintDC` and `Wx::AutoBufferedPaintDC` classes provide `::draw_on` methods just like all other DC classes but
|
48
|
+
this is mostly to be consistent.
|
49
|
+
|
50
|
+
In this case it is recommended to instead use the `Wx::Window#paint` or `Wx::Window#paint_buffered` methods as these
|
51
|
+
provide some optimizations with regard to automatically detecting is the methods are called inside `Wx::EVT_PAINT`
|
52
|
+
handlers (which should normally be the case) or not.
|
53
|
+
|
54
|
+
So the typical way to do buffered painting inside a windows `Wx::EVT_PAINT` handler would be something like:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
def on_paint(_event)
|
58
|
+
self.paint_buffered do |dc|
|
59
|
+
# ... do some drawing ...
|
60
|
+
end
|
61
|
+
end
|
62
|
+
```
|
@@ -0,0 +1,75 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class MemoryDC < Wx::DC
|
5
|
+
|
6
|
+
# Creates a Memory DC and passes that to the given block to draw on.
|
7
|
+
# Automatically unselects any source object of the MemoryDC after the block finishes.
|
8
|
+
# @overload self.draw_on()
|
9
|
+
# @yieldparam [Wx::MemoryDC] dc
|
10
|
+
# @overload self.draw_on(bitmap)
|
11
|
+
# @param [Wx::Bitmap]
|
12
|
+
# @yieldparam [Wx::MemoryDC] dc
|
13
|
+
# @overload self.draw_on(dc)
|
14
|
+
# @param [Wx::DC]
|
15
|
+
# @yieldparam [Wx::MemoryDC] dc
|
16
|
+
def self.draw_on(*arg) end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
class BufferedDC < Wx::MemoryDC
|
21
|
+
|
22
|
+
# Creates a Buffered DC and passes that to the given block to draw on.
|
23
|
+
# Destroys the DC after the block returns.
|
24
|
+
# @overload self.draw_on()
|
25
|
+
# Creates a buffer for the provided dc.
|
26
|
+
# @yieldparam [Wx::BufferedDC] dc
|
27
|
+
# @overload self.draw_on(tgt, area, style=Wx::BUFFER_CLIENT_AREA)
|
28
|
+
# Creates a buffer for the provided dc. #init must not be called when using this constructor.
|
29
|
+
# @param [Wx::DC] tgt The underlying DC: everything drawn to this object will be flushed to this DC when this object is destroyed. You may pass nil in order to just initialize the buffer, and not flush it.
|
30
|
+
# @param [Wx::Size] area The size of the bitmap to be used for buffering (this bitmap is created internally when it is not given explicitly).
|
31
|
+
# @param [Integer] style Wx::BUFFER_CLIENT_AREA to indicate that just the client area of the window is buffered, or Wx::BUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the virtual area.
|
32
|
+
# @yieldparam [Wx::BufferedDC] dc
|
33
|
+
# @overload self.draw_on(tgt, buffer=Wx::NULL_BITMAP, style=Wx::BUFFER_CLIENT_AREA)
|
34
|
+
# Creates a buffer for the provided dc. #init must not be called when using this constructor.
|
35
|
+
# @param [Wx::DC] tgt The underlying DC: everything drawn to this object will be flushed to this DC when this object is destroyed. You may pass nil in order to just initialize the buffer, and not flush it.
|
36
|
+
# @param [Wx::Bitmap] buffer Explicitly provided bitmap to be used for buffering: this is the most efficient solution as the bitmap doesn't have to be recreated each time but it also requires more memory as the bitmap is never freed. The bitmap should have appropriate size, anything drawn outside of its bounds is clipped.
|
37
|
+
# @param [Integer] style Wx::BUFFER_CLIENT_AREA to indicate that just the client area of the window is buffered, or Wx::BUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the virtual area.
|
38
|
+
# @yieldparam [Wx::BufferedDC] dc
|
39
|
+
def self.draw_on(*arg) end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class BufferedPaintDC < Wx::BufferedDC
|
44
|
+
|
45
|
+
# Creates a Buffered DC and passes that to the given block to draw on.
|
46
|
+
# Destroys the DC after the block returns.
|
47
|
+
# As with Wx::BufferedDC, you may either provide the bitmap to be used for buffering or let this object create one internally (in the latter case, the size of the client part of the window is used).
|
48
|
+
#
|
49
|
+
# Pass W::xBUFFER_CLIENT_AREA for the style parameter to indicate that just the client area of the window is buffered, or Wx::BUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the virtual area.
|
50
|
+
# @overload self.draw_on(win, style=Wx::BUFFER_CLIENT_AREA)
|
51
|
+
# @param [Wx::Window] win The underlying window; everything drawn to this object will be flushed to this window when this object is destroyed.
|
52
|
+
# @param [Integer] style Wx::BUFFER_CLIENT_AREA to indicate that just the client area of the window is buffered, or Wx::BUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the virtual area.
|
53
|
+
# @yieldparam [Wx::BufferedPaintDC] dc
|
54
|
+
# @overload self.draw_on(win, buffer=Wx::NULL_BITMAP, style=Wx::BUFFER_CLIENT_AREA)
|
55
|
+
# @param [Wx::Window] win The underlying window; everything drawn to this object will be flushed to this window when this object is destroyed.
|
56
|
+
# @param [Wx::Bitmap] buffer Explicitly provided bitmap to be used for buffering: this is the most efficient solution as the bitmap doesn't have to be recreated each time but it also requires more memory as the bitmap is never freed. The bitmap should have appropriate size, anything drawn outside of its bounds is clipped.
|
57
|
+
# @param [Integer] style Wx::BUFFER_CLIENT_AREA to indicate that just the client area of the window is buffered, or Wx::BUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the virtual area.
|
58
|
+
# @yieldparam [Wx::BufferedPaintDC] dc
|
59
|
+
def self.draw_on(*arg) end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
class AutoBufferedPaintDC < Wx::BufferedPaintDC
|
64
|
+
|
65
|
+
# Creates a Buffered DC and passes that to the given block to draw on.
|
66
|
+
# Destroys the DC after the block returns.
|
67
|
+
# Pass a pointer to the window on which you wish to paint.
|
68
|
+
# @note In wxRuby this method mostly exists to be consistent with the other DC classes. It is however recommended to use Wx::Window#paint_buffered instead.
|
69
|
+
# @param [Wx::Window] win The underlying window; everything drawn to this object will be flushed to this window when this object is destroyed.
|
70
|
+
# @yieldparam [Wx::AutoBufferedPaintDC] dc
|
71
|
+
def self.draw_on(win, &block) end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class MirrorDC < Wx::DC
|
5
|
+
|
6
|
+
# Executes the given block providing a temporary (mirror) dc as
|
7
|
+
# it's single argument.
|
8
|
+
# @param [Wx::DC] dc DC to duplicate the (mirrored) drawing on
|
9
|
+
# @param [Boolean] mirror whether to mirror or not
|
10
|
+
# @yieldparam [Wx::MirrorDC] dc the MirrorDC instance to paint on
|
11
|
+
# @return [Object] result of the block
|
12
|
+
def self.draw_on(dc, mirror) end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
module Wx::PRT
|
3
|
+
|
4
|
+
class PrinterDC < Wx::DC
|
5
|
+
|
6
|
+
# Executes the given block providing a temporary (printer) dc as
|
7
|
+
# it's single argument.
|
8
|
+
# @param [Wx::PRT::PrintData] print_data print_data defining the print settings
|
9
|
+
# @yieldparam [Wx::PrinterDC] dc the PrinterDC instance to paint on
|
10
|
+
# @return [Object] result of the block
|
11
|
+
def self.draw_on(win) end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class PostScriptDC < Wx::DC
|
16
|
+
|
17
|
+
# Executes the given block providing a temporary (postscript) dc as
|
18
|
+
# it's single argument.
|
19
|
+
# @param [Wx::PRT::PrintData] print_data print_data defining the print settings
|
20
|
+
# @yieldparam [Wx::PostScriptDC] dc the PostScriptDC instance to paint on
|
21
|
+
# @return [Object] result of the block
|
22
|
+
def self.draw_on(win) end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/wx/doc/screen_dc.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
module Wx
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
class ScreenDC < Wx::DC
|
5
|
+
|
6
|
+
# Executes the given block providing a temporary (screen) dc as
|
7
|
+
# it's single argument.
|
8
|
+
# @yieldparam [Wx::ScreenDC] dc the ScreenDC instance to paint on
|
9
|
+
# @return [Object] result of the block
|
10
|
+
def self.draw_on; end
|
11
|
+
|
12
|
+
end
|
9
13
|
|
10
14
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class SVGFileDC < Wx::DC
|
5
|
+
|
6
|
+
# Executes the given block providing a temporary dc as it's single argument.
|
7
|
+
# Initializes a wxSVGFileDC with the given filename, width and height at dpi resolution, and an optional title.
|
8
|
+
# The title provides a readable name for the SVG document.
|
9
|
+
# @param [String] filename name of file to create
|
10
|
+
# @param [Integer] width width for SVG image
|
11
|
+
# @param [Integer] height height for SVG image
|
12
|
+
# @param [Float] dpi resolution for SVG image
|
13
|
+
# @param [String] title readable name for the SVG document
|
14
|
+
# @yieldparam [Wx::SVGFileDC] dc the SVGFileDC instance to paint on
|
15
|
+
# @return [Object] result of the block
|
16
|
+
def self.draw_on(filename, width=320, height=240, dpi=72, title='') end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
class Wx::VListBox
|
3
|
+
|
4
|
+
# Iterate selected items. Returns Enumerator if no block given.
|
5
|
+
# @yieldparam [Integer] sel selected item index
|
6
|
+
# @return [Enumerator,Object] if block given returns last return value of block, Enumerator otherwise
|
7
|
+
def each_selected; end
|
8
|
+
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
class Wx::WindowDisabler
|
3
|
+
|
4
|
+
# Disables all top level windows of the application (maybe with the exception of one of them) in
|
5
|
+
# and enables them back after the given block has returned.
|
6
|
+
# @param [Wx::Window,nil] to_skip window to exclude from disabling
|
7
|
+
# @return [void]
|
8
|
+
def self.disable(to_skip = nil) end
|
9
|
+
|
10
|
+
end
|
data/lib/wx/html/keyword_defs.rb
CHANGED
@@ -10,13 +10,12 @@ Wx::define_keyword_ctors(Wx::HTML::HtmlWindow) do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# wxHtmlListBox A listbox showing HTML content
|
13
|
-
|
14
|
-
|
15
|
-
wx_ctor_params :id, :pos, :size, :choices => []
|
16
|
-
wx_ctor_params :style
|
17
|
-
wx_ctor_params :validator, :name => 'listBox'
|
13
|
+
Wx::define_keyword_ctors(Wx::HTML::HtmlListBox) do
|
14
|
+
wx_ctor_params :id, :pos, :size, :style, :name => 'HtmlListBox'
|
18
15
|
end
|
19
16
|
|
20
|
-
Wx::define_keyword_ctors(
|
21
|
-
wx_ctor_params :id, :pos, :size
|
17
|
+
Wx::define_keyword_ctors(Wx::HTML::SimpleHtmlListBox) do
|
18
|
+
wx_ctor_params :id, :pos, :size
|
19
|
+
wx_ctor_params :choices => []
|
20
|
+
wx_ctor_params :style, :validator, :name => 'SimpleHtmlListBox'
|
22
21
|
end
|
data/lib/wx/html/require.rb
CHANGED
@@ -0,0 +1,105 @@
|
|
1
|
+
|
2
|
+
class Wx::HTML::SimpleHtmlListBox
|
3
|
+
|
4
|
+
# Make this a Ruby enumerable so find, find_all, map etc are available
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# Passes each valid item index into the passed block
|
8
|
+
def each
|
9
|
+
get_count.times { | i | yield i }
|
10
|
+
end
|
11
|
+
|
12
|
+
# We need to cache client data in Ruby variables as we cannot access items
|
13
|
+
# during the GC mark phase as for some platforms (WXMSW at least) that would
|
14
|
+
# involve calling methods that would break in that phase.
|
15
|
+
|
16
|
+
def client_data_store
|
17
|
+
@client_data ||= []
|
18
|
+
end
|
19
|
+
private :client_data_store
|
20
|
+
|
21
|
+
wx_set_client_data = instance_method :set_client_data
|
22
|
+
define_method :set_client_data do |item, data|
|
23
|
+
item = item.to_i
|
24
|
+
wx_set_client_data.bind(self).call(item, data)
|
25
|
+
client_data_store[item] = data
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_client_data(item)
|
29
|
+
client_data_store[item.to_i]
|
30
|
+
end
|
31
|
+
|
32
|
+
wx_append = instance_method :append
|
33
|
+
define_method :append do |item, data=nil|
|
34
|
+
if data
|
35
|
+
if ::Array === item
|
36
|
+
if !(::Array === data)
|
37
|
+
::Kernel.raise ::TypeError.new("Expected Array for argument 3")
|
38
|
+
elsif data.size != item.size
|
39
|
+
::Kernel.raise ::ArgumentError.new("item and data array must be equal size")
|
40
|
+
end
|
41
|
+
offs = get_count
|
42
|
+
wx_append.bind(self).call(item)
|
43
|
+
item.size.times { |ix| set_client_data(offs+ix, data[ix]) }
|
44
|
+
else
|
45
|
+
wx_append.bind(self).call(item, data)
|
46
|
+
client_data_store[get_count-1] = data
|
47
|
+
end
|
48
|
+
else
|
49
|
+
wx_append.bind(self).call(item)
|
50
|
+
# no changes to data store
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
wx_insert = instance_method :insert
|
55
|
+
define_method :insert do |item, pos, data=nil|
|
56
|
+
if data
|
57
|
+
if ::Array === item
|
58
|
+
if !(::Array === data)
|
59
|
+
::Kernel.raise ::TypeError.new("Expected Array for argument 3")
|
60
|
+
elsif data.size != item.size
|
61
|
+
::Kernel.raise ::ArgumentError.new("item and data array must be equal size")
|
62
|
+
end
|
63
|
+
wx_insert.bind(self).call(item, pos)
|
64
|
+
client_data_store.insert(pos, *::Array.new(item.size))
|
65
|
+
item.size.times { |ix| set_client_data(pos+ix, data[ix]) }
|
66
|
+
else
|
67
|
+
wx_insert.bind(self).call(item, pos, data)
|
68
|
+
client_data_store.insert(pos, data)
|
69
|
+
end
|
70
|
+
else
|
71
|
+
wx_insert.bind(self).call(item, pos)
|
72
|
+
if ::Array === item
|
73
|
+
client_data_store.insert(pos, *::Array.new(item.size))
|
74
|
+
else
|
75
|
+
client_data_store.insert(pos, nil)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
wx_set = instance_method :set
|
81
|
+
define_method :set do |items, data=nil|
|
82
|
+
if data
|
83
|
+
if !(::Array === data)
|
84
|
+
::Kernel.raise ::TypeError.new("Expected Array for argument 2")
|
85
|
+
elsif data.size != items.size
|
86
|
+
::Kernel.raise ::ArgumentError.new("items and data array must be equal size")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
wx_set.bind(self).call(items)
|
90
|
+
client_data_store.clear
|
91
|
+
items.each_with_index { |item, ix| set_client_data(item, data[ix]) }
|
92
|
+
end
|
93
|
+
|
94
|
+
wx_clear = instance_method :clear
|
95
|
+
define_method :clear do
|
96
|
+
wx_clear.bind(self).call
|
97
|
+
client_data_store.clear
|
98
|
+
end
|
99
|
+
|
100
|
+
wx_delete = instance_method :delete
|
101
|
+
define_method :delete do |item|
|
102
|
+
wx_delete.bind(self).call(item.to_i)
|
103
|
+
client_data_store.slice!(item.to_i)
|
104
|
+
end
|
105
|
+
end
|
data/lib/wx/keyword_defs.rb
CHANGED
@@ -296,6 +296,13 @@ Wx::define_keyword_ctors('CheckBox') do
|
|
296
296
|
wx_ctor_params :validator, :name => 'checkBox'
|
297
297
|
end
|
298
298
|
|
299
|
+
# wxListBox A list of strings for single or multiple selection
|
300
|
+
Wx::define_keyword_ctors('ListBox') do
|
301
|
+
wx_ctor_params :id, :pos, :size, :choices => []
|
302
|
+
wx_ctor_params :style
|
303
|
+
wx_ctor_params :validator, :name => 'listBox'
|
304
|
+
end
|
305
|
+
|
299
306
|
# A listbox with a checkbox to the left of each item
|
300
307
|
Wx::define_keyword_ctors('CheckListBox') do
|
301
308
|
wx_ctor_params :id, :pos, :size, :choices, :style
|
data/lib/wx/version.rb
CHANGED
data/lib/wx/wxruby/cmd/test.rb
CHANGED
data/rakelib/install.rb
CHANGED
@@ -34,7 +34,9 @@ module WXRuby3
|
|
34
34
|
grp_id = m[1]
|
35
35
|
lib_id = m[2]
|
36
36
|
ver = m[3].sub('.', '')
|
37
|
-
|
37
|
+
# as of wxw 3.3 there seems to be an additional digit added to the version part of the dll name
|
38
|
+
# so add a wildcard ('*') in that spot to match older and newer versions
|
39
|
+
lib = "wx#{grp_id.sub(/u\Z/, '')}#{ver}*u#{lib_id}"
|
38
40
|
@wxwin_shlibs.include File.join(libdir, "#{lib}*.#{WXRuby3.config.dll_mask}")
|
39
41
|
end
|
40
42
|
else
|
data/rakelib/lib/core/mapping.rb
CHANGED
@@ -223,13 +223,13 @@ module WXRuby3
|
|
223
223
|
def map_to(typedef)
|
224
224
|
if ::Hash === typedef
|
225
225
|
typedef.each_pair do |argmasks, type|
|
226
|
-
pattern = @patterns.detect { |ps| ps == argmasks }
|
226
|
+
pattern = @map.patterns.detect { |ps| ps == argmasks }
|
227
227
|
raise "Unknown parameter set [#{argmasks}] for [#{@map}]" unless pattern
|
228
|
-
@to[pattern] = type
|
228
|
+
@to[pattern] = _get_mapped_type(type)
|
229
229
|
end
|
230
230
|
else
|
231
|
-
@patterns.inject(@to) do |map, pattern|
|
232
|
-
map[pattern] = typedef
|
231
|
+
@map.patterns.inject(@to) do |map, pattern|
|
232
|
+
map[pattern] = _get_mapped_type(typedef)
|
233
233
|
map
|
234
234
|
end
|
235
235
|
end
|
@@ -422,7 +422,7 @@ module WXRuby3
|
|
422
422
|
end
|
423
423
|
|
424
424
|
def map_out(ignore: nil, to: nil, temp: nil, code: nil, &block)
|
425
|
-
@out = Out.new(self, ignore: ignore, to:
|
425
|
+
@out = Out.new(self, ignore: ignore, to: to, temp: temp, code: code, &block)
|
426
426
|
end
|
427
427
|
|
428
428
|
def map_freearg(temp: nil, code: nil, &block)
|
data/rakelib/lib/core/spec.rb
CHANGED
@@ -250,12 +250,12 @@ module WXRuby3
|
|
250
250
|
self
|
251
251
|
end
|
252
252
|
|
253
|
-
def
|
253
|
+
def gc_as_untracked(*names)
|
254
254
|
if names.empty?
|
255
|
-
@gc_type = :
|
255
|
+
@gc_type = :GC_MANAGE_AS_UNTRACKED
|
256
256
|
else
|
257
257
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
258
|
-
names.each {|n| @gc_type[n] = :
|
258
|
+
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_UNTRACKED }
|
259
259
|
end
|
260
260
|
self
|
261
261
|
end
|
@@ -291,6 +291,10 @@ module WXRuby3
|
|
291
291
|
@abstracts.has_key?(cls) && !@abstracts[cls]
|
292
292
|
end
|
293
293
|
|
294
|
+
def concretes
|
295
|
+
@abstracts.keys.select { |cls| concrete?(cls) }
|
296
|
+
end
|
297
|
+
|
294
298
|
def mixin?(cls)
|
295
299
|
@mixins.include?(cls)
|
296
300
|
end
|
@@ -153,6 +153,10 @@ module WXRuby3
|
|
153
153
|
ifspec.abstract?(class_def.name) || (class_def.abstract && !ifspec.concrete?(class_def.name))
|
154
154
|
end
|
155
155
|
|
156
|
+
def explicit_concretes
|
157
|
+
ifspec.concretes
|
158
|
+
end
|
159
|
+
|
156
160
|
def mixins
|
157
161
|
ifspec.mixins
|
158
162
|
end
|
@@ -183,12 +187,16 @@ module WXRuby3
|
|
183
187
|
return :GC_MANAGE_AS_SIZER if classdef.is_derived_from?('wxSizer') || classdef.name == 'wxSizer'
|
184
188
|
return :GC_MANAGE_AS_REFCOUNTED if classdef.is_derived_from?('wxRefCounter')
|
185
189
|
return :GC_MANAGE_AS_OBJECT if classdef.is_derived_from?('wxObject') || classdef.name == 'wxObject'
|
186
|
-
return :
|
190
|
+
return :GC_MANAGE_AS_UNTRACKED
|
187
191
|
end
|
188
192
|
end
|
189
193
|
ifspec.gc_type(classdef.name) || :GC_NEVER
|
190
194
|
end
|
191
195
|
|
196
|
+
def is_tracked?(classdef)
|
197
|
+
gc_type(classdef) != :GC_MANAGE_AS_UNTRACKED
|
198
|
+
end
|
199
|
+
|
192
200
|
def includes
|
193
201
|
ifspec.includes
|
194
202
|
end
|
@@ -37,7 +37,7 @@ module WXRuby3
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
__HEREDOC
|
40
|
-
spec.map 'int keyCode' => 'Integer' do
|
40
|
+
spec.map 'int keyCode' => 'Integer,String' do
|
41
41
|
map_in code: '$1 = wxRuby_RubyStringOrIntToKeyCode($input);'
|
42
42
|
map_typecheck precedence: 'INT32', code: <<~__CODE
|
43
43
|
$1 = ( (TYPE($input) == T_FIXNUM) || wxRuby_IsAnEnum($input) ||
|