wxruby 1.9.10-x86-linux → 2.0.0-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +254 -0
- data/README +184 -283
- data/lib/wx/accessors.rb +19 -7
- data/lib/wx/classes/bitmap.rb +3 -0
- data/lib/wx/classes/clipboard.rb +28 -4
- data/lib/wx/classes/image.rb +5 -0
- data/lib/wx/classes/toolbar.rb +7 -4
- data/lib/wx/classes/validator.rb +7 -0
- data/lib/wx/keyword_defs.rb +19 -2
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.so +0 -0
- data/samples/aui/aui.rb +21 -21
- data/samples/calendar/calendar.rb +1 -1
- data/samples/drawing/{images.rb → bitmap.rb} +10 -3
- data/samples/drawing/bitmap_image.rb +92 -0
- data/samples/drawing/maths_images.rb +265 -0
- data/samples/drawing/ruby-logo.jpg +0 -0
- data/samples/drawing/wxruby-logo.png +0 -0
- data/samples/text/document-open.png +0 -0
- data/samples/text/document-save.png +0 -0
- data/samples/text/edit-copy.png +0 -0
- data/samples/text/edit-cut.png +0 -0
- data/samples/text/edit-paste.png +0 -0
- data/samples/text/edit-redo.png +0 -0
- data/samples/text/edit-undo.png +0 -0
- data/samples/text/preferences-desktop-font.png +0 -0
- data/samples/text/rich_textctrl.rb +234 -42
- metadata +17 -4
- data/samples/drawing/paperclip.png +0 -0
data/README
CHANGED
@@ -1,297 +1,198 @@
|
|
1
|
-
README for
|
1
|
+
= README for wxRuby version 2.0
|
2
2
|
|
3
|
-
|
3
|
+
== Introduction
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
wxRuby is a cross-platform GUI library for Ruby, based on the wxWidgets
|
6
|
+
GUI toolkit for C++. It uses native widgets wherever possible, providing
|
7
|
+
the correct look, feel and behaviour to GUI applications on Windows, OS
|
8
|
+
X and Linux/GTK. wxRuby aims to provide a comprehensive solution to
|
9
|
+
developing professional-standard desktop applications in Ruby.
|
9
10
|
|
10
|
-
|
11
|
-
wxruby version 2.0.
|
11
|
+
== Installing wxRuby
|
12
12
|
|
13
|
-
|
13
|
+
wxRuby is distributed as pre-compiled binaries and source from the
|
14
|
+
project's site on Rubyforge: http://wxruby.rubyforge.org/
|
14
15
|
|
15
|
-
|
16
|
+
For the majority of users, installation simply requires running 'gem
|
17
|
+
install wxruby' on the command line. See INSTALL for further
|
18
|
+
information.
|
16
19
|
|
17
|
-
|
20
|
+
== wxRuby licence
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
wxRuby is free and open-source. It is distributed under a liberal
|
23
|
+
licence which is compatible with both free and commercial development.
|
24
|
+
See LICENSE for more details.
|
22
25
|
|
23
|
-
|
24
|
-
will be added to wxRuby2 in the near future, as these operating
|
25
|
-
systems have very limited support for Unicode.
|
26
|
+
== FAQ
|
26
27
|
|
27
|
-
|
28
|
-
GUI toolkits? Isn't wxruby arriving "too late"?
|
29
|
-
|
30
|
-
There are several great GUI toolkits available for Ruby, but we
|
31
|
-
like wxruby better because it has a combination of features that no
|
32
|
-
other toolkit has:
|
33
|
-
|
34
|
-
- Cross-platform (MSWindows, Mac OS X, Linux)
|
35
|
-
- Native widgets when possible
|
36
|
-
- Provides a wide selection of widgets
|
37
|
-
- Simple license that is compatible with proprietary and Free Software
|
38
|
-
- Mature foundation (wxWidgets has been around for over 10 years)
|
39
|
-
|
40
|
-
The really big feature is native widgets. The only other cross-platform
|
41
|
-
toolkits that use native widgets are either limited (Tk) or expensive if
|
42
|
-
you want to develop proprietary software (Qt). We are not saying that
|
43
|
-
those toolkits are bad! Just that wxruby offers a unique set of
|
44
|
-
features.
|
45
|
-
|
46
|
-
- Why are native widgets important or helpful?
|
47
|
-
|
48
|
-
For one thing, it means that end-users do not have to adjust to a
|
49
|
-
"foreign" interface. It also ensures maximum compatibility with
|
50
|
-
"assistive technology" such as screen readers for blind users.
|
51
|
-
It also allows apps to respect any themes the user may have chosen
|
52
|
-
through their operating system. No matter how hard a toolkit may try
|
53
|
-
to emulate a particular UI, there will always be differences in the
|
54
|
-
look or behavior.
|
55
|
-
|
56
|
-
- How does wxruby2 relate to wxruby (and the wxruby 0.6.0 release)?
|
28
|
+
=== What platforms and operating systems are supported in wxRuby2?
|
57
29
|
|
58
|
-
|
59
|
-
by the same wxruby team, and is intended to replace the older
|
60
|
-
code base. wxruby2 is built using SWIG, a powerful tool that makes
|
61
|
-
it much easier to create and maintain wrappers around C/C++ libraries.
|
62
|
-
|
63
|
-
- Why should I use wxruby2 instead of wxruby?
|
30
|
+
Currently the following are fully supported:
|
64
31
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
- Available as binary gems for MSWindows, OS X, and Linux (GTK)
|
70
|
-
- Support for more classes, and more methods within classes
|
71
|
-
- Unicode support
|
72
|
-
- Vastly improved support for OS X
|
73
|
-
- Looks much better under Linux because it uses GTK+2
|
74
|
-
- Simpler and more permissive license
|
75
|
-
- Wraps wxWidgets 2.8.7 instead of the older 2.4 series
|
76
|
-
|
77
|
-
- Is wxruby2 ready for "production" use?
|
78
|
-
|
79
|
-
Yes, pretty much. This is a beta release, and there may be some bugs
|
80
|
-
in some methods, or memory leaks. This release includes all the
|
81
|
-
classes and features that are proposed for inclusion in wxruby 2.0.
|
82
|
-
|
83
|
-
It is considerably more stable and fully-featured than the old 0.6.0
|
84
|
-
release, which was never really stable enough for heavy-duty
|
85
|
-
production use.
|
86
|
-
|
87
|
-
- Does wxruby2 support the Xxx class?
|
32
|
+
* Windows NT/2000/XP/Vista (i686, MSVC and MingW)
|
33
|
+
* OS X 10.4+ (i686 and PowerPc)
|
34
|
+
* Linux (i686 + AMD-64)
|
88
35
|
|
89
|
-
|
90
|
-
|
36
|
+
Support for other platforms is not being actively developed at present,
|
37
|
+
but patches are welcome. It is likely to be much simpler to get wxRuby
|
38
|
+
working on similar modern systems (eg FreeBSD or Solaris with GTK) than
|
39
|
+
on legacy systems (eg Windows 98, Mac OS 9).
|
40
|
+
|
41
|
+
=== Why would I choose wxruby over FXRuby, Ruby/GTK, Shoes etc?
|
91
42
|
|
92
|
-
|
93
|
-
|
94
|
-
wxruby 0.6.0 was released under the wxWindows license, which is a
|
95
|
-
modified LGPL. It is a good, fair license, allowing use in both Free
|
96
|
-
Software and proprietary applications. However, it is long and complex,
|
97
|
-
and is more appropriate for compiled code. wxruby2 is available under a
|
98
|
-
*very* simple MIT-style license, which allows just about any use with
|
99
|
-
very few restrictions.
|
43
|
+
There are several fine GUI toolkits available for Ruby, but we consider
|
44
|
+
that wxRuby offers a combination of features that no other toolkit can match:
|
100
45
|
|
101
|
-
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
to somewhere on your ruby library path, such as a ruby extensions
|
255
|
-
directory.
|
256
|
-
|
257
|
-
|
258
|
-
PORTING TO OTHER PLATFORMS
|
259
|
-
|
260
|
-
Platform-dependent rakefiles are used to set up compiler-specific
|
261
|
-
settings. The following platforms are currently fully supported:
|
262
|
-
|
263
|
-
Mac OSX (gcc): rakemacosx.rb
|
264
|
-
MS Windows (VC++): rakemswin.rb
|
265
|
-
Linux (GTK2 + gcc): rakelinux.rb
|
266
|
-
|
267
|
-
For other platforms, you may need to edit the appropriate
|
268
|
-
platform-dependent rake file if your system is not yet supported, or if
|
269
|
-
it is unusual. These files are found in the rake subdirectory:
|
270
|
-
|
271
|
-
MS Windows BC++: rakebccwin.rb
|
272
|
-
MS Windows MingGW: rakemingw.rb
|
273
|
-
MS Windows Cygwin: rakecygwin.rb
|
274
|
-
NetBSD: rakenetbsd.rb
|
275
|
-
|
276
|
-
When editing a platform-dependent rakefile, you might
|
277
|
-
merely need to set one or more of the following variables:
|
278
|
-
|
279
|
-
$extra_cppflags
|
280
|
-
$extra_ldflags
|
281
|
-
$extra_objs
|
282
|
-
$extra_libs
|
283
|
-
|
284
|
-
|
285
|
-
CREDITS
|
286
|
-
|
287
|
-
Kevin Smith set up the wxruby2 project using SWIG and did much of the
|
288
|
-
work that still forms the core of the library in its present form. Over
|
289
|
-
the years dozens of volunteers have contributed invaluable patches and
|
290
|
-
new functionality. The list is too long to give here, but their
|
291
|
-
contributions are recorded in the wxruby mailing list archives.
|
292
|
-
|
293
|
-
-----------------------------------------------------------
|
294
|
-
|
295
|
-
LEAD MAINTAINER:
|
296
|
-
Alex Fenton
|
297
|
-
alex at pressure dot to
|
46
|
+
* Cross-platform (MS Windows, Mac OS X, Linux)
|
47
|
+
* Real native widgets wherever possible
|
48
|
+
* Provides a comprehensive selection of widgets and other GUI features
|
49
|
+
* Useful non-GUI support classes, eg for Images and internationalisation
|
50
|
+
* Simple licence that is compatible with proprietary and Free Software
|
51
|
+
* Mature and actively developed foundation in wxWidgets
|
52
|
+
* Easy to install and redistribute
|
53
|
+
|
54
|
+
=== Why are native widgets important or helpful?
|
55
|
+
|
56
|
+
The really important feature among the above is, for many people, native
|
57
|
+
widgets. Several toolkits are to some degree able to simulate the native
|
58
|
+
appearance of widgets, but wxRuby widgets are actually native widgets -
|
59
|
+
so they behave and interact exactly according to the desktop's GUI
|
60
|
+
conventions.
|
61
|
+
|
62
|
+
For one thing, this means that end-users do not have to adjust to a
|
63
|
+
"foreign" interface. It ensures maximum compatibility with "assistive
|
64
|
+
technology" such as screen readers for blind users. It also allows apps
|
65
|
+
to respect any themes the user may have chosen through their operating
|
66
|
+
system.
|
67
|
+
|
68
|
+
Desktop conventions go beyond widget appearance, to the labelling and
|
69
|
+
positioning of items in standard dialogs and menus. wxRuby offers
|
70
|
+
features to help with these too.
|
71
|
+
|
72
|
+
== Where can I ask a question, or report a bug?
|
73
|
+
|
74
|
+
The main mailing list for those using wxRuby for GUI development is
|
75
|
+
wxruby-users. General questions and queries of all sorts are appropriate
|
76
|
+
for this list, and new users are welcome.
|
77
|
+
|
78
|
+
When asking a question, if something is not working as you expect,
|
79
|
+
please provide a *minimal*, *runnable* sample of code that demonstrates
|
80
|
+
the problem, and say what you expected to happen, and what actually
|
81
|
+
happened. Please also provide basic details of your platform, ruby and
|
82
|
+
wxruby version, and make a reasonable effort to find answers in the
|
83
|
+
archive and documentation before posting. People on the list are happy
|
84
|
+
to help, but it's too much to expect them to guess what you're trying to
|
85
|
+
do, or try and debug 1,000 lines of your application.
|
86
|
+
|
87
|
+
There is a bug-tracker and feature-request system on the rubyforge
|
88
|
+
project pages for wxRuby. Using these helps ensure that a bug is
|
89
|
+
followed through and resolved. You're strongly encouraged to post to
|
90
|
+
these logged-in to rubyforge and not anonymously. You won't receive any
|
91
|
+
requests for follow-up information on anonymous items, and so these can
|
92
|
+
end up being closed without being resolved if needed information isn't
|
93
|
+
supplied.
|
94
|
+
|
95
|
+
wxruby-development is a secondary mailing list for all those interested
|
96
|
+
in the current and future development of wxRuby. The discussion on this
|
97
|
+
list tends to deal more with the internals of the library.
|
98
|
+
|
99
|
+
== How can I learn to use wxRuby?
|
100
|
+
|
101
|
+
wxRuby is a large API and takes some time to learn. The wxRuby
|
102
|
+
distribution comes with numerous samples which illustrate how to use
|
103
|
+
many specific parts of the API. A good one to start with is the
|
104
|
+
'minimal' sample, which provides an application skeleton. All the
|
105
|
+
bundled samples are expected to work with current wxRuby 2.0, although
|
106
|
+
some use a more modern coding style than others.
|
107
|
+
|
108
|
+
Complete wxRuby API documentation can downloaded separately; this tends
|
109
|
+
to focus on how to use specific classes and methods, rather than on how
|
110
|
+
to construct an application overall.
|
111
|
+
|
112
|
+
There are also tutorials on the wiki, as well as on third-party
|
113
|
+
websites. These typically provide in-depth view of a particular topic,
|
114
|
+
but some may be out-of-date.
|
115
|
+
|
116
|
+
One of the advantages of wxRuby is the much larger ecosystem of
|
117
|
+
wxWidgets and wxPython resources out there. There is a book for
|
118
|
+
wxWidgets,"Cross-Platform Programming in wxWidgets", whcih can be freely
|
119
|
+
downloaded as a PDF. This provides very comprehensive coverage of the
|
120
|
+
wxWidgets API in C++. The code may not be directly useful, but the
|
121
|
+
descriptions of how widgets and events and so forth work are almost
|
122
|
+
always relevant to wxRuby.
|
123
|
+
|
124
|
+
When using a search engine to find answers about a wxRuby class, it can
|
125
|
+
be worth searching for the same term but with 'wx' prepended. For
|
126
|
+
example, if you wanted answers about the "Grid" class, try searching for
|
127
|
+
"wxGrid" as this will turn up results relating to wxWidgets and wxPython
|
128
|
+
which may be relevant.
|
129
|
+
|
130
|
+
== What wxWidgets features are supported by wxRuby?
|
131
|
+
|
132
|
+
wxRuby supports almost all of the wxWidgets 2.8.9 GUI API, around 300
|
133
|
+
classes in total. wxWidgets classes that provide general programming
|
134
|
+
support features, such as strings, networking, threading and database
|
135
|
+
access are not and will never be ported, as it's assumed that in all
|
136
|
+
these cases it's preferable to use a Ruby library.
|
137
|
+
|
138
|
+
If you know of a feature in wxWidgets that you would like to see
|
139
|
+
supported in wxRuby
|
140
|
+
|
141
|
+
== How does wxRuby 2.0 relate to the wxruby 0.6.0 release?
|
142
|
+
|
143
|
+
wxRuby 0.6.0 was the last in a series of releases developed using a
|
144
|
+
different approach in the early days of wxRuby. Work on this series
|
145
|
+
stopped in early 2005, in favour of what is now wxRuby 2.0. Several
|
146
|
+
years of development have gone into wxRuby since, making it vastly more
|
147
|
+
capable and correct than the 0.6.0 release, which is only offered for
|
148
|
+
legacy applications.
|
149
|
+
|
150
|
+
== I am getting an error trying to install or compile wxRuby
|
151
|
+
|
152
|
+
Please double-check the INSTALL documents, and search the mailing list
|
153
|
+
archives. If this doesn't help, please post your question on the wxruby
|
154
|
+
mailing list (http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists)
|
155
|
+
|
156
|
+
= Credits
|
157
|
+
|
158
|
+
Kevin Smith established the wxRuby 2.0 project using SWIG in 2005. Since
|
159
|
+
then it has benefitted from the input of dozens of volunteers, who have
|
160
|
+
contributed code, documentation, testing, bug reports and feature
|
161
|
+
requests.
|
162
|
+
|
163
|
+
The alphabetic list shows (some of) those who've contributed code to
|
164
|
+
wxRuby 2.0.
|
165
|
+
|
166
|
+
Albin Holmgren
|
167
|
+
Alex Fenton
|
168
|
+
Artur Kuptel
|
169
|
+
Cezar Espinola
|
170
|
+
Chauk-Mean Proum
|
171
|
+
Christophe Bludau
|
172
|
+
Curt Hibbs
|
173
|
+
Dale Edmons
|
174
|
+
Daniel Savarese
|
175
|
+
David Whetstone
|
176
|
+
Dirk Traulsen
|
177
|
+
Hawley Waldman
|
178
|
+
Jani Monoses
|
179
|
+
Joe Seeley
|
180
|
+
Jonathan Maasland
|
181
|
+
Kevin Smith
|
182
|
+
Mario Steele
|
183
|
+
Nic
|
184
|
+
Pascal Hurni
|
185
|
+
Robert Carlin
|
186
|
+
Roy Sutton
|
187
|
+
Ryuichi Sakamoto
|
188
|
+
Sean Lindsay
|
189
|
+
Sean Long
|
190
|
+
Tobias Gruetzmacher
|
191
|
+
Zach Dennis
|
192
|
+
|
193
|
+
If your name is missing and should be here, please get in touch
|
194
|
+
with the current development team.
|
195
|
+
|
196
|
+
== Lead Maintainer
|
197
|
+
|
198
|
+
Alex Fenton: alex at pressure dot to
|
data/lib/wx/accessors.rb
CHANGED
@@ -5,16 +5,21 @@
|
|
5
5
|
# * get_position()
|
6
6
|
# * set_size(a_size)
|
7
7
|
# * is_checked()
|
8
|
+
# * can_undo()
|
9
|
+
# * has_style(a_style)
|
8
10
|
#
|
9
11
|
# and so on. Methods that retrieve set, or query attributes of an object
|
10
|
-
# are more normally in Ruby called simply by the attribute name
|
12
|
+
# are more normally in Ruby called simply by the attribute name, or, in
|
13
|
+
# other cases, with a predicate method:
|
11
14
|
#
|
12
|
-
# * position
|
13
|
-
# * size = a_size
|
14
|
-
# * checked?
|
15
|
+
# * pos = my_widget.position
|
16
|
+
# * my_widget.size = a_size
|
17
|
+
# * my_widget.checked?
|
18
|
+
# * my_widget.can_undo?
|
19
|
+
# * my_widget.has_style?
|
15
20
|
#
|
16
21
|
# This extension creates an alias for every WxRuby instance method that
|
17
|
-
# begins with +get_+, +set_+
|
22
|
+
# begins with +get_+, +set_+, +is_+, +can_+ and +has_+. Note that if you are calling a
|
18
23
|
# 'setter' method on self, you must explicitly send the message to self:
|
19
24
|
#
|
20
25
|
# # set's self size to be 100px by 100px
|
@@ -23,11 +28,18 @@
|
|
23
28
|
# size = Wx::Size.new
|
24
29
|
|
25
30
|
module WxRubyStyleAccessors
|
31
|
+
# Ruby-style method named are implemented by method-missing; if an
|
32
|
+
# unknown method is called, see if it is a rubyish name for a real
|
33
|
+
# method. In principle it would be possible to set up real aliases for
|
34
|
+
# them at start-up, but in practice this is far too slow for all the
|
35
|
+
# classes that need to be started up.
|
26
36
|
def method_missing(sym, *args)
|
27
37
|
case sym.to_s
|
28
|
-
when /^(
|
38
|
+
when /^(\w+)\=$/
|
29
39
|
meth = "set_#{$1}"
|
30
|
-
when /^(
|
40
|
+
when /^((?:has|can)\w+)\?$/
|
41
|
+
meth = $1
|
42
|
+
when /^(\w+)\?$/
|
31
43
|
meth = "is_#{$1}"
|
32
44
|
else
|
33
45
|
meth = "get_#{sym}"
|
data/lib/wx/classes/bitmap.rb
CHANGED
@@ -25,6 +25,9 @@ class Wx::Bitmap
|
|
25
25
|
new(img, depth)
|
26
26
|
end
|
27
27
|
|
28
|
+
# Ruby methods that switch class are conventionally named to_foo
|
29
|
+
alias :to_image :convert_to_image
|
30
|
+
|
28
31
|
# Redefine the initialize method so it raises an exception if a
|
29
32
|
# non-existent file is given to the constructor; otherwise, wx Widgets
|
30
33
|
# just carries on with an empty bitmap, which may cause faults
|
data/lib/wx/classes/clipboard.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
class Wx::Clipboard
|
2
|
-
# See if we like these better
|
3
|
-
alias :place :set_data
|
4
|
-
alias :fetch :get_data
|
5
|
-
|
6
2
|
class << self
|
7
3
|
# This is provided internally by the SWIG interface file, but all
|
8
4
|
# public access should be via Clipboard.open; see below
|
@@ -29,4 +25,32 @@ class Wx::Clipboard
|
|
29
25
|
clip.close if clip
|
30
26
|
end
|
31
27
|
end
|
28
|
+
|
29
|
+
# Need to do some internal record-keeping to protect data objects on
|
30
|
+
# the clipboard from garbage collection
|
31
|
+
@@__clip_data = []
|
32
|
+
|
33
|
+
# These methods affect the clipboard contents; each time, update the
|
34
|
+
# record with the changed data contents
|
35
|
+
wx_add_data = instance_method(:add_data)
|
36
|
+
define_method(:add_data) do | the_data |
|
37
|
+
@@__clip_data << the_data
|
38
|
+
wx_add_data.bind(self).call(the_data)
|
39
|
+
end
|
40
|
+
|
41
|
+
wx_clear = instance_method(:clear)
|
42
|
+
define_method(:clear) do
|
43
|
+
@@__clip_data.clear
|
44
|
+
wx_clear.bind(self).call
|
45
|
+
end
|
46
|
+
|
47
|
+
wx_set_data = instance_method(:set_data)
|
48
|
+
define_method(:set_data) do | the_data |
|
49
|
+
@@__clip_data = [ the_data ]
|
50
|
+
wx_set_data.bind(self).call(the_data)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Aliases, more clearly expressive?
|
54
|
+
alias :place :set_data
|
55
|
+
alias :fetch :get_data
|
32
56
|
end
|
data/lib/wx/classes/image.rb
CHANGED
@@ -17,6 +17,11 @@ class Wx::Image
|
|
17
17
|
bmp.convert_to_image
|
18
18
|
end
|
19
19
|
|
20
|
+
# Ruby methods that switch class are conventionally named to_foo
|
21
|
+
def to_bitmap
|
22
|
+
Wx::Bitmap.from_image(self)
|
23
|
+
end
|
24
|
+
|
20
25
|
# Redefine the initialize method so it raises an exception if a
|
21
26
|
# non-existent file is given to the constructor; otherwise, wx Widgets
|
22
27
|
# just carries on with an invalid image, which may cause faults
|
data/lib/wx/classes/toolbar.rb
CHANGED
@@ -2,20 +2,23 @@
|
|
2
2
|
class Wx::ToolBar
|
3
3
|
# Generic method to add items, supporting positional and named
|
4
4
|
# arguments
|
5
|
-
ADD_ITEM_PARAMS = [
|
5
|
+
ADD_ITEM_PARAMS = [
|
6
|
+
Wx::Parameter[ :bitmap2, Wx::NULL_BITMAP ],
|
7
|
+
Wx::Parameter[ :position, -1 ],
|
6
8
|
Wx::Parameter[ :id, -1 ],
|
7
9
|
Wx::Parameter[ :label, "" ],
|
8
|
-
Wx::Parameter[ :bitmap2, Wx::NULL_BITMAP ],
|
9
10
|
Wx::Parameter[ :kind, Wx::ITEM_NORMAL ],
|
10
11
|
Wx::Parameter[ :short_help, "" ],
|
11
12
|
Wx::Parameter[ :long_help, "" ],
|
12
13
|
Wx::Parameter[ :client_data, nil ] ]
|
13
14
|
|
14
|
-
def add_item(
|
15
|
+
def add_item(bitmap1, *mixed_args)
|
15
16
|
args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
|
16
17
|
|
18
|
+
bitmap2 = args.shift
|
17
19
|
pos = args.shift
|
18
|
-
args.insert(2,
|
20
|
+
args.insert(2, bitmap1)
|
21
|
+
args.insert(3, bitmap2)
|
19
22
|
|
20
23
|
# Call add_tool to append if default position
|
21
24
|
if pos == -1
|