wxruby 1.9.0-i386-mswin32 → 1.9.1-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wx.rb +42 -35
- data/lib/wx/accessors.rb +52 -0
- data/lib/wx/classes/evthandler.rb +36 -32
- data/lib/wx/classes/grid.rb +13 -13
- 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/window.rb +4 -0
- data/lib/wx/keyword_ctors.rb +219 -0
- data/lib/wx/keyword_defs.rb +455 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.exp +0 -0
- data/lib/wxruby2.lib +0 -0
- data/lib/wxruby2.so +0 -0
- data/samples/SAMPLES-LICENSE.TXT +17 -17
- data/samples/aui/aui.rb +6 -5
- data/samples/bigdemo/About.rbw +39 -39
- data/samples/bigdemo/ColorPanel.rbw +25 -25
- data/samples/bigdemo/GridSimple.rbw +80 -80
- data/samples/bigdemo/MDIDemo.rbw +59 -59
- data/samples/bigdemo/PopupMenu.rbw +151 -151
- data/samples/bigdemo/Sizers.rbw +545 -545
- data/samples/bigdemo/bigdemo.rb +826 -826
- data/samples/bigdemo/demoTemplate.rbw +37 -37
- 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 +66 -66
- data/samples/bigdemo/wxCalendarCtrl.rbw +72 -72
- data/samples/bigdemo/wxCheckBox.rbw +52 -52
- data/samples/bigdemo/wxCheckListBox.rbw +77 -77
- data/samples/bigdemo/wxChoice.rbw +49 -49
- data/samples/bigdemo/wxColourDialog.rbw +34 -34
- data/samples/bigdemo/wxComboBox.rbw +79 -79
- data/samples/bigdemo/wxDialog.rbw +92 -92
- data/samples/bigdemo/wxDirDialog.rbw +32 -32
- data/samples/bigdemo/wxFileDialog.rbw +39 -39
- data/samples/bigdemo/wxFileDialog_Save.rbw +38 -38
- data/samples/bigdemo/wxFindReplaceDialog.rbw +85 -85
- data/samples/bigdemo/wxFontDialog.rbw +176 -176
- data/samples/bigdemo/wxFrame.rbw +55 -55
- data/samples/bigdemo/wxGauge.rbw +73 -73
- data/samples/bigdemo/wxGrid.rbw +68 -68
- data/samples/bigdemo/wxListBox.rbw +142 -142
- data/samples/bigdemo/wxListCtrl_virtual.rbw +109 -109
- data/samples/bigdemo/wxMDIWindows.rbw +52 -52
- data/samples/bigdemo/wxMenu.rbw +238 -238
- data/samples/bigdemo/wxMessageDialog.rbw +30 -30
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +34 -34
- data/samples/bigdemo/wxNotebook.rbw +138 -138
- data/samples/bigdemo/wxProgressDialog.rbw +45 -45
- data/samples/bigdemo/wxRadioBox.rbw +74 -74
- data/samples/bigdemo/wxRadioButton.rbw +127 -127
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +59 -59
- data/samples/bigdemo/wxScrolledWindow.rbw +196 -196
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +35 -35
- data/samples/bigdemo/wxSlider.rbw +44 -44
- data/samples/bigdemo/wxSpinButton.rbw +52 -52
- data/samples/bigdemo/wxSpinCtrl.rbw +53 -53
- data/samples/bigdemo/wxSplitterWindow.rbw +65 -65
- data/samples/bigdemo/wxStaticBitmap.rbw +53 -53
- data/samples/bigdemo/wxStaticText.rbw +57 -57
- data/samples/bigdemo/wxStatusBar.rbw +128 -128
- data/samples/bigdemo/wxTextCtrl.rbw +151 -151
- data/samples/bigdemo/wxTextEntryDialog.rbw +34 -34
- data/samples/bigdemo/wxToggleButton.rbw +51 -51
- data/samples/bigdemo/wxToolBar.rbw +133 -133
- data/samples/bigdemo/wxTreeCtrl.rbw +192 -192
- data/samples/calendar/calendar.rb +275 -275
- data/samples/caret/caret.rb +296 -296
- data/samples/caret/mondrian.xpm +44 -44
- data/samples/controls/controls.rb +1140 -1140
- 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 +724 -724
- data/samples/dialogs/tips.txt +18 -18
- data/samples/etc/activation.rb +108 -108
- data/samples/etc/choice.rb +72 -72
- data/samples/etc/miniframe.rb +84 -84
- data/samples/etc/sash.rb +135 -135
- data/samples/etc/scrollwin.rb +116 -116
- data/samples/etc/system_settings.rb +258 -258
- data/samples/etc/wizard.rb +81 -81
- data/samples/event/event.rb +184 -0
- data/samples/images/images.rb +48 -48
- data/samples/listbook/listbook.rb +183 -183
- data/samples/listbook/listbook.xrc +370 -370
- data/samples/mdi/mdi.rb +87 -87
- data/samples/minimal/minimal.rb +83 -95
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +46 -46
- data/samples/minimal/text.rb +35 -35
- data/samples/text/scintilla.rb +22 -28
- data/samples/text/textctrl.rb +124 -124
- data/samples/text/unicode.rb +238 -238
- data/samples/text/utf8.txt +14 -14
- data/samples/treectrl/treectrl.rb +1210 -1210
- data/samples/xrc/samples.xrc +46 -46
- data/samples/xrc/xrc_sample.rb +107 -107
- metadata +13 -5
- data/samples/minimal/mondrian.ico +0 -0
- data/samples/minimal/mondrian.xpm +0 -44
data/lib/wx.rb
CHANGED
@@ -1,35 +1,42 @@
|
|
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
|
-
|
29
|
-
# Load in all the class extension methods written in ruby
|
30
|
-
# evthandler must be required first b/c it sets up methods modified elsewhere
|
31
|
-
require 'wx/classes/evthandler.rb'
|
32
|
-
class_files = File.join( File.dirname(__FILE__), 'wx', 'classes', '*.rb')
|
33
|
-
Dir.glob(class_files) do | class_file |
|
34
|
-
require 'wx/classes/' + class_file[/\w+\.rb$/]
|
35
|
-
end
|
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
|
+
|
29
|
+
# Load in all the class extension methods written in ruby
|
30
|
+
# evthandler must be required first b/c it sets up methods modified elsewhere
|
31
|
+
require 'wx/classes/evthandler.rb'
|
32
|
+
class_files = File.join( File.dirname(__FILE__), 'wx', 'classes', '*.rb')
|
33
|
+
Dir.glob(class_files) do | class_file |
|
34
|
+
require 'wx/classes/' + class_file[/\w+\.rb$/]
|
35
|
+
end
|
36
|
+
|
37
|
+
# Load in syntax sweetner
|
38
|
+
require 'wx/accessors'
|
39
|
+
require 'wx/keyword_ctors'
|
40
|
+
require 'wx/keyword_defs'
|
41
|
+
|
42
|
+
|
data/lib/wx/accessors.rb
ADDED
@@ -0,0 +1,52 @@
|
|
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
|
+
#
|
9
|
+
# 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:
|
11
|
+
#
|
12
|
+
# * position()
|
13
|
+
# * size = a_size
|
14
|
+
# * checked?
|
15
|
+
#
|
16
|
+
# This extension creates an alias for every WxRuby instance method that
|
17
|
+
# begins with +get_+, +set_+ or +is_+. Note that if you are calling a
|
18
|
+
# 'setter' method on self, you must explicitly send the message to self:
|
19
|
+
#
|
20
|
+
# # set's self size to be 100px by 100px
|
21
|
+
# self.size = Wx::Size.new(100, 100)
|
22
|
+
# # only sets the value of a local variable 'size'
|
23
|
+
# size = Wx::Size.new
|
24
|
+
|
25
|
+
module WxRubyStyleAccessors
|
26
|
+
def method_missing(sym, *args)
|
27
|
+
case sym.to_s
|
28
|
+
when /^(.*)\=$/
|
29
|
+
meth = "set_#{$1}"
|
30
|
+
when /^(.*)\?$/
|
31
|
+
meth = "is_#{$1}"
|
32
|
+
else
|
33
|
+
meth = "get_#{sym}"
|
34
|
+
end
|
35
|
+
if respond_to?(meth)
|
36
|
+
send(meth, *args)
|
37
|
+
else
|
38
|
+
e = NoMethodError.new("undefined method '#{sym}' for #{self.inspect}")
|
39
|
+
e.set_backtrace(caller)
|
40
|
+
Kernel.raise e
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
all_classes = Wx::constants.collect { | c | Wx::const_get(c) }.grep(Class)
|
46
|
+
|
47
|
+
all_classes.each do | klass |
|
48
|
+
klass.class_eval do
|
49
|
+
include WxRubyStyleAccessors
|
50
|
+
extend WxRubyStyleAccessors
|
51
|
+
end
|
52
|
+
end
|
@@ -16,14 +16,17 @@ class Wx::EvtHandler
|
|
16
16
|
EventType = Struct.new(:name, :arity, :const, :evt_class)
|
17
17
|
|
18
18
|
# Fast look-up hash to map event type ids to ruby event classes
|
19
|
-
|
19
|
+
EVENT_TYPE_CLASS_MAP = {}
|
20
|
+
# Hash to look up EVT constants from symbol names of evt handler
|
21
|
+
# methods; used internally by disconnect (see EvtHandler.i)
|
22
|
+
EVENT_NAME_TYPE_MAP = {}
|
20
23
|
|
21
24
|
# Given a Wx EventType id (eg Wx::EVT_MENU), returns a WxRuby Event
|
22
25
|
# class which should be passed to event handler blocks. The actual
|
23
26
|
# EVT_XXX constants themselves are in the compiled library, defined in
|
24
27
|
# swig/classes/Event.i
|
25
28
|
def self.event_class_for_type(id)
|
26
|
-
if evt_klass =
|
29
|
+
if evt_klass = EVENT_TYPE_CLASS_MAP[id]
|
27
30
|
return evt_klass
|
28
31
|
else
|
29
32
|
warn "No event class defined for event type #{id}"
|
@@ -31,6 +34,18 @@ class Wx::EvtHandler
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
37
|
+
# Given the symbol name of an evt_xxx handler method, returns the
|
38
|
+
# Integer Wx::EVT_XXX constant associated with that handler.
|
39
|
+
def self.event_type_for_name(name)
|
40
|
+
EVENT_NAME_TYPE_MAP[name]
|
41
|
+
end
|
42
|
+
|
43
|
+
# Given the Integer constant Wx::EVT_XXX, returns the convenience
|
44
|
+
# handler method name associated with that type of event.
|
45
|
+
def self.event_name_for_type(name)
|
46
|
+
EVENT_NAME_TYPE_MAP.index(name)
|
47
|
+
end
|
48
|
+
|
34
49
|
# Public method to register the mapping of a custom event type
|
35
50
|
# +konstant+ (which should be a unique integer; one will be created if
|
36
51
|
# not supplied) to a custom event class +klass+. If +meth+ and +arity+
|
@@ -50,7 +65,9 @@ class Wx::EvtHandler
|
|
50
65
|
# Registers the event type +ev_type+, which should be an instance of
|
51
66
|
# the Struct class +Wx::EvtHandler::EventType+.
|
52
67
|
def self.register_event_type(ev_type)
|
53
|
-
|
68
|
+
EVENT_TYPE_CLASS_MAP[ev_type.const] = ev_type.evt_class
|
69
|
+
EVENT_NAME_TYPE_MAP[ev_type.name.intern] = ev_type.const
|
70
|
+
|
54
71
|
unless ev_type.arity and ev_type.name
|
55
72
|
return
|
56
73
|
end
|
@@ -73,6 +90,11 @@ class Wx::EvtHandler
|
|
73
90
|
end
|
74
91
|
end
|
75
92
|
|
93
|
+
# Definitions for all event types that are part by core wxRuby. Events
|
94
|
+
# that are mapped to class Wx::Event are TODO as they are not
|
95
|
+
# currently wrapped by the correct class. All StyledTextCtrl
|
96
|
+
# (Scintilla) events with prefix EVT_STC are dealt with in the
|
97
|
+
# separate styledtextctrl.rb file.
|
76
98
|
EVENT_DEFINITIONS = [
|
77
99
|
EventType['evt_activate', 0,
|
78
100
|
Wx::EVT_ACTIVATE,
|
@@ -791,34 +813,16 @@ class Wx::EvtHandler
|
|
791
813
|
evt_mousewheel(&block)
|
792
814
|
end
|
793
815
|
|
794
|
-
#
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
# Wx::EVT_SCI_UPDATEUI => Wx::ScintillaEvent,
|
806
|
-
# Wx::EVT_SCI_MODIFIED => Wx::ScintillaEvent,
|
807
|
-
# Wx::EVT_SCI_MACRORECORD => Wx::ScintillaEvent,
|
808
|
-
# Wx::EVT_SCI_MARGINCLICK => Wx::ScintillaEvent,
|
809
|
-
# Wx::EVT_SCI_NEEDSHOWN => Wx::ScintillaEvent,
|
810
|
-
# Wx::EVT_SCI_PAINTED => Wx::ScintillaEvent,
|
811
|
-
# Wx::EVT_SCI_USERLISTSELECTION => Wx::ScintillaEvent,
|
812
|
-
# Wx::EVT_SCI_URIDROPPED => Wx::ScintillaEvent,
|
813
|
-
# Wx::EVT_SCI_DWELLSTART => Wx::ScintillaEvent,
|
814
|
-
# Wx::EVT_SCI_DWELLEND => Wx::ScintillaEvent,
|
815
|
-
# Wx::EVT_SCI_START_DRAG => Wx::ScintillaEvent,
|
816
|
-
# Wx::EVT_SCI_DRAG_OVER => Wx::ScintillaEvent,
|
817
|
-
# Wx::EVT_SCI_DO_DROP => Wx::ScintillaEvent,
|
818
|
-
# Wx::EVT_SCI_ZOOM => Wx::ScintillaEvent,
|
819
|
-
# Wx::EVT_SCI_HOTSPOT_CLICK => Wx::ScintillaEvent,
|
820
|
-
# Wx::EVT_SCI_HOTSPOT_DCLICK => Wx::ScintillaEvent,
|
821
|
-
# Wx::EVT_SCI_CALLTIP_CLICK => Wx::ScintillaEvent )
|
822
|
-
# end
|
816
|
+
# convenience evt handler to listen to all scrollwin events
|
817
|
+
def evt_scrollwin(&block)
|
818
|
+
evt_scrollwin_top(&block)
|
819
|
+
evt_scrollwin_bottom(&block)
|
820
|
+
evt_scrollwin_lineup(&block)
|
821
|
+
evt_scrollwin_linedown(&block)
|
822
|
+
evt_scrollwin_pageup(&block)
|
823
|
+
evt_scrollwin_pagedown(&block)
|
824
|
+
evt_scrollwin_thumbtrack(&block)
|
825
|
+
evt_scrollwin_thumbrelease(&block)
|
826
|
+
end
|
823
827
|
end
|
824
828
|
|
data/lib/wx/classes/grid.rb
CHANGED
@@ -84,18 +84,18 @@ class Wx::Grid
|
|
84
84
|
# This and the following methods do a bit of book-keeping - as rows
|
85
85
|
# and columns are deleted and inserted, the position of the columns
|
86
86
|
# and rows with stored editors and renderers may move.
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
alias :__insert_rows :insert_rows
|
88
|
+
def insert_rows(pos = 0, num = 1, update_labels = true)
|
89
|
+
__insert_rows(pos, num, update_labels)
|
90
90
|
num.times { @__row_editors.insert(pos, nil) }
|
91
91
|
num.times { @__row_renderers.insert(pos, nil) }
|
92
92
|
num.times { @__cell_editors.insert(pos, []) }
|
93
93
|
num.times { @__cell_renderers.insert(pos, []) }
|
94
94
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
|
96
|
+
alias :__insert_cols :insert_cols
|
97
|
+
def insert_cols(pos = 0, num = 1, update_labels = true)
|
98
|
+
__insert_cols(pos, num, update_labels)
|
99
99
|
num.times { @__col_editors.insert(pos, nil) }
|
100
100
|
num.times { @__col_renderers.insert(pos, nil) }
|
101
101
|
num.times do
|
@@ -106,18 +106,18 @@ class Wx::Grid
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
alias :__delete_rows :delete_rows
|
110
|
+
def delete_rows(pos = 0, num = 1, update_labels = true)
|
111
|
+
__delete_rows(pos, num, update_labels)
|
112
112
|
@__row_editors.slice!(pos, num)
|
113
113
|
@__row_renderers.slice!(pos, num)
|
114
114
|
@__cell_editors.slice!(pos, num)
|
115
115
|
@__cell_renderers.slice!(pos, num)
|
116
116
|
end
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
alias :__delete_cols :delete_cols
|
119
|
+
def delete_cols(pos = 0, num = 1, update_labels = true)
|
120
|
+
__delete_cols(pos, num, update_labels)
|
121
121
|
@__col_editors.slice!(pos, num)
|
122
122
|
@__col_renderers.slice!(pos, num)
|
123
123
|
num.times do
|
data/lib/wx/classes/point.rb
CHANGED
@@ -1,5 +1,48 @@
|
|
1
1
|
class Wx::Point
|
2
|
+
# More informative output when converted to string
|
2
3
|
def to_s
|
3
4
|
"#<Wx::Point: (#{x}, #{y})>"
|
4
5
|
end
|
6
|
+
|
7
|
+
# Return a new Wx::Point with the x and y parameters both divided by
|
8
|
+
# parameter +div+, which should be a Numeric
|
9
|
+
def /(div)
|
10
|
+
self.class.new( (get_x / div).to_i, (get_y / div).to_i )
|
11
|
+
end
|
12
|
+
|
13
|
+
# Return a new Wx::Point with the x and y values both multiplied by
|
14
|
+
# parameter +mul+, which should be a Numeric
|
15
|
+
def *(mul)
|
16
|
+
self.class.new( (get_x * mul).to_i, (get_y * mul).to_i )
|
17
|
+
end
|
18
|
+
|
19
|
+
# Return a new Wx::Point with the x and y values both reduced by
|
20
|
+
# parameter +arg+. If +arg+ is another Wx::Point, reduce x by the
|
21
|
+
# other's x and y by the other's y; if +arg+ is a numeric value,
|
22
|
+
# reduce x and y both by that value.
|
23
|
+
def -(arg)
|
24
|
+
case arg
|
25
|
+
when self.class
|
26
|
+
self.class.new( get_x - arg.get_x, get_y - arg.get_y )
|
27
|
+
when Numeric
|
28
|
+
self.class.new( (get_x - arg).to_i, (get_y - arg).to_i )
|
29
|
+
else
|
30
|
+
Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Return a new Wx::Point with the x and y values both increased by
|
35
|
+
# parameter +arg+. If +arg+ is another Wx::Point, increase x by the
|
36
|
+
# other's x and y by the other's y; if +arg+ is a numeric value,
|
37
|
+
# increase both x and y by that value.
|
38
|
+
def +(arg)
|
39
|
+
case arg
|
40
|
+
when self.class
|
41
|
+
self.class.new( get_x + arg.get_x, get_y + arg.get_y )
|
42
|
+
when Numeric
|
43
|
+
self.class.new( (get_x + arg).to_i, (get_y + arg).to_i )
|
44
|
+
else
|
45
|
+
Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
|
46
|
+
end
|
47
|
+
end
|
5
48
|
end
|
data/lib/wx/classes/size.rb
CHANGED
@@ -2,4 +2,48 @@ class Wx::Size
|
|
2
2
|
def to_s
|
3
3
|
"#<Wx::Size: (#{get_width}, #{get_height})>"
|
4
4
|
end
|
5
|
+
|
6
|
+
# Return a new Wx::Size with the width and height values both divided
|
7
|
+
# by parameter +div+, which should be a Numeric
|
8
|
+
def /(div)
|
9
|
+
self.class.new( (get_x / div).to_i, (get_y / div).to_i )
|
10
|
+
end
|
11
|
+
|
12
|
+
# Return a new Wx::Size with the width and height values both
|
13
|
+
# multiplied by parameter +mul+, which should be a Numeric
|
14
|
+
def *(mul)
|
15
|
+
self.class.new( (get_x * mul).to_i, (get_y * mul).to_i )
|
16
|
+
end
|
17
|
+
|
18
|
+
# Return a new Wx::Size with the width and height parameters both
|
19
|
+
# reduced by parameter +arg+. If +arg+ is another Wx::Size, reduce
|
20
|
+
# width by the other's width and height by the other's height; if
|
21
|
+
# +arg+ is a numeric value, reduce both width and height by that
|
22
|
+
# value.
|
23
|
+
def -(arg)
|
24
|
+
case arg
|
25
|
+
when self.class
|
26
|
+
self.class.new( get_x - arg.get_x, get_y - arg.get_y )
|
27
|
+
when Numeric
|
28
|
+
self.class.new( (get_x - arg).to_i, (get_y - arg).to_i )
|
29
|
+
else
|
30
|
+
Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Return a new Wx::Size with the width and height parameters both
|
35
|
+
# increased by parameter +arg+. If +arg+ is another Wx::Size, increase
|
36
|
+
# width by the other's width and height by the other's height; if
|
37
|
+
# +arg+ is a numeric value, increase both width and height by that
|
38
|
+
# value.
|
39
|
+
def +(arg)
|
40
|
+
case arg
|
41
|
+
when self.class
|
42
|
+
self.class.new( get_x + arg.get_x, get_y + arg.get_y )
|
43
|
+
when Numeric
|
44
|
+
self.class.new( (get_x + arg).to_i, (get_y + arg).to_i )
|
45
|
+
else
|
46
|
+
Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
|
47
|
+
end
|
48
|
+
end
|
5
49
|
end
|
@@ -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
|