wxruby 1.9.9-x86-mingw32 → 1.9.10-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +53 -53
- data/README +297 -297
- data/lib/wx.rb +53 -53
- data/lib/wx/classes/bitmap.rb +29 -1
- data/lib/wx/classes/clipboard.rb +19 -3
- data/lib/wx/classes/colour.rb +6 -4
- data/lib/wx/classes/data_object.rb +14 -0
- data/lib/wx/classes/data_object_simple.rb +6 -0
- data/lib/wx/classes/dataformat.rb +23 -0
- data/lib/wx/classes/evthandler.rb +31 -4
- data/lib/wx/classes/genericdirctrl.rb +36 -0
- data/lib/wx/classes/grid.rb +8 -0
- data/lib/wx/classes/hboxsizer.rb +6 -0
- data/lib/wx/classes/icon.rb +12 -1
- data/lib/wx/classes/image.rb +13 -1
- data/lib/wx/classes/listctrl.rb +12 -0
- data/lib/wx/classes/point.rb +8 -0
- data/lib/wx/classes/rect.rb +10 -1
- data/lib/wx/classes/richtextctrl.rb +22 -0
- data/lib/wx/classes/size.rb +9 -0
- data/lib/wx/classes/sizer.rb +18 -3
- data/lib/wx/classes/toolbar.rb +4 -6
- data/lib/wx/classes/vboxsizer.rb +6 -0
- data/lib/wx/classes/window.rb +7 -0
- data/lib/wx/classes/xmlresource.rb +17 -0
- data/lib/wx/helpers.rb +16 -1
- data/lib/wx/keyword_ctors.rb +3 -2
- data/lib/wx/keyword_defs.rb +27 -5
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.so +0 -0
- data/samples/SAMPLES-LICENSE.TXT +17 -17
- data/samples/bigdemo/About.rbw +39 -39
- data/samples/bigdemo/ColorPanel.rbw +23 -23
- data/samples/bigdemo/GridSimple.rbw +78 -78
- data/samples/bigdemo/MDIDemo.rbw +57 -57
- data/samples/bigdemo/PopupMenu.rbw +149 -149
- data/samples/bigdemo/Sizers.rbw +543 -543
- data/samples/bigdemo/bigdemo.rb +823 -823
- data/samples/bigdemo/demoTemplate.rbw +33 -33
- data/samples/bigdemo/icons/choice.xpm +27 -27
- data/samples/bigdemo/icons/combo.xpm +27 -27
- data/samples/bigdemo/icons/copy.xpm +25 -25
- data/samples/bigdemo/icons/cut.xpm +24 -24
- data/samples/bigdemo/icons/gauge.xpm +27 -27
- data/samples/bigdemo/icons/help.xpm +25 -25
- data/samples/bigdemo/icons/list.xpm +27 -27
- data/samples/bigdemo/icons/mondrian.xpm +44 -44
- data/samples/bigdemo/icons/new.xpm +24 -24
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +45 -45
- data/samples/bigdemo/icons/open.xpm +26 -26
- data/samples/bigdemo/icons/paste.xpm +38 -38
- data/samples/bigdemo/icons/preview.xpm +26 -26
- data/samples/bigdemo/icons/print.xpm +26 -26
- data/samples/bigdemo/icons/radio.xpm +27 -27
- data/samples/bigdemo/icons/robert.xpm +415 -415
- data/samples/bigdemo/icons/save.xpm +25 -25
- data/samples/bigdemo/icons/smiles.xpm +39 -39
- data/samples/bigdemo/icons/smiley.xpm +42 -42
- data/samples/bigdemo/icons/stattext.xpm +24 -24
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.xpm +79 -79
- data/samples/bigdemo/icons/text.xpm +27 -27
- data/samples/bigdemo/icons/tog1.xpm +38 -38
- data/samples/bigdemo/icons/tog2.xpm +38 -38
- data/samples/bigdemo/icons/wxwin16x16.xpm +25 -25
- data/samples/bigdemo/tips.txt +7 -7
- data/samples/bigdemo/utils.rb +11 -11
- data/samples/bigdemo/wxButton.rbw +64 -64
- data/samples/bigdemo/wxCalendarCtrl.rbw +60 -60
- data/samples/bigdemo/wxCheckBox.rbw +50 -50
- data/samples/bigdemo/wxCheckListBox.rbw +65 -75
- data/samples/bigdemo/wxChoice.rbw +47 -47
- data/samples/bigdemo/wxColourDialog.rbw +31 -31
- data/samples/bigdemo/wxComboBox.rbw +77 -77
- data/samples/bigdemo/wxDialog.rbw +74 -74
- data/samples/bigdemo/wxDirDialog.rbw +29 -29
- data/samples/bigdemo/wxFileDialog.rbw +37 -37
- data/samples/bigdemo/wxFileDialog_Save.rbw +35 -35
- data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -82
- data/samples/bigdemo/wxFontDialog.rbw +173 -173
- data/samples/bigdemo/wxFrame.rbw +53 -53
- data/samples/bigdemo/wxGauge.rbw +71 -71
- data/samples/bigdemo/wxGrid.rbw +66 -66
- data/samples/bigdemo/wxListBox.rbw +140 -140
- data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -107
- data/samples/bigdemo/wxMDIWindows.rbw +50 -50
- data/samples/bigdemo/wxMenu.rbw +236 -236
- data/samples/bigdemo/wxMessageDialog.rbw +27 -27
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -32
- data/samples/bigdemo/wxNotebook.rbw +136 -136
- data/samples/bigdemo/wxProgressDialog.rbw +43 -43
- data/samples/bigdemo/wxRadioBox.rbw +72 -72
- data/samples/bigdemo/wxRadioButton.rbw +125 -125
- data/samples/bigdemo/wxSashWindow.rbw +2 -2
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -57
- data/samples/bigdemo/wxScrolledWindow.rbw +199 -199
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -33
- data/samples/bigdemo/wxSlider.rbw +42 -42
- data/samples/bigdemo/wxSpinButton.rbw +50 -50
- data/samples/bigdemo/wxSpinCtrl.rbw +51 -51
- data/samples/bigdemo/wxSplitterWindow.rbw +63 -63
- data/samples/bigdemo/wxStaticBitmap.rbw +51 -51
- data/samples/bigdemo/wxStaticText.rbw +55 -55
- data/samples/bigdemo/wxStatusBar.rbw +126 -126
- data/samples/bigdemo/wxTextCtrl.rbw +149 -149
- data/samples/bigdemo/wxTextEntryDialog.rbw +31 -31
- data/samples/bigdemo/wxToggleButton.rbw +49 -49
- data/samples/bigdemo/wxToolBar.rbw +131 -131
- data/samples/bigdemo/wxTreeCtrl.rbw +191 -190
- data/samples/calendar/calendar.rb +256 -271
- data/samples/caret/caret.rb +282 -282
- data/samples/caret/mondrian.xpm +44 -44
- data/samples/controls/controls.rb +1136 -1136
- data/samples/controls/get_item_sample.rb +87 -87
- data/samples/controls/icons/choice.xpm +27 -27
- data/samples/controls/icons/combo.xpm +27 -27
- data/samples/controls/icons/gauge.xpm +27 -27
- data/samples/controls/icons/list.xpm +27 -27
- data/samples/controls/icons/radio.xpm +27 -27
- data/samples/controls/icons/stattext.xpm +24 -24
- data/samples/controls/icons/text.xpm +27 -27
- data/samples/controls/mondrian.xpm +44 -44
- data/samples/dialogs/dialogs.rb +797 -723
- data/samples/dialogs/tips.txt +18 -18
- data/samples/drawing/images.rb +37 -37
- data/samples/etc/activation.rb +102 -102
- data/samples/etc/choice.rb +67 -67
- data/samples/etc/miniframe.rb +79 -79
- data/samples/etc/sash.rb +130 -130
- data/samples/etc/scrollwin.rb +110 -110
- data/samples/etc/system_settings.rb +252 -252
- data/samples/etc/toolbar_sizer_additem.rb +55 -0
- data/samples/etc/wizard.rb +74 -74
- data/samples/event/update_ui_event.rb +70 -0
- data/samples/grid/gridtablebase.rb +43 -29
- data/samples/listbook/listbook.rb +174 -174
- data/samples/listbook/listbook.xrc +370 -370
- data/samples/mdi/mdi.rb +85 -77
- data/samples/minimal/minimal.rb +77 -77
- data/samples/minimal/nothing.rb +16 -16
- data/samples/text/format-text-bold.png +0 -0
- data/samples/text/format-text-italic.png +0 -0
- data/samples/text/format-text-underline.png +0 -0
- data/samples/text/rich_textctrl.rb +98 -0
- data/samples/text/textctrl.rb +111 -113
- data/samples/text/unicode.rb +242 -242
- data/samples/text/utf8.txt +14 -14
- data/samples/treectrl/treectrl.rb +1166 -1174
- data/samples/xrc/samples.xrc +46 -46
- data/samples/xrc/xrc_sample.rb +76 -96
- metadata +15 -3
data/lib/wx.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
# Copyright 2004-2006 by Kevin Smith
|
2
|
-
# released under the MIT-style wxruby2 license
|
3
|
-
|
4
|
-
# This wrapper serves three functions:
|
5
|
-
# 1. It loads the binary library 'wxruby2.so' or 'wxruby.dll', while
|
6
|
-
# still allowing applications to just require 'wx'.
|
7
|
-
# 2. It sets up the version information
|
8
|
-
# 3. It loads in ruby extensions to the core Wx classes.
|
9
|
-
|
10
|
-
|
11
|
-
# load the binary library
|
12
|
-
require 'wxruby2'
|
13
|
-
|
14
|
-
# alias the module
|
15
|
-
Wx = Wxruby2
|
16
|
-
|
17
|
-
# Load the version information (should be bundled with all released versions)
|
18
|
-
begin
|
19
|
-
require 'wx/version'
|
20
|
-
rescue LoadError
|
21
|
-
Wx::WXRUBY_VERSION = '0.0.0'
|
22
|
-
end
|
23
|
-
# Convenience string for WxWidgets version info
|
24
|
-
Wx::WXWIDGETS_VERSION = '%i.%i.%i' % [ Wx::WXWIDGETS_MAJOR_VERSION,
|
25
|
-
Wx::WXWIDGETS_MINOR_VERSION,
|
26
|
-
Wx::WXWIDGETS_RELEASE_NUMBER ]
|
27
|
-
|
28
|
-
# Helper functions
|
29
|
-
require 'wx/helpers'
|
30
|
-
|
31
|
-
# Load in all the class extension methods written in ruby
|
32
|
-
# evthandler must be required first b/c it sets up methods modified elsewhere
|
33
|
-
require 'wx/classes/evthandler.rb'
|
34
|
-
class_files = File.join( File.dirname(__FILE__), 'wx', 'classes', '*.rb')
|
35
|
-
Dir.glob(class_files) do | class_file |
|
36
|
-
require 'wx/classes/' + class_file[/\w+\.rb$/]
|
37
|
-
end
|
38
|
-
|
39
|
-
# Load in syntax sweeteners
|
40
|
-
require 'wx/accessors'
|
41
|
-
require 'wx/keyword_ctors'
|
42
|
-
require 'wx/keyword_defs'
|
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
|
-
# These are set at App startup and wxRuby shut down respectively - see App.i
|
49
|
-
if Wx::const_defined?(:THE_APP) and not $__wx_app_ended__
|
50
|
-
Wx::THE_APP.on_exit
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
1
|
+
# Copyright 2004-2006 by Kevin Smith
|
2
|
+
# released under the MIT-style wxruby2 license
|
3
|
+
|
4
|
+
# This wrapper serves three functions:
|
5
|
+
# 1. It loads the binary library 'wxruby2.so' or 'wxruby.dll', while
|
6
|
+
# still allowing applications to just require 'wx'.
|
7
|
+
# 2. It sets up the version information
|
8
|
+
# 3. It loads in ruby extensions to the core Wx classes.
|
9
|
+
|
10
|
+
|
11
|
+
# load the binary library
|
12
|
+
require 'wxruby2'
|
13
|
+
|
14
|
+
# alias the module
|
15
|
+
Wx = Wxruby2
|
16
|
+
|
17
|
+
# Load the version information (should be bundled with all released versions)
|
18
|
+
begin
|
19
|
+
require 'wx/version'
|
20
|
+
rescue LoadError
|
21
|
+
Wx::WXRUBY_VERSION = '0.0.0'
|
22
|
+
end
|
23
|
+
# Convenience string for WxWidgets version info
|
24
|
+
Wx::WXWIDGETS_VERSION = '%i.%i.%i' % [ Wx::WXWIDGETS_MAJOR_VERSION,
|
25
|
+
Wx::WXWIDGETS_MINOR_VERSION,
|
26
|
+
Wx::WXWIDGETS_RELEASE_NUMBER ]
|
27
|
+
|
28
|
+
# Helper functions
|
29
|
+
require 'wx/helpers'
|
30
|
+
|
31
|
+
# Load in all the class extension methods written in ruby
|
32
|
+
# evthandler must be required first b/c it sets up methods modified elsewhere
|
33
|
+
require 'wx/classes/evthandler.rb'
|
34
|
+
class_files = File.join( File.dirname(__FILE__), 'wx', 'classes', '*.rb')
|
35
|
+
Dir.glob(class_files) do | class_file |
|
36
|
+
require 'wx/classes/' + class_file[/\w+\.rb$/]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Load in syntax sweeteners
|
40
|
+
require 'wx/accessors'
|
41
|
+
require 'wx/keyword_ctors'
|
42
|
+
require 'wx/keyword_defs'
|
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
|
+
# These are set at App startup and wxRuby shut down respectively - see App.i
|
49
|
+
if Wx::const_defined?(:THE_APP) and not $__wx_app_ended__
|
50
|
+
Wx::THE_APP.on_exit
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
data/lib/wx/classes/bitmap.rb
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
+
# A platform-dependent image that can be drawn on the screen
|
1
2
|
class Wx::Bitmap
|
3
|
+
# Allow wxRuby to guess the type of an image file from its extension.
|
4
|
+
BITMAP_TYPE_GUESS = {
|
5
|
+
'bmp' => Wx::BITMAP_TYPE_BMP,
|
6
|
+
'gif' => Wx::BITMAP_TYPE_GIF,
|
7
|
+
'ico' => Wx::BITMAP_TYPE_ICO,
|
8
|
+
'jpeg' => Wx::BITMAP_TYPE_JPEG,
|
9
|
+
'jpg' => Wx::BITMAP_TYPE_JPEG,
|
10
|
+
'pbm' => Wx::BITMAP_TYPE_PNM,
|
11
|
+
'pcx' => Wx::BITMAP_TYPE_PCX,
|
12
|
+
'pgm' => Wx::BITMAP_TYPE_PNM,
|
13
|
+
'png' => Wx::BITMAP_TYPE_PNG,
|
14
|
+
'pnm' => Wx::BITMAP_TYPE_PNM,
|
15
|
+
'ppm' => Wx::BITMAP_TYPE_PNM,
|
16
|
+
'tga' => Wx::BITMAP_TYPE_TGA,
|
17
|
+
'tif' => Wx::BITMAP_TYPE_TIF,
|
18
|
+
'tiff' => Wx::BITMAP_TYPE_TIF,
|
19
|
+
'xbm' => Wx::BITMAP_TYPE_XBM,
|
20
|
+
'xpm' => Wx::BITMAP_TYPE_XPM
|
21
|
+
}
|
22
|
+
|
2
23
|
# Constructor copying data from an image
|
3
24
|
def self.from_image(img, depth = -1)
|
4
25
|
new(img, depth)
|
@@ -6,13 +27,20 @@ class Wx::Bitmap
|
|
6
27
|
|
7
28
|
# Redefine the initialize method so it raises an exception if a
|
8
29
|
# non-existent file is given to the constructor; otherwise, wx Widgets
|
9
|
-
# just carries on with an empty bitmap, which may cause faults
|
30
|
+
# just carries on with an empty bitmap, which may cause faults
|
31
|
+
# later. Also, be helpful and try to guess the bitmap type from the
|
32
|
+
# filename if it's not specified
|
10
33
|
wx_init = self.instance_method(:initialize)
|
11
34
|
define_method(:initialize) do | *args |
|
35
|
+
# If creating from a file, check it exists
|
12
36
|
if args[0].kind_of? String
|
13
37
|
if not File.exist?( File.expand_path(args[0]) )
|
14
38
|
Kernel.raise(ArgumentError, "Bitmap file does not exist: #{args[0]}")
|
15
39
|
end
|
40
|
+
# If type not specified, try to guess it from the file extension
|
41
|
+
if not args[1] and file_ext = args[0][/\w+$/]
|
42
|
+
args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
|
43
|
+
end
|
16
44
|
end
|
17
45
|
wx_init.bind(self).call(*args)
|
18
46
|
end
|
data/lib/wx/classes/clipboard.rb
CHANGED
@@ -1,16 +1,32 @@
|
|
1
1
|
class Wx::Clipboard
|
2
|
+
# See if we like these better
|
3
|
+
alias :place :set_data
|
4
|
+
alias :fetch :get_data
|
5
|
+
|
2
6
|
class << self
|
7
|
+
# This is provided internally by the SWIG interface file, but all
|
8
|
+
# public access should be via Clipboard.open; see below
|
9
|
+
private :get_global_clipboard
|
10
|
+
|
3
11
|
# Class method to provide access to the clipboard within a ruby
|
4
12
|
# block. Tests that the clipboard could be accessed, and ensures
|
5
13
|
# that it is closed when the block is finished.
|
6
14
|
def open
|
7
|
-
clip =
|
15
|
+
clip = nil
|
16
|
+
# Trying to access the segfault outside main_loop will segfault on
|
17
|
+
# some platforms (eg, GTK)
|
18
|
+
unless Wx::const_defined?(:THE_APP)
|
19
|
+
raise RuntimeError,
|
20
|
+
"The clipboard can only be accessed when the App is running"
|
21
|
+
end
|
22
|
+
|
23
|
+
clip = get_global_clipboard
|
8
24
|
unless clip.open
|
9
25
|
Kernel.raise "Could not open clipboard"
|
10
26
|
end
|
11
27
|
yield clip
|
12
|
-
|
13
|
-
|
28
|
+
ensure
|
29
|
+
clip.close if clip
|
14
30
|
end
|
15
31
|
end
|
16
32
|
end
|
data/lib/wx/classes/colour.rb
CHANGED
@@ -33,11 +33,13 @@ class Wx::Colour
|
|
33
33
|
# Colours are equal to one another if they have the same red, green
|
34
34
|
# and blue intensity, and the same alpha
|
35
35
|
def ==(other)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
[ red, green, blue, alpha ] ==
|
36
|
+
case other
|
37
|
+
when Wx::Colour
|
38
|
+
[ self.red, self.green, self.blue, self.alpha ] ==
|
40
39
|
[ other.red, other.green, other.blue, other.alpha ]
|
40
|
+
else
|
41
|
+
false
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
# More informative output for inspect etc
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Provide some default implementations of these to make life easier
|
2
|
+
class Wx::DataObject
|
3
|
+
def get_preferred_format(direction)
|
4
|
+
get_all_formats(direction).first
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_format_count(direction)
|
8
|
+
get_all_formats(direction).length
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_data_size(format)
|
12
|
+
get_data_here(format).size
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Make this easier to use for multi-typed data objects. Comparison
|
2
|
+
# doesn't work correctly in the SWIG binding
|
3
|
+
class Wx::DataFormat
|
4
|
+
def ==(other)
|
5
|
+
if self.get_type > Wx::DATA_FORMAT_ID_INVALID
|
6
|
+
self.get_type == other.get_type
|
7
|
+
else
|
8
|
+
self.id == other.id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Provide pre-cooked data formats for the standard types
|
14
|
+
module Wx
|
15
|
+
DF_TEXT = DataFormat.new( DATA_FORMAT_ID_TEXT )
|
16
|
+
DF_BITMAP = DataFormat.new( DATA_FORMAT_ID_BITMAP )
|
17
|
+
if Wx::PLATFORM != 'WXGTK'
|
18
|
+
DF_METAFILE = DataFormat.new( DATA_FORMAT_ID_METAFILE )
|
19
|
+
end
|
20
|
+
DF_FILENAME = DataFormat.new( DATA_FORMAT_ID_FILENAME )
|
21
|
+
DF_UNICODETEXT = DataFormat.new( DATA_FORMAT_ID_UNICODETEXT )
|
22
|
+
# DF_HTML is only supported on Windows + MSVC, so don't offer it
|
23
|
+
end
|
@@ -235,6 +235,12 @@ class Wx::EvtHandler
|
|
235
235
|
EventType['evt_aui_render', 0,
|
236
236
|
Wx::EVT_AUI_RENDER,
|
237
237
|
Wx::AuiManagerEvent],
|
238
|
+
EventType['evt_bookctrl_page_changed', 1,
|
239
|
+
Wx::EVT_COMMAND_BOOKCTRL_PAGE_CHANGED,
|
240
|
+
Wx::BookCtrlBaseEvent],
|
241
|
+
EventType['evt_bookctrl_page_changing', 1,
|
242
|
+
Wx::EVT_COMMAND_BOOKCTRL_PAGE_CHANGING,
|
243
|
+
Wx::BookCtrlBaseEvent],
|
238
244
|
EventType['evt_button', 1,
|
239
245
|
Wx::EVT_COMMAND_BUTTON_CLICKED,
|
240
246
|
Wx::CommandEvent],
|
@@ -313,15 +319,18 @@ class Wx::EvtHandler
|
|
313
319
|
EventType['evt_context_menu', 0,
|
314
320
|
Wx::EVT_CONTEXT_MENU,
|
315
321
|
Wx::ContextMenuEvent],
|
316
|
-
EventType['
|
317
|
-
Wx::
|
318
|
-
Wx::
|
322
|
+
EventType['evt_date_changed', 1,
|
323
|
+
Wx::EVT_DATE_CHANGED,
|
324
|
+
Wx::DateEvent],
|
319
325
|
EventType['evt_detailed_help', 1,
|
320
326
|
Wx::EVT_DETAILED_HELP,
|
321
327
|
Wx::HelpEvent],
|
322
328
|
EventType['evt_detailed_help_range', 2,
|
323
329
|
Wx::EVT_DETAILED_HELP,
|
324
330
|
Wx::HelpEvent],
|
331
|
+
EventType['evt_drop_files', 0,
|
332
|
+
Wx::EVT_DROP_FILES,
|
333
|
+
Wx::Event],
|
325
334
|
EventType['evt_end_process', 1,
|
326
335
|
Wx::EVT_END_PROCESS,
|
327
336
|
Wx::Event],
|
@@ -864,10 +873,16 @@ class Wx::EvtHandler
|
|
864
873
|
Wx::TimerEvent],
|
865
874
|
EventType['evt_togglebutton', 1,
|
866
875
|
Wx::EVT_COMMAND_TOGGLEBUTTON_CLICKED,
|
867
|
-
Wx::
|
876
|
+
Wx::CommandEvent],
|
868
877
|
EventType['evt_tool', 1,
|
869
878
|
Wx::EVT_COMMAND_TOOL_CLICKED,
|
870
879
|
Wx::CommandEvent],
|
880
|
+
EventType['evt_toolbook_page_changed', 1,
|
881
|
+
Wx::EVT_COMMAND_TOOLBOOK_PAGE_CHANGED,
|
882
|
+
Wx::ToolbookEvent],
|
883
|
+
EventType['evt_toolbook_page_changing', 1,
|
884
|
+
Wx::EVT_COMMAND_TOOLBOOK_PAGE_CHANGING,
|
885
|
+
Wx::ToolbookEvent],
|
871
886
|
EventType['evt_tool_enter', 1,
|
872
887
|
Wx::EVT_COMMAND_TOOL_ENTER,
|
873
888
|
Wx::CommandEvent],
|
@@ -943,6 +958,18 @@ class Wx::EvtHandler
|
|
943
958
|
EventType['evt_tree_state_image_click', 1,
|
944
959
|
Wx::EVT_COMMAND_TREE_STATE_IMAGE_CLICK,
|
945
960
|
Wx::TreeEvent],
|
961
|
+
EventType['evt_treebook_node_collapsed', 1,
|
962
|
+
Wx::EVT_COMMAND_TREEBOOK_NODE_COLLAPSED,
|
963
|
+
Wx::TreebookEvent],
|
964
|
+
EventType['evt_treebook_node_expanded', 1,
|
965
|
+
Wx::EVT_COMMAND_TREEBOOK_NODE_EXPANDED,
|
966
|
+
Wx::TreebookEvent],
|
967
|
+
EventType['evt_treebook_page_changed', 1,
|
968
|
+
Wx::EVT_COMMAND_TREEBOOK_PAGE_CHANGED,
|
969
|
+
Wx::TreebookEvent],
|
970
|
+
EventType['evt_treebook_page_changing', 1,
|
971
|
+
Wx::EVT_COMMAND_TREEBOOK_PAGE_CHANGING,
|
972
|
+
Wx::TreebookEvent],
|
946
973
|
EventType['evt_update_ui', 1,
|
947
974
|
Wx::EVT_UPDATE_UI,
|
948
975
|
Wx::UpdateUIEvent],
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Bottom-up implementation of a Directory lister
|
2
|
+
class Wx::GenericDirCtrl
|
3
|
+
module DirCtrlTree
|
4
|
+
# The TreeCtrl contained in a GenericDirCtrl already has C++ data
|
5
|
+
# associated with the items. If these are returned to Ruby crashes
|
6
|
+
# will result. So this module sets the TreeCtrl to return the path
|
7
|
+
# string.
|
8
|
+
def get_item_data(tree_id)
|
9
|
+
root_id = get_root_item
|
10
|
+
return "" if tree_id == root_id
|
11
|
+
|
12
|
+
path = item_text(tree_id)
|
13
|
+
while tree_id = item_parent(tree_id) and tree_id != root_id
|
14
|
+
path = item_text(tree_id) + "/#{path}"
|
15
|
+
end
|
16
|
+
unless Wx::PLATFORM == 'WXMSW'
|
17
|
+
path = "/" + path
|
18
|
+
end
|
19
|
+
path
|
20
|
+
end
|
21
|
+
|
22
|
+
alias :get_item_path :get_item_data
|
23
|
+
|
24
|
+
# Not allowed
|
25
|
+
def set_item_data(tree_id, data)
|
26
|
+
Kernel.raise "Item data cannot be set for a GenericDirCtrl's Tree"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
wx_get_tree_ctrl = instance_method(:get_tree_ctrl)
|
31
|
+
define_method(:get_tree_ctrl) do
|
32
|
+
tree = wx_get_tree_ctrl.bind(self).call
|
33
|
+
tree.extend(DirCtrlTree)
|
34
|
+
tree
|
35
|
+
end
|
36
|
+
end
|
data/lib/wx/classes/grid.rb
CHANGED
@@ -35,6 +35,14 @@ class Wx::Grid
|
|
35
35
|
@__grid_table = table
|
36
36
|
end
|
37
37
|
|
38
|
+
# Store the renderers / editors associated with types, if used
|
39
|
+
alias :__register_data_type :register_data_type
|
40
|
+
def register_data_type(type_name, renderer, editor)
|
41
|
+
__register_data_type(type_name, renderer, editor)
|
42
|
+
@__named_type_info ||= {}
|
43
|
+
@__named_type_info[type_name] = [ renderer, editor ]
|
44
|
+
end
|
45
|
+
|
38
46
|
# store default editor
|
39
47
|
wx_set_default_editor = self.instance_method(:set_default_editor)
|
40
48
|
define_method(:set_default_editor) do | editr |
|
data/lib/wx/classes/icon.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
+
# Specific type of platform-dependent image used for frames on Windows and
|
2
|
+
# Linux. Normally Bitmap is used
|
1
3
|
class Wx::Icon
|
4
|
+
# Load the type-guessing hash from Wx::Bitmap
|
5
|
+
require 'wx/classes/bitmap'
|
6
|
+
BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
|
7
|
+
|
2
8
|
# Analogous to Image.from_bitmap
|
3
9
|
def self.from_bitmap(bmp)
|
4
10
|
ico = new
|
@@ -8,13 +14,18 @@ class Wx::Icon
|
|
8
14
|
|
9
15
|
# Redefine the initialize method so it raises an exception if a
|
10
16
|
# non-existent file is given to the constructor; otherwise, wx Widgets
|
11
|
-
# just carries on with an empty icon, which may cause faults
|
17
|
+
# just carries on with an empty icon, which may cause faults
|
18
|
+
# later. Also guess icon type from filename, if not specified.
|
12
19
|
wx_init = self.instance_method(:initialize)
|
13
20
|
define_method(:initialize) do | *args |
|
14
21
|
if args[0].kind_of? String
|
15
22
|
if not File.exist?( File.expand_path(args[0]) )
|
16
23
|
Kernel.raise(ArgumentError, "Icon file does not exist: #{args[0]}")
|
17
24
|
end
|
25
|
+
# If type not specified, try to guess it from the file extension
|
26
|
+
if not args[1] and ( file_ext = args[0][/\w+$/] )
|
27
|
+
args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
|
28
|
+
end
|
18
29
|
end
|
19
30
|
wx_init.bind(self).call(*args)
|
20
31
|
end
|
data/lib/wx/classes/image.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
+
# A platform-independent image; can be manipulated more extensively than
|
2
|
+
# Bitmap, but must be converted to a Bitmap for drawing.
|
1
3
|
class Wx::Image
|
4
|
+
# Load the type-guessing hash from Wx::Bitmap
|
5
|
+
require 'wx/classes/bitmap'
|
6
|
+
BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
|
7
|
+
|
2
8
|
# Load a new image from an IO-like object that supports "read"
|
3
9
|
def self.read(an_io, type_or_mime, index = -1)
|
4
10
|
img = new
|
@@ -13,13 +19,19 @@ class Wx::Image
|
|
13
19
|
|
14
20
|
# Redefine the initialize method so it raises an exception if a
|
15
21
|
# non-existent file is given to the constructor; otherwise, wx Widgets
|
16
|
-
# just carries on with an invalid image, which may cause faults
|
22
|
+
# just carries on with an invalid image, which may cause faults
|
23
|
+
# later. Also, if loading from a file, and the type is not specified,
|
24
|
+
# try to guess it from the filename extension
|
17
25
|
wx_init = self.instance_method(:initialize)
|
18
26
|
define_method(:initialize) do | *args |
|
19
27
|
if args[0].kind_of? String
|
20
28
|
if not File.exist?( File.expand_path(args[0]) )
|
21
29
|
Kernel.raise(ArgumentError, "Image file does not exist: #{args[0]}")
|
22
30
|
end
|
31
|
+
# If type not specified, try to guess it from the file extension
|
32
|
+
if not args[1] and file_ext = args[0][/\w+$/]
|
33
|
+
args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
|
34
|
+
end
|
23
35
|
end
|
24
36
|
wx_init.bind(self).call(*args)
|
25
37
|
end
|