wxruby 1.9.7-universal-darwin-9 → 1.9.8-universal-darwin-9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wx/classes/auinotebook.rb +9 -0
- data/lib/wx/classes/controlwithitems.rb +1 -1
- data/lib/wx/classes/evthandler.rb +47 -4
- data/lib/wx/classes/helpcontrollerhelpprovider.rb +23 -0
- data/lib/wx/classes/helpprovider.rb +15 -0
- data/lib/wx/classes/mediactrl.rb +29 -3
- data/lib/wx/classes/notebook.rb +9 -0
- data/lib/wx/classes/object.rb +8 -1
- data/lib/wx/classes/simplehelpprovider.rb +38 -0
- data/lib/wx/classes/sizer.rb +22 -0
- data/lib/wx/classes/toolbar.rb +29 -0
- data/lib/wx/helpers.rb +30 -0
- data/lib/wx/keyword_ctors.rb +1 -20
- data/lib/wx/keyword_defs.rb +15 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wx.rb +12 -1
- data/lib/wxruby2.bundle +0 -0
- data/samples/aui/aui.rb +1 -1
- data/samples/mdi/mdi.rb +35 -40
- data/samples/media/mediactrl.rb +3 -3
- data/samples/printing/printing.rb +177 -0
- metadata +10 -2
@@ -126,10 +126,11 @@ class Wx::EvtHandler
|
|
126
126
|
when Proc then meth
|
127
127
|
when Method then meth.to_proc
|
128
128
|
end
|
129
|
+
# Create an anonymous block to call the relevant method
|
129
130
|
if h_meth.arity == 1
|
130
|
-
return
|
131
|
+
return proc { | evt | h_meth.call(evt) }
|
131
132
|
else
|
132
|
-
return
|
133
|
+
return proc { h_meth.call }
|
133
134
|
end
|
134
135
|
else
|
135
136
|
Kernel.raise ArgumentError,
|
@@ -177,12 +178,18 @@ class Wx::EvtHandler
|
|
177
178
|
EventType['evt_auinotebook_begin_drag', 1,
|
178
179
|
Wx::EVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG,
|
179
180
|
Wx::AuiNotebookEvent],
|
181
|
+
EventType['evt_auinotebook_bg_dclick', 1,
|
182
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_BG_DCLICK,
|
183
|
+
Wx::AuiNotebookEvent],
|
180
184
|
EventType['evt_auinotebook_button', 1,
|
181
185
|
Wx::EVT_COMMAND_AUINOTEBOOK_BUTTON,
|
182
186
|
Wx::AuiNotebookEvent],
|
183
187
|
EventType['evt_auinotebook_drag_motion', 1,
|
184
188
|
Wx::EVT_COMMAND_AUINOTEBOOK_DRAG_MOTION,
|
185
189
|
Wx::AuiNotebookEvent],
|
190
|
+
EventType['evt_auinotebook_drag_done', 1,
|
191
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_DRAG_DONE,
|
192
|
+
Wx::AuiNotebookEvent],
|
186
193
|
EventType['evt_auinotebook_end_drag', 1,
|
187
194
|
Wx::EVT_COMMAND_AUINOTEBOOK_END_DRAG,
|
188
195
|
Wx::AuiNotebookEvent],
|
@@ -195,6 +202,21 @@ class Wx::EvtHandler
|
|
195
202
|
EventType['evt_auinotebook_page_close', 1,
|
196
203
|
Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE,
|
197
204
|
Wx::AuiNotebookEvent],
|
205
|
+
EventType['evt_auinotebook_page_closed', 1,
|
206
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED,
|
207
|
+
Wx::AuiNotebookEvent],
|
208
|
+
EventType['evt_auinotebook_tab_middle_down', 1,
|
209
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN,
|
210
|
+
Wx::AuiNotebookEvent],
|
211
|
+
EventType['evt_auinotebook_tab_middle_up', 1,
|
212
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP,
|
213
|
+
Wx::AuiNotebookEvent],
|
214
|
+
EventType['evt_auinotebook_tab_right_down', 1,
|
215
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN,
|
216
|
+
Wx::AuiNotebookEvent],
|
217
|
+
EventType['evt_auinotebook_tab_right_up', 1,
|
218
|
+
Wx::EVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP,
|
219
|
+
Wx::AuiNotebookEvent],
|
198
220
|
EventType['evt_aui_find_manager', 0,
|
199
221
|
Wx::EVT_AUI_FIND_MANAGER,
|
200
222
|
Wx::AuiManagerEvent],
|
@@ -294,6 +316,12 @@ class Wx::EvtHandler
|
|
294
316
|
EventType['evt_drop_files', 0,
|
295
317
|
Wx::EVT_DROP_FILES,
|
296
318
|
Wx::Event],
|
319
|
+
EventType['evt_detailed_help', 1,
|
320
|
+
Wx::EVT_DETAILED_HELP,
|
321
|
+
Wx::HelpEvent],
|
322
|
+
EventType['evt_detailed_help_range', 2,
|
323
|
+
Wx::EVT_DETAILED_HELP,
|
324
|
+
Wx::HelpEvent],
|
297
325
|
EventType['evt_end_process', 1,
|
298
326
|
Wx::EVT_END_PROCESS,
|
299
327
|
Wx::Event],
|
@@ -419,10 +447,13 @@ class Wx::EvtHandler
|
|
419
447
|
Wx::GridEvent],
|
420
448
|
EventType['evt_help', 1,
|
421
449
|
Wx::EVT_HELP,
|
422
|
-
Wx::
|
450
|
+
Wx::HelpEvent],
|
423
451
|
EventType['evt_help_range', 2,
|
424
452
|
Wx::EVT_HELP,
|
425
|
-
Wx::
|
453
|
+
Wx::HelpEvent],
|
454
|
+
EventType['evt_hibernate', 2,
|
455
|
+
Wx::EVT_HIBERNATE,
|
456
|
+
Wx::ActivateEvent],
|
426
457
|
EventType['evt_html_cell_clicked', 1,
|
427
458
|
Wx::EVT_COMMAND_HTML_CELL_CLICKED,
|
428
459
|
Wx::HtmlCellEvent],
|
@@ -762,12 +793,21 @@ class Wx::EvtHandler
|
|
762
793
|
EventType['evt_text', 1,
|
763
794
|
Wx::EVT_COMMAND_TEXT_UPDATED,
|
764
795
|
Wx::CommandEvent],
|
796
|
+
EventType['evt_text_copy', 1,
|
797
|
+
Wx::EVT_COMMAND_TEXT_COPY,
|
798
|
+
Wx::ClipboardTextEvent],
|
799
|
+
EventType['evt_text_cut', 1,
|
800
|
+
Wx::EVT_COMMAND_TEXT_CUT,
|
801
|
+
Wx::ClipboardTextEvent],
|
765
802
|
EventType['evt_text_enter', 1,
|
766
803
|
Wx::EVT_COMMAND_TEXT_ENTER,
|
767
804
|
Wx::CommandEvent],
|
768
805
|
EventType['evt_text_maxlen', 1,
|
769
806
|
Wx::EVT_COMMAND_TEXT_MAXLEN,
|
770
807
|
Wx::CommandEvent],
|
808
|
+
EventType['evt_text_paste', 1,
|
809
|
+
Wx::EVT_COMMAND_TEXT_PASTE,
|
810
|
+
Wx::ClipboardTextEvent],
|
771
811
|
EventType['evt_text_url', 1,
|
772
812
|
Wx::EVT_COMMAND_TEXT_URL,
|
773
813
|
Wx::TextUrlEvent],
|
@@ -852,6 +892,9 @@ class Wx::EvtHandler
|
|
852
892
|
EventType['evt_tree_set_info', 1,
|
853
893
|
Wx::EVT_COMMAND_TREE_SET_INFO,
|
854
894
|
Wx::TreeEvent],
|
895
|
+
EventType['evt_tree_state_image_click', 1,
|
896
|
+
Wx::EVT_COMMAND_TREE_STATE_IMAGE_CLICK,
|
897
|
+
Wx::TreeEvent],
|
855
898
|
EventType['evt_update_ui', 1,
|
856
899
|
Wx::EVT_UPDATE_UI,
|
857
900
|
Wx::UpdateUIEvent],
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Pure-ruby implementation of the corresponding Wx class. Shows a
|
2
|
+
# relevant section of help, if available, or a native popup
|
3
|
+
require 'wx/classes/simplehelpprovider'
|
4
|
+
class Wx::HelpControllerHelpProvider < Wx::SimpleHelpProvider
|
5
|
+
def initialize(help_controller)
|
6
|
+
super()
|
7
|
+
@hc = help_controller
|
8
|
+
end
|
9
|
+
|
10
|
+
# Show help for +win+; if the help text for +win+ is a string with a
|
11
|
+
# single integer only, treats that as a section id for help and shows
|
12
|
+
# that, otherwise shows a popup (native-style on Windows) of the text.
|
13
|
+
def show_help(win)
|
14
|
+
help_text = get_help(win)
|
15
|
+
return false if help_text.empty?
|
16
|
+
if help_text =~ /\A\d+\z/
|
17
|
+
@hc.display_context_popup(help_text.to_i)
|
18
|
+
else
|
19
|
+
@hc.display_text_popup(help_text, Wx::get_mouse_position)
|
20
|
+
end
|
21
|
+
true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Base class for providing context-sensitive help. The main definition
|
2
|
+
# is in SWIG/C++
|
3
|
+
class Wx::HelpProvider
|
4
|
+
class << self
|
5
|
+
# We need to protect the currently set HelpProvider from GC as it is a
|
6
|
+
# SWIG Director; it can't be reaped and re-wrapped later. The
|
7
|
+
# easiest way is to make the currently set one an instance variable
|
8
|
+
# of this class
|
9
|
+
alias :__wx_set :set
|
10
|
+
define_method(:set) do | help_provider |
|
11
|
+
__wx_set(help_provider)
|
12
|
+
@__hp__ = help_provider
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/wx/classes/mediactrl.rb
CHANGED
@@ -9,14 +9,40 @@ if defined?(Wx::MediaCtrl)
|
|
9
9
|
evt_type['evt_media_finished', 1,
|
10
10
|
Wx::EVT_MEDIA_FINISHED,
|
11
11
|
Wx::MediaEvent],
|
12
|
-
evt_type['evt_media_stop', 1,
|
13
|
-
Wx::EVT_MEDIA_STOP,
|
14
|
-
Wx::MediaEvent],
|
15
12
|
evt_type['evt_media_loaded', 1,
|
16
13
|
Wx::EVT_MEDIA_LOADED,
|
14
|
+
Wx::MediaEvent],
|
15
|
+
evt_type['evt_media_pause', 1,
|
16
|
+
Wx::EVT_MEDIA_PAUSE,
|
17
|
+
Wx::MediaEvent],
|
18
|
+
evt_type['evt_media_play', 1,
|
19
|
+
Wx::EVT_MEDIA_PLAY,
|
20
|
+
Wx::MediaEvent],
|
21
|
+
evt_type['evt_media_statechanged', 1,
|
22
|
+
Wx::EVT_MEDIA_STATECHANGED,
|
23
|
+
Wx::MediaEvent],
|
24
|
+
evt_type['evt_media_stop', 1,
|
25
|
+
Wx::EVT_MEDIA_STOP,
|
17
26
|
Wx::MediaEvent]
|
18
27
|
]
|
19
28
|
mediactrl_event_types.each do | ev_type |
|
20
29
|
Wx::EvtHandler.register_event_type(ev_type)
|
21
30
|
end
|
31
|
+
|
32
|
+
# Extend with a nicer interface to get_state
|
33
|
+
class Wx::MediaCtrl
|
34
|
+
# Returns true if the media is currently paused, else false
|
35
|
+
def is_paused
|
36
|
+
get_state == Wx::MEDIASTATE_PAUSED
|
37
|
+
end
|
38
|
+
# Returns true if the media is currently playing, else false
|
39
|
+
def is_playing
|
40
|
+
get_state == Wx::MEDIASTATE_PLAYING
|
41
|
+
end
|
42
|
+
# Returns true if the media is currently stopped, else false
|
43
|
+
def is_stopped
|
44
|
+
get_state == Wx::MEDIASTATE_STOPPED
|
45
|
+
end
|
46
|
+
end
|
22
47
|
end
|
48
|
+
|
data/lib/wx/classes/object.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# The root class for most (not all) WxRuby classes
|
2
2
|
class Wx::Object
|
3
|
-
#
|
3
|
+
# Massage the output of inspect to show the public module name (Wx),
|
4
|
+
# instead of the internal name (Wxruby2)
|
4
5
|
def to_s
|
5
6
|
super.sub('ruby2', '')
|
6
7
|
end
|
8
|
+
|
9
|
+
# Returns a string containing the C++ pointer address of this
|
10
|
+
# object. Only useful for debugging.
|
11
|
+
def ptr_addr
|
12
|
+
Wx::ptr_addr(self)
|
13
|
+
end
|
7
14
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Pure-ruby implementation of the corresponding Wx class. Simply shows
|
2
|
+
# the Window's help text in a tooltip.
|
3
|
+
class Wx::SimpleHelpProvider < Wx::HelpProvider
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
# Store for mapping windows -> help strings
|
7
|
+
@help_wins = {}
|
8
|
+
# Store for mapping ids -> help strings
|
9
|
+
@help_ids = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# This is what is called by Wx::Window#set_help_text
|
13
|
+
def add_help(identifier, text)
|
14
|
+
if identifier.kind_of? Wx::Window
|
15
|
+
@help_wins[identifier.object_id] = text
|
16
|
+
else
|
17
|
+
@help_ids[identifier] = text
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Retrieve help text for the given window +win+
|
22
|
+
def get_help(win)
|
23
|
+
@help_wins[win.object_id] || @help_ids[win.wx_id] || ""
|
24
|
+
end
|
25
|
+
|
26
|
+
# Remove the help text for +win+
|
27
|
+
def remove_help(win)
|
28
|
+
@help_wins.delete(win.object_id)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Show help for +win+
|
32
|
+
def show_help(win)
|
33
|
+
help_text = get_help(win)
|
34
|
+
return false if help_text.empty?
|
35
|
+
tip = Wx::TipWindow.new(win, help_text, 100)
|
36
|
+
true
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Class for automatically managing layouts
|
2
|
+
class Wx::Sizer
|
3
|
+
# Generic method to add items, supporting positional and named
|
4
|
+
# arguments
|
5
|
+
ADD_ITEM_PARAMS = [ Wx::Parameter[ :index, -1 ],
|
6
|
+
Wx::Parameter[ :proportion, 0 ],
|
7
|
+
Wx::Parameter[ :flag, 0 ],
|
8
|
+
Wx::Parameter[ :border, 0 ],
|
9
|
+
Wx::Parameter[ :user_data, nil ] ]
|
10
|
+
|
11
|
+
def add_item(item, *mixed_args)
|
12
|
+
args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
|
13
|
+
|
14
|
+
# Call add to append if default position
|
15
|
+
idx = args.shift
|
16
|
+
if idx == -1
|
17
|
+
add(item, *args)
|
18
|
+
else
|
19
|
+
insert(idx, item, *args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# A set of buttons and controls attached to one edge of a Wx::Frame
|
2
|
+
class Wx::ToolBar
|
3
|
+
# Generic method to add items, supporting positional and named
|
4
|
+
# arguments
|
5
|
+
ADD_ITEM_PARAMS = [ Wx::Parameter[ :position, -1 ],
|
6
|
+
Wx::Parameter[ :id, -1 ],
|
7
|
+
Wx::Parameter[ :label, "" ],
|
8
|
+
Wx::Parameter[ :bitmap, Wx::NULL_BITMAP ],
|
9
|
+
Wx::Parameter[ :bitmap2, Wx::NULL_BITMAP ],
|
10
|
+
Wx::Parameter[ :kind, Wx::ITEM_NORMAL ],
|
11
|
+
Wx::Parameter[ :short_help, "" ],
|
12
|
+
Wx::Parameter[ :long_help, "" ],
|
13
|
+
Wx::Parameter[ :client_data, nil ] ]
|
14
|
+
|
15
|
+
def add_item(*mixed_args)
|
16
|
+
args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
|
17
|
+
if args[3] == Wx::NULL_BITMAP
|
18
|
+
Kernel.raise ArgumentError, "Main button bitmap may not be NULL"
|
19
|
+
end
|
20
|
+
|
21
|
+
# Call add_tool to append if default position
|
22
|
+
pos = args.shift
|
23
|
+
if pos == -1
|
24
|
+
add_tool(*args)
|
25
|
+
else
|
26
|
+
insert_tool(pos, *args)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/wx/helpers.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Various non-GUI helper functions
|
2
|
+
module Wx
|
3
|
+
# A named parameter in a Wx named-arg parameter list
|
4
|
+
Parameter = Struct.new( :name, :default )
|
5
|
+
|
6
|
+
# Convert mixed positional / named args into a list to be passed to
|
7
|
+
# an underlying API method. +param_spec+ is an Array of Parameter
|
8
|
+
# structs containing the keyword name and default value for each
|
9
|
+
# possible argument. +mixed_args+ is an array which may optionally end
|
10
|
+
# with a set of named arguments
|
11
|
+
|
12
|
+
def self.args_as_list(param_spec, *mixed_args)
|
13
|
+
# get keyword arguments from mixed args if supplied, else empty
|
14
|
+
kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
|
15
|
+
out_args = []
|
16
|
+
param_spec.each_with_index do | param, i |
|
17
|
+
if arg = mixed_args[i] # use the supplied list arg
|
18
|
+
out_args << arg
|
19
|
+
elsif kwa.key?(param.name) # use the keyword arg
|
20
|
+
out_args << kwa[param.name]
|
21
|
+
else # use the default argument
|
22
|
+
out_args << param.default
|
23
|
+
end
|
24
|
+
end
|
25
|
+
out_args
|
26
|
+
rescue
|
27
|
+
Kernel.raise ArgumentError,
|
28
|
+
"Bad arg composition of #{mixed_args.inspect}"
|
29
|
+
end
|
30
|
+
end
|
data/lib/wx/keyword_ctors.rb
CHANGED
@@ -106,10 +106,6 @@ module Wx
|
|
106
106
|
:choices => [] # for Choice, ComboBox etc
|
107
107
|
}
|
108
108
|
|
109
|
-
|
110
|
-
# A named parameter in a Wx constructor parameter list
|
111
|
-
Parameter = Struct.new( :name, :default )
|
112
|
-
|
113
109
|
attr_writer :param_spec
|
114
110
|
def param_spec
|
115
111
|
@param_spec ||= []
|
@@ -132,22 +128,7 @@ module Wx
|
|
132
128
|
end
|
133
129
|
|
134
130
|
def args_as_list(*mixed_args)
|
135
|
-
|
136
|
-
kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
|
137
|
-
out_args = []
|
138
|
-
param_spec.each_with_index do | param, i |
|
139
|
-
if arg = mixed_args[i] # use the supplied list arg
|
140
|
-
out_args << arg
|
141
|
-
elsif kwa.key?(param.name) # use the keyword arg
|
142
|
-
out_args << kwa[param.name]
|
143
|
-
else # use the default argument
|
144
|
-
out_args << param.default
|
145
|
-
end
|
146
|
-
end
|
147
|
-
out_args
|
148
|
-
rescue
|
149
|
-
Kernel.raise ArgumentError,
|
150
|
-
"Bad arg composition of #{mixed_args.inspect}"
|
131
|
+
Wx::args_as_list(param_spec, *mixed_args)
|
151
132
|
end
|
152
133
|
|
153
134
|
def args_as_hash(*mixed_args)
|
data/lib/wx/keyword_defs.rb
CHANGED
@@ -141,6 +141,21 @@ Wx::define_keyword_ctors('ToolBar') do
|
|
141
141
|
wx_ctor_params :name => 'toolBar' # not as documented in Wx 2.6.3
|
142
142
|
end
|
143
143
|
|
144
|
+
# ToolBarTool class
|
145
|
+
Wx::define_keyword_ctors('ToolBarTool') do
|
146
|
+
# By default we want Wx to generate an id for us, thus it doesn't
|
147
|
+
# respect the wxWidgets default constructor value which is
|
148
|
+
# ID_SEPARATOR
|
149
|
+
wx_ctor_params :id => Wx::ID_ANY
|
150
|
+
wx_ctor_params :label => ''
|
151
|
+
wx_ctor_params :bitmap
|
152
|
+
wx_ctor_params :disabled_bitmap => Wx::NULL_BITMAP
|
153
|
+
wx_ctor_params :kind => Wx::ITEM_NORMAL
|
154
|
+
wx_ctor_params :data => nil
|
155
|
+
wx_ctor_params :short_help => ''
|
156
|
+
wx_ctor_params :long_help => ''
|
157
|
+
end
|
158
|
+
|
144
159
|
# Notebook class
|
145
160
|
Wx::define_keyword_ctors('Notebook') do
|
146
161
|
wx_ctor_params :id, :pos, :size, :style, :name => 'noteBook'
|
data/lib/wx/version.rb
CHANGED
data/lib/wx.rb
CHANGED
@@ -25,6 +25,8 @@ Wx::WXWIDGETS_VERSION = '%i.%i.%i' % [ Wx::WXWIDGETS_MAJOR_VERSION,
|
|
25
25
|
Wx::WXWIDGETS_MINOR_VERSION,
|
26
26
|
Wx::WXWIDGETS_RELEASE_NUMBER ]
|
27
27
|
|
28
|
+
# Helper functions
|
29
|
+
require 'wx/helpers'
|
28
30
|
|
29
31
|
# Load in all the class extension methods written in ruby
|
30
32
|
# evthandler must be required first b/c it sets up methods modified elsewhere
|
@@ -34,9 +36,18 @@ Dir.glob(class_files) do | class_file |
|
|
34
36
|
require 'wx/classes/' + class_file[/\w+\.rb$/]
|
35
37
|
end
|
36
38
|
|
37
|
-
# Load in syntax
|
39
|
+
# Load in syntax sweeteners
|
38
40
|
require 'wx/accessors'
|
39
41
|
require 'wx/keyword_ctors'
|
40
42
|
require 'wx/keyword_defs'
|
41
43
|
|
44
|
+
# If a program is ended by ruby's exit, it can bypass doing the proper
|
45
|
+
# Wx clean-up routines called by Wx::App#on_exit. This can under some
|
46
|
+
# circumstances cause crashes as the application ends.
|
47
|
+
Kernel::at_exit do
|
48
|
+
# This is set in wxRubyApp.OnExit (see swig/classes/App.i)
|
49
|
+
if not $__wx_app_ended__
|
50
|
+
Wx::THE_APP.on_exit
|
51
|
+
end
|
52
|
+
end
|
42
53
|
|
data/lib/wxruby2.bundle
CHANGED
Binary file
|
data/samples/aui/aui.rb
CHANGED
@@ -994,7 +994,7 @@ class AuiFrame < Wx::Frame
|
|
994
994
|
event.check((@notebook_style & Wx::AUI_NB_CLOSE_ON_ALL_TABS) != 0)
|
995
995
|
when ID_NotebookCloseButtonActive
|
996
996
|
event.check((@notebook_style & Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB) != 0)
|
997
|
-
when ID_NotebookAllowTabSplit
|
997
|
+
when ID_NotebookAllowTabSplit
|
998
998
|
event.check((@notebook_style & Wx::AUI_NB_TAB_SPLIT) != 0)
|
999
999
|
when ID_NotebookAllowTabMove
|
1000
1000
|
event.check((@notebook_style & Wx::AUI_NB_TAB_MOVE) != 0)
|
data/samples/mdi/mdi.rb
CHANGED
@@ -7,60 +7,56 @@ rescue LoadError
|
|
7
7
|
end
|
8
8
|
require 'wx'
|
9
9
|
|
10
|
-
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
ID_TILE = 4
|
18
|
-
ID_CREATE = 5
|
19
|
-
ID_CLOSE = 6
|
20
|
-
ID_EXIT = 99
|
21
|
-
|
10
|
+
# Simple MDI-based parent frame with menus to create, cycle through and
|
11
|
+
# close child frames within in.
|
12
|
+
#
|
13
|
+
# NB: MDI is only properly implemented on Windows, and is simulated by
|
14
|
+
# using a Notebook on Linux and OS X. Therefore its use is not
|
15
|
+
# recommended for cross-platform applications. An alternative interface
|
16
|
+
# strategy may be to use separate frames, or possibly the AUI classes.
|
22
17
|
class MyFrame < Wx::MDIParentFrame
|
23
18
|
def initialize(title)
|
24
|
-
super(nil,
|
19
|
+
super(nil, :title => title, :size => [ 500, 400 ] )
|
25
20
|
|
26
21
|
@child_number = 0
|
27
22
|
|
28
23
|
menuFile = Wx::Menu.new
|
29
|
-
menuFile.append(ID_EXIT, "E&xit\tAlt-X")
|
24
|
+
menuFile.append(Wx::ID_EXIT, "E&xit\tAlt-X")
|
25
|
+
evt_menu Wx::ID_EXIT, :close
|
26
|
+
|
30
27
|
menuMDI = Wx::Menu.new
|
31
|
-
menuMDI.append(
|
32
|
-
|
33
|
-
menuMDI.
|
34
|
-
|
35
|
-
menuMDI.
|
36
|
-
|
37
|
-
menuMDI.append(
|
38
|
-
|
28
|
+
menuMDI.append(Wx::ID_FORWARD, "&Next Child\tCtrl-F6")
|
29
|
+
evt_menu Wx::ID_FORWARD, :activate_next
|
30
|
+
menuMDI.append(Wx::ID_BACKWARD, "&Previous Child")
|
31
|
+
evt_menu Wx::ID_BACKWARD, :activate_previous
|
32
|
+
menuMDI.append_separator
|
33
|
+
|
34
|
+
mi_cascade = menuMDI.append("&Cascade")
|
35
|
+
evt_menu mi_cascade, :cascade
|
36
|
+
mi_tile = menuMDI.append("&Tile")
|
37
|
+
evt_menu mi_tile, :tile
|
38
|
+
menuMDI.append_separator
|
39
|
+
|
40
|
+
menuMDI.append(Wx::ID_NEW, "&Add Child")
|
41
|
+
evt_menu Wx::ID_NEW, :create_child
|
42
|
+
menuMDI.append(Wx::ID_CLOSE, "&Remove Child\tCtrl-F4")
|
43
|
+
evt_menu Wx::ID_CLOSE, :on_close_child
|
44
|
+
|
39
45
|
menuBar = Wx::MenuBar.new
|
40
46
|
menuBar.append(menuFile, "&File")
|
41
47
|
menuBar.append(menuMDI, "&Window")
|
42
|
-
|
43
|
-
|
44
|
-
evt_menu(ID_EXIT) { close }
|
45
|
-
evt_menu(ID_NEXT) { activate_next }
|
46
|
-
evt_menu(ID_PREVIOUS) { activate_previous }
|
47
|
-
evt_menu(ID_CASCADE) { cascade }
|
48
|
-
evt_menu(ID_TILE) { tile }
|
49
|
-
evt_menu(ID_CREATE) { create_child }
|
50
|
-
evt_menu(ID_CLOSE) { on_close_child }
|
48
|
+
|
49
|
+
self.menu_bar = menuBar
|
51
50
|
|
52
51
|
create_status_bar(2).set_status_widths([100, -1])
|
53
52
|
set_status_text("Some features only work on MS Windows", 1)
|
54
53
|
|
55
|
-
create_child
|
56
|
-
create_child
|
57
|
-
create_child
|
54
|
+
3.times { create_child }
|
58
55
|
end
|
59
56
|
|
60
57
|
def on_close_child
|
61
|
-
|
62
|
-
|
63
|
-
active.close
|
58
|
+
if active_child
|
59
|
+
active_child.close
|
64
60
|
end
|
65
61
|
end
|
66
62
|
|
@@ -71,12 +67,11 @@ class MyFrame < Wx::MDIParentFrame
|
|
71
67
|
end
|
72
68
|
end
|
73
69
|
|
74
|
-
class
|
70
|
+
class MDIApp < Wx::App
|
75
71
|
def on_init
|
76
72
|
frame = MyFrame.new("MDI App")
|
77
73
|
frame.show
|
78
74
|
end
|
79
75
|
end
|
80
76
|
|
81
|
-
|
82
|
-
a.main_loop()
|
77
|
+
MDIApp.new.main_loop
|
data/samples/media/mediactrl.rb
CHANGED
@@ -9,12 +9,13 @@ require 'wx'
|
|
9
9
|
|
10
10
|
# This sample demonstrates the use of Wx::MediaCtrl, which can be used
|
11
11
|
# to playback sounds or movies using a platform-native player.
|
12
|
-
class MediaPanel<Wx::Panel
|
12
|
+
class MediaPanel < Wx::Panel
|
13
13
|
def initialize(parent)
|
14
14
|
super(parent, :style => Wx::TAB_TRAVERSAL|Wx::CLIP_CHILDREN)
|
15
15
|
|
16
16
|
# The actual media player control
|
17
|
-
@mc = Wx::MediaCtrl.new(self
|
17
|
+
@mc = Wx::MediaCtrl.new(self)
|
18
|
+
|
18
19
|
evt_media_loaded @mc,:on_media_loaded
|
19
20
|
|
20
21
|
# Some buttons to control playback
|
@@ -102,7 +103,6 @@ class MediaPanel<Wx::Panel
|
|
102
103
|
if dlg.show_modal == Wx::ID_OK
|
103
104
|
do_load_file(dlg.path)
|
104
105
|
end
|
105
|
-
dlg.destroy
|
106
106
|
end
|
107
107
|
|
108
108
|
# Move the media to a position in the file, using the slider
|
@@ -7,6 +7,183 @@ rescue LoadError
|
|
7
7
|
end
|
8
8
|
require 'wx'
|
9
9
|
|
10
|
+
WXPRINT_QUIT = Wx::ID_EXIT
|
11
|
+
WXPRINT_PRINT = Wx::ID_PRINT
|
12
|
+
WXPRINT_PAGE_SETUP = Wx::ID_PRINT_SETUP
|
13
|
+
WXPRINT_PREVIEW = Wx::ID_PREVIEW
|
14
|
+
|
15
|
+
WXPRINT_PRINT_PS = 105
|
16
|
+
WXPRINT_PAGE_SETUP_PS = 107
|
17
|
+
WXPRINT_PREVIEW_PS = 108
|
18
|
+
|
19
|
+
WXPRINT_ABOUT = Wx::ID_ABOUT
|
20
|
+
|
21
|
+
WXPRINT_ANGLEUP = 110
|
22
|
+
WXPRINT_ANGLEDOWN = 111
|
23
|
+
|
24
|
+
class MyFrame < Wx::Frame
|
25
|
+
|
26
|
+
attr_accessor :canvas
|
27
|
+
|
28
|
+
def initialize(parent,title,pos,size)
|
29
|
+
super(parent,-1,title,pos,size)
|
30
|
+
@canvas = nil
|
31
|
+
@bitmap = Wx::Bitmap.new
|
32
|
+
@angle = 30
|
33
|
+
|
34
|
+
# map events
|
35
|
+
evt_menu(WXPRINT_QUIT) {|e| on_exit(e)}
|
36
|
+
evt_menu(WXPRINT_PRINT) {|e| on_print(e)}
|
37
|
+
evt_menu(WXPRINT_PREVIEW) {|e| on_print_preview(e)}
|
38
|
+
evt_menu(WXPRINT_PAGE_SETUP) {|e| on_page_setup(e)}
|
39
|
+
evt_menu(WXPRINT_ABOUT) {|e| on_print_about(e)}
|
40
|
+
evt_menu(WXPRINT_ANGLEUP) {|e| on_angle_up(e)}
|
41
|
+
evt_menu(WXPRINT_ANGLEDOWN) {|e| on_angle_down(e)}
|
42
|
+
end
|
43
|
+
|
44
|
+
def draw(dc)
|
45
|
+
dc.set_background(Wx::WHITE_BRUSH)
|
46
|
+
dc.clear()
|
47
|
+
dc.set_font(Wx::get_app.test_font)
|
48
|
+
|
49
|
+
dc.set_background_mode(Wx::TRANSPARENT)
|
50
|
+
|
51
|
+
dc.set_brush(Wx::CYAN_BRUSH)
|
52
|
+
dc.set_pen(Wx::RED_PEN)
|
53
|
+
|
54
|
+
dc.draw_rounded_rectangle(0, 20, 200, 80, 20)
|
55
|
+
|
56
|
+
dc.draw_text( "Rectangle 200 by 80", 40, 40)
|
57
|
+
|
58
|
+
dc.set_pen( Wx::Pen.new(Wx::BLACK,0,Wx::DOT_DASH) )
|
59
|
+
dc.draw_ellipse(50, 140, 100, 50)
|
60
|
+
dc.set_pen(Wx::RED_PEN)
|
61
|
+
|
62
|
+
dc.draw_text( "Test message: this is in 10 point text", 10, 180)
|
63
|
+
|
64
|
+
test = "Hebrew שלום -- Japanese (日本語)"
|
65
|
+
dc.draw_text( test, 10, 200 )
|
66
|
+
|
67
|
+
points = []
|
68
|
+
points << Wx::Point.new(0,0)
|
69
|
+
points << Wx::Point.new(20,0)
|
70
|
+
points << Wx::Point.new(20,20)
|
71
|
+
points << Wx::Point.new(10,20)
|
72
|
+
points << Wx::Point.new(10,-20)
|
73
|
+
|
74
|
+
dc.draw_polygon( points, 20, 250, Wx::ODDEVEN_RULE )
|
75
|
+
dc.draw_polygon( points, 50, 250, Wx::WINDING_RULE )
|
76
|
+
|
77
|
+
dc.draw_elliptic_arc( 80, 250, 60, 30, 0.0, 270.0 )
|
78
|
+
|
79
|
+
points[0].x = 150
|
80
|
+
points[0].y = 250
|
81
|
+
points[1].x = 180
|
82
|
+
points[1].y = 250
|
83
|
+
points[2].x = 180
|
84
|
+
points[2].y = 220
|
85
|
+
points[3].x = 200
|
86
|
+
points[3].y = 220
|
87
|
+
points.pop
|
88
|
+
dc.draw_spline( points )
|
89
|
+
|
90
|
+
dc.draw_arc( 20,10, 10,10, 25,40 )
|
91
|
+
|
92
|
+
str = ""
|
93
|
+
i = 0
|
94
|
+
str = "---- Text at angle #{i} ----"
|
95
|
+
dc.draw_rotated_text( str, 100, 300, i )
|
96
|
+
|
97
|
+
i = @angle;
|
98
|
+
str = "---- Text at angle #{i} ----"
|
99
|
+
dc.draw_rotated_text( str, 100, 300, i )
|
100
|
+
|
101
|
+
dc.set_pen(Wx::BLACK_PEN)
|
102
|
+
dc.draw_line(0, 0, 200, 200)
|
103
|
+
dc.draw_line(200, 0, 0, 200)
|
104
|
+
|
105
|
+
# Load icon
|
106
|
+
if Wx::PLATFORM == "WXMSW"
|
107
|
+
icon_file = File.join(File.dirname(__FILE__), 'mondrian.ico')
|
108
|
+
my_icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_ICO)
|
109
|
+
else
|
110
|
+
icon_file = File.join(File.dirname(__FILE__), 'mondrian.xpm')
|
111
|
+
my_icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_XPM)
|
112
|
+
end
|
113
|
+
|
114
|
+
dc.draw_icon( my_icon, 100, 100)
|
115
|
+
|
116
|
+
if @bitmap.is_ok
|
117
|
+
dc.draw_bitmap( @bitmap, 10, 10 )
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def on_angle_up(event)
|
122
|
+
@angle += 5
|
123
|
+
canvas.refresh
|
124
|
+
end
|
125
|
+
|
126
|
+
def on_angle_down(event)
|
127
|
+
@angle -= 5
|
128
|
+
canvas.refresh
|
129
|
+
end
|
130
|
+
|
131
|
+
def on_size(event)
|
132
|
+
super(event)
|
133
|
+
end
|
134
|
+
|
135
|
+
def on_print(event)
|
136
|
+
print_dialog_data = Wx::PrintDialogData.new(Wx::get_app.print_data)
|
137
|
+
|
138
|
+
printer = Wx::Printer.new(print_dialog_data)
|
139
|
+
printout = MyPrintout.new("My printout")
|
140
|
+
if (!printer.print(self, printout, true))
|
141
|
+
if (Wx::Printer.get_last_error == Wx::PRINTER_ERROR)
|
142
|
+
Wx::message_box("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", Wx::OK)
|
143
|
+
else
|
144
|
+
Wx::message_box("You canceled printing", "Printing", Wx::OK)
|
145
|
+
end
|
146
|
+
else
|
147
|
+
Wx::get_app.print_data = printer.get_print_dialog_data.get_print_data
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def on_print_preview(event)
|
152
|
+
# Pass two printout objects: for preview, and possible printing.
|
153
|
+
print_dialog_data = Wx::PrintDialogData.new(Wx::get_app.print_data)
|
154
|
+
preview = Wx::PrintPreview.new(MyPrintout.new, MyPrintout.new, print_dialog_data)
|
155
|
+
if not preview.is_ok
|
156
|
+
#delete preview;
|
157
|
+
Wx::message_box("There was a problem previewing.\nPerhaps your current printer is not set correctly?", "Previewing", Wx::OK)
|
158
|
+
return
|
159
|
+
end
|
160
|
+
|
161
|
+
prev_frame = Wx::PreviewFrame.new(preview, self, "Demo Print Preview", Wx::Point.new(100, 100), Wx::Size.new(600, 650))
|
162
|
+
prev_frame.centre(Wx::BOTH)
|
163
|
+
prev_frame.init
|
164
|
+
prev_frame.show
|
165
|
+
end
|
166
|
+
|
167
|
+
def on_page_setup(event)
|
168
|
+
Wx::get_app.page_setup_data = Wx::PageSetupDialogData.new(Wx::get_app.print_data)
|
169
|
+
page_setup_dialog = Wx::PageSetupDialog.new(self, Wx::get_app.page_setup_data)
|
170
|
+
page_setup_dialog.show_modal
|
171
|
+
|
172
|
+
Wx::get_app.print_data = page_setup_dialog.get_page_setup_data.get_print_data
|
173
|
+
Wx::get_app.page_setup_data = Wx::PageSetupDialogData.new(Wx::get_app.print_data)
|
174
|
+
end
|
175
|
+
|
176
|
+
def on_exit(event)
|
177
|
+
close(true)
|
178
|
+
end
|
179
|
+
|
180
|
+
def on_print_about(event)
|
181
|
+
Wx::message_box("wxWidgets printing demo\nAuthor: Julian Smart\nAdapted to wxRuby by Sean Long",
|
182
|
+
"About wxRuby printing demo", Wx::OK|Wx::CENTRE)
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
10
187
|
class MyCanvas < Wx::ScrolledWindow
|
11
188
|
#attr_accessor :frame
|
12
189
|
|
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: 1.9.
|
4
|
+
version: 1.9.8
|
5
5
|
platform: universal-darwin-9
|
6
6
|
authors:
|
7
7
|
- wxRuby development team
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-08-28 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- lib/wx/classes/animation.rb
|
30
30
|
- lib/wx/classes/app.rb
|
31
31
|
- lib/wx/classes/artprovider.rb
|
32
|
+
- lib/wx/classes/auinotebook.rb
|
32
33
|
- lib/wx/classes/bitmap.rb
|
33
34
|
- lib/wx/classes/busycursor.rb
|
34
35
|
- lib/wx/classes/checklistbox.rb
|
@@ -47,6 +48,8 @@ files:
|
|
47
48
|
- lib/wx/classes/gauge.rb
|
48
49
|
- lib/wx/classes/grid.rb
|
49
50
|
- lib/wx/classes/helpcontroller.rb
|
51
|
+
- lib/wx/classes/helpcontrollerhelpprovider.rb
|
52
|
+
- lib/wx/classes/helpprovider.rb
|
50
53
|
- lib/wx/classes/htmlhelpcontroller.rb
|
51
54
|
- lib/wx/classes/htmlwindow.rb
|
52
55
|
- lib/wx/classes/icon.rb
|
@@ -59,21 +62,26 @@ files:
|
|
59
62
|
- lib/wx/classes/mediactrl.rb
|
60
63
|
- lib/wx/classes/menu.rb
|
61
64
|
- lib/wx/classes/menuitem.rb
|
65
|
+
- lib/wx/classes/notebook.rb
|
62
66
|
- lib/wx/classes/object.rb
|
63
67
|
- lib/wx/classes/paintdc.rb
|
64
68
|
- lib/wx/classes/point.rb
|
65
69
|
- lib/wx/classes/previewframe.rb
|
66
70
|
- lib/wx/classes/rect.rb
|
71
|
+
- lib/wx/classes/simplehelpprovider.rb
|
67
72
|
- lib/wx/classes/size.rb
|
73
|
+
- lib/wx/classes/sizer.rb
|
68
74
|
- lib/wx/classes/sound.rb
|
69
75
|
- lib/wx/classes/styledtextctrl.rb
|
70
76
|
- lib/wx/classes/textctrl.rb
|
71
77
|
- lib/wx/classes/texturlevent.rb
|
72
78
|
- lib/wx/classes/timer.rb
|
79
|
+
- lib/wx/classes/toolbar.rb
|
73
80
|
- lib/wx/classes/toolbartool.rb
|
74
81
|
- lib/wx/classes/treectrl.rb
|
75
82
|
- lib/wx/classes/window.rb
|
76
83
|
- lib/wx/classes/xmlresource.rb
|
84
|
+
- lib/wx/helpers.rb
|
77
85
|
- lib/wx/keyword_ctors.rb
|
78
86
|
- lib/wx/keyword_defs.rb
|
79
87
|
- lib/wx/version.rb
|