wxruby 1.9.4-i386-mswin32 → 1.9.5-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/README +10 -12
- data/lib/wx/classes/dc.rb +57 -0
- data/lib/wx/classes/evthandler.rb +3 -0
- data/lib/wx/classes/gauge.rb +12 -0
- data/lib/wx/classes/rect.rb +5 -0
- data/lib/wx/classes/window.rb +33 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.exp +0 -0
- data/lib/wxruby2.lib +0 -0
- data/lib/wxruby2.so +0 -0
- data/samples/bigdemo/bigdemo.rb +8 -10
- data/samples/bigdemo/wxDialog.rbw +51 -67
- data/samples/drawing/images.rb +11 -17
- data/samples/treectrl/treectrl.rb +2 -2
- metadata +4 -2
data/README
CHANGED
@@ -17,7 +17,7 @@ wxruby version 2.0.
|
|
17
17
|
Currently the following are fully supported:
|
18
18
|
|
19
19
|
Windows NT/2000/XP/Vista (i686)
|
20
|
-
OS X 10.
|
20
|
+
OS X 10.4+ (i686 and PowerPc)
|
21
21
|
Linux (i686 + AMD-64)
|
22
22
|
|
23
23
|
It is unlikely that support for old Windows OS's (3.1, 95, 98, ME)
|
@@ -72,7 +72,7 @@ wxruby version 2.0.
|
|
72
72
|
- Vastly improved support for OS X
|
73
73
|
- Looks much better under Linux because it uses GTK+2
|
74
74
|
- Simpler and more permissive license
|
75
|
-
- Wraps wxWidgets 2.8.
|
75
|
+
- Wraps wxWidgets 2.8.7 instead of the older 2.4 series
|
76
76
|
|
77
77
|
- Is wxruby2 ready for "production" use?
|
78
78
|
|
@@ -135,7 +135,7 @@ wxruby version 2.0.
|
|
135
135
|
the bug list, handle publicity, or do other necessary chores.
|
136
136
|
|
137
137
|
Wrapping wx is a big project that requires a wide variety of skills. As of
|
138
|
-
|
138
|
+
February 2008, the wxRuby project has over 100,000 lines of code, including
|
139
139
|
ruby, C++, and SWIG scripts. If we weren't using SWIG it would be far bigger.
|
140
140
|
|
141
141
|
|
@@ -153,7 +153,12 @@ recommend installing the gem rather than building from source.
|
|
153
153
|
REQUIREMENTS TO CREATE AND RUN WXRUBY APPS:
|
154
154
|
|
155
155
|
- Ruby 1.8
|
156
|
-
- MS Windows NT/2000/XP/Vista, Mac OS X 10.
|
156
|
+
- MS Windows NT/2000/XP/Vista, Mac OS X 10.4+, or Linux with GTK+ 2,
|
157
|
+
|
158
|
+
- On Windows, gdiplus.pll and msvcp71.dll. These are available on most
|
159
|
+
systems, but can be downloaded and installed for free from the
|
160
|
+
internet
|
161
|
+
- On Linux, libgstreamer. This can be installed from most package sources
|
157
162
|
|
158
163
|
SAMPLES:
|
159
164
|
|
@@ -212,19 +217,12 @@ API DIFFERENCES FROM WXWIDGETS:
|
|
212
217
|
- log_message and log_status take a single string parameter,
|
213
218
|
rather than a format string followed by additional values
|
214
219
|
to be inserted. Use Ruby's sprintf if required.
|
215
|
-
- ScreenDC extends DC on all platforms, unlike in C++ wx.
|
216
|
-
This means that you cannot override any virtual methods that were
|
217
|
-
defined in PaintDC or WindowDC in a ruby subclass of ScreenDC.
|
218
|
-
[Need to verify if this is still true]
|
219
|
-
- BusyCursor can be used in a Ruby block to ensure the original cursor
|
220
|
-
is always restored.
|
221
220
|
|
222
221
|
----------------------COMPILING WXRUBY--------------------------
|
223
222
|
REQUIREMENTS TO COMPILE/BUILD WXRUBY ITSELF
|
224
223
|
|
225
224
|
- rake
|
226
|
-
- SWIG, version 1.3.
|
227
|
-
definitely won't, nor will later versions such as 1.3.33
|
225
|
+
- SWIG, version 1.3.32 or later. Earlier versions will not work correctly.
|
228
226
|
- wxWidgets 2.8.x SDK. See further information on the wxruby website for
|
229
227
|
recommended compile-time options for wxWidgets.
|
230
228
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Class for drawing primitives and bitmaps on various outputs (screen, paper)
|
2
|
+
class Wx::DC
|
3
|
+
# Several methods accept an array of Wx::Point objects. In line with
|
4
|
+
# the rest of the wxRuby API, allow these points to be specified as
|
5
|
+
# simple two-element arrays [x, y].
|
6
|
+
def __convert_point_array(arr)
|
7
|
+
if arr.all? { | x | x.kind_of?(Wx::Point) }
|
8
|
+
return arr
|
9
|
+
end
|
10
|
+
arr.map do | x |
|
11
|
+
case x
|
12
|
+
when Wx::Point
|
13
|
+
x
|
14
|
+
when Array
|
15
|
+
if x.length != 2
|
16
|
+
msg = "Wrong number of elements in point array item, should be two"
|
17
|
+
err = ArgumentError.new(msg)
|
18
|
+
err.set_backtrace(caller[2..-1])
|
19
|
+
Kernel.raise(err)
|
20
|
+
end
|
21
|
+
Wx::Point.new(x[0], x[1])
|
22
|
+
else
|
23
|
+
msg = "Wrong type of item #{x.inspect} in point array"
|
24
|
+
err = ArgumentError.new(msg)
|
25
|
+
err.set_backtrace(caller[2..-1])
|
26
|
+
Kernel.raise(err)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
private :__convert_point_array
|
31
|
+
|
32
|
+
wx_draw_lines = self.instance_method(:draw_lines)
|
33
|
+
define_method(:draw_lines) do | *args |
|
34
|
+
args[0] = __convert_point_array(args[0])
|
35
|
+
wx_draw_lines.bind(self).call(*args)
|
36
|
+
end
|
37
|
+
|
38
|
+
wx_draw_polygon = self.instance_method(:draw_polygon)
|
39
|
+
define_method(:draw_polygon) do | *args |
|
40
|
+
args[0] = __convert_point_array(args[0])
|
41
|
+
wx_draw_polygon.bind(self).call(*args)
|
42
|
+
end
|
43
|
+
|
44
|
+
wx_draw_poly_polygon = self.instance_method(:draw_poly_polygon)
|
45
|
+
define_method(:draw_poly_polygon) do | *args |
|
46
|
+
args[0].map! do | arr |
|
47
|
+
__convert_point_array(arr)
|
48
|
+
end
|
49
|
+
wx_draw_poly_polygon.bind(self).call(*args)
|
50
|
+
end
|
51
|
+
|
52
|
+
wx_draw_spline = self.instance_method(:draw_spline)
|
53
|
+
define_method(:draw_spline) do | *args |
|
54
|
+
args[0] = __convert_point_array(args[0])
|
55
|
+
wx_draw_spline.bind(self).call(*args)
|
56
|
+
end
|
57
|
+
end
|
@@ -816,6 +816,9 @@ class Wx::EvtHandler
|
|
816
816
|
EventType['evt_tree_item_expanding', 1,
|
817
817
|
Wx::EVT_COMMAND_TREE_ITEM_EXPANDING,
|
818
818
|
Wx::TreeEvent],
|
819
|
+
EventType['evt_tree_item_menu', 1,
|
820
|
+
Wx::EVT_COMMAND_TREE_ITEM_MENU,
|
821
|
+
Wx::TreeEvent],
|
819
822
|
EventType['evt_tree_item_middle_click', 1,
|
820
823
|
Wx::EVT_COMMAND_TREE_ITEM_MIDDLE_CLICK,
|
821
824
|
Wx::TreeEvent],
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Gauge : presents a progress bar
|
2
|
+
#
|
3
|
+
# On the C++ side, the actual class name of wxGauge under Windows is
|
4
|
+
# wxGauge95. So when a Gauge is loaded from XRC, and we try to wrap the
|
5
|
+
# object in a ruby class by calling obj->ClassInfo()->ClassName(), it
|
6
|
+
# seeks for a ruby class (Wx::Gauge95) that doesn't exist (see
|
7
|
+
# swig/shared/get_ruby_object.i).
|
8
|
+
#
|
9
|
+
# To fix this, make Wx::Gauge95 an alias.
|
10
|
+
if Wx::PLATFORM == 'WXMSW'
|
11
|
+
Wx::Gauge95 = Wx::Gauge
|
12
|
+
end
|
data/lib/wx/classes/rect.rb
CHANGED
data/lib/wx/classes/window.rb
CHANGED
@@ -46,4 +46,37 @@ class Wx::Window
|
|
46
46
|
end
|
47
47
|
__old_evt_paint(&wrapped_block)
|
48
48
|
end
|
49
|
+
|
50
|
+
# Provides bufferd drawing facility to reduce flicker for complex
|
51
|
+
# drawing commands. Works similar to BufferedDC and BufferedPaintDC in
|
52
|
+
# the wxWidgets API, by doing drawing on an in-memory Bitmap, then
|
53
|
+
# copying the result in bulk to the screen.
|
54
|
+
#
|
55
|
+
# The method may be passed an existing Wx::Bitmap as the +buffer+,
|
56
|
+
# otherwise one will be created.
|
57
|
+
#
|
58
|
+
# Works like wxAutoBufferedDC in that additional buffering will only
|
59
|
+
# be done on platforms that do not already natively support buffering
|
60
|
+
# for the standard PaintDC / ClientDC - Windows, in particular.
|
61
|
+
def paint_buffered(buffer = nil)
|
62
|
+
# OS X and GTK do double-buffering natively
|
63
|
+
if self.double_buffered?
|
64
|
+
paint { | dc | yield dc }
|
65
|
+
else
|
66
|
+
# client_size is the window area available for drawing upon
|
67
|
+
c_size = client_size
|
68
|
+
# Create an in-memory buffer if none supplied
|
69
|
+
buffer ||= Wx::Bitmap.new(c_size.width, c_size.height)
|
70
|
+
buffer.draw do | mem_dc |
|
71
|
+
mem_dc.background = Wx::TRANSPARENT_BRUSH
|
72
|
+
mem_dc.clear
|
73
|
+
# Yield the bitmap for the user code to draw upon
|
74
|
+
yield mem_dc
|
75
|
+
paint do | dc |
|
76
|
+
# Copy the buffer to the window
|
77
|
+
dc.blit(0, 0, c_size.width, c_size.height, mem_dc, 0, 0)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
49
82
|
end
|
data/lib/wx/version.rb
CHANGED
data/lib/wxruby2.exp
CHANGED
Binary file
|
data/lib/wxruby2.lib
CHANGED
Binary file
|
data/lib/wxruby2.so
CHANGED
Binary file
|
data/samples/bigdemo/bigdemo.rb
CHANGED
@@ -22,8 +22,6 @@ rescue LoadError => no_wx_err
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
MENU_EXIT = 100
|
26
|
-
TREE_ID = 101
|
27
25
|
|
28
26
|
OVR_TEXT = "This is the WxRuby Demo. It was ported from the wxPython Demo, created by Robin Dunn. Many thanks to him for all his hard work - this demo is what it is because of him. Click on any of the items in the tree control to start the demo. Don't forget to check out the Demo Code tab - you can see the source code for each demo!\nHope you like it!"
|
29
27
|
|
@@ -249,8 +247,8 @@ class WxRubyDemo < Wx::Frame
|
|
249
247
|
|
250
248
|
@mainmenu = Wx::MenuBar.new
|
251
249
|
menu = Wx::Menu.new
|
252
|
-
menu.append(
|
253
|
-
evt_menu(
|
250
|
+
menu.append(Wx::ID_EXIT, "E&xit\tALT-X", "Get the heck outta here!")
|
251
|
+
evt_menu(Wx::ID_EXIT) {exit}
|
254
252
|
@mainmenu.append(menu, "&File")
|
255
253
|
|
256
254
|
# Make a Demo menu - thanks to Kevin Smith for figuring the submenus out!
|
@@ -289,7 +287,7 @@ class WxRubyDemo < Wx::Frame
|
|
289
287
|
@finddata = Wx::FindReplaceData.new()
|
290
288
|
|
291
289
|
@treeMap = {}
|
292
|
-
@tree = Wx::TreeCtrl.new(splitter
|
290
|
+
@tree = Wx::TreeCtrl.new(splitter)
|
293
291
|
root = @tree.add_root("wxRuby Overview")
|
294
292
|
firstChild = nil
|
295
293
|
|
@@ -304,11 +302,11 @@ class WxRubyDemo < Wx::Frame
|
|
304
302
|
@tree.expand(root)
|
305
303
|
@tree.expand(firstChild)
|
306
304
|
|
307
|
-
evt_tree_item_expanded
|
308
|
-
evt_tree_item_collapsed
|
309
|
-
evt_tree_sel_changed
|
310
|
-
evt_tree_item_activated
|
311
|
-
@tree.evt_left_down
|
305
|
+
evt_tree_item_expanded @tree, :on_item_expanded
|
306
|
+
evt_tree_item_collapsed @tree, :on_item_collapsed
|
307
|
+
evt_tree_sel_changed @tree, :on_tree_sel_changed
|
308
|
+
evt_tree_item_activated @tree, :on_tree_sel_changed
|
309
|
+
@tree.evt_left_down method(:on_tree_left_down)
|
312
310
|
|
313
311
|
|
314
312
|
|
@@ -12,77 +12,61 @@ rescue LoadError => no_wx_err
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class TestDialog < Wx::Dialog
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
# The StdDialogButtonSizer arranges the contained buttons with
|
53
|
-
# platform-standard spacing, ordering and labelling.
|
54
|
-
button_sizer = Wx::StdDialogButtonSizer.new()
|
55
|
-
btn = Wx::Button.new(self, Wx::ID_OK, 'OK')
|
56
|
-
btn.set_default()
|
57
|
-
#btn.set_help_text("The Ok button completes the dialog")
|
58
|
-
button_sizer.add_button(btn)
|
59
|
-
|
60
|
-
btn = Wx::Button.new(self, Wx::ID_CANCEL, 'Cancel')
|
61
|
-
#btn.set_help_text("The Cancel button cancels the dialog. (Duh!)")
|
62
|
-
button_sizer.add_button(btn)
|
63
|
-
button_sizer.realize
|
64
|
-
sizer.add(button_sizer, 0, Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)
|
65
|
-
|
66
|
-
set_sizer(sizer)
|
67
|
-
sizer.fit(self)
|
68
|
-
end
|
15
|
+
def initialize(parent, id, title)
|
16
|
+
super(parent, id, title)
|
17
|
+
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
18
|
+
label = Wx::StaticText.new(self, :label => "This is a wxDialog")
|
19
|
+
#label.set_help_text("This is the help text for the label")
|
20
|
+
sizer.add(label, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
21
|
+
|
22
|
+
box = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
23
|
+
|
24
|
+
label = Wx::StaticText.new(self, :label => "Field #1")
|
25
|
+
#label.set_help_text("This is the help text for the label")
|
26
|
+
box.add(label, 0, Wx::ALIGN_CENTER|Wx::ALL, 5)
|
27
|
+
|
28
|
+
text = Wx::TextCtrl.new(self, :value => "", :size => [80,-1])
|
29
|
+
#text.set_help_text("Here's some help text for field #1")
|
30
|
+
box.add(text, 1, Wx::ALIGN_CENTER|Wx::ALL, 5)
|
31
|
+
sizer.add(box, 0, Wx::GROW|Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)
|
32
|
+
|
33
|
+
box = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
34
|
+
|
35
|
+
label = Wx::StaticText.new(self, :label => "Field #2")
|
36
|
+
#label.set_help_text("This is the help text for the label")
|
37
|
+
box.add(label, 0, Wx::ALIGN_CENTER|Wx::ALL, 5)
|
38
|
+
|
39
|
+
text = Wx::TextCtrl.new(self, :value => "", :size => [80,-1])
|
40
|
+
#text.set_help_text("Here's some help text for field #2")
|
41
|
+
box.add(text, 1, Wx::ALIGN_CENTER|Wx::ALL, 5)
|
42
|
+
sizer.add(box, 0, Wx::GROW|Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)
|
43
|
+
|
44
|
+
# This convenience method creates a sizer containing the chosen
|
45
|
+
# buttons (in this case, OK and Cancel). The buttons will be given
|
46
|
+
# the correct layout and labels for the platform.
|
47
|
+
button_sizer = create_button_sizer(Wx::OK|Wx::CANCEL)
|
48
|
+
sizer.add(button_sizer, 0, Wx::ALIGN_CENTER_VERTICAL|Wx::ALL, 5)
|
49
|
+
self.sizer = sizer
|
50
|
+
sizer.fit(self)
|
51
|
+
end
|
69
52
|
end
|
70
53
|
|
71
54
|
module Demo
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
def Demo.overview
|
84
|
-
return "Welcome to the wxRuby Dialog Demo!"
|
55
|
+
def Demo.run(frame, nb, log)
|
56
|
+
win = TestDialog.new(frame, -1, "This is a wxDialog")
|
57
|
+
win.center_on_screen(Wx::BOTH)
|
58
|
+
# Show the dialog and await the user's response
|
59
|
+
val = win.show_modal()
|
60
|
+
if val == Wx::ID_OK
|
61
|
+
log.write_text("You pressed OK")
|
62
|
+
else
|
63
|
+
log.write_text("You pressed Cancel")
|
85
64
|
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def Demo.overview
|
68
|
+
return "Welcome to the wxRuby Dialog Demo!"
|
69
|
+
end
|
86
70
|
end
|
87
71
|
|
88
72
|
if __FILE__ == $0
|
data/samples/drawing/images.rb
CHANGED
@@ -17,32 +17,26 @@ end
|
|
17
17
|
# window. This one uses a small PNG file, but other formats such as JPEG
|
18
18
|
# are supported - see documentation for more details.
|
19
19
|
|
20
|
-
class
|
21
|
-
def initialize
|
22
|
-
super(nil,
|
23
|
-
|
24
|
-
|
20
|
+
class ImageFrame < Wx::Frame
|
21
|
+
def initialize
|
22
|
+
super(nil, :title => 'Simple image demo')
|
23
|
+
|
24
|
+
# Load a PNG bitmap from a file for drawing
|
25
25
|
img_file = File.join( File.dirname(__FILE__), 'paperclip.png')
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
|
26
|
+
@bitmap = Wx::Bitmap.new(img_file, Wx::BITMAP_TYPE_PNG)
|
27
|
+
|
28
|
+
# Set up the drawing to be done when the frame needs re-painting
|
29
|
+
evt_paint :on_paint
|
30
30
|
end
|
31
31
|
|
32
32
|
def on_paint
|
33
33
|
paint do | dc |
|
34
|
-
dc.clear
|
35
34
|
dc.draw_bitmap(@bitmap, 0, 0, false)
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
frame = MyFrame.new("Simple Image Demo")
|
43
|
-
frame.show
|
44
|
-
end
|
39
|
+
Wx::App.run do
|
40
|
+
ImageFrame.new.show
|
45
41
|
end
|
46
42
|
|
47
|
-
a = ImagesApp.new
|
48
|
-
a.main_loop()
|
@@ -89,7 +89,7 @@ class MyTreeCtrl < Wx::TreeCtrl
|
|
89
89
|
evt_tree_item_expanding self, :on_item_expanding
|
90
90
|
evt_tree_item_collapsed self, :on_item_collapsed
|
91
91
|
evt_tree_item_collapsing self, :on_item_collapsing
|
92
|
-
|
92
|
+
evt_tree_item_menu self, :on_item_menu
|
93
93
|
evt_tree_sel_changed self, :on_sel_changed
|
94
94
|
evt_tree_sel_changing self, :on_sel_changing
|
95
95
|
evt_tree_key_down self, :on_tree_key_down
|
@@ -644,7 +644,7 @@ class MyTreeCtrl < Wx::TreeCtrl
|
|
644
644
|
Wx::log_message("OnItemActivated")
|
645
645
|
end
|
646
646
|
|
647
|
-
def
|
647
|
+
def on_item_menu(event)
|
648
648
|
show_popup_menu(event.item, event.point)
|
649
649
|
end
|
650
650
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: wxruby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.9.
|
7
|
-
date: 2008-
|
6
|
+
version: 1.9.5
|
7
|
+
date: 2008-03-10 00:00:00 -07:00
|
8
8
|
summary: Ruby interface to the wxWidgets GUI library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -49,9 +49,11 @@ files:
|
|
49
49
|
- lib/wx/classes/combobox.rb
|
50
50
|
- lib/wx/classes/commandevent.rb
|
51
51
|
- lib/wx/classes/controlwithitems.rb
|
52
|
+
- lib/wx/classes/dc.rb
|
52
53
|
- lib/wx/classes/event.rb
|
53
54
|
- lib/wx/classes/evthandler.rb
|
54
55
|
- lib/wx/classes/font.rb
|
56
|
+
- lib/wx/classes/gauge.rb
|
55
57
|
- lib/wx/classes/grid.rb
|
56
58
|
- lib/wx/classes/helpcontroller.rb
|
57
59
|
- lib/wx/classes/htmlhelpcontroller.rb
|