wxruby 1.9.0-powerpc-darwin8.10.0 → 1.9.2-powerpc-darwin8.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +53 -0
- data/README +299 -0
- data/lib/wx.rb +7 -0
- data/lib/wx/accessors.rb +52 -0
- data/lib/wx/classes/app.rb +15 -1
- data/lib/wx/classes/bitmap.rb +2 -2
- data/lib/wx/classes/checklistbox.rb +30 -0
- data/lib/wx/classes/clientdc.rb +1 -1
- data/lib/wx/classes/commandevent.rb +7 -0
- data/lib/wx/classes/controlwithitems.rb +10 -0
- data/lib/wx/classes/evthandler.rb +99 -39
- data/lib/wx/classes/grid.rb +13 -13
- data/lib/wx/classes/listctrl.rb +9 -0
- data/lib/wx/classes/menu.rb +62 -0
- data/lib/wx/classes/menuitem.rb +7 -0
- data/lib/wx/classes/paintdc.rb +1 -1
- data/lib/wx/classes/point.rb +43 -0
- data/lib/wx/classes/size.rb +44 -0
- data/lib/wx/classes/styledtextctrl.rb +92 -0
- data/lib/wx/classes/textctrl.rb +14 -0
- data/lib/wx/classes/timer.rb +2 -2
- data/lib/wx/classes/treectrl.rb +18 -0
- data/lib/wx/classes/window.rb +13 -2
- data/lib/wx/keyword_ctors.rb +205 -0
- data/lib/wx/keyword_defs.rb +465 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.bundle +0 -0
- data/samples/aui/aui.rb +6 -5
- data/samples/bigdemo/wxListCtrl_virtual.rbw +21 -21
- data/samples/bigdemo/wxScrolledWindow.rbw +8 -3
- data/samples/calendar/calendar.rb +1 -1
- data/samples/caret/caret.rb +29 -39
- data/samples/etc/threaded.rb +81 -0
- data/samples/etc/wizard.rb +22 -24
- data/samples/event/event.rb +184 -0
- data/samples/html/html.rb +25 -12
- data/samples/listbook/listbook.rb +65 -67
- data/samples/minimal/minimal.rb +40 -50
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +5 -30
- data/samples/text/scintilla.rb +22 -28
- data/samples/text/unicode.rb +1 -1
- data/samples/treectrl/treectrl.rb +197 -226
- metadata +20 -4
- data/samples/minimal/mondrian.xpm +0 -44
- data/samples/minimal/text.rb +0 -35
@@ -0,0 +1,92 @@
|
|
1
|
+
# Functionality here must be loaded first to add custom events
|
2
|
+
require 'wx/classes/evthandler'
|
3
|
+
|
4
|
+
# These event type constants will only be available and meaningful if
|
5
|
+
# Wx::StyledTextCtrl has been compiled into the library. If so, they
|
6
|
+
# need the below definitions for mapping, otherwise all the rest should
|
7
|
+
# be skipped
|
8
|
+
if defined?(Wx::StyledTextCtrl)
|
9
|
+
EventType = Wx::EvtHandler::EventType
|
10
|
+
|
11
|
+
STC_EVENT_TYPES = [
|
12
|
+
EventType['evt_stc_calltip_click', 1,
|
13
|
+
Wx::EVT_STC_CALLTIP_CLICK,
|
14
|
+
Wx::StyledTextEvent],
|
15
|
+
EventType['evt_stc_change', 1,
|
16
|
+
Wx::EVT_STC_CHANGE,
|
17
|
+
Wx::StyledTextEvent],
|
18
|
+
EventType['evt_stc_charadded', 1,
|
19
|
+
Wx::EVT_STC_CHARADDED,
|
20
|
+
Wx::StyledTextEvent],
|
21
|
+
EventType['evt_stc_doubleclick', 1,
|
22
|
+
Wx::EVT_STC_DOUBLECLICK,
|
23
|
+
Wx::StyledTextEvent],
|
24
|
+
EventType['evt_stc_do_drop', 1,
|
25
|
+
Wx::EVT_STC_DO_DROP,
|
26
|
+
Wx::StyledTextEvent],
|
27
|
+
EventType['evt_stc_drag_over', 1,
|
28
|
+
Wx::EVT_STC_DRAG_OVER,
|
29
|
+
Wx::StyledTextEvent],
|
30
|
+
EventType['evt_stc_dwellend', 1,
|
31
|
+
Wx::EVT_STC_DWELLEND,
|
32
|
+
Wx::StyledTextEvent],
|
33
|
+
EventType['evt_stc_dwellstart', 1,
|
34
|
+
Wx::EVT_STC_DWELLSTART,
|
35
|
+
Wx::StyledTextEvent],
|
36
|
+
EventType['evt_stc_hotspot_click', 1,
|
37
|
+
Wx::EVT_STC_HOTSPOT_CLICK,
|
38
|
+
Wx::StyledTextEvent],
|
39
|
+
EventType['evt_stc_hotspot_dclick', 1,
|
40
|
+
Wx::EVT_STC_HOTSPOT_DCLICK,
|
41
|
+
Wx::StyledTextEvent],
|
42
|
+
EventType['evt_stc_key', 1,
|
43
|
+
Wx::EVT_STC_KEY,
|
44
|
+
Wx::StyledTextEvent],
|
45
|
+
EventType['evt_stc_macrorecord', 1,
|
46
|
+
Wx::EVT_STC_MACRORECORD,
|
47
|
+
Wx::StyledTextEvent],
|
48
|
+
EventType['evt_stc_marginclick', 1,
|
49
|
+
Wx::EVT_STC_MARGINCLICK,
|
50
|
+
Wx::StyledTextEvent],
|
51
|
+
EventType['evt_stc_modified', 1,
|
52
|
+
Wx::EVT_STC_MODIFIED,
|
53
|
+
Wx::StyledTextEvent],
|
54
|
+
EventType['evt_stc_needshown', 1,
|
55
|
+
Wx::EVT_STC_NEEDSHOWN,
|
56
|
+
Wx::StyledTextEvent],
|
57
|
+
EventType['evt_stc_painted', 1,
|
58
|
+
Wx::EVT_STC_PAINTED,
|
59
|
+
Wx::StyledTextEvent],
|
60
|
+
EventType['evt_stc_romodifyattempt', 1,
|
61
|
+
Wx::EVT_STC_ROMODIFYATTEMPT,
|
62
|
+
Wx::StyledTextEvent],
|
63
|
+
EventType['evt_stc_savepointleft', 1,
|
64
|
+
Wx::EVT_STC_SAVEPOINTLEFT,
|
65
|
+
Wx::StyledTextEvent],
|
66
|
+
EventType['evt_stc_savepointreached', 1,
|
67
|
+
Wx::EVT_STC_SAVEPOINTREACHED,
|
68
|
+
Wx::StyledTextEvent],
|
69
|
+
EventType['evt_stc_start_drag', 1,
|
70
|
+
Wx::EVT_STC_START_DRAG,
|
71
|
+
Wx::StyledTextEvent],
|
72
|
+
EventType['evt_stc_styleneeded', 1,
|
73
|
+
Wx::EVT_STC_STYLENEEDED,
|
74
|
+
Wx::StyledTextEvent],
|
75
|
+
EventType['evt_stc_updateui', 1,
|
76
|
+
Wx::EVT_STC_UPDATEUI,
|
77
|
+
Wx::StyledTextEvent],
|
78
|
+
EventType['evt_stc_uridropped', 1,
|
79
|
+
Wx::EVT_STC_URIDROPPED,
|
80
|
+
Wx::StyledTextEvent],
|
81
|
+
EventType['evt_stc_userlistselection', 1,
|
82
|
+
Wx::EVT_STC_USERLISTSELECTION,
|
83
|
+
Wx::StyledTextEvent],
|
84
|
+
EventType['evt_stc_zoom', 1,
|
85
|
+
Wx::EVT_STC_ZOOM,
|
86
|
+
Wx::StyledTextEvent]
|
87
|
+
]
|
88
|
+
|
89
|
+
STC_EVENT_TYPES.each do | ev_type |
|
90
|
+
Wx::EvtHandler.register_event_type(ev_type)
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Wx::TextCtrl
|
2
|
+
# Fix position_to_xy so it returns a two-element array - the internal
|
3
|
+
# version returns a three-element array with a Boolean that doesn't
|
4
|
+
# really make sense in Ruby
|
5
|
+
wx_position_to_xy = instance_method(:position_to_xy)
|
6
|
+
define_method(:position_to_xy) do | pos |
|
7
|
+
retval, x, y = wx_position_to_xy.bind(self).call(pos)
|
8
|
+
if retval
|
9
|
+
return [x, y]
|
10
|
+
else
|
11
|
+
return nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/wx/classes/timer.rb
CHANGED
@@ -34,7 +34,7 @@ class Wx::Timer
|
|
34
34
|
@@__unowned_timers__ ||= []
|
35
35
|
|
36
36
|
# remove from list of previous owner
|
37
|
-
if @__owner__
|
37
|
+
if defined?(@__owner__) and @__owner__
|
38
38
|
@__owner__.instance_eval { @__owned_timers__.delete(this_timer) }
|
39
39
|
end
|
40
40
|
|
@@ -51,7 +51,7 @@ class Wx::Timer
|
|
51
51
|
|
52
52
|
# Then add to list of new owner, setting destructor hook if required
|
53
53
|
new_owner.instance_eval do
|
54
|
-
if not @__owned_timers__
|
54
|
+
if not defined?(@__owned_timers__)
|
55
55
|
@__owned_timers__ = []
|
56
56
|
unless self.kind_of?(Wx::App) # Don't set up hook on App
|
57
57
|
evt_window_destroy do | evt |
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Hierarchical control with items
|
2
|
+
class Wx::TreeCtrl
|
3
|
+
# Make these ruby enumerables so find, find_all, map etc are available
|
4
|
+
include Enumerable
|
5
|
+
# Iterate over all items
|
6
|
+
alias :each :traverse
|
7
|
+
|
8
|
+
# Return the children of +parent+ as an array of TreeItemIDs.
|
9
|
+
def get_children(parent)
|
10
|
+
kids = [ get_first_child(parent) ]
|
11
|
+
return [] if kids[0].zero?
|
12
|
+
|
13
|
+
while kid = get_next_sibling(kids.last) and not kid.zero?
|
14
|
+
kids << kid
|
15
|
+
end
|
16
|
+
kids
|
17
|
+
end
|
18
|
+
end
|
data/lib/wx/classes/window.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
# Copyright 2004-2007 by Kevin Smith
|
2
2
|
# released under the MIT-style wxruby2 license
|
3
3
|
|
4
|
+
# The base class for all things displayed on screen
|
4
5
|
class Wx::Window
|
6
|
+
|
7
|
+
# Ruby's Object#id is deprecated and will be removed in 1.9; therefore
|
8
|
+
# for classes inheriting from Wx::Window, the id method returns the
|
9
|
+
# wxRuby Window id
|
10
|
+
alias :id :get_id
|
11
|
+
# In case a more explicit option is preferred.
|
12
|
+
alias :wx_id :get_id
|
13
|
+
|
14
|
+
|
5
15
|
# Recursively searches all windows below +self+ and returns the first
|
6
16
|
# window which has the id +an_id+. This corresponds to the find_window
|
7
17
|
# method method in WxWidgets when called with an integer.
|
@@ -27,10 +37,11 @@ class Wx::Window
|
|
27
37
|
# paint event is being handled just before running the event
|
28
38
|
# handler. This ensures that any call to Window#paint within the
|
29
39
|
# handler will supply a Wx::PaintDC (see swig/Window.i).
|
30
|
-
def evt_paint(&block)
|
40
|
+
def evt_paint(meth = nil, &block)
|
41
|
+
paint_proc = acquire_handler(meth, block)
|
31
42
|
wrapped_block = proc do | event |
|
32
43
|
instance_variable_set("@__painting__", true)
|
33
|
-
|
44
|
+
paint_proc.call(event)
|
34
45
|
remove_instance_variable("@__painting__")
|
35
46
|
end
|
36
47
|
__old_evt_paint(&wrapped_block)
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# = WxRuby Extensions - Keyword Constructors
|
2
|
+
#
|
3
|
+
# The *Keyword Constructors* extension allows the use of Ruby hash-style
|
4
|
+
# keyword arguments in constructors of common WxWidgets Windows, Frame,
|
5
|
+
# Dialog and Control classes.
|
6
|
+
#
|
7
|
+
# == Introduction
|
8
|
+
#
|
9
|
+
# Building a GUI in WxWidgets involves lots of calls to +new+, but
|
10
|
+
# these methods often have long parameter lists. Often the default
|
11
|
+
# values for many of these parameters are correct. For example, if
|
12
|
+
# you're using a sizer-based layout, you usually don't want to specify a
|
13
|
+
# size for widgets, but you still have to type
|
14
|
+
#
|
15
|
+
# Wx::TreeCtrl.new( parent, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
16
|
+
# Wx::NO_BUTTONS )
|
17
|
+
#
|
18
|
+
# just to create a standard TreeCtrl with the 'no buttons' style. If you
|
19
|
+
# want to specify the 'NO BUTTONS' style, you can't avoid all the typing
|
20
|
+
# of DEFAULT_POSITION etc.
|
21
|
+
#
|
22
|
+
# == Basic Keyword Constructors
|
23
|
+
#
|
24
|
+
# With keyword_constructors, you could write the above as
|
25
|
+
#
|
26
|
+
# TreeCtrl.new(parent, :style => Wx::NO_BUTTONS)
|
27
|
+
#
|
28
|
+
# And it will assume you want the default id (-1), and the default size
|
29
|
+
# and position. If you want to specify an explicit size, you can do so:
|
30
|
+
#
|
31
|
+
# TreeCtrl.new(parent, :size => Wx::Size.new(100, 300))
|
32
|
+
#
|
33
|
+
# For brevity, this module also allows you to specify positions and
|
34
|
+
# sizes using a a two-element array:
|
35
|
+
#
|
36
|
+
# TreeCtrl.new(parent, :size => [100, 300])
|
37
|
+
#
|
38
|
+
# Similarly with position:
|
39
|
+
#
|
40
|
+
# TreeCtrl.new(parent, :pos => Wx::Point.new(5, 25))
|
41
|
+
#
|
42
|
+
# TreeCtrl.new(parent, :pos => [5, 25])
|
43
|
+
#
|
44
|
+
# You can have multiple keyword arguments:
|
45
|
+
#
|
46
|
+
# TreeCtrl.new(parent, :pos => [5, 25], :size => [100, 300] )
|
47
|
+
#
|
48
|
+
# == No ID required
|
49
|
+
#
|
50
|
+
# As with position and size, you usually don't want to deal with
|
51
|
+
# assigning unique ids to every widget and frame you create - it's a C++
|
52
|
+
# hangover that often seems clunky in Ruby. The *Event Connectors*
|
53
|
+
# extension allows you to set up event handling without having to use
|
54
|
+
# ids, and if no :id argument is supplied to a constructor, the default
|
55
|
+
# (-1) will be passed.
|
56
|
+
#
|
57
|
+
# There are occasions when a specific ID does need to be used - for
|
58
|
+
# example, to tell WxWidgets that a button is a 'stock' item, so that it
|
59
|
+
# can be displayed using platform-standard text and icon. To do this,
|
60
|
+
# simply pass an :id argument to the constructor - here, the system's
|
61
|
+
# standard 'preview' button
|
62
|
+
#
|
63
|
+
# Wx::Button.new(parent, :id => Wx::ID_PREVIEW)
|
64
|
+
#
|
65
|
+
# == Class-specific arguments
|
66
|
+
#
|
67
|
+
# The arguments :size, :pos and :style are common to many WxWidgets
|
68
|
+
# window classes. The +new+ methods of these classes also have
|
69
|
+
# parameters that are specific to those classes; for example, the text
|
70
|
+
# label on a button, or the initial value of a text control.
|
71
|
+
#
|
72
|
+
# Wx::Button.new(parent, :label => 'press me')
|
73
|
+
# Wx::TextCtrl.new(parent, :value => 'type some text here')
|
74
|
+
#
|
75
|
+
# The keyword names of these arguments can be found by looking at the
|
76
|
+
# WxRuby documentation, in the relevant class's +new+ method. You can
|
77
|
+
# also get a string description of the class's +new+ method parameters
|
78
|
+
# within Ruby by doing:
|
79
|
+
#
|
80
|
+
# puts Wx::TextCtrl.describe_constructor()
|
81
|
+
#
|
82
|
+
# This will print a list of the argument names expected by the class's
|
83
|
+
# +new+ method, and the correct type for them.
|
84
|
+
#
|
85
|
+
# == Mixing positional and keyword arguments
|
86
|
+
#
|
87
|
+
# To support existing code, and to avoid forcing the use of more verbose
|
88
|
+
# keyword-style arguments where they're not desired, you can mix
|
89
|
+
# positional and keyword arguments, omitting or including +id+s as
|
90
|
+
# desired.
|
91
|
+
#
|
92
|
+
# Wx::Button.new(parent, 'press me', :style => Wx::BU_RIGHT)
|
93
|
+
|
94
|
+
module Wx
|
95
|
+
module KeywordConstructor
|
96
|
+
module ClassMethods
|
97
|
+
|
98
|
+
# Common Wx constructor argument keywords, with their default values.
|
99
|
+
STANDARD_DEFAULTS = {
|
100
|
+
:id => -1,
|
101
|
+
:size => Wx::DEFAULT_SIZE,
|
102
|
+
:pos => Wx::DEFAULT_POSITION,
|
103
|
+
:style => 0,
|
104
|
+
:title => '',
|
105
|
+
:validator => Wx::DEFAULT_VALIDATOR,
|
106
|
+
:choices => [] # for Choice, ComboBox etc
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
# A named parameter in a Wx constructor parameter list
|
111
|
+
Parameter = Struct.new( :name, :default )
|
112
|
+
|
113
|
+
attr_writer :param_spec
|
114
|
+
def param_spec
|
115
|
+
@param_spec ||= []
|
116
|
+
end
|
117
|
+
|
118
|
+
# Adds a list of named parameters *params* to the parameter
|
119
|
+
# specification for this Wx class's constructor. Each parameter
|
120
|
+
# should be specified as a either a common known symbol, such as
|
121
|
+
# +:size+ or +:pos:+ or +:style:+ (corresponding to the common
|
122
|
+
# constructor arguments in WxWidgets API), or a single-key with the
|
123
|
+
# key the name of the argument, and the value a default value.
|
124
|
+
#
|
125
|
+
# Parameters should be specified in the order they occur in the Wx
|
126
|
+
# API constructor
|
127
|
+
def wx_ctor_params(*params)
|
128
|
+
self.param_spec += params.map do | param |
|
129
|
+
param.kind_of?(Hash) ? Parameter[*param.to_a.flatten] :
|
130
|
+
Parameter[param, STANDARD_DEFAULTS[param] ]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def args_as_list(*mixed_args)
|
135
|
+
# get keyword arguments from mixed args if supplied, else empty
|
136
|
+
kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
|
137
|
+
out_args = []
|
138
|
+
param_spec.zip(mixed_args) do | param, arg |
|
139
|
+
if arg # 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}"
|
151
|
+
end
|
152
|
+
|
153
|
+
def args_as_hash(*mixed_args)
|
154
|
+
kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
|
155
|
+
param_spec.zip(mixed_args) do | param, arg |
|
156
|
+
kwa[param.name] = arg if arg
|
157
|
+
end
|
158
|
+
kwa
|
159
|
+
end
|
160
|
+
|
161
|
+
def describe_constructor()
|
162
|
+
param_spec.inject("") do | desc, param |
|
163
|
+
desc << "#{param.name} (#{param.default.class.name})\n"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def self.included(klass)
|
169
|
+
klass.extend ClassMethods
|
170
|
+
klass.module_eval do
|
171
|
+
|
172
|
+
alias :pre_wx_kwctor_init :initialize
|
173
|
+
|
174
|
+
def initialize(parent = :default_ctor, *mixed_args)
|
175
|
+
# allow zero-args ctor for use with XRC
|
176
|
+
if parent == :default_ctor
|
177
|
+
pre_wx_kwctor_init()
|
178
|
+
return
|
179
|
+
end
|
180
|
+
|
181
|
+
real_args = [ parent ] + self.class.args_as_list(*mixed_args)
|
182
|
+
begin
|
183
|
+
pre_wx_kwctor_init(*real_args)
|
184
|
+
rescue
|
185
|
+
msg = "Error initializing #{self.inspect} \n" +
|
186
|
+
"Sent parameters: #{real_args.inspect}\n" +
|
187
|
+
"Correct parameters are:\n" +
|
188
|
+
self.class.describe_constructor()
|
189
|
+
Kernel.raise ArgumentError, msg
|
190
|
+
end
|
191
|
+
|
192
|
+
yield self if block_given?
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Any class inheriting from a class including this module must have
|
197
|
+
# its own copy of the param_spec
|
198
|
+
def klass.inherited(sub_klass)
|
199
|
+
sub_klass.instance_variable_set(:@param_spec,
|
200
|
+
instance_variable_get(:@param_spec) )
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
@@ -0,0 +1,465 @@
|
|
1
|
+
# = WxSugar - Keyword Constructors Classes
|
2
|
+
#
|
3
|
+
# This extension defines the keyword parameters for +new+ methods for
|
4
|
+
# widgets, windows and frames. It's for use with *Keyword Constructors*
|
5
|
+
# and is no use on its own - except if you are looking for a bug or want
|
6
|
+
# to add a missing class.
|
7
|
+
#
|
8
|
+
# For each class, the parameters *must* be declared in the order that
|
9
|
+
# they are supplied to wxRuby. A parameter is specified by a symbol
|
10
|
+
# name, and, optionally, a default argument which will of whatever type
|
11
|
+
# the wxRuby core library accepts. Because hashes are unordered in Ruby
|
12
|
+
# 1.8, if a default argument is specified, this must be the last in a
|
13
|
+
# list of parameters.
|
14
|
+
#
|
15
|
+
# Some common parameters to constructors such as size, position, title,
|
16
|
+
# id and so forth always have a standard default argumnet, which is
|
17
|
+
# defined in keyword_ctors. In these cases, it is not necessary to
|
18
|
+
# supply the default argument in the definition.
|
19
|
+
module Wx
|
20
|
+
@defined_kw_classes = {}
|
21
|
+
|
22
|
+
# accepts a string unadorned name of a WxWidgets class, and block, which
|
23
|
+
# defines the constructor parameters and style flags for that class.
|
24
|
+
# If the named class exists in the available WxRuby, the block is run and
|
25
|
+
# the class may use keyword constructors. If the class is not available, the
|
26
|
+
# block is ignored.
|
27
|
+
def self.define_keyword_ctors(klass_name, &block)
|
28
|
+
# check this class hasn't already been defined
|
29
|
+
if @defined_kw_classes[klass_name]
|
30
|
+
raise ArgumentError, "Keyword ctor for #{klass_name} already defined"
|
31
|
+
else
|
32
|
+
@defined_kw_classes[klass_name] = true
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
klass = Wx::const_get(klass_name)
|
37
|
+
rescue NameError
|
38
|
+
return nil
|
39
|
+
end
|
40
|
+
klass.module_eval { include Wx::KeywordConstructor }
|
41
|
+
klass.instance_eval(&block)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Window : base class for all widgets and frames
|
46
|
+
Wx::define_keyword_ctors('Window') do
|
47
|
+
wx_ctor_params :id, :pos, :size, :style
|
48
|
+
wx_ctor_params :name => 'window'
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
### FRAMES
|
53
|
+
|
54
|
+
# wxTopLevelWindow ABSTRACT: Any top level window, dialog or frame
|
55
|
+
|
56
|
+
# Normal frame
|
57
|
+
Wx::define_keyword_ctors('Frame') do
|
58
|
+
wx_ctor_params :id, :title, :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
|
59
|
+
wx_ctor_params :name => 'frame'
|
60
|
+
end
|
61
|
+
|
62
|
+
# MDI child frame
|
63
|
+
Wx::define_keyword_ctors('MDIChildFrame') do
|
64
|
+
wx_ctor_params :id, :title, :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
|
65
|
+
wx_ctor_params :name => 'frame'
|
66
|
+
end
|
67
|
+
|
68
|
+
# MDI parent frame
|
69
|
+
Wx::define_keyword_ctors('MDIParentFrame') do
|
70
|
+
wx_ctor_params :id, :title, :pos, :size
|
71
|
+
wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE|Wx::VSCROLL|Wx::HSCROLL
|
72
|
+
wx_ctor_params :name => 'frame'
|
73
|
+
end
|
74
|
+
|
75
|
+
# wxMiniFrame A frame with a small title bar
|
76
|
+
Wx::define_keyword_ctors('MiniFrame') do
|
77
|
+
wx_ctor_params :id, :title, :pos, :size
|
78
|
+
wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE
|
79
|
+
wx_ctor_params :name => 'frame'
|
80
|
+
end
|
81
|
+
|
82
|
+
# wxSplashScreen Splash screen class
|
83
|
+
# FIXME - this probably won't work at present because the 'parent' arg
|
84
|
+
# comes in a funny place in this class's ctor
|
85
|
+
#
|
86
|
+
# Wx::define_keyword_ctors('SplashScreen') do
|
87
|
+
# wx_ctor_params :bitmap => Wx::NULL_BITMAP
|
88
|
+
# wx_ctor_params :splashstyle, :milliseconds, :id => 1
|
89
|
+
# wx_ctor_params :parent => nil
|
90
|
+
# wx_ctor_params :title => ''
|
91
|
+
# wx_ctor_params :pos, :size
|
92
|
+
# wx_ctor_params :style => Wx::SIMPLE_BORDER|Wx::FRAME_NO_TASKBAR|Wx::STAY_ON_TOP
|
93
|
+
# end
|
94
|
+
|
95
|
+
# wxPropertySheetDialog Property sheet dialog
|
96
|
+
# wxTipWindow Shows text in a small window
|
97
|
+
|
98
|
+
# wxWizard A wizard dialog
|
99
|
+
Wx::define_keyword_ctors('Wizard') do
|
100
|
+
wx_ctor_params :id, :title, :bitmap => Wx::NULL_BITMAP
|
101
|
+
wx_ctor_params :pos # NB - no size argument for this class
|
102
|
+
wx_ctor_params :style => Wx::DEFAULT_DIALOG_STYLE
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
# MISCELLANEOUS WINDOWS
|
107
|
+
|
108
|
+
# A window whose colour changes according to current user settings
|
109
|
+
Wx::define_keyword_ctors('Panel') do
|
110
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::TAB_TRAVERSAL
|
111
|
+
wx_ctor_params :name => 'panel'
|
112
|
+
end
|
113
|
+
|
114
|
+
# wxScrolledWindow Window with automatically managed scrollbars
|
115
|
+
Wx::define_keyword_ctors('ScrolledWindow') do
|
116
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::VSCROLL|Wx::HSCROLL
|
117
|
+
wx_ctor_params :name => 'scrolledWindow'
|
118
|
+
end
|
119
|
+
|
120
|
+
# wxGrid A grid (table) window
|
121
|
+
Wx::define_keyword_ctors('Grid') do
|
122
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::WANTS_CHARS
|
123
|
+
wx_ctor_params :name => 'grid'
|
124
|
+
end
|
125
|
+
|
126
|
+
# Window which can be split vertically or horizontally
|
127
|
+
Wx::define_keyword_ctors('SplitterWindow') do
|
128
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::SP_3D
|
129
|
+
wx_ctor_params :name => 'splitterWindow'
|
130
|
+
end
|
131
|
+
|
132
|
+
# Implements the status bar on a frame
|
133
|
+
Wx::define_keyword_ctors('StatusBar') do
|
134
|
+
wx_ctor_params :id, :style => Wx::ST_SIZEGRIP
|
135
|
+
wx_ctor_params :name => 'statusBar'
|
136
|
+
end
|
137
|
+
|
138
|
+
# Toolbar class
|
139
|
+
Wx::define_keyword_ctors('ToolBar') do
|
140
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::TB_HORIZONTAL|Wx::NO_BORDER
|
141
|
+
wx_ctor_params :name => 'toolBar' # not as documented in Wx 2.6.3
|
142
|
+
end
|
143
|
+
|
144
|
+
# Notebook class
|
145
|
+
Wx::define_keyword_ctors('Notebook') do
|
146
|
+
wx_ctor_params :id, :pos, :size, :style, :name => 'noteBook'
|
147
|
+
end
|
148
|
+
|
149
|
+
# Similar to notebook but using list control - undocumented
|
150
|
+
Wx::define_keyword_ctors('Listbook') do
|
151
|
+
wx_ctor_params :id, :pos, :size, :style, :name => 'listBook'
|
152
|
+
end
|
153
|
+
|
154
|
+
# Similar to notebook but using choice control
|
155
|
+
Wx::define_keyword_ctors('Choicebook') do
|
156
|
+
wx_ctor_params :id, :pos, :size, :style, :name => 'choiceBook'
|
157
|
+
end
|
158
|
+
|
159
|
+
# wxSashWindow: Window with four optional sashes that can be dragged
|
160
|
+
Wx::define_keyword_ctors('SashWindow') do
|
161
|
+
wx_ctor_params :id, :pos, :size
|
162
|
+
wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D
|
163
|
+
wx_ctor_params :name => 'sashWindow'
|
164
|
+
end
|
165
|
+
|
166
|
+
# wxSashLayoutWindow: Window that can be involved in an IDE-like layout
|
167
|
+
# arrangement
|
168
|
+
Wx::define_keyword_ctors('SashLayoutWindow') do
|
169
|
+
wx_ctor_params :id, :pos, :size
|
170
|
+
wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D
|
171
|
+
wx_ctor_params :name => 'layoutWindow'
|
172
|
+
end
|
173
|
+
|
174
|
+
# wxVScrolledWindow: As wxScrolledWindow but supports lines of variable height
|
175
|
+
|
176
|
+
# wxWizardPage: A base class for the page in wizard dialog.
|
177
|
+
Wx::define_keyword_ctors('WizardPage') do
|
178
|
+
wx_ctor_params :bitmap => Wx::NULL_BITMAP
|
179
|
+
end
|
180
|
+
|
181
|
+
# wxWizardPageSimple: A page in wizard dialog.
|
182
|
+
Wx::define_keyword_ctors('WizardPageSimple') do
|
183
|
+
wx_ctor_params :prev => nil
|
184
|
+
wx_ctor_params :next => nil
|
185
|
+
wx_ctor_params :bitmap => Wx::NULL_BITMAP
|
186
|
+
end
|
187
|
+
|
188
|
+
### DIALOGS
|
189
|
+
# wxDialog Base class for common dialogs
|
190
|
+
Wx::define_keyword_ctors('Dialog') do
|
191
|
+
wx_ctor_params :id, :title => ''
|
192
|
+
wx_ctor_params :pos, :size, :style => Wx::DEFAULT_DIALOG_STYLE
|
193
|
+
wx_ctor_params :name => 'dialogBox'
|
194
|
+
end
|
195
|
+
|
196
|
+
# wxColourDialog Colour chooser dialog
|
197
|
+
Wx::define_keyword_ctors('ColourDialog') do
|
198
|
+
wx_ctor_params :colour_data => nil
|
199
|
+
end
|
200
|
+
|
201
|
+
# wxDirDialog Directory selector dialog
|
202
|
+
Wx::define_keyword_ctors('DirDialog') do
|
203
|
+
wx_ctor_params :message => 'Choose a directory'
|
204
|
+
wx_ctor_params :default_path => ''
|
205
|
+
wx_ctor_params :style, :pos, :size, :name => 'wxDirCtrl'
|
206
|
+
end
|
207
|
+
|
208
|
+
# wxFileDialog File selector dialog
|
209
|
+
Wx::define_keyword_ctors('FileDialog') do
|
210
|
+
wx_ctor_params :message => 'Choose a file'
|
211
|
+
wx_ctor_params :default_dir => ''
|
212
|
+
wx_ctor_params :default_file => ''
|
213
|
+
wx_ctor_params :wildcard => '*.*'
|
214
|
+
wx_ctor_params :style, :pos
|
215
|
+
end
|
216
|
+
|
217
|
+
# wxFindReplaceDialog Text search/replace dialog
|
218
|
+
Wx::define_keyword_ctors('FindReplaceDialog') do
|
219
|
+
wx_ctor_params :find_replace_data => Wx::FindReplaceData.new()
|
220
|
+
wx_ctor_params :title => 'findReplaceDialog'
|
221
|
+
wx_ctor_params :style
|
222
|
+
end
|
223
|
+
|
224
|
+
# wxMultiChoiceDialog Dialog to get one or more selections from a list
|
225
|
+
# wxSingleChoiceDialog Dialog to get a single selection from a list and return the string
|
226
|
+
|
227
|
+
# Dialog to get a single line of text from the user
|
228
|
+
Wx::define_keyword_ctors('TextEntryDialog') do
|
229
|
+
wx_ctor_params :message => ''
|
230
|
+
wx_ctor_params :caption => 'Please enter text'
|
231
|
+
wx_ctor_params :default_value => ''
|
232
|
+
wx_ctor_params :style => Wx::OK|Wx::CANCEL|Wx::CENTRE
|
233
|
+
wx_ctor_params :pos
|
234
|
+
end
|
235
|
+
|
236
|
+
# wxPasswordEntryDialog Dialog to get a password from the user
|
237
|
+
# Wx::define_keyword_ctors('PasswordEntryDialog') do
|
238
|
+
# wx_ctor_params :message => ''
|
239
|
+
# wx_ctor_params :caption => 'Enter password'
|
240
|
+
# wx_ctor_params :default_value => ''
|
241
|
+
# wx_ctor_params :style => Wx::OK|Wx::CANCEL|Wx::CENTRE
|
242
|
+
# wx_ctor_params :pos
|
243
|
+
# end
|
244
|
+
|
245
|
+
# wxFontDialog Font chooser dialog
|
246
|
+
# wxPageSetupDialog Standard page setup dialog
|
247
|
+
Wx::define_keyword_ctors('PageSetupDialog') do
|
248
|
+
wx_ctor_params :data
|
249
|
+
end
|
250
|
+
|
251
|
+
# wxPrintDialog Standard print dialog
|
252
|
+
Wx::define_keyword_ctors('PrintDialog') do
|
253
|
+
wx_ctor_params :data
|
254
|
+
end
|
255
|
+
|
256
|
+
|
257
|
+
# Simple message box dialog
|
258
|
+
Wx::define_keyword_ctors('MessageDialog') do
|
259
|
+
wx_ctor_params :message => ''
|
260
|
+
wx_ctor_params :caption => 'Message box'
|
261
|
+
wx_ctor_params :style => Wx::OK|Wx::CANCEL
|
262
|
+
wx_ctor_params :pos
|
263
|
+
end
|
264
|
+
|
265
|
+
### CONTROLS
|
266
|
+
|
267
|
+
# Push button control, displaying text
|
268
|
+
Wx::define_keyword_ctors('Button') do
|
269
|
+
wx_ctor_params :id, :label => ''
|
270
|
+
wx_ctor_params :pos, :size, :style
|
271
|
+
wx_ctor_params :validator, :name => 'button'
|
272
|
+
end
|
273
|
+
|
274
|
+
# Push button control, displaying a bitmap
|
275
|
+
Wx::define_keyword_ctors('BitmapButton') do
|
276
|
+
wx_ctor_params :id, :bitmap, :pos, :size, :style => Wx::BU_AUTODRAW
|
277
|
+
wx_ctor_params :validator, :name => 'button'
|
278
|
+
end
|
279
|
+
|
280
|
+
# A button which stays pressed when clicked by user.
|
281
|
+
Wx::define_keyword_ctors('ToggleButton') do
|
282
|
+
wx_ctor_params :id, :label, :pos, :size, :style
|
283
|
+
wx_ctor_params :validator, :name => 'checkBox'
|
284
|
+
end
|
285
|
+
|
286
|
+
# Control showing an entire calendar month
|
287
|
+
Wx::define_keyword_ctors('CalendarCtrl') do
|
288
|
+
wx_ctor_params :id, :date => Time.now()
|
289
|
+
wx_ctor_params :pos, :size, :style => Wx::CAL_SHOW_HOLIDAYS
|
290
|
+
wx_ctor_params :name => 'calendar'
|
291
|
+
end
|
292
|
+
|
293
|
+
# Checkbox control
|
294
|
+
Wx::define_keyword_ctors('CheckBox') do
|
295
|
+
wx_ctor_params :id, :label => ''
|
296
|
+
wx_ctor_params :pos, :size, :style
|
297
|
+
wx_ctor_params :validator, :name => 'checkBox'
|
298
|
+
end
|
299
|
+
|
300
|
+
# A listbox with a checkbox to the left of each item
|
301
|
+
Wx::define_keyword_ctors('CheckListBox') do
|
302
|
+
wx_ctor_params :id, :pos, :size, :choices, :style
|
303
|
+
wx_ctor_params :validator, :name => 'listBox'
|
304
|
+
end
|
305
|
+
|
306
|
+
# wxChoice Choice control (a combobox without the editable area)
|
307
|
+
Wx::define_keyword_ctors('Choice') do
|
308
|
+
wx_ctor_params :id, :pos, :size, :choices, :style
|
309
|
+
wx_ctor_params :validator, :name => 'choice'
|
310
|
+
end
|
311
|
+
|
312
|
+
# wxComboBox A choice with an editable area
|
313
|
+
Wx::define_keyword_ctors('ComboBox') do
|
314
|
+
wx_ctor_params :id, :value => ''
|
315
|
+
wx_ctor_params :pos, :size, :choices => []
|
316
|
+
wx_ctor_params :style
|
317
|
+
wx_ctor_params :validator, :name => 'comboBox'
|
318
|
+
end
|
319
|
+
|
320
|
+
# wxBitmapComboBox A choice with an editable area
|
321
|
+
Wx::define_keyword_ctors('BitmapComboBox') do
|
322
|
+
wx_ctor_params :id, :value => ''
|
323
|
+
wx_ctor_params :pos, :size, :choices => []
|
324
|
+
wx_ctor_params :style
|
325
|
+
wx_ctor_params :validator, :name => 'comboBox'
|
326
|
+
end
|
327
|
+
|
328
|
+
# wxDatePickerCtrl Small date picker control
|
329
|
+
|
330
|
+
# wxGauge A control to represent a varying quantity, such as time
|
331
|
+
# remaining
|
332
|
+
Wx::define_keyword_ctors('Gauge') do
|
333
|
+
wx_ctor_params :id, :range, :pos, :size, :style => Wx::GA_HORIZONTAL
|
334
|
+
wx_ctor_params :validator, :name => 'gauge'
|
335
|
+
end
|
336
|
+
|
337
|
+
# wxGenericDirCtrl A control for displaying a directory tree
|
338
|
+
Wx::define_keyword_ctors('GenericDirCtrl') do
|
339
|
+
# TODO :dir => Wx::DIR_DIALOG_DEFAULT_FOLDER_STR
|
340
|
+
wx_ctor_params :id, :dir => ''
|
341
|
+
wx_ctor_params :pos, :size,
|
342
|
+
:style => Wx::DIRCTRL_3D_INTERNAL|Wx::SUNKEN_BORDER
|
343
|
+
wx_ctor_params :filter => ''
|
344
|
+
wx_ctor_params :default_filter => 0
|
345
|
+
wx_ctor_params :name => 'genericDirCtrl'
|
346
|
+
end
|
347
|
+
|
348
|
+
|
349
|
+
# wxHtmlListBox A listbox showing HTML content
|
350
|
+
# wxListBox A list of strings for single or multiple selection
|
351
|
+
Wx::define_keyword_ctors('ListBox') do
|
352
|
+
wx_ctor_params :id, :pos, :size, :choices => []
|
353
|
+
wx_ctor_params :style
|
354
|
+
wx_ctor_params :validator, :name => 'listBox'
|
355
|
+
end
|
356
|
+
|
357
|
+
# wxListCtrl A control for displaying lists of strings and/or icons, plus a multicolumn report view
|
358
|
+
Wx::define_keyword_ctors('ListCtrl') do
|
359
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::LC_ICON
|
360
|
+
wx_ctor_params :validator, :name => 'listCtrl'
|
361
|
+
end
|
362
|
+
|
363
|
+
# wxListView A simpler interface (facade for wxListCtrl in report mode
|
364
|
+
|
365
|
+
# wxTreeCtrl Tree (hierarchy) control
|
366
|
+
Wx::define_keyword_ctors('TreeCtrl') do
|
367
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::TR_HAS_BUTTONS
|
368
|
+
wx_ctor_params :validator, :name => 'treeCtrl'
|
369
|
+
end
|
370
|
+
|
371
|
+
# wxSpinCtrl A spin control - i.e. spin button and text control
|
372
|
+
Wx::define_keyword_ctors('SpinCtrl') do
|
373
|
+
wx_ctor_params :id, :value => ''
|
374
|
+
wx_ctor_params :pos, :size, :style => Wx::SP_ARROW_KEYS
|
375
|
+
wx_ctor_params :min => 0
|
376
|
+
wx_ctor_params :max => 100
|
377
|
+
wx_ctor_params :initial => 0
|
378
|
+
wx_ctor_params :name => 'spinCtrl'
|
379
|
+
end
|
380
|
+
|
381
|
+
# One or more lines of non-editable text
|
382
|
+
Wx::define_keyword_ctors('StaticText') do
|
383
|
+
wx_ctor_params :id, :label, :pos, :size, :style, :name => 'staticText'
|
384
|
+
end
|
385
|
+
|
386
|
+
Wx::define_keyword_ctors('StaticBox') do
|
387
|
+
wx_ctor_params :id, :label, :pos, :size, :style, :name => 'staticBox'
|
388
|
+
end
|
389
|
+
|
390
|
+
Wx::define_keyword_ctors('StaticLine') do
|
391
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::LI_HORIZONTAL
|
392
|
+
wx_ctor_params :name => 'staticBox'
|
393
|
+
end
|
394
|
+
|
395
|
+
# wxStaticBitmap A control to display a bitmap
|
396
|
+
Wx::define_keyword_ctors('StaticBitmap') do
|
397
|
+
wx_ctor_params :id, :label, :pos, :size, :style
|
398
|
+
end
|
399
|
+
|
400
|
+
|
401
|
+
# wxRadioBox A group of radio buttons
|
402
|
+
Wx::define_keyword_ctors('RadioBox') do
|
403
|
+
wx_ctor_params :id, :label => ''
|
404
|
+
wx_ctor_params :pos, :size, :choices => []
|
405
|
+
wx_ctor_params :major_dimension => 0
|
406
|
+
wx_ctor_params :style => Wx::RA_SPECIFY_COLS
|
407
|
+
wx_ctor_params :validator, :name => 'radioBox'
|
408
|
+
end
|
409
|
+
|
410
|
+
# wxRadioButton: A round button used with others in a mutually exclusive way
|
411
|
+
Wx::define_keyword_ctors('RadioButton') do
|
412
|
+
wx_ctor_params :id, :label => ''
|
413
|
+
wx_ctor_params :pos, :size, :style => 0
|
414
|
+
wx_ctor_params :validator, :name => 'radioButton'
|
415
|
+
end
|
416
|
+
|
417
|
+
# wxSlider A slider that can be dragged by the user
|
418
|
+
Wx::define_keyword_ctors('Slider') do
|
419
|
+
wx_ctor_params :id, :value => 0
|
420
|
+
wx_ctor_params :min_value, :max_value
|
421
|
+
wx_ctor_params :pos, :size, :style => Wx::SL_HORIZONTAL
|
422
|
+
wx_ctor_params :validator, :name => 'slider'
|
423
|
+
end
|
424
|
+
|
425
|
+
# wxSpinButton - Has two small up and down (or left and right) arrow buttons
|
426
|
+
Wx::define_keyword_ctors('SpinButton') do
|
427
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::SP_HORIZONTAL
|
428
|
+
wx_ctor_params :name => 'spinButton'
|
429
|
+
end
|
430
|
+
|
431
|
+
# wxVListBox A listbox supporting variable height rows
|
432
|
+
|
433
|
+
# wxTextCtrl Single or multiline text editing control
|
434
|
+
Wx::define_keyword_ctors('TextCtrl') do
|
435
|
+
wx_ctor_params :id, :value => ''
|
436
|
+
wx_ctor_params :pos, :size, :style
|
437
|
+
wx_ctor_params :validator, :name => 'textCtrl'
|
438
|
+
end
|
439
|
+
|
440
|
+
# wxHtmlWindow - Control for displaying HTML
|
441
|
+
Wx::define_keyword_ctors('HtmlWindow') do
|
442
|
+
wx_ctor_params :id, :pos, :size, :style => Wx::HW_DEFAULT_STYLE
|
443
|
+
wx_ctor_params :name => 'htmlWindow'
|
444
|
+
end
|
445
|
+
|
446
|
+
# wxHyperTextCtrl - display a clickable URL
|
447
|
+
Wx::define_keyword_ctors('HyperlinkCtrl') do
|
448
|
+
wx_ctor_params :id, :label => ''
|
449
|
+
wx_ctor_params :url => ''
|
450
|
+
wx_ctor_params :pos, :size, :style => 0
|
451
|
+
wx_ctor_params :name => 'hyperlink'
|
452
|
+
end
|
453
|
+
|
454
|
+
Wx::define_keyword_ctors('StyledTextCtrl') do
|
455
|
+
wx_ctor_params :id, :pos, :size, :style => 0
|
456
|
+
wx_ctor_params :name => 'styledTextCtrl'
|
457
|
+
end
|
458
|
+
|
459
|
+
|
460
|
+
Wx::define_keyword_ctors('CollapsiblePane') do
|
461
|
+
wx_ctor_params :id, :label => ''
|
462
|
+
wx_ctor_params :pos, :size, :style => 0
|
463
|
+
wx_ctor_params :validator, :name => 'collapsiblePane'
|
464
|
+
end
|
465
|
+
|