wxruby64 2.0.1-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/INSTALL +254 -0
- data/LICENSE +53 -0
- data/README +198 -0
- data/art/wxruby-128x128.png +0 -0
- data/art/wxruby-256x256.png +0 -0
- data/art/wxruby-64x64.png +0 -0
- data/art/wxruby.png +0 -0
- data/lib/wx.rb +53 -0
- data/lib/wx/accessors.rb +68 -0
- data/lib/wx/classes/acceleratortable.rb +28 -0
- data/lib/wx/classes/animation.rb +18 -0
- data/lib/wx/classes/app.rb +51 -0
- data/lib/wx/classes/artprovider.rb +31 -0
- data/lib/wx/classes/auinotebook.rb +9 -0
- data/lib/wx/classes/bitmap.rb +59 -0
- data/lib/wx/classes/busycursor.rb +12 -0
- data/lib/wx/classes/checklistbox.rb +46 -0
- data/lib/wx/classes/choice.rb +4 -0
- data/lib/wx/classes/clientdc.rb +13 -0
- data/lib/wx/classes/clipboard.rb +56 -0
- data/lib/wx/classes/colour.rb +49 -0
- data/lib/wx/classes/combobox.rb +4 -0
- data/lib/wx/classes/commandevent.rb +7 -0
- data/lib/wx/classes/controlwithitems.rb +10 -0
- 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/dc.rb +57 -0
- data/lib/wx/classes/event.rb +5 -0
- data/lib/wx/classes/evthandler.rb +1039 -0
- data/lib/wx/classes/font.rb +118 -0
- data/lib/wx/classes/functions.rb +44 -0
- data/lib/wx/classes/gauge.rb +12 -0
- data/lib/wx/classes/genericdirctrl.rb +36 -0
- data/lib/wx/classes/grid.rb +146 -0
- data/lib/wx/classes/hboxsizer.rb +6 -0
- data/lib/wx/classes/helpcontroller.rb +5 -0
- data/lib/wx/classes/helpcontrollerhelpprovider.rb +23 -0
- data/lib/wx/classes/helpprovider.rb +15 -0
- data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
- data/lib/wx/classes/htmlwindow.rb +14 -0
- data/lib/wx/classes/icon.rb +32 -0
- data/lib/wx/classes/iconbundle.rb +3 -0
- data/lib/wx/classes/image.rb +53 -0
- data/lib/wx/classes/imagelist.rb +3 -0
- data/lib/wx/classes/listbox.rb +4 -0
- data/lib/wx/classes/listctrl.rb +33 -0
- data/lib/wx/classes/locale.rb +28 -0
- data/lib/wx/classes/mediactrl.rb +48 -0
- data/lib/wx/classes/menu.rb +62 -0
- data/lib/wx/classes/menuitem.rb +7 -0
- data/lib/wx/classes/notebook.rb +9 -0
- data/lib/wx/classes/object.rb +14 -0
- data/lib/wx/classes/paintdc.rb +12 -0
- data/lib/wx/classes/point.rb +56 -0
- data/lib/wx/classes/previewframe.rb +13 -0
- data/lib/wx/classes/rect.rb +19 -0
- data/lib/wx/classes/richtextctrl.rb +63 -0
- data/lib/wx/classes/simplehelpprovider.rb +38 -0
- data/lib/wx/classes/size.rb +58 -0
- data/lib/wx/classes/sizer.rb +43 -0
- data/lib/wx/classes/sound.rb +23 -0
- data/lib/wx/classes/splitterwindow.rb +10 -0
- data/lib/wx/classes/standardpaths.rb +9 -0
- data/lib/wx/classes/styledtextctrl.rb +92 -0
- data/lib/wx/classes/textctrl.rb +14 -0
- data/lib/wx/classes/texturlevent.rb +18 -0
- data/lib/wx/classes/timer.rb +96 -0
- data/lib/wx/classes/toolbar.rb +36 -0
- data/lib/wx/classes/toolbartool.rb +4 -0
- data/lib/wx/classes/treectrl.rb +44 -0
- data/lib/wx/classes/validator.rb +7 -0
- data/lib/wx/classes/vboxsizer.rb +6 -0
- data/lib/wx/classes/window.rb +89 -0
- data/lib/wx/classes/xmlresource.rb +54 -0
- data/lib/wx/helpers.rb +54 -0
- data/lib/wx/keyword_ctors.rb +204 -0
- data/lib/wx/keyword_defs.rb +585 -0
- data/lib/wx/version.rb +3 -0
- data/lib/wxruby2.so +0 -0
- data/samples/SAMPLES-LICENSE.TXT +18 -0
- data/samples/aui/aui.rb +1356 -0
- data/samples/bigdemo/About.rbw +39 -0
- data/samples/bigdemo/ColorPanel.rbw +23 -0
- data/samples/bigdemo/GridSimple.rbw +78 -0
- data/samples/bigdemo/MDIDemo.rbw +57 -0
- data/samples/bigdemo/PopupMenu.rbw +149 -0
- data/samples/bigdemo/ShapedWindow.rbw +128 -0
- data/samples/bigdemo/Sizers.rbw +543 -0
- data/samples/bigdemo/bigdemo.rb +823 -0
- data/samples/bigdemo/demoTemplate.rbw +33 -0
- data/samples/bigdemo/helpfile.htb +0 -0
- data/samples/bigdemo/icons/Test 015.jpg +0 -0
- data/samples/bigdemo/icons/Test 015.png +0 -0
- data/samples/bigdemo/icons/choice.bmp +0 -0
- data/samples/bigdemo/icons/choice.xpm +27 -0
- data/samples/bigdemo/icons/combo.bmp +0 -0
- data/samples/bigdemo/icons/combo.xpm +27 -0
- data/samples/bigdemo/icons/copy.xpm +25 -0
- data/samples/bigdemo/icons/cut.xpm +24 -0
- data/samples/bigdemo/icons/gauge.bmp +0 -0
- data/samples/bigdemo/icons/gauge.xpm +27 -0
- data/samples/bigdemo/icons/help.xpm +25 -0
- data/samples/bigdemo/icons/list.bmp +0 -0
- data/samples/bigdemo/icons/list.xpm +27 -0
- data/samples/bigdemo/icons/mondrian.ico +0 -0
- data/samples/bigdemo/icons/mondrian.xpm +44 -0
- data/samples/bigdemo/icons/new.xpm +24 -0
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +45 -0
- data/samples/bigdemo/icons/open.xpm +26 -0
- data/samples/bigdemo/icons/paste.bmp +0 -0
- data/samples/bigdemo/icons/paste.xpm +38 -0
- data/samples/bigdemo/icons/pointy.png +0 -0
- data/samples/bigdemo/icons/preview.xpm +26 -0
- data/samples/bigdemo/icons/print.xpm +26 -0
- data/samples/bigdemo/icons/radio.bmp +0 -0
- data/samples/bigdemo/icons/radio.xpm +27 -0
- data/samples/bigdemo/icons/robert.xpm +415 -0
- data/samples/bigdemo/icons/sashtest.ico +0 -0
- data/samples/bigdemo/icons/save.xpm +25 -0
- data/samples/bigdemo/icons/smiles.bmp +0 -0
- data/samples/bigdemo/icons/smiles.xpm +39 -0
- data/samples/bigdemo/icons/smiley.ico +0 -0
- data/samples/bigdemo/icons/smiley.xpm +42 -0
- data/samples/bigdemo/icons/stattext.xpm +24 -0
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.png +0 -0
- data/samples/bigdemo/icons/test2.xpm +79 -0
- data/samples/bigdemo/icons/text.bmp +0 -0
- data/samples/bigdemo/icons/text.xpm +27 -0
- data/samples/bigdemo/icons/tog1.bmp +0 -0
- data/samples/bigdemo/icons/tog1.xpm +38 -0
- data/samples/bigdemo/icons/tog2.bmp +0 -0
- data/samples/bigdemo/icons/tog2.xpm +38 -0
- data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
- data/samples/bigdemo/icons/wxwin.ico +0 -0
- data/samples/bigdemo/icons/wxwin16x16.png +0 -0
- data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
- data/samples/bigdemo/icons/wxwin32x32.png +0 -0
- data/samples/bigdemo/icons/wxwin48x48.png +0 -0
- data/samples/bigdemo/run.rb +90 -0
- data/samples/bigdemo/tips.txt +7 -0
- data/samples/bigdemo/utils.rb +12 -0
- data/samples/bigdemo/wxArtProvider.rbw +281 -0
- data/samples/bigdemo/wxBitmapButton.rbw +65 -0
- data/samples/bigdemo/wxButton.rbw +64 -0
- data/samples/bigdemo/wxCalendarCtrl.rbw +60 -0
- data/samples/bigdemo/wxCheckBox.rbw +50 -0
- data/samples/bigdemo/wxCheckListBox.rbw +65 -0
- data/samples/bigdemo/wxChoice.rbw +47 -0
- data/samples/bigdemo/wxChoicebook.rbw +78 -0
- data/samples/bigdemo/wxColourDialog.rbw +31 -0
- data/samples/bigdemo/wxComboBox.rbw +77 -0
- data/samples/bigdemo/wxCursor.rbw +136 -0
- data/samples/bigdemo/wxDialog.rbw +74 -0
- data/samples/bigdemo/wxDirDialog.rbw +29 -0
- data/samples/bigdemo/wxDragImage.rbw +70 -0
- data/samples/bigdemo/wxFileDialog.rbw +37 -0
- data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
- data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
- data/samples/bigdemo/wxFontDialog.rbw +173 -0
- data/samples/bigdemo/wxFrame.rbw +53 -0
- data/samples/bigdemo/wxGauge.rbw +71 -0
- data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
- data/samples/bigdemo/wxGrid.rbw +66 -0
- data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
- data/samples/bigdemo/wxListBox.rbw +140 -0
- data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -0
- data/samples/bigdemo/wxMDIWindows.rbw +50 -0
- data/samples/bigdemo/wxMenu.rbw +236 -0
- data/samples/bigdemo/wxMessageDialog.rbw +27 -0
- data/samples/bigdemo/wxMiniFrame.rbw +70 -0
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -0
- data/samples/bigdemo/wxNotebook.rbw +136 -0
- data/samples/bigdemo/wxProgressDialog.rbw +43 -0
- data/samples/bigdemo/wxRadioBox.rbw +72 -0
- data/samples/bigdemo/wxRadioButton.rbw +125 -0
- data/samples/bigdemo/wxSashWindow.rbw +141 -0
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
- data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
- data/samples/bigdemo/wxSlider.rbw +42 -0
- data/samples/bigdemo/wxSpinButton.rbw +50 -0
- data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
- data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
- data/samples/bigdemo/wxStaticBitmap.rbw +47 -0
- data/samples/bigdemo/wxStaticText.rbw +55 -0
- data/samples/bigdemo/wxStatusBar.rbw +126 -0
- data/samples/bigdemo/wxTextCtrl.rbw +149 -0
- data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
- data/samples/bigdemo/wxToggleButton.rbw +49 -0
- data/samples/bigdemo/wxToolBar.rbw +131 -0
- data/samples/bigdemo/wxTreeCtrl.rbw +191 -0
- data/samples/calendar/calendar.rb +348 -0
- data/samples/caret/caret.rb +282 -0
- data/samples/caret/mondrian.xpm +44 -0
- data/samples/controls/controls.rb +1136 -0
- data/samples/controls/get_item_sample.rb +87 -0
- data/samples/controls/icons/choice.xpm +27 -0
- data/samples/controls/icons/combo.xpm +27 -0
- data/samples/controls/icons/gauge.xpm +27 -0
- data/samples/controls/icons/list.xpm +27 -0
- data/samples/controls/icons/radio.xpm +27 -0
- data/samples/controls/icons/stattext.xpm +24 -0
- data/samples/controls/icons/text.xpm +27 -0
- data/samples/controls/mondrian.ico +0 -0
- data/samples/controls/mondrian.xpm +44 -0
- data/samples/controls/test2.bmp +0 -0
- data/samples/dialogs/dialogs.rb +797 -0
- data/samples/dialogs/tips.txt +18 -0
- data/samples/dragdrop/dragdrop.rb +177 -0
- data/samples/drawing/bitmap.rb +49 -0
- data/samples/drawing/bitmap_image.rb +92 -0
- data/samples/drawing/graphics_drawing.rb +235 -0
- data/samples/drawing/maths_images.rb +265 -0
- data/samples/drawing/rmagic_bitmap_image.rb +110 -0
- data/samples/drawing/ruby-logo.jpg +0 -0
- data/samples/etc/activation.rb +102 -0
- data/samples/etc/choice.rb +67 -0
- data/samples/etc/miniframe.rb +79 -0
- data/samples/etc/sash.rb +130 -0
- data/samples/etc/scrollwin.rb +110 -0
- data/samples/etc/system_settings.rb +252 -0
- data/samples/etc/threaded.rb +72 -0
- data/samples/etc/toolbar_sizer_additem.rb +55 -0
- data/samples/etc/wizard.rb +74 -0
- data/samples/event/event.rb +182 -0
- data/samples/event/update_ui_event.rb +70 -0
- data/samples/grid/grid.rb +198 -0
- data/samples/grid/gridtablebase.rb +148 -0
- data/samples/html/html.rb +262 -0
- data/samples/listbook/listbook.rb +174 -0
- data/samples/listbook/listbook.xrc +370 -0
- data/samples/mdi/mdi.rb +85 -0
- data/samples/media/mediactrl.rb +167 -0
- data/samples/minimal/minimal.rb +77 -0
- data/samples/minimal/mondrian.ico +0 -0
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +16 -0
- data/samples/opengl/cube.rb +130 -0
- data/samples/opengl/cube_anim_lighting.rb +191 -0
- data/samples/printing/mondrian.ico +0 -0
- data/samples/printing/mondrian.xpm +44 -0
- data/samples/printing/printing.rb +487 -0
- data/samples/sockets/SocketPackets.rb +27 -0
- data/samples/sockets/res/message-new.png +0 -0
- data/samples/sockets/res/user.png +0 -0
- data/samples/sockets/wxClient.rb +395 -0
- data/samples/sockets/wxServer.rb +422 -0
- data/samples/sockets/wxSocketGUI.rb +97 -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/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/mondrian.ico +0 -0
- data/samples/text/mondrian.xpm +44 -0
- data/samples/text/preferences-desktop-font.png +0 -0
- data/samples/text/rich_textctrl.rb +290 -0
- data/samples/text/scintilla.rb +169 -0
- data/samples/text/textctrl.rb +111 -0
- data/samples/text/unicode.rb +242 -0
- data/samples/text/utf8.txt +15 -0
- data/samples/treectrl/icon1.xpm +79 -0
- data/samples/treectrl/icon2.xpm +53 -0
- data/samples/treectrl/icon3.xpm +79 -0
- data/samples/treectrl/icon4.xpm +43 -0
- data/samples/treectrl/icon5.xpm +79 -0
- data/samples/treectrl/treectrl.rb +1166 -0
- data/samples/xrc/samples.xrc +46 -0
- data/samples/xrc/xrc_sample.rb +76 -0
- metadata +330 -0
Binary file
|
Binary file
|
Binary file
|
data/art/wxruby.png
ADDED
Binary file
|
data/lib/wx.rb
ADDED
@@ -0,0 +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
|
+
|
data/lib/wx/accessors.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# = WxSugar - Accessors
|
2
|
+
#
|
3
|
+
# The default WxRuby interface has lots and lots of methods like
|
4
|
+
#
|
5
|
+
# * get_position()
|
6
|
+
# * set_size(a_size)
|
7
|
+
# * is_checked()
|
8
|
+
# * can_undo()
|
9
|
+
# * has_style(a_style)
|
10
|
+
#
|
11
|
+
# and so on. Methods that retrieve set, or query attributes of an object
|
12
|
+
# are more normally in Ruby called simply by the attribute name, or, in
|
13
|
+
# other cases, with a predicate method:
|
14
|
+
#
|
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?
|
20
|
+
#
|
21
|
+
# This extension creates an alias for every WxRuby instance method that
|
22
|
+
# begins with +get_+, +set_+, +is_+, +can_+ and +has_+. Note that if you are calling a
|
23
|
+
# 'setter' method on self, you must explicitly send the message to self:
|
24
|
+
#
|
25
|
+
# # set's self size to be 100px by 100px
|
26
|
+
# self.size = Wx::Size.new(100, 100)
|
27
|
+
# # only sets the value of a local variable 'size'
|
28
|
+
# size = Wx::Size.new
|
29
|
+
|
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.
|
36
|
+
def method_missing(sym, *args)
|
37
|
+
case sym.to_s
|
38
|
+
when /^(\w+)\=$/
|
39
|
+
meth = "set_#{$1}"
|
40
|
+
when /^((?:has|can)\w+)\?$/
|
41
|
+
meth = $1
|
42
|
+
when /^(\w+)\?$/
|
43
|
+
meth = "is_#{$1}"
|
44
|
+
else
|
45
|
+
meth = "get_#{sym}"
|
46
|
+
end
|
47
|
+
if respond_to?(meth)
|
48
|
+
send(meth, *args)
|
49
|
+
else
|
50
|
+
super
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Allow Wx-global functions to be accessed with nice syntax
|
56
|
+
module Wx
|
57
|
+
extend WxRubyStyleAccessors
|
58
|
+
end
|
59
|
+
|
60
|
+
# Apply the syntax extensions to every class, both class methods and
|
61
|
+
# instance methods
|
62
|
+
all_classes = Wx::constants.collect { | c | Wx::const_get(c) }.grep(Class)
|
63
|
+
all_classes.each do | klass |
|
64
|
+
klass.class_eval do
|
65
|
+
include WxRubyStyleAccessors
|
66
|
+
extend WxRubyStyleAccessors
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Wx::AcceleratorTable
|
2
|
+
# Allow new to be called as []
|
3
|
+
class << self
|
4
|
+
alias :[] :new
|
5
|
+
end
|
6
|
+
|
7
|
+
# Allow initialize to be called with a splat-like list of arguments,
|
8
|
+
# and allow entries to be specified in terser form [mod, key, id]
|
9
|
+
# rather than full AcceleratorEntry.new call.
|
10
|
+
wx_init = self.instance_method(:initialize)
|
11
|
+
define_method(:initialize) do | *args |
|
12
|
+
# Test for old-style arg passing in a single array
|
13
|
+
if args.length == 1 and args.first.kind_of?(Array) and
|
14
|
+
args.first.all? { | e | e.kind_of?(Wx::AcceleratorEntry) }
|
15
|
+
args = args[0]
|
16
|
+
end
|
17
|
+
# Convert to array of AccEntries, to pass in as single array
|
18
|
+
args = args.map do | entry |
|
19
|
+
case entry
|
20
|
+
when Wx::AcceleratorEntry then entry
|
21
|
+
when Array then Wx::AcceleratorEntry.new(*entry)
|
22
|
+
else Kernel.raise ArgumentError,
|
23
|
+
"#{entry.inspect} is not a valid AcceleratorTable entry"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
wx_init.bind(self).call(args)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Wx::Animation < Wx::GDIObject
|
2
|
+
# Redefine the initialize method so it raises an exception if a
|
3
|
+
# non-existent file is given to the constructor; otherwise, wx Widgets
|
4
|
+
# just carries on with an empty bitmap, which may cause faults later
|
5
|
+
wx_init = self.instance_method(:initialize)
|
6
|
+
define_method(:initialize) do | *args |
|
7
|
+
if args[0].kind_of? String
|
8
|
+
if not File.exist?( File.expand_path(args[0]) )
|
9
|
+
Kernel.raise( ArgumentError,
|
10
|
+
"Animation file does not exist: #{args[0]}" )
|
11
|
+
end
|
12
|
+
res = wx_init.bind(self).call()
|
13
|
+
res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY)
|
14
|
+
else
|
15
|
+
wx_init.bind(self).call(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright 2004-2006 by Kevin Smith
|
2
|
+
# released under the MIT-style wxruby2 license
|
3
|
+
|
4
|
+
# Controller class which creates and manages all windows.
|
5
|
+
class Wx::App
|
6
|
+
# Convenience class method to create simple apps. Starts an
|
7
|
+
# application main_loop, setting up initial windows etc as specified
|
8
|
+
# in the passed block.
|
9
|
+
# block
|
10
|
+
def self.run(&block)
|
11
|
+
app_klass = Class.new(self)
|
12
|
+
app_klass.class_eval do
|
13
|
+
define_method(:on_init, &block)
|
14
|
+
end
|
15
|
+
the_app = app_klass.new
|
16
|
+
the_app.main_loop
|
17
|
+
end
|
18
|
+
|
19
|
+
# This is a class method in Wx, but permit it to be an instance method
|
20
|
+
# in wxRuby
|
21
|
+
def is_main_loop_running
|
22
|
+
Wx::App.is_main_loop_running
|
23
|
+
end
|
24
|
+
|
25
|
+
# This method handles failed assertions from within the WxWidgets C++
|
26
|
+
# code. These messages are only generated by a DEBUG build of
|
27
|
+
# WxRuby. Such messages usually indicate that the API is being used
|
28
|
+
# incorrectly; the file/line reference points to the place in the
|
29
|
+
# WxWidgets source code where the assertion was made.
|
30
|
+
define_method(:on_assert_failure) do | file, line, condition, message |
|
31
|
+
warn "Wx WARNING: #{message} (#{file}:#{line})"
|
32
|
+
end
|
33
|
+
|
34
|
+
# For use in development only, of no practical use in production code.
|
35
|
+
# This method causes Ruby's garbage collection to run (roughly) at
|
36
|
+
# interval +interval+ (seconds) - the default is 1, i.e. every
|
37
|
+
# second. This should help ferret out bugs in memory management more
|
38
|
+
# quickly.
|
39
|
+
def gc_stress(interval = 1)
|
40
|
+
# Ruby 1.9 provides this built-in version, but doesn't like the 1.8
|
41
|
+
# version at all - results in frequent segfaults.
|
42
|
+
if RUBY_VERSION >= "1.9.0"
|
43
|
+
GC.stress
|
44
|
+
else # Ruby 1.8
|
45
|
+
t = Wx::Timer.new(self, 9999)
|
46
|
+
evt_timer(9999) { Thread.pass }
|
47
|
+
Thread.new { loop { sleep interval; GC.start } }
|
48
|
+
t.start(100)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Class which can supply icons and bitmaps
|
2
|
+
class Wx::ArtProvider
|
3
|
+
# Keep a note of supplied ArtProviders to prevent them being GC'd
|
4
|
+
@__art_provs = []
|
5
|
+
|
6
|
+
class << self
|
7
|
+
wx_insert = instance_method(:insert)
|
8
|
+
define_method(:insert) do | art_prov |
|
9
|
+
wx_insert.bind(self).call(art_prov)
|
10
|
+
@__art_provs.unshift(art_prov)
|
11
|
+
end
|
12
|
+
|
13
|
+
wx_pop = instance_method(:pop)
|
14
|
+
define_method(:pop) do
|
15
|
+
wx_pop.bind(self).call
|
16
|
+
@__art_provs.pop
|
17
|
+
end
|
18
|
+
|
19
|
+
wx_push = instance_method(:push)
|
20
|
+
define_method(:push) do | art_prov |
|
21
|
+
wx_push.bind(self).call(art_prov)
|
22
|
+
@__art_provs.push(art_prov)
|
23
|
+
end
|
24
|
+
|
25
|
+
wx_remove = instance_method(:remove)
|
26
|
+
define_method(:remove) do | art_prov |
|
27
|
+
wx_push.bind(self).call(art_prov)
|
28
|
+
@__art_provs.delete(art_prov)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# A platform-dependent image that can be drawn on the screen
|
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
|
+
|
23
|
+
# Constructor copying data from an image
|
24
|
+
def self.from_image(img, depth = -1)
|
25
|
+
new(img, depth)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Ruby methods that switch class are conventionally named to_foo
|
29
|
+
alias :to_image :convert_to_image
|
30
|
+
|
31
|
+
# Redefine the initialize method so it raises an exception if a
|
32
|
+
# non-existent file is given to the constructor; otherwise, wx Widgets
|
33
|
+
# just carries on with an empty bitmap, which may cause faults
|
34
|
+
# later. Also, be helpful and try to guess the bitmap type from the
|
35
|
+
# filename if it's not specified
|
36
|
+
wx_init = self.instance_method(:initialize)
|
37
|
+
define_method(:initialize) do | *args |
|
38
|
+
# If creating from a file, check it exists
|
39
|
+
if args[0].kind_of? String
|
40
|
+
if not File.exist?( File.expand_path(args[0]) )
|
41
|
+
Kernel.raise(ArgumentError, "Bitmap file does not exist: #{args[0]}")
|
42
|
+
end
|
43
|
+
# If type not specified, try to guess it from the file extension
|
44
|
+
if not args[1] and file_ext = args[0][/\w+$/]
|
45
|
+
args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
wx_init.bind(self).call(*args)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Accepts a block, which will be passed a device context which can be
|
52
|
+
# used to draw upon the Bitmap
|
53
|
+
def draw
|
54
|
+
dc = Wx::MemoryDC.new
|
55
|
+
dc.select_object(self)
|
56
|
+
yield dc
|
57
|
+
dc.select_object( Wx::NULL_BITMAP )
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Emulates the wxWidgets BusyCursor class, by providing a scope within
|
2
|
+
# which a busy cursor will be shown
|
3
|
+
class Wx::BusyCursor
|
4
|
+
# Only one class method, optionally accepting a cursor that should be
|
5
|
+
# shown, defaulting to an hour glass cursor.
|
6
|
+
def self.busy(cursor = Wx::HOURGLASS_CURSOR)
|
7
|
+
Wx::begin_busy_cursor(cursor)
|
8
|
+
yield
|
9
|
+
ensure
|
10
|
+
Wx::end_busy_cursor
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# A ListBox, where each item has a checkbox next to it
|
2
|
+
class Wx::CheckListBox
|
3
|
+
# wxRuby redefinitions of core methods to add item data support (not
|
4
|
+
# available in wxWidgets). Use a private method to initialize and
|
5
|
+
# access the data, rather than in initialize(), b/c can't guarantee
|
6
|
+
# that initialize will be called (eg when loaded from XRC)
|
7
|
+
def __wx_item_data
|
8
|
+
@__wx_item_data ||= []
|
9
|
+
end
|
10
|
+
private :__wx_item_data
|
11
|
+
|
12
|
+
# Call method in ControlWithItems, then sync item data
|
13
|
+
def append(item, data = nil)
|
14
|
+
i = super(item)
|
15
|
+
__wx_item_data[count - 1] = data
|
16
|
+
return i
|
17
|
+
end
|
18
|
+
|
19
|
+
# Call method in ControlWithItems, then sync item data
|
20
|
+
def clear
|
21
|
+
super
|
22
|
+
__wx_item_data.clear
|
23
|
+
end
|
24
|
+
|
25
|
+
# delete is defined in Wx::CheckListBox, so must be called in this class
|
26
|
+
wx_delete = self.instance_method(:delete)
|
27
|
+
define_method(:delete) do | n |
|
28
|
+
wx_delete.bind(self).call(n)
|
29
|
+
__wx_item_data.delete_at(n)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns an array of indices of items that are currently checked.
|
33
|
+
def get_checked_items
|
34
|
+
find_all { | i | checked?(i) }
|
35
|
+
end
|
36
|
+
|
37
|
+
# Wholly redefined here
|
38
|
+
def get_item_data(n)
|
39
|
+
__wx_item_data[n]
|
40
|
+
end
|
41
|
+
|
42
|
+
# Wholly redefined here
|
43
|
+
def set_item_data(n, data)
|
44
|
+
__wx_item_data[n] = data
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Device Context to paint on a window outside an on_paint handler. It is
|
2
|
+
# recommended that PaintDC is used in preference to this class.
|
3
|
+
class Wx::ClientDC
|
4
|
+
# This class should not be instantiated directly in wxRuby; it should
|
5
|
+
# always be used via Window#paint, which takes a block receiving the
|
6
|
+
# DC. This ensures that the DC is cleaned up at the correct time,
|
7
|
+
# avoiding errors and segfaults on exit.
|
8
|
+
define_method(:initialize) do | *args |
|
9
|
+
Kernel.raise RuntimeError,
|
10
|
+
"Do not instantiate ClientDC directly; use Window#paint",
|
11
|
+
caller[1..-1]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class Wx::Clipboard
|
2
|
+
class << self
|
3
|
+
# This is provided internally by the SWIG interface file, but all
|
4
|
+
# public access should be via Clipboard.open; see below
|
5
|
+
private :get_global_clipboard
|
6
|
+
|
7
|
+
# Class method to provide access to the clipboard within a ruby
|
8
|
+
# block. Tests that the clipboard could be accessed, and ensures
|
9
|
+
# that it is closed when the block is finished.
|
10
|
+
def open
|
11
|
+
clip = nil
|
12
|
+
# Trying to access the segfault outside main_loop will segfault on
|
13
|
+
# some platforms (eg, GTK)
|
14
|
+
unless Wx::const_defined?(:THE_APP)
|
15
|
+
raise RuntimeError,
|
16
|
+
"The clipboard can only be accessed when the App is running"
|
17
|
+
end
|
18
|
+
|
19
|
+
clip = get_global_clipboard
|
20
|
+
unless clip.open
|
21
|
+
Kernel.raise "Could not open clipboard"
|
22
|
+
end
|
23
|
+
yield clip
|
24
|
+
ensure
|
25
|
+
clip.close if clip
|
26
|
+
end
|
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
|
56
|
+
end
|