wxruby 2.0.0-x86-mingw32 → 2.0.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/art/wxruby-128x128.png +0 -0
- data/art/wxruby-256x256.png +0 -0
- data/art/wxruby-64x64.png +0 -0
- data/art/wxruby.png +0 -0
- data/lib/wx/accessors.rb +1 -3
- data/lib/wx/classes/checklistbox.rb +2 -1
- data/lib/wx/classes/evthandler.rb +1 -1
- data/lib/wx/classes/image.rb +5 -0
- data/lib/wx/classes/listctrl.rb +2 -2
- data/lib/wx/classes/sizer.rb +7 -1
- data/lib/wx/classes/splitterwindow.rb +10 -0
- data/lib/wx/classes/timer.rb +2 -0
- data/lib/wx/classes/toolbar.rb +7 -1
- data/lib/wx/helpers.rb +22 -13
- data/lib/wx/keyword_ctors.rb +1 -1
- data/lib/wx/keyword_defs.rb +14 -4
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.so +0 -0
- data/samples/bigdemo/ShapedWindow.rbw +11 -14
- data/samples/bigdemo/bigdemo.rb +2 -2
- data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
- data/samples/bigdemo/wxStaticBitmap.rbw +8 -12
- data/samples/calendar/calendar.rb +92 -0
- data/samples/drawing/bitmap.rb +8 -3
- data/samples/drawing/maths_images.rb +4 -4
- data/samples/drawing/rmagic_bitmap_image.rb +110 -0
- data/samples/minimal/minimal.rb +1 -1
- data/samples/opengl/cube.rb +27 -14
- data/samples/opengl/cube_anim_lighting.rb +191 -0
- metadata +16 -35
- data/samples/bigdemo/icons/ruby.png +0 -0
- data/samples/drawing/wxruby-logo.png +0 -0
Binary file
|
Binary file
|
Binary file
|
data/art/wxruby.png
ADDED
Binary file
|
data/lib/wx/accessors.rb
CHANGED
@@ -11,8 +11,9 @@ class Wx::CheckListBox
|
|
11
11
|
|
12
12
|
# Call method in ControlWithItems, then sync item data
|
13
13
|
def append(item, data = nil)
|
14
|
-
super(item)
|
14
|
+
i = super(item)
|
15
15
|
__wx_item_data[count - 1] = data
|
16
|
+
return i
|
16
17
|
end
|
17
18
|
|
18
19
|
# Call method in ControlWithItems, then sync item data
|
@@ -145,7 +145,7 @@ class Wx::EvtHandler
|
|
145
145
|
case window_or_id
|
146
146
|
when Fixnum
|
147
147
|
window_or_id
|
148
|
-
when Wx::Window, Wx::MenuItem, Wx::ToolBarTool
|
148
|
+
when Wx::Window, Wx::MenuItem, Wx::ToolBarTool, Wx::Timer
|
149
149
|
window_or_id.wx_id
|
150
150
|
else
|
151
151
|
Kernel.raise ArgumentError,
|
data/lib/wx/classes/image.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# A platform-independent image; can be manipulated more extensively than
|
2
2
|
# Bitmap, but must be converted to a Bitmap for drawing.
|
3
3
|
class Wx::Image
|
4
|
+
|
5
|
+
# alias for backward compatibility
|
6
|
+
alias :get_data :get_rgb_data
|
7
|
+
alias :set_data :set_rgb_data
|
8
|
+
|
4
9
|
# Load the type-guessing hash from Wx::Bitmap
|
5
10
|
require 'wx/classes/bitmap'
|
6
11
|
BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
|
data/lib/wx/classes/listctrl.rb
CHANGED
@@ -11,10 +11,10 @@ class Wx::ListCtrl
|
|
11
11
|
# items
|
12
12
|
def get_selections
|
13
13
|
selections = []
|
14
|
-
item = get_next_item(-1, Wx::
|
14
|
+
item = get_next_item(-1, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)
|
15
15
|
while item >= 0
|
16
16
|
selections << item
|
17
|
-
item = get_next_item(item, Wx::
|
17
|
+
item = get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)
|
18
18
|
end
|
19
19
|
selections
|
20
20
|
end
|
data/lib/wx/classes/sizer.rb
CHANGED
@@ -9,7 +9,13 @@ class Wx::Sizer
|
|
9
9
|
Wx::Parameter[ :user_data, nil ] ]
|
10
10
|
|
11
11
|
def add_item(item, *mixed_args)
|
12
|
-
|
12
|
+
|
13
|
+
begin
|
14
|
+
args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
|
15
|
+
rescue => err
|
16
|
+
err.set_backtrace(caller)
|
17
|
+
Kernel.raise err
|
18
|
+
end
|
13
19
|
|
14
20
|
full_args = []
|
15
21
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Class with movable sash to separate two windows
|
2
|
+
class Wx::SplitterWindow
|
3
|
+
# These were released in wxRuby 2.0 with names slightly out of kilter
|
4
|
+
# with the documentation. The correct ones have an underscore before
|
5
|
+
# the digit.
|
6
|
+
#
|
7
|
+
# FIXME - the old names :get_window1 should be deleted in future versions.
|
8
|
+
alias :get_window_1 :get_window1
|
9
|
+
alias :get_window_2 :get_window2
|
10
|
+
end
|
data/lib/wx/classes/timer.rb
CHANGED
@@ -24,6 +24,8 @@ class Wx::Timer
|
|
24
24
|
# In common with other classes, make the id method refer to the
|
25
25
|
# wxWidgets id, not ruby's deprecated name for object_id
|
26
26
|
alias :id :get_id
|
27
|
+
# In case a more explicit option is preferred.
|
28
|
+
alias :wx_id :get_id
|
27
29
|
|
28
30
|
# This class can be linked to an owner - an instance of a class
|
29
31
|
# derived from EvtHandler which will receive Timer events. However,
|
data/lib/wx/classes/toolbar.rb
CHANGED
@@ -13,7 +13,13 @@ class Wx::ToolBar
|
|
13
13
|
Wx::Parameter[ :client_data, nil ] ]
|
14
14
|
|
15
15
|
def add_item(bitmap1, *mixed_args)
|
16
|
-
|
16
|
+
|
17
|
+
begin
|
18
|
+
args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
|
19
|
+
rescue => err
|
20
|
+
err.set_backtrace(caller)
|
21
|
+
Kernel.raise err
|
22
|
+
end
|
17
23
|
|
18
24
|
bitmap2 = args.shift
|
19
25
|
pos = args.shift
|
data/lib/wx/helpers.rb
CHANGED
@@ -9,22 +9,31 @@ module Wx
|
|
9
9
|
# possible argument. +mixed_args+ is an array which may optionally end
|
10
10
|
# with a set of named arguments
|
11
11
|
def self.args_as_list(param_spec, *mixed_args)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
|
13
|
+
begin
|
14
|
+
# get keyword arguments from mixed args if supplied, else empty
|
15
|
+
kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
|
16
|
+
out_args = []
|
17
|
+
param_spec.each_with_index do | param, i |
|
18
|
+
if arg = mixed_args[i] # use the supplied list arg
|
19
|
+
out_args << arg
|
20
|
+
elsif kwa.key?(param.name) # use the keyword arg
|
21
|
+
out_args << kwa.delete(param.name)
|
22
|
+
else # use the default argument
|
23
|
+
out_args << param.default
|
24
|
+
end
|
22
25
|
end
|
26
|
+
rescue
|
27
|
+
Kernel.raise ArgumentError,
|
28
|
+
"Bad arg composition of #{mixed_args.inspect}"
|
29
|
+
end
|
30
|
+
|
31
|
+
unless kwa.empty?
|
32
|
+
Kernel.raise ArgumentError,
|
33
|
+
"Unknown keyword argument(s) : #{kwa.keys.inspect}"
|
23
34
|
end
|
35
|
+
|
24
36
|
out_args
|
25
|
-
rescue
|
26
|
-
Kernel.raise ArgumentError,
|
27
|
-
"Bad arg composition of #{mixed_args.inspect}"
|
28
37
|
end
|
29
38
|
|
30
39
|
# Given an integer constant +int_const+, returns an array Wx constant
|
data/lib/wx/keyword_ctors.rb
CHANGED
@@ -163,8 +163,8 @@ module Wx
|
|
163
163
|
return
|
164
164
|
end
|
165
165
|
|
166
|
-
real_args = [ parent ] + self.class.args_as_list(*mixed_args)
|
167
166
|
begin
|
167
|
+
real_args = [ parent ] + self.class.args_as_list(*mixed_args)
|
168
168
|
pre_wx_kwctor_init(*real_args)
|
169
169
|
rescue => err
|
170
170
|
msg = "Error initializing #{self.inspect}\n"+
|
data/lib/wx/keyword_defs.rb
CHANGED
@@ -105,6 +105,15 @@ end
|
|
105
105
|
|
106
106
|
# MISCELLANEOUS WINDOWS
|
107
107
|
|
108
|
+
# OpenGL Canvas
|
109
|
+
Wx::define_keyword_ctors('GLCanvas') do
|
110
|
+
wx_ctor_params :id
|
111
|
+
wx_ctor_params :pos, :size, :style => Wx::FULL_REPAINT_ON_RESIZE
|
112
|
+
wx_ctor_params :name => 'GLCanvas'
|
113
|
+
wx_ctor_params :attrib_list => [Wx::GL_RGBA, Wx::GL_DOUBLEBUFFER]
|
114
|
+
wx_ctor_params :palette => Wx::NULL_PALETTE
|
115
|
+
end
|
116
|
+
|
108
117
|
# A window whose colour changes according to current user settings
|
109
118
|
Wx::define_keyword_ctors('Panel') do
|
110
119
|
wx_ctor_params :id, :pos, :size, :style => Wx::TAB_TRAVERSAL
|
@@ -227,7 +236,8 @@ end
|
|
227
236
|
Wx::define_keyword_ctors('DirDialog') do
|
228
237
|
wx_ctor_params :message => 'Choose a directory'
|
229
238
|
wx_ctor_params :default_path => ''
|
230
|
-
wx_ctor_params :style
|
239
|
+
wx_ctor_params :style => Wx::DD_DEFAULT_STYLE
|
240
|
+
wx_ctor_params :pos, :size, :name => 'wxDirCtrl'
|
231
241
|
end
|
232
242
|
|
233
243
|
# wxFileDialog File selector dialog
|
@@ -236,7 +246,8 @@ Wx::define_keyword_ctors('FileDialog') do
|
|
236
246
|
wx_ctor_params :default_dir => ''
|
237
247
|
wx_ctor_params :default_file => ''
|
238
248
|
wx_ctor_params :wildcard => '*.*'
|
239
|
-
wx_ctor_params :style
|
249
|
+
wx_ctor_params :style => Wx::FD_DEFAULT_STYLE
|
250
|
+
wx_ctor_params :pos, :size, :name => 'filedlg'
|
240
251
|
end
|
241
252
|
|
242
253
|
# wxFindReplaceDialog Text search/replace dialog
|
@@ -551,8 +562,7 @@ Wx::define_keyword_ctors('HtmlListBox') do
|
|
551
562
|
end
|
552
563
|
|
553
564
|
Wx::define_keyword_ctors('DatePickerCtrl') do
|
554
|
-
wx_ctor_params :id, :dt =>
|
555
|
-
wx_ctor_params :pos, :size, :style, :validator, :name => 'dateCtrl'
|
565
|
+
wx_ctor_params :id, :dt, :pos, :size, :style, :validator, :name => 'dateCtrl'
|
556
566
|
end
|
557
567
|
|
558
568
|
Wx::define_keyword_ctors('RichTextCtrl') do
|
data/lib/wx/version.rb
CHANGED
data/lib/wxruby2.so
CHANGED
Binary file
|
@@ -7,16 +7,13 @@ rescue LoadError
|
|
7
7
|
end
|
8
8
|
require 'wx'
|
9
9
|
|
10
|
-
|
11
10
|
include Wx
|
12
11
|
|
13
|
-
BUTTON_CLOSE = 1003
|
14
|
-
|
15
12
|
class MyFrame < Frame
|
16
13
|
def initialize(parent, log)
|
17
14
|
@log = log
|
18
|
-
super(parent,
|
19
|
-
FRAME_SHAPED|SIMPLE_BORDER|FRAME_NO_TASKBAR|STAY_ON_TOP)
|
15
|
+
super(parent, :title => "Shaped Window", :size => [350,200],
|
16
|
+
:style => FRAME_SHAPED|SIMPLE_BORDER|FRAME_NO_TASKBAR|STAY_ON_TOP)
|
20
17
|
|
21
18
|
@has_shape = false
|
22
19
|
@delta = [0,0]
|
@@ -28,9 +25,9 @@ class MyFrame < Frame
|
|
28
25
|
evt_right_up {on_exit}
|
29
26
|
evt_paint {on_paint}
|
30
27
|
|
31
|
-
shape = File.join( File.dirname(__FILE__), 'icons', '
|
28
|
+
shape = File.join( File.dirname(__FILE__), 'icons', 'wxruby-128x128.png' )
|
32
29
|
@bmp = Bitmap.new( Image.new(shape) )
|
33
|
-
set_client_size(@bmp.
|
30
|
+
set_client_size(@bmp.width, @bmp.height)
|
34
31
|
|
35
32
|
if Wx::PLATFORM == 'WXGTK'
|
36
33
|
# wxGTK requires that the window be created before you can
|
@@ -69,8 +66,8 @@ class MyFrame < Frame
|
|
69
66
|
|
70
67
|
def on_left_down(event)
|
71
68
|
capture_mouse
|
72
|
-
point = client_to_screen(event.
|
73
|
-
origin =
|
69
|
+
point = client_to_screen(event.position)
|
70
|
+
origin = position
|
74
71
|
dx = point.x - origin.x
|
75
72
|
dy = point.y - origin.y
|
76
73
|
@delta = [dx, dy]
|
@@ -84,7 +81,7 @@ class MyFrame < Frame
|
|
84
81
|
|
85
82
|
def on_mouse_move(event)
|
86
83
|
if event.dragging and event.left_is_down
|
87
|
-
point = client_to_screen(event.
|
84
|
+
point = client_to_screen(event.position)
|
88
85
|
move(point.x - @delta[0], point.y - @delta[1])
|
89
86
|
end
|
90
87
|
end
|
@@ -92,16 +89,16 @@ end
|
|
92
89
|
|
93
90
|
class TestPanel < Wx::Panel
|
94
91
|
def initialize(parent, log)
|
95
|
-
super(parent,
|
92
|
+
super(parent, :style => Wx::NO_FULL_REPAINT_ON_RESIZE)
|
96
93
|
@log = log
|
97
94
|
|
98
|
-
b = Button.new(self,
|
99
|
-
evt_button(b
|
95
|
+
b = Button.new(self, :label => 'Show the ShapedWindow Sample', :pos => [50,50])
|
96
|
+
evt_button(b) { on_button }
|
100
97
|
end
|
101
98
|
|
102
99
|
def on_button
|
103
100
|
win = MyFrame.new(self, @log)
|
104
|
-
win.
|
101
|
+
win.size = [200, 200]
|
105
102
|
win.center_on_parent(Wx::BOTH)
|
106
103
|
win.show(true)
|
107
104
|
end
|
data/samples/bigdemo/bigdemo.rb
CHANGED
@@ -743,7 +743,7 @@ class DemoTaskBarIcon < Wx::TaskBarIcon
|
|
743
743
|
@frame = frame
|
744
744
|
|
745
745
|
# starting image
|
746
|
-
icon = make_icon('
|
746
|
+
icon = make_icon('wxruby-128x128.png')
|
747
747
|
set_icon(icon, 'wxRuby Demo')
|
748
748
|
@image_index = 1
|
749
749
|
|
@@ -796,7 +796,7 @@ class DemoTaskBarIcon < Wx::TaskBarIcon
|
|
796
796
|
end
|
797
797
|
|
798
798
|
def on_taskbar_change(evt)
|
799
|
-
names = [ "
|
799
|
+
names = [ "wxruby-128x128.png", "wxwin16x16.xpm", "smiles.xpm", "mondrian.xpm" ]
|
800
800
|
name = names[@image_index]
|
801
801
|
@image_index += 1
|
802
802
|
if @image_index >= names.length
|
Binary file
|
@@ -11,24 +11,20 @@ require 'wx'
|
|
11
11
|
|
12
12
|
class TestPanel < Wx::Panel
|
13
13
|
def initialize(parent, log)
|
14
|
-
super(parent
|
14
|
+
super(parent)
|
15
15
|
|
16
|
-
Wx::StaticText.new( self,
|
17
|
-
Wx::Point.new(45,5))
|
16
|
+
Wx::StaticText.new( self, :label => "This is a wxStaticBitmap.", :pos => [45,5])
|
18
17
|
|
19
18
|
bmp_file1 = File.join(File.dirname(__FILE__), 'icons', 'test2.xpm')
|
20
|
-
Wx::StaticBitmap.new( self,
|
21
|
-
|
22
|
-
Wx::Point.new(80,25))
|
19
|
+
Wx::StaticBitmap.new( self, :label => Wx::Bitmap.new(bmp_file1),
|
20
|
+
:pos => [80,25])
|
23
21
|
|
24
22
|
bmp_file2 = File.join(File.dirname(__FILE__), 'icons', 'robert.xpm')
|
25
|
-
Wx::StaticBitmap.new( self,
|
26
|
-
|
27
|
-
Wx::Point.new(0, 100))
|
23
|
+
Wx::StaticBitmap.new( self, :label => Wx::Bitmap.new(bmp_file2),
|
24
|
+
:pos => [0, 100])
|
28
25
|
|
29
|
-
Wx::StaticText.new( self,
|
30
|
-
|
31
|
-
Wx::Point.new(100, 125) )
|
26
|
+
Wx::StaticText.new( self, :label => "Hey, if Ousterhout (and Dunn) can do it, so can I.",
|
27
|
+
:pos => [100, 125])
|
32
28
|
end
|
33
29
|
end
|
34
30
|
|
@@ -17,6 +17,11 @@ Calendar_Cal_Year = 204
|
|
17
17
|
Calendar_Cal_SeqMonth = 205
|
18
18
|
Calendar_Cal_SurroundWeeks = 206
|
19
19
|
|
20
|
+
Calendar_DatePicker_AskDate = 300
|
21
|
+
Calendar_DatePicker_ShowCentury = 301
|
22
|
+
Calendar_DatePicker_DropDown = 302
|
23
|
+
Calendar_DatePicker_AllowNone = 303
|
24
|
+
Calendar_DatePicker_StartWithNone = 304
|
20
25
|
|
21
26
|
class MyCalendar < CalendarCtrl
|
22
27
|
def initialize(parent, display_frame, initial_date, calendar_flags)
|
@@ -77,6 +82,9 @@ class MyFrame < Frame
|
|
77
82
|
evt_menu Wx::ID_EXIT, :on_quit
|
78
83
|
evt_menu Wx::ID_ABOUT, :on_about
|
79
84
|
|
85
|
+
evt_menu Calendar_DatePicker_AskDate, :on_ask_date
|
86
|
+
evt_update_ui Calendar_DatePicker_StartWithNone, :on_update_ui_start_with_none
|
87
|
+
|
80
88
|
evt_menu Calendar_Cal_Monday, :on_cal_monday
|
81
89
|
evt_menu Calendar_Cal_Holidays, :on_cal_holidays
|
82
90
|
evt_menu Calendar_Cal_Special, :on_cal_special
|
@@ -125,16 +133,27 @@ class MyFrame < Frame
|
|
125
133
|
"Allow changing the year in the calendar",
|
126
134
|
ITEM_CHECK)
|
127
135
|
|
136
|
+
menu_date = Menu.new
|
137
|
+
menu_date.append_check_item(Calendar_DatePicker_ShowCentury, "Al&ways show century")
|
138
|
+
menu_date.append_check_item(Calendar_DatePicker_DropDown, "Use &drop down control")
|
139
|
+
menu_date.append_check_item(Calendar_DatePicker_AllowNone, "Allow &no date")
|
140
|
+
menu_date.append_check_item(Calendar_DatePicker_StartWithNone, "Start &with no date")
|
141
|
+
menu_date.append_separator
|
142
|
+
menu_date.append(Calendar_DatePicker_AskDate, "&Choose date...\tCtrl-D", "Show dialog with DatePickerCtrl")
|
143
|
+
|
128
144
|
# now append the freshly created menu to the menu bar...
|
129
145
|
menu_bar = MenuBar.new
|
130
146
|
menu_bar.append(menu_file, "&File")
|
131
147
|
menu_bar.append(menu_cal, "&Calendar")
|
148
|
+
menu_bar.append(menu_date, "&Date picker")
|
132
149
|
|
133
150
|
menu_bar.check(Calendar_Cal_Monday, TRUE)
|
134
151
|
menu_bar.check(Calendar_Cal_Holidays, TRUE)
|
135
152
|
menu_bar.check(Calendar_Cal_Month, TRUE)
|
136
153
|
menu_bar.check(Calendar_Cal_Year, TRUE)
|
137
154
|
|
155
|
+
menu_bar.check(Calendar_DatePicker_ShowCentury, TRUE)
|
156
|
+
|
138
157
|
# ... and attach self menu bar to the frame
|
139
158
|
self.menu_bar = menu_bar
|
140
159
|
end
|
@@ -201,6 +220,36 @@ class MyFrame < Frame
|
|
201
220
|
event.enable( get_menu_bar().is_checked(Calendar_Cal_Month))
|
202
221
|
end
|
203
222
|
|
223
|
+
def on_update_ui_start_with_none(event)
|
224
|
+
event.enable( get_menu_bar().is_checked(Calendar_DatePicker_AllowNone))
|
225
|
+
end
|
226
|
+
|
227
|
+
def on_ask_date(event)
|
228
|
+
dt = @calendar.get_date
|
229
|
+
|
230
|
+
style = DP_DEFAULT
|
231
|
+
style |= DP_SHOWCENTURY if get_menu_bar.is_checked(Calendar_DatePicker_ShowCentury)
|
232
|
+
style |= DP_DROPDOWN if get_menu_bar.is_checked(Calendar_DatePicker_DropDown)
|
233
|
+
if get_menu_bar.is_checked(Calendar_DatePicker_AllowNone)
|
234
|
+
style |= DP_ALLOWNONE
|
235
|
+
dt = nil if get_menu_bar.is_checked(Calendar_DatePicker_StartWithNone)
|
236
|
+
end
|
237
|
+
|
238
|
+
dlg = MyDialog.new(self, dt, style)
|
239
|
+
if dlg.show_modal == ID_OK
|
240
|
+
if dt = dlg.get_date
|
241
|
+
today = Time.now
|
242
|
+
if dt.day == today.day && dt.month == today.month
|
243
|
+
message_box("Happy birthday", "Calendar Sample")
|
244
|
+
end
|
245
|
+
@calendar.set_date(dt)
|
246
|
+
log_status("Changed the date to your input")
|
247
|
+
else
|
248
|
+
log_status("No date entered")
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
204
253
|
def toggle_cal_style(on,flag)
|
205
254
|
style = @calendar.get_window_style_flag
|
206
255
|
date = @calendar.date
|
@@ -244,6 +293,49 @@ class MyFrame < Frame
|
|
244
293
|
|
245
294
|
end
|
246
295
|
|
296
|
+
class MyDialog < Dialog
|
297
|
+
def initialize(parent, dt, picker_style)
|
298
|
+
super(parent, :style => DEFAULT_DIALOG_STYLE|RESIZE_BORDER)
|
299
|
+
sizer_buttons = StdDialogButtonSizer.new
|
300
|
+
sizer_buttons.add_button(Button.new(self, ID_OK))
|
301
|
+
sizer_buttons.add_button(Button.new(self, ID_CANCEL))
|
302
|
+
sizer_buttons.realize
|
303
|
+
|
304
|
+
sizer_text = BoxSizer.new(HORIZONTAL)
|
305
|
+
sizer_text.add(StaticText.new(self, ID_ANY, "Date in ISO format:"), 0, ALL|ALIGN_CENTRE_VERTICAL, 10)
|
306
|
+
@text = TextCtrl.new(self)
|
307
|
+
sizer_text.add(@text, 1, ALL|ALIGN_CENTRE_VERTICAL|EXPAND, 10)
|
308
|
+
|
309
|
+
sizer_top = BoxSizer.new(VERTICAL)
|
310
|
+
sizer_top.add(StaticText.new(self, ID_ANY, "Enter your birthday date (not before 20th century):"), 0, ALL, 10)
|
311
|
+
|
312
|
+
@picker = DatePickerCtrl.new(self, ID_ANY, dt, DEFAULT_POSITION, DEFAULT_SIZE, picker_style)
|
313
|
+
@picker.set_range(DateTime.new(1900, 1, 1), nil)
|
314
|
+
sizer_top.add(@picker, 0, ALL|EXPAND, 10)
|
315
|
+
sizer_top.add_stretch_spacer(1)
|
316
|
+
sizer_top.add(sizer_text, 0, EXPAND)
|
317
|
+
|
318
|
+
sizer_top.add(sizer_buttons, 0, ALL|ALIGN_CENTER, 10)
|
319
|
+
|
320
|
+
set_sizer_and_fit(sizer_top)
|
321
|
+
layout
|
322
|
+
|
323
|
+
evt_date_changed(@picker, :on_date_changed)
|
324
|
+
end
|
325
|
+
|
326
|
+
def get_date
|
327
|
+
@picker.get_value
|
328
|
+
end
|
329
|
+
|
330
|
+
def on_date_changed(event)
|
331
|
+
if dt = event.get_date
|
332
|
+
@text.set_value(dt.to_s)
|
333
|
+
else
|
334
|
+
@text.set_value("")
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
247
339
|
|
248
340
|
class RbApp < App
|
249
341
|
def on_init()
|
data/samples/drawing/bitmap.rb
CHANGED
@@ -22,8 +22,13 @@ class ImageFrame < Wx::Frame
|
|
22
22
|
def initialize
|
23
23
|
super(nil, :title => 'Simple image demo')
|
24
24
|
|
25
|
+
@offset = 10
|
26
|
+
size = 256+2*@offset
|
27
|
+
self.client_size = [size, size]
|
28
|
+
|
25
29
|
# Load a PNG bitmap from a file for drawing
|
26
|
-
img_file = File.join( File.dirname(__FILE__),
|
30
|
+
img_file = File.join( File.dirname(__FILE__)+"/../../art",
|
31
|
+
'wxruby-256x256.png')
|
27
32
|
@bitmap = Wx::Bitmap.new(img_file)
|
28
33
|
|
29
34
|
# Set up the drawing to be done when the frame needs re-painting
|
@@ -32,8 +37,8 @@ class ImageFrame < Wx::Frame
|
|
32
37
|
|
33
38
|
def on_paint
|
34
39
|
paint do | dc |
|
35
|
-
# Draw the bitmap at
|
36
|
-
dc.draw_bitmap(@bitmap,
|
40
|
+
# Draw the bitmap at the specified offset with no transparency
|
41
|
+
dc.draw_bitmap(@bitmap, @offset, @offset, false)
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
@@ -21,7 +21,7 @@ include Math
|
|
21
21
|
# The sample demonstrates some uses of the Wx::Image class, a
|
22
22
|
# platform-independent representation of an image which can be
|
23
23
|
# manipulated (for example, resizing) and written to files in various
|
24
|
-
# formats. It also shows how an image's data can be written directly, by
|
24
|
+
# formats. It also shows how an image's rgb data can be written directly, by
|
25
25
|
# using Array#pack.
|
26
26
|
|
27
27
|
# A canvas that draws and displays a mathematically generated image
|
@@ -36,7 +36,7 @@ class MathsDrawing < Window
|
|
36
36
|
super(parent)
|
37
37
|
# Create a dummy image
|
38
38
|
@default_image = Image.new(1, 1)
|
39
|
-
@default_image.
|
39
|
+
@default_image.rgb_data = [255, 255, 255].pack('CCC')
|
40
40
|
@img = @default_image
|
41
41
|
|
42
42
|
@red = lambda { | x, y | 1 }
|
@@ -88,7 +88,7 @@ class MathsDrawing < Window
|
|
88
88
|
end
|
89
89
|
|
90
90
|
start_time = Time.now
|
91
|
-
# The string holding raw
|
91
|
+
# The string holding raw rgb data
|
92
92
|
data = ''
|
93
93
|
x_factor = size_x.to_f
|
94
94
|
y_factor = size_y.to_f
|
@@ -105,7 +105,7 @@ class MathsDrawing < Window
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
img = Image.new(size_x, size_y)
|
108
|
-
img.
|
108
|
+
img.rgb_data = data
|
109
109
|
@render_time = Time.now - start_time
|
110
110
|
img
|
111
111
|
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
require 'wx'
|
9
|
+
require 'RMagick'
|
10
|
+
|
11
|
+
# RMagick sample (written by Chauk-Mean Proum)
|
12
|
+
|
13
|
+
# This sample demonstrates how to convert directly a RMagick image to
|
14
|
+
# a wxRuby image (without saving and loading the image file).
|
15
|
+
# See the magick_to_wx method.
|
16
|
+
|
17
|
+
class ImageFrame < Wx::Frame
|
18
|
+
def initialize
|
19
|
+
super(nil, :title => 'RMagick sample', :size => [600, 600])
|
20
|
+
|
21
|
+
# Create the magick image from an image file
|
22
|
+
img_file = File.join( File.dirname(__FILE__)+"/../../art",
|
23
|
+
'wxruby-256x256.png')
|
24
|
+
@magick_image = Magick::ImageList.new(img_file)
|
25
|
+
|
26
|
+
# Create some magick images with special effects
|
27
|
+
@magick_image1 = @magick_image.sketch
|
28
|
+
@magick_image2 = @magick_image.oil_paint(4)
|
29
|
+
@magick_image3 = @magick_image.shade
|
30
|
+
|
31
|
+
# Convert the magick images to wxRuby images
|
32
|
+
@image1 = magick_to_wx(@magick_image1)
|
33
|
+
@image2 = magick_to_wx(@magick_image2)
|
34
|
+
@image3 = magick_to_wx(@magick_image3)
|
35
|
+
|
36
|
+
# Create the corresponding bitmaps
|
37
|
+
compute_bitmaps
|
38
|
+
|
39
|
+
# Set up event handling
|
40
|
+
evt_size :on_size
|
41
|
+
evt_idle :on_idle
|
42
|
+
evt_paint :on_paint
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
# Convert the RMagick image to a WxRuby image
|
47
|
+
def magick_to_wx magick_img
|
48
|
+
wx_img = Wx::Image.new(magick_img.columns, magick_img.rows)
|
49
|
+
|
50
|
+
# Set the image data
|
51
|
+
wx_img.rgb_data = magick_img.to_blob { self.format = "RGB" }
|
52
|
+
|
53
|
+
# Set the alpha (transparency) if any
|
54
|
+
if magick_img.alpha?
|
55
|
+
wx_img.alpha_data = magick_img.to_blob { self.format = "A" }
|
56
|
+
end
|
57
|
+
|
58
|
+
wx_img
|
59
|
+
end
|
60
|
+
|
61
|
+
# Create a bitmap for the specified image and size
|
62
|
+
def compute_bitmap image, width, height
|
63
|
+
rescaled_image = Wx::Image.new(image).rescale(width, height)
|
64
|
+
rescaled_image.to_bitmap
|
65
|
+
end
|
66
|
+
|
67
|
+
# Create the bitmaps corresponding to the images and with half the size of the frame
|
68
|
+
def compute_bitmaps
|
69
|
+
width = client_size.x / 2
|
70
|
+
height = client_size.y / 2
|
71
|
+
@bitmap1 = compute_bitmap(@image1, width, height)
|
72
|
+
@bitmap2 = compute_bitmap(@image2, width, height)
|
73
|
+
@bitmap3 = compute_bitmap(@image3, width, height)
|
74
|
+
@done = true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Note to recompute the bitmaps on a resize
|
78
|
+
def on_size(event)
|
79
|
+
@done = false
|
80
|
+
event.skip
|
81
|
+
end
|
82
|
+
|
83
|
+
# Recompute the bitmaps if needed, then do a refresh
|
84
|
+
def on_idle
|
85
|
+
if not @done
|
86
|
+
compute_bitmaps
|
87
|
+
refresh
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Paint the frame with the bitmaps
|
92
|
+
def on_paint
|
93
|
+
paint do | dc |
|
94
|
+
|
95
|
+
if @done
|
96
|
+
offset_x = client_size.x / 4
|
97
|
+
offset_y = client_size.y / 4
|
98
|
+
dc.draw_bitmap(@bitmap1, 0, 0, true)
|
99
|
+
dc.draw_bitmap(@bitmap2, offset_x, offset_y, true)
|
100
|
+
dc.draw_bitmap(@bitmap3, offset_x*2, offset_y*2, true)
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
Wx::App.run do
|
108
|
+
ImageFrame.new.show
|
109
|
+
end
|
110
|
+
|
data/samples/minimal/minimal.rb
CHANGED
@@ -20,7 +20,7 @@ class MinimalFrame < Wx::Frame
|
|
20
20
|
|
21
21
|
# Give the frame an icon. PNG is a good choice of format for
|
22
22
|
# cross-platform images. Note that OS X doesn't have "Frame" icons.
|
23
|
-
icon_file = File.join( File.dirname(__FILE__), "
|
23
|
+
icon_file = File.join( File.dirname(__FILE__)+"/../../art", "wxruby.png")
|
24
24
|
self.icon = Wx::Icon.new(icon_file)
|
25
25
|
|
26
26
|
menu_bar = Wx::MenuBar.new
|
data/samples/opengl/cube.rb
CHANGED
@@ -14,13 +14,27 @@ include Glu
|
|
14
14
|
|
15
15
|
class CubeFrame < Wx::Frame
|
16
16
|
def initialize(title)
|
17
|
-
super(nil, :title => title, :size => [
|
17
|
+
super(nil, :title => title, :size => [ 600, 400 ])
|
18
|
+
|
19
|
+
sizer = Wx::VBoxSizer.new
|
20
|
+
|
18
21
|
attrib = [Wx::GL_RGBA, Wx::GL_DOUBLEBUFFER, Wx::GL_DEPTH_SIZE, 24]
|
19
22
|
@canvas = Wx::GLCanvas.new(self, -1, [-1, -1], [-1, -1],
|
20
|
-
Wx::FULL_REPAINT_ON_RESIZE,
|
21
|
-
|
23
|
+
Wx::FULL_REPAINT_ON_RESIZE, "GLCanvas", attrib)
|
24
|
+
sizer.add_item @canvas, :proportion => 1, :flag => Wx::EXPAND
|
25
|
+
|
26
|
+
text = Wx::StaticText.new(self, :label => "Use Up/Down/Left/Right keys to rotate the cube")
|
27
|
+
sizer.add_item text
|
28
|
+
|
29
|
+
self.sizer = sizer
|
30
|
+
self.show
|
31
|
+
|
32
|
+
@canvas.set_focus
|
22
33
|
@canvas.evt_key_down {|evt| on_key_down(evt.get_key_code) }
|
23
|
-
|
34
|
+
|
35
|
+
@canvas.evt_paint { @canvas.paint { render } }
|
36
|
+
@rotate = [30.0, 0.0, -30.0]
|
37
|
+
|
24
38
|
end
|
25
39
|
|
26
40
|
def on_key_down(key)
|
@@ -39,9 +53,9 @@ class CubeFrame < Wx::Frame
|
|
39
53
|
|
40
54
|
def render
|
41
55
|
@canvas.set_current
|
42
|
-
sz = @canvas.
|
43
|
-
w = sz.
|
44
|
-
h = sz.
|
56
|
+
sz = @canvas.size
|
57
|
+
w = sz.width
|
58
|
+
h = sz.height
|
45
59
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
46
60
|
glEnable(GL_DEPTH_TEST)
|
47
61
|
glViewport(0, 0, w, h)
|
@@ -58,7 +72,7 @@ class CubeFrame < Wx::Frame
|
|
58
72
|
glRotate(@rotate[2], 0.0, 0.0, 1.0)
|
59
73
|
glBegin(GL_TRIANGLES)
|
60
74
|
#left
|
61
|
-
glColor3d(1.0, 1.0,
|
75
|
+
glColor3d(1.0, 1.0, 0.0) # yellow
|
62
76
|
glVertex3d(-1.0, 1.0, 1.0)
|
63
77
|
glVertex3d(-1.0, 1.0,-1.0)
|
64
78
|
glVertex3d(-1.0,-1.0, 1.0)
|
@@ -66,7 +80,7 @@ class CubeFrame < Wx::Frame
|
|
66
80
|
glVertex3d(-1.0, 1.0,-1.0)
|
67
81
|
glVertex3d(-1.0,-1.0,-1.0)
|
68
82
|
#right
|
69
|
-
glColor3d(0.0, 1.0,
|
83
|
+
glColor3d(0.0, 1.0, 0.0) # green
|
70
84
|
glVertex3d( 1.0,-1.0, 1.0)
|
71
85
|
glVertex3d( 1.0,-1.0,-1.0)
|
72
86
|
glVertex3d( 1.0, 1.0, 1.0)
|
@@ -74,7 +88,7 @@ class CubeFrame < Wx::Frame
|
|
74
88
|
glVertex3d( 1.0,-1.0,-1.0)
|
75
89
|
glVertex3d( 1.0, 1.0,-1.0)
|
76
90
|
#up
|
77
|
-
glColor3d(0.0, 0.0, 1.0)
|
91
|
+
glColor3d(0.0, 0.0, 1.0) # blue
|
78
92
|
glVertex3d(-1.0, 1.0, 1.0)
|
79
93
|
glVertex3d(-1.0,-1.0, 1.0)
|
80
94
|
glVertex3d( 1.0, 1.0, 1.0)
|
@@ -82,7 +96,7 @@ class CubeFrame < Wx::Frame
|
|
82
96
|
glVertex3d(-1.0,-1.0, 1.0)
|
83
97
|
glVertex3d( 1.0,-1.0, 1.0)
|
84
98
|
#down
|
85
|
-
glColor3d(
|
99
|
+
glColor3d(0.0, 1.0, 1.0) # cyan
|
86
100
|
glVertex3d(-1.0,-1.0,-1.0)
|
87
101
|
glVertex3d(-1.0, 1.0,-1.0)
|
88
102
|
glVertex3d( 1.0,-1.0,-1.0)
|
@@ -90,7 +104,7 @@ class CubeFrame < Wx::Frame
|
|
90
104
|
glVertex3d(-1.0, 1.0,-1.0)
|
91
105
|
glVertex3d( 1.0, 1.0,-1.0)
|
92
106
|
#front
|
93
|
-
glColor3d(1.0,
|
107
|
+
glColor3d(1.0, 0.0, 0.0) # red
|
94
108
|
glVertex3d(-1.0,-1.0, 1.0)
|
95
109
|
glVertex3d(-1.0,-1.0,-1.0)
|
96
110
|
glVertex3d( 1.0,-1.0, 1.0)
|
@@ -98,7 +112,7 @@ class CubeFrame < Wx::Frame
|
|
98
112
|
glVertex3d(-1.0,-1.0,-1.0)
|
99
113
|
glVertex3d( 1.0,-1.0,-1.0)
|
100
114
|
#back
|
101
|
-
glColor3d(
|
115
|
+
glColor3d(1.0, 0.0, 1.0) # magenta
|
102
116
|
glVertex3d( 1.0, 1.0, 1.0)
|
103
117
|
glVertex3d( 1.0, 1.0,-1.0)
|
104
118
|
glVertex3d(-1.0, 1.0, 1.0)
|
@@ -113,5 +127,4 @@ end
|
|
113
127
|
Wx::App.run do
|
114
128
|
self.app_name = 'GLCanvas Cube'
|
115
129
|
frame = CubeFrame.new("OpenGL Canvas wxRuby App")
|
116
|
-
frame.show
|
117
130
|
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
+
|
5
|
+
# OpenGL sample by Chauk-Mean Proum featuring an animated cube with lighting.
|
6
|
+
# OpenGL commands are structured following the Red Book :
|
7
|
+
# - init part (opengl_init)
|
8
|
+
# - resize part (opengl_resize)
|
9
|
+
# - render part (opengl_render)
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'rubygems'
|
13
|
+
rescue LoadError
|
14
|
+
end
|
15
|
+
require 'wx'
|
16
|
+
require 'gl'
|
17
|
+
require 'glu'
|
18
|
+
|
19
|
+
include Gl
|
20
|
+
include Glu
|
21
|
+
|
22
|
+
class CubeFrame < Wx::Frame
|
23
|
+
def initialize(title)
|
24
|
+
super(nil, :title => title)
|
25
|
+
|
26
|
+
sizer = Wx::VBoxSizer.new
|
27
|
+
|
28
|
+
attrib = [Wx::GL_RGBA, Wx::GL_DOUBLEBUFFER, Wx::GL_DEPTH_SIZE, 24]
|
29
|
+
# Use of keyword arguments for the GLCanvas initializer
|
30
|
+
@canvas = Wx::GLCanvas.new(self, :attrib_list => attrib, :size => [600, 600])
|
31
|
+
sizer.add_item @canvas, :proportion => 1, :flag => Wx::EXPAND
|
32
|
+
|
33
|
+
text = Wx::StaticText.new(self, :label => "Use Up/Down/Left/Right keys to change rotation direction")
|
34
|
+
sizer.add_item text
|
35
|
+
|
36
|
+
self.sizer = sizer
|
37
|
+
sizer.fit(self)
|
38
|
+
|
39
|
+
self.show
|
40
|
+
# A GL context can be set to a GL canvas only if the latter has been shown
|
41
|
+
opengl_init()
|
42
|
+
opengl_resize()
|
43
|
+
|
44
|
+
# set the focus on the GL canvas for key press
|
45
|
+
@canvas.set_focus
|
46
|
+
@canvas.evt_key_down {|evt| on_key_down(evt.get_key_code) }
|
47
|
+
|
48
|
+
@canvas.evt_paint { @canvas.paint { opengl_render } }
|
49
|
+
@canvas.evt_size do |e|
|
50
|
+
opengl_resize
|
51
|
+
e.skip()
|
52
|
+
end
|
53
|
+
|
54
|
+
# set up the animation
|
55
|
+
@rotate = [15.0, -30.0, 0.0]
|
56
|
+
@anim_step_x_axis = -1.0
|
57
|
+
@anim_step_y_axis = -2.0
|
58
|
+
anim_timer = Wx::Timer.new(self)
|
59
|
+
anim_timer.start(25) # start the timer with a period of 25 ms
|
60
|
+
evt_timer anim_timer, :animate
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def animate
|
65
|
+
@rotate[0] += @anim_step_x_axis
|
66
|
+
@rotate[1] += @anim_step_y_axis
|
67
|
+
opengl_render()
|
68
|
+
end
|
69
|
+
|
70
|
+
def on_key_down(key)
|
71
|
+
case key
|
72
|
+
when Wx::K_UP
|
73
|
+
@anim_step_x_axis = -1.0
|
74
|
+
when Wx::K_DOWN
|
75
|
+
@anim_step_x_axis = 1.0
|
76
|
+
when Wx::K_LEFT
|
77
|
+
@anim_step_y_axis = -2.0
|
78
|
+
when Wx::K_RIGHT
|
79
|
+
@anim_step_y_axis = 2.0
|
80
|
+
end
|
81
|
+
opengl_render()
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def opengl_init
|
86
|
+
# initialize the GL rendering
|
87
|
+
@canvas.set_current
|
88
|
+
|
89
|
+
mat_specular = [1.0, 1.0, 1.0, 1.0]
|
90
|
+
mat_shininess = [90.0]
|
91
|
+
|
92
|
+
light_ambient = [0.9, 0.9, 0.9, 1.0]
|
93
|
+
light_position = [-1.0, 4.0, 7.0, 0.0]
|
94
|
+
|
95
|
+
glLoadIdentity()
|
96
|
+
|
97
|
+
# glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular)
|
98
|
+
# glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess)
|
99
|
+
|
100
|
+
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_ambient)
|
101
|
+
glLightfv(GL_LIGHT0, GL_POSITION, light_position)
|
102
|
+
|
103
|
+
glColorMaterial(GL_FRONT, GL_DIFFUSE)
|
104
|
+
|
105
|
+
glEnable(GL_LIGHTING)
|
106
|
+
glEnable(GL_LIGHT0)
|
107
|
+
glEnable(GL_COLOR_MATERIAL)
|
108
|
+
|
109
|
+
glDepthFunc(GL_LEQUAL)
|
110
|
+
glEnable(GL_DEPTH_TEST)
|
111
|
+
end
|
112
|
+
|
113
|
+
def opengl_resize
|
114
|
+
@canvas.set_current
|
115
|
+
sz = @canvas.size
|
116
|
+
w = sz.width
|
117
|
+
h = sz.height
|
118
|
+
glViewport(0, 0, w, h)
|
119
|
+
glMatrixMode(GL_PROJECTION)
|
120
|
+
glLoadIdentity()
|
121
|
+
gluPerspective(30.0, w.to_f/h.to_f, 1.0, 20.0)
|
122
|
+
glMatrixMode(GL_MODELVIEW)
|
123
|
+
end
|
124
|
+
|
125
|
+
def opengl_render
|
126
|
+
@canvas.set_current
|
127
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
128
|
+
glLoadIdentity()
|
129
|
+
|
130
|
+
gluLookAt(0.0, 3.0, 8.0, # position
|
131
|
+
0.0, 0.0, 0.0, # target
|
132
|
+
0.0, 1.0, 0.0) # up direction
|
133
|
+
|
134
|
+
glRotate(@rotate[0], 1.0, 0.0, 0.0)
|
135
|
+
glRotate(@rotate[1], 0.0, 1.0, 0.0)
|
136
|
+
glRotate(@rotate[2], 0.0, 0.0, 1.0)
|
137
|
+
|
138
|
+
glBegin(GL_QUADS)
|
139
|
+
|
140
|
+
#left
|
141
|
+
glNormal3d(-1.0, 0.0, 0.0) # normal vector is required for proper lighting
|
142
|
+
glColor3d(1.0, 1.0, 0.0) # yellow
|
143
|
+
glVertex3d(-1.0,-1.0,-1.0)
|
144
|
+
glVertex3d(-1.0, 1.0,-1.0)
|
145
|
+
glVertex3d(-1.0, 1.0, 1.0)
|
146
|
+
glVertex3d(-1.0,-1.0, 1.0)
|
147
|
+
#right
|
148
|
+
glNormal3d( 1.0, 0.0, 0.0)
|
149
|
+
glColor3d(0.0, 1.0, 0.0) # green
|
150
|
+
glVertex3d( 1.0,-1.0,-1.0)
|
151
|
+
glVertex3d( 1.0, 1.0,-1.0)
|
152
|
+
glVertex3d( 1.0, 1.0, 1.0)
|
153
|
+
glVertex3d( 1.0,-1.0, 1.0)
|
154
|
+
#up
|
155
|
+
glNormal3d( 0.0, 1.0, 0.0)
|
156
|
+
glColor3d(0.0, 0.0, 1.0) # blue
|
157
|
+
glVertex3d(-1.0, 1.0,-1.0)
|
158
|
+
glVertex3d( 1.0, 1.0,-1.0)
|
159
|
+
glVertex3d( 1.0, 1.0, 1.0)
|
160
|
+
glVertex3d(-1.0, 1.0, 1.0)
|
161
|
+
#down
|
162
|
+
glNormal3d( 0.0,-1.0, 0.0)
|
163
|
+
glColor3d(0.0, 1.0, 1.0) # cyan
|
164
|
+
glVertex3d(-1.0,-1.0,-1.0)
|
165
|
+
glVertex3d( 1.0,-1.0,-1.0)
|
166
|
+
glVertex3d( 1.0,-1.0, 1.0)
|
167
|
+
glVertex3d(-1.0,-1.0, 1.0)
|
168
|
+
#front
|
169
|
+
glNormal3d( 0.0, 0.0, 1.0)
|
170
|
+
glColor3d(1.0, 0.0, 0.0) # red
|
171
|
+
glVertex3d(-1.0,-1.0, 1.0)
|
172
|
+
glVertex3d(-1.0, 1.0, 1.0)
|
173
|
+
glVertex3d( 1.0, 1.0, 1.0)
|
174
|
+
glVertex3d( 1.0,-1.0, 1.0)
|
175
|
+
#back
|
176
|
+
glNormal3d( 0.0, 0.0,-1.0)
|
177
|
+
glColor3d(1.0, 0.0, 1.0) # magenta
|
178
|
+
glVertex3d(-1.0,-1.0,-1.0)
|
179
|
+
glVertex3d(-1.0, 1.0,-1.0)
|
180
|
+
glVertex3d( 1.0, 1.0,-1.0)
|
181
|
+
glVertex3d( 1.0,-1.0,-1.0)
|
182
|
+
glEnd()
|
183
|
+
glFlush()
|
184
|
+
@canvas.swap_buffers
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
Wx::App.run do
|
189
|
+
self.app_name = 'GLCanvas Cube'
|
190
|
+
frame = CubeFrame.new("OpenGL Canvas wxRuby : Animation and Lighting")
|
191
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wxruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- wxRuby development team
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-10 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description: wxRuby allows the creation of graphical user interface (GUI)
|
16
|
+
description: " wxRuby allows the creation of graphical user interface (GUI)\n applications via the wxWidgets library. wxRuby provides native-style\n GUI windows, dialogs and controls on platforms including Windows, OS X\n and Linux.\n"
|
17
17
|
email: support@wxruby.org
|
18
18
|
executables: []
|
19
19
|
|
@@ -22,9 +22,7 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
-
- lib/wx
|
26
25
|
- lib/wx/accessors.rb
|
27
|
-
- lib/wx/classes
|
28
26
|
- lib/wx/classes/acceleratortable.rb
|
29
27
|
- lib/wx/classes/animation.rb
|
30
28
|
- lib/wx/classes/app.rb
|
@@ -78,6 +76,7 @@ files:
|
|
78
76
|
- lib/wx/classes/size.rb
|
79
77
|
- lib/wx/classes/sizer.rb
|
80
78
|
- lib/wx/classes/sound.rb
|
79
|
+
- lib/wx/classes/splitterwindow.rb
|
81
80
|
- lib/wx/classes/standardpaths.rb
|
82
81
|
- lib/wx/classes/styledtextctrl.rb
|
83
82
|
- lib/wx/classes/textctrl.rb
|
@@ -96,16 +95,17 @@ files:
|
|
96
95
|
- lib/wx/version.rb
|
97
96
|
- lib/wx.rb
|
98
97
|
- lib/wxruby2.so
|
99
|
-
-
|
98
|
+
- art/wxruby-128x128.png
|
99
|
+
- art/wxruby-256x256.png
|
100
|
+
- art/wxruby-64x64.png
|
101
|
+
- art/wxruby.png
|
100
102
|
- samples/aui/aui.rb
|
101
|
-
- samples/bigdemo
|
102
103
|
- samples/bigdemo/About.rbw
|
103
104
|
- samples/bigdemo/bigdemo.rb
|
104
105
|
- samples/bigdemo/ColorPanel.rbw
|
105
106
|
- samples/bigdemo/demoTemplate.rbw
|
106
107
|
- samples/bigdemo/GridSimple.rbw
|
107
108
|
- samples/bigdemo/helpfile.htb
|
108
|
-
- samples/bigdemo/icons
|
109
109
|
- samples/bigdemo/icons/choice.bmp
|
110
110
|
- samples/bigdemo/icons/choice.xpm
|
111
111
|
- samples/bigdemo/icons/combo.bmp
|
@@ -131,7 +131,6 @@ files:
|
|
131
131
|
- samples/bigdemo/icons/radio.bmp
|
132
132
|
- samples/bigdemo/icons/radio.xpm
|
133
133
|
- samples/bigdemo/icons/robert.xpm
|
134
|
-
- samples/bigdemo/icons/ruby.png
|
135
134
|
- samples/bigdemo/icons/sashtest.ico
|
136
135
|
- samples/bigdemo/icons/save.xpm
|
137
136
|
- samples/bigdemo/icons/smiles.bmp
|
@@ -150,6 +149,7 @@ files:
|
|
150
149
|
- samples/bigdemo/icons/tog1.xpm
|
151
150
|
- samples/bigdemo/icons/tog2.bmp
|
152
151
|
- samples/bigdemo/icons/tog2.xpm
|
152
|
+
- samples/bigdemo/icons/wxruby-128x128.png
|
153
153
|
- samples/bigdemo/icons/wxwin.ico
|
154
154
|
- samples/bigdemo/icons/wxwin16x16.png
|
155
155
|
- samples/bigdemo/icons/wxwin16x16.xpm
|
@@ -212,15 +212,11 @@ files:
|
|
212
212
|
- samples/bigdemo/wxToggleButton.rbw
|
213
213
|
- samples/bigdemo/wxToolBar.rbw
|
214
214
|
- samples/bigdemo/wxTreeCtrl.rbw
|
215
|
-
- samples/calendar
|
216
215
|
- samples/calendar/calendar.rb
|
217
|
-
- samples/caret
|
218
216
|
- samples/caret/caret.rb
|
219
217
|
- samples/caret/mondrian.xpm
|
220
|
-
- samples/controls
|
221
218
|
- samples/controls/controls.rb
|
222
219
|
- samples/controls/get_item_sample.rb
|
223
|
-
- samples/controls/icons
|
224
220
|
- samples/controls/icons/choice.xpm
|
225
221
|
- samples/controls/icons/combo.xpm
|
226
222
|
- samples/controls/icons/gauge.xpm
|
@@ -231,19 +227,15 @@ files:
|
|
231
227
|
- samples/controls/mondrian.ico
|
232
228
|
- samples/controls/mondrian.xpm
|
233
229
|
- samples/controls/test2.bmp
|
234
|
-
- samples/dialogs
|
235
230
|
- samples/dialogs/dialogs.rb
|
236
231
|
- samples/dialogs/tips.txt
|
237
|
-
- samples/dragdrop
|
238
232
|
- samples/dragdrop/dragdrop.rb
|
239
|
-
- samples/drawing
|
240
233
|
- samples/drawing/bitmap.rb
|
241
234
|
- samples/drawing/bitmap_image.rb
|
242
235
|
- samples/drawing/graphics_drawing.rb
|
243
236
|
- samples/drawing/maths_images.rb
|
237
|
+
- samples/drawing/rmagic_bitmap_image.rb
|
244
238
|
- samples/drawing/ruby-logo.jpg
|
245
|
-
- samples/drawing/wxruby-logo.png
|
246
|
-
- samples/etc
|
247
239
|
- samples/etc/activation.rb
|
248
240
|
- samples/etc/choice.rb
|
249
241
|
- samples/etc/miniframe.rb
|
@@ -253,42 +245,31 @@ files:
|
|
253
245
|
- samples/etc/threaded.rb
|
254
246
|
- samples/etc/toolbar_sizer_additem.rb
|
255
247
|
- samples/etc/wizard.rb
|
256
|
-
- samples/event
|
257
248
|
- samples/event/event.rb
|
258
249
|
- samples/event/update_ui_event.rb
|
259
|
-
- samples/grid
|
260
250
|
- samples/grid/grid.rb
|
261
251
|
- samples/grid/gridtablebase.rb
|
262
|
-
- samples/html
|
263
252
|
- samples/html/html.rb
|
264
|
-
- samples/listbook
|
265
253
|
- samples/listbook/listbook.rb
|
266
254
|
- samples/listbook/listbook.xrc
|
267
|
-
- samples/mdi
|
268
255
|
- samples/mdi/mdi.rb
|
269
|
-
- samples/media
|
270
256
|
- samples/media/mediactrl.rb
|
271
|
-
- samples/minimal
|
272
257
|
- samples/minimal/minimal.rb
|
273
258
|
- samples/minimal/mondrian.ico
|
274
259
|
- samples/minimal/mondrian.png
|
275
260
|
- samples/minimal/nothing.rb
|
276
|
-
- samples/opengl
|
277
261
|
- samples/opengl/cube.rb
|
278
|
-
- samples/
|
262
|
+
- samples/opengl/cube_anim_lighting.rb
|
279
263
|
- samples/printing/mondrian.ico
|
280
264
|
- samples/printing/mondrian.xpm
|
281
265
|
- samples/printing/printing.rb
|
282
266
|
- samples/SAMPLES-LICENSE.TXT
|
283
|
-
- samples/sockets
|
284
|
-
- samples/sockets/res
|
285
267
|
- samples/sockets/res/message-new.png
|
286
268
|
- samples/sockets/res/user.png
|
287
269
|
- samples/sockets/SocketPackets.rb
|
288
270
|
- samples/sockets/wxClient.rb
|
289
271
|
- samples/sockets/wxServer.rb
|
290
272
|
- samples/sockets/wxSocketGUI.rb
|
291
|
-
- samples/text
|
292
273
|
- samples/text/document-open.png
|
293
274
|
- samples/text/document-save.png
|
294
275
|
- samples/text/edit-copy.png
|
@@ -307,21 +288,21 @@ files:
|
|
307
288
|
- samples/text/textctrl.rb
|
308
289
|
- samples/text/unicode.rb
|
309
290
|
- samples/text/utf8.txt
|
310
|
-
- samples/treectrl
|
311
291
|
- samples/treectrl/icon1.xpm
|
312
292
|
- samples/treectrl/icon2.xpm
|
313
293
|
- samples/treectrl/icon3.xpm
|
314
294
|
- samples/treectrl/icon4.xpm
|
315
295
|
- samples/treectrl/icon5.xpm
|
316
296
|
- samples/treectrl/treectrl.rb
|
317
|
-
- samples/xrc
|
318
297
|
- samples/xrc/samples.xrc
|
319
298
|
- samples/xrc/xrc_sample.rb
|
320
299
|
- README
|
321
300
|
- INSTALL
|
322
301
|
- LICENSE
|
323
|
-
has_rdoc:
|
302
|
+
has_rdoc: true
|
324
303
|
homepage: http://wxruby.org/
|
304
|
+
licenses: []
|
305
|
+
|
325
306
|
post_install_message:
|
326
307
|
rdoc_options: []
|
327
308
|
|
@@ -342,9 +323,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
323
|
requirements: []
|
343
324
|
|
344
325
|
rubyforge_project: wxruby
|
345
|
-
rubygems_version: 1.3.
|
326
|
+
rubygems_version: 1.3.4
|
346
327
|
signing_key:
|
347
|
-
specification_version:
|
328
|
+
specification_version: 3
|
348
329
|
summary: Ruby interface to the wxWidgets GUI library
|
349
330
|
test_files: []
|
350
331
|
|
Binary file
|
Binary file
|