vruby 2004.08.07
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vr/clipboard.rb +107 -0
- data/lib/vr/compat/rubycompat.rb +18 -0
- data/lib/vr/compat/vrcomctl.rb +12 -0
- data/lib/vr/compat/vrcontrol.rb +50 -0
- data/lib/vr/compat/vrmmedia.rb +24 -0
- data/lib/vr/contrib/inifile.rb +111 -0
- data/lib/vr/contrib/msgboxconst.rb +55 -0
- data/lib/vr/contrib/toolbar.rb +378 -0
- data/lib/vr/contrib/vrctlcolor.rb +110 -0
- data/lib/vr/contrib/vrhotkey.rb +35 -0
- data/lib/vr/contrib/vrlistviewex.rb +71 -0
- data/lib/vr/contrib/vrwincomponent.rb +54 -0
- data/lib/vr/dragdropformat.rb +210 -0
- data/lib/vr/handlers.rd +5 -0
- data/lib/vr/rscutil.rb +170 -0
- data/lib/vr/sysmod.rb +250 -0
- data/lib/vr/vractivex.rb +56 -0
- data/lib/vr/vrclipboard.rb +55 -0
- data/lib/vr/vrcomctl.rb +1779 -0
- data/lib/vr/vrcontrol.rb +1326 -0
- data/lib/vr/vrdde.rb +625 -0
- data/lib/vr/vrddrop.rb +191 -0
- data/lib/vr/vrdialog.rb +403 -0
- data/lib/vr/vrhandler.rb +196 -0
- data/lib/vr/vrlayout.old.rb +209 -0
- data/lib/vr/vrlayout.rb +174 -0
- data/lib/vr/vrlayout2.rb +340 -0
- data/lib/vr/vrmmedia.rb +289 -0
- data/lib/vr/vrolednd.rb +193 -0
- data/lib/vr/vrowndraw.rb +109 -0
- data/lib/vr/vrrichedit.rb +335 -0
- data/lib/vr/vrtimer.rb +150 -0
- data/lib/vr/vrtooltip.rb +274 -0
- data/lib/vr/vrtray.rb +144 -0
- data/lib/vr/vrtvitem.rb +120 -0
- data/lib/vr/vrtwopane.rb +226 -0
- data/lib/vr/vruby.rb +1050 -0
- data/lib/vr/winconst.rb +159 -0
- metadata +86 -0
data/lib/vr/vrhandler.rb
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
###################################
|
2
|
+
#
|
3
|
+
# vrhandler.rb
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
5
|
+
# Copyright 1999-2001 Nishikawa,Yasuhiro
|
6
|
+
#
|
7
|
+
# More information at http://www.threeweb.ad.jp/~nyasu/software/vrproject.html
|
8
|
+
# (in Japanese)
|
9
|
+
#
|
10
|
+
###################################
|
11
|
+
|
12
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
13
|
+
require VR_DIR+'vruby'
|
14
|
+
|
15
|
+
=begin
|
16
|
+
= VisualuRuby(tmp) Additional Modules
|
17
|
+
=end
|
18
|
+
|
19
|
+
|
20
|
+
module VRMouseFeasible
|
21
|
+
include VRMessageHandler
|
22
|
+
|
23
|
+
SHIFT_LBUTTON=1
|
24
|
+
SHIFT_RBUTTON=2
|
25
|
+
SHIFT_SHIFT =4
|
26
|
+
SHIFT_CONTROL=8
|
27
|
+
SHIFT_MBUTTON=16
|
28
|
+
|
29
|
+
=begin
|
30
|
+
== VRMouseFeasible
|
31
|
+
This is a module to receive mouse messages.
|
32
|
+
|
33
|
+
=== Event Handlers
|
34
|
+
--- self_lbuttonup(shift,x,y)
|
35
|
+
This method is fired when mouse left button is released at coord(x,y).
|
36
|
+
Press SHIFT key to set 0x4 bit of argument "shift".
|
37
|
+
Its 0x8 bit is for CONTROL key
|
38
|
+
--- self_lbuttondown(shift,x,y)
|
39
|
+
This method is fired when mouse left button is pressed.
|
40
|
+
--- self_rbuttonup(shift,x,y)
|
41
|
+
This method is fired when mouse right button is released.
|
42
|
+
--- self_rbuttondown(shift,x,y)
|
43
|
+
This method is fired when mouse right button is pressed.
|
44
|
+
--- self_mousemove(shift,x,y)
|
45
|
+
This method is fired when mouse cursor is moving on the window at coord(x,y).
|
46
|
+
=end
|
47
|
+
|
48
|
+
def mousefeasibleinit
|
49
|
+
addHandler WMsg::WM_LBUTTONUP, "lbuttonup", MSGTYPE::ARGINTSINTSINT,nil
|
50
|
+
addHandler WMsg::WM_LBUTTONDOWN,"lbuttondown",MSGTYPE::ARGINTSINTSINT,nil
|
51
|
+
addHandler WMsg::WM_RBUTTONUP, "rbuttonup", MSGTYPE::ARGINTSINTSINT,nil
|
52
|
+
addHandler WMsg::WM_RBUTTONDOWN,"rbuttondown",MSGTYPE::ARGINTSINTSINT,nil
|
53
|
+
addHandler WMsg::WM_MOUSEMOVE, "mousemove", MSGTYPE::ARGINTSINTSINT,nil
|
54
|
+
acceptEvents [WMsg::WM_LBUTTONUP,WMsg::WM_RBUTTONUP,
|
55
|
+
WMsg::WM_LBUTTONDOWN,WMsg::WM_RBUTTONDOWN,
|
56
|
+
WMsg::WM_MOUSEMOVE]
|
57
|
+
end
|
58
|
+
|
59
|
+
def vrinit
|
60
|
+
super
|
61
|
+
mousefeasibleinit
|
62
|
+
end
|
63
|
+
|
64
|
+
=begin handlers
|
65
|
+
def self_lbuttonup(*arg) end
|
66
|
+
def self_lbuttondown(*arg) end
|
67
|
+
def self_rbuttonup(*arg) end
|
68
|
+
def self_rbuttondown(*arg) end
|
69
|
+
def self_mousemove(*arg) end
|
70
|
+
=end
|
71
|
+
end
|
72
|
+
|
73
|
+
module VRFocusSensitive
|
74
|
+
include VRMessageHandler
|
75
|
+
|
76
|
+
=begin
|
77
|
+
== VRFocusSensitive
|
78
|
+
This is a module to sense getting/losing focus.
|
79
|
+
=== Event Handlers
|
80
|
+
--- self_gotfocus()
|
81
|
+
This method is fired when the window get focus.
|
82
|
+
--- self_lostfocus()
|
83
|
+
This method is fired when the window lose the focus.
|
84
|
+
=end
|
85
|
+
|
86
|
+
def focussensitiveinit
|
87
|
+
addHandler WMsg::WM_SETFOCUS, "gotfocus", MSGTYPE::ARGNONE,nil
|
88
|
+
addHandler WMsg::WM_KILLFOCUS, "lostfocus", MSGTYPE::ARGNONE,nil
|
89
|
+
acceptEvents [WMsg::WM_SETFOCUS,WMsg::WM_KILLFOCUS]
|
90
|
+
end
|
91
|
+
|
92
|
+
def vrinit
|
93
|
+
super
|
94
|
+
focussensitiveinit
|
95
|
+
end
|
96
|
+
=begin handlers
|
97
|
+
def gotfocus() end
|
98
|
+
def lostfocus() end
|
99
|
+
=end
|
100
|
+
end
|
101
|
+
|
102
|
+
module VRKeyFeasible
|
103
|
+
include VRMessageHandler
|
104
|
+
|
105
|
+
=begin
|
106
|
+
== VRKeyFeasible
|
107
|
+
This is a module to sense keyboard input.
|
108
|
+
|
109
|
+
=== Event Handlers
|
110
|
+
--- self_char(keycode,keydata)
|
111
|
+
This method is fired when WM_KEYUP and WM_KEYDOWN are translated into
|
112
|
+
keyboard input messages.
|
113
|
+
--- self_deadchar(keycode,keydata)
|
114
|
+
--- self_syschar(keycode,keydata)
|
115
|
+
--- self_sysdeadchar(keycode,keydata)
|
116
|
+
=end
|
117
|
+
|
118
|
+
def keyfeasibleinit
|
119
|
+
addHandler(0x102,"char", MSGTYPE::ARGINTINT,nil) # WM_CHAR
|
120
|
+
addHandler(0x103,"deadchar", MSGTYPE::ARGINTINT,nil) # WM_DEADCHAR
|
121
|
+
addHandler(0x106,"syschar", MSGTYPE::ARGINTINT,nil) # WM_SYSCHAR
|
122
|
+
addHandler(0x107,"sysdeadchar", MSGTYPE::ARGINTINT,nil) # WM_SYSDEADCHAR
|
123
|
+
acceptEvents [0x102,0x103,0x106,0x107]
|
124
|
+
end
|
125
|
+
def vrinit
|
126
|
+
super
|
127
|
+
keyfeasibleinit
|
128
|
+
end
|
129
|
+
|
130
|
+
=begin handlers
|
131
|
+
def self_char(*arg) end
|
132
|
+
def self_deadchar(*arg) end
|
133
|
+
def self_syschar(*arg) end
|
134
|
+
def self_sysdeadchar(*arg) end
|
135
|
+
=end
|
136
|
+
end
|
137
|
+
|
138
|
+
module VRDestroySensitive
|
139
|
+
=begin
|
140
|
+
== VRDestroySensitive
|
141
|
+
This is a module to sense window destruction.
|
142
|
+
|
143
|
+
=== Event Handlers
|
144
|
+
--- self_destroy
|
145
|
+
This is fired when the window is destroying.
|
146
|
+
=end
|
147
|
+
|
148
|
+
include VRMessageHandler
|
149
|
+
|
150
|
+
def destroysensitiveinit
|
151
|
+
addHandler WMsg::WM_DESTROY,"destroy",MSGTYPE::ARGNONE,nil
|
152
|
+
acceptEvents [WMsg::WM_DESTROY]
|
153
|
+
end
|
154
|
+
|
155
|
+
def vrinit
|
156
|
+
super
|
157
|
+
destroysensitiveinit
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
module VRClosingSensitive
|
162
|
+
=begin
|
163
|
+
== VRClosingSensitive
|
164
|
+
This is a module to sense window closing.
|
165
|
+
This module can be used for implement of CanClose method.
|
166
|
+
|
167
|
+
ex.
|
168
|
+
class MyForm < VRForm
|
169
|
+
include VRClosingSensitive
|
170
|
+
def self_close
|
171
|
+
r = messageBox("Can Close?","close query",4) #4=MB_YESNO
|
172
|
+
|
173
|
+
if r==7 # ID_NO then
|
174
|
+
SKIP_DEFAULTHANDLER
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
=== Event Handlers
|
180
|
+
--- self_close
|
181
|
+
This is fired when the window is closing.
|
182
|
+
=end
|
183
|
+
|
184
|
+
include VRMessageHandler
|
185
|
+
def closingsensitiveinit
|
186
|
+
addHandler WMsg::WM_CLOSE,"close",MSGTYPE::ARGNONE,nil
|
187
|
+
acceptEvents [WMsg::WM_CLOSE]
|
188
|
+
end
|
189
|
+
|
190
|
+
def vrinit
|
191
|
+
super
|
192
|
+
closingsensitiveinit
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
require VR_DIR+'contrib/vrctlcolor'
|
@@ -0,0 +1,209 @@
|
|
1
|
+
###################################
|
2
|
+
#
|
3
|
+
# vrlayout.rb (old version)
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
5
|
+
# Copyright 1999-2001 Nishikawa,Yasuhiro
|
6
|
+
#
|
7
|
+
# More information at http://www.threeweb.ad.jp/~nyasu/software/vrproject.html
|
8
|
+
# (in Japanese)
|
9
|
+
#
|
10
|
+
###################################
|
11
|
+
|
12
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
13
|
+
require VR_DIR+'vruby'
|
14
|
+
|
15
|
+
=begin
|
16
|
+
= VisualuRuby(tmp) Layout Managers
|
17
|
+
Layout Managers re-arrange child windows(controls)
|
18
|
+
when the parent window is resized.
|
19
|
+
=end
|
20
|
+
|
21
|
+
|
22
|
+
##############################################
|
23
|
+
# base module for LayoutManagers
|
24
|
+
#
|
25
|
+
module VRLayoutManager
|
26
|
+
=begin
|
27
|
+
== VRLayoutManager
|
28
|
+
The base class for the layout managers.
|
29
|
+
|
30
|
+
=== Methods
|
31
|
+
--- rearrange
|
32
|
+
Re-arranges child windows.
|
33
|
+
=end
|
34
|
+
|
35
|
+
|
36
|
+
include VRMessageHandler
|
37
|
+
|
38
|
+
def vrLayoutinit
|
39
|
+
addHandler(WMsg::WM_SIZE, "vrlayoutresize",MSGTYPE::ARGLINTINT,nil)
|
40
|
+
acceptEvents [WMsg::WM_SIZE]
|
41
|
+
end
|
42
|
+
|
43
|
+
def vrinit
|
44
|
+
super
|
45
|
+
vrLayoutinit
|
46
|
+
end
|
47
|
+
|
48
|
+
def rearrange
|
49
|
+
if self.visible? then
|
50
|
+
a=self.clientrect
|
51
|
+
sendMessage WMsg::WM_SIZE,0,MAKELPARAM(a[2]-a[0],a[3]-a[1])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self_vrlayoutresize(*arg)
|
56
|
+
self_layout_arrange(*arg)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
##########################################
|
62
|
+
|
63
|
+
|
64
|
+
module VRVertLayoutManager
|
65
|
+
=begin
|
66
|
+
== VRVertLayoutManager
|
67
|
+
On window resizing, each controls on the window is re-arranged
|
68
|
+
to vertical arrangement. each control's width is window width and
|
69
|
+
each height is one n-th of window's height.
|
70
|
+
|
71
|
+
=== Methods
|
72
|
+
--- addControl(type,name,caption,astyle)
|
73
|
+
Create a new control and add on the window.
|
74
|
+
The arguments are same as VRParent#addControl
|
75
|
+
without args ((|x|)),((|y|)),((|w|)),((|h|))
|
76
|
+
=end
|
77
|
+
|
78
|
+
include VRLayoutManager
|
79
|
+
|
80
|
+
def self_layout_arrange(width,fheight)
|
81
|
+
return unless @_vr_c_order
|
82
|
+
height=(@_vr_c_order.size>0)? (fheight.to_f / @_vr_c_order.size) : fheight
|
83
|
+
|
84
|
+
@_vr_c_order.each_index do |i|
|
85
|
+
@_vr_c_order[i].move( 0,i*height, width,height )
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
VR_ADDCONTROL_FEWARGS=true
|
90
|
+
|
91
|
+
def addControl(type,name,caption,style=0)
|
92
|
+
@_vr_c_order=[] if !@_vr_c_order
|
93
|
+
r=vr_addControlOriginal(type,name,caption,0,@controls.size*10,10,10,style)
|
94
|
+
@_vr_c_order.push r
|
95
|
+
return r
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
module VRHorizLayoutManager
|
101
|
+
=begin
|
102
|
+
== VRHorizLayoutManager
|
103
|
+
On window resizing, each controls on the window is re-arranged
|
104
|
+
to horizontal arrangement. each control's height is window height and
|
105
|
+
each width is one n-th of window's width.
|
106
|
+
|
107
|
+
=== Methods
|
108
|
+
--- addControl(type,name,caption,astyle)
|
109
|
+
Create a new control and add on the window.
|
110
|
+
The arguments are same as VRParent#addControl
|
111
|
+
without args ((|x|)),((|y|)),((|w|)),((|h|))
|
112
|
+
=end
|
113
|
+
|
114
|
+
include VRLayoutManager
|
115
|
+
|
116
|
+
def self_layout_arrange(fwidth,height)
|
117
|
+
return unless @_vr_c_order
|
118
|
+
width =(@_vr_c_order.size>0)? (fwidth.to_f / @_vr_c_order.size) : fwidth
|
119
|
+
|
120
|
+
@_vr_c_order.each_index do |i|
|
121
|
+
@_vr_c_order[i].move( i*width,0, width,height )
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
VR_ADDCONTROL_FEWARGS=true
|
126
|
+
|
127
|
+
def addControl(type,name,caption,style=0)
|
128
|
+
@_vr_c_order=[] if !@_vr_c_order
|
129
|
+
r=vr_addControlOriginal(type,name,caption,0,@controls.size*10,10,10,style)
|
130
|
+
@_vr_c_order.push r
|
131
|
+
return r
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
module VRGridLayoutManager
|
137
|
+
=begin
|
138
|
+
== VRGridLayoutManager
|
139
|
+
On window resizing, each controls on the window is re-arranged
|
140
|
+
with the grid which devides the window height and width by the number
|
141
|
+
specified by ((<setDimension>)) method.
|
142
|
+
|
143
|
+
=== Methods
|
144
|
+
--- setDimension(x,y)
|
145
|
+
Devides windows width by ((|x|)) and height by ((|y|)).
|
146
|
+
|
147
|
+
--- addControl(type,name,caption,x,y,w,h,astyle)
|
148
|
+
Create a new control and add on the window.
|
149
|
+
The arguments are same as VRParent#addControl but
|
150
|
+
args ((|x|)),((|y|)),((|w|)),((|h|)) are under grid dimension.
|
151
|
+
=end
|
152
|
+
|
153
|
+
include VRLayoutManager
|
154
|
+
|
155
|
+
def setDimension(x,y)
|
156
|
+
@_vr_xsize=x
|
157
|
+
@_vr_ysize=y
|
158
|
+
@_vr_controldim={}
|
159
|
+
end
|
160
|
+
|
161
|
+
def self_layout_arrange(width,height)
|
162
|
+
return unless @controls
|
163
|
+
|
164
|
+
@controls.each do |id,cntl|
|
165
|
+
cntl.move(width.to_f / @_vr_xsize*@_vr_controldim[id][0],
|
166
|
+
height.to_f / @_vr_ysize*@_vr_controldim[id][1],
|
167
|
+
width.to_f / @_vr_xsize*@_vr_controldim[id][2],
|
168
|
+
height.to_f / @_vr_ysize*@_vr_controldim[id][3] )
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def addControl(type,name,caption,x,y,w,h,style=0)
|
173
|
+
if !@_vr_controldim then raise("addControl before setDimension") end
|
174
|
+
if @controls.size != @_vr_controldim.size then
|
175
|
+
raise "VRGridLayoutManager misses some controls"+
|
176
|
+
"(mng#{@_vr_controldim.size} cntls#{@_vr_cid})."
|
177
|
+
end
|
178
|
+
|
179
|
+
gx=self.w/@_vr_xsize*x; gw=self.w/@_vr_xsize*w;
|
180
|
+
gy=self.h/@_vr_ysize*y; gh=self.h/@_vr_ysize*h;
|
181
|
+
r=vr_addControlOriginal(type,name,caption,gx,gy,gw,gh,style)
|
182
|
+
@_vr_controldim[r.etc]= [x,y,w,h]
|
183
|
+
return r
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
module VRFullsizeLayoutManager
|
188
|
+
=begin
|
189
|
+
== VRFullsizeLayoutManager
|
190
|
+
This is a LayoutManager for only one control, whose size is full size
|
191
|
+
on the window.
|
192
|
+
|
193
|
+
=== Methods
|
194
|
+
--- addControl(type,name,caption,astyle)
|
195
|
+
You can call this method only once.
|
196
|
+
=end
|
197
|
+
|
198
|
+
|
199
|
+
include VRVertLayoutManager
|
200
|
+
|
201
|
+
VR_ADDCONTROL_FEWARGS=true
|
202
|
+
|
203
|
+
def addControl(*arg)
|
204
|
+
super
|
205
|
+
def self.addControl(*arg)
|
206
|
+
raise "addControl twice"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
data/lib/vr/vrlayout.rb
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
###################################
|
2
|
+
#
|
3
|
+
# vrlayout.rb (using vrlayout2 version)
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
5
|
+
# Copyright 1999-2001 Nishikawa,Yasuhiro
|
6
|
+
#
|
7
|
+
# More information at http://www.threeweb.ad.jp/~nyasu/software/vrproject.html
|
8
|
+
# (in Japanese)
|
9
|
+
#
|
10
|
+
###################################
|
11
|
+
|
12
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
13
|
+
require VR_DIR+'vruby'
|
14
|
+
require VR_DIR+'vrlayout2'
|
15
|
+
|
16
|
+
=begin
|
17
|
+
= VisualuRuby(tmp) Layout Managers
|
18
|
+
Layout Managers re-arrange child windows(controls)
|
19
|
+
when the parent window is resized.
|
20
|
+
=end
|
21
|
+
|
22
|
+
##############################################
|
23
|
+
# base module for LayoutManagers
|
24
|
+
#
|
25
|
+
module VRLayoutManager
|
26
|
+
=begin
|
27
|
+
== VRLayoutManager
|
28
|
+
The base class for the layout managers.
|
29
|
+
|
30
|
+
=== Methods
|
31
|
+
--- rearrange
|
32
|
+
Re-arranges child windows.
|
33
|
+
=end
|
34
|
+
|
35
|
+
|
36
|
+
include VRMessageHandler
|
37
|
+
|
38
|
+
def vrLayoutinit
|
39
|
+
@_vr_layoutframe=nil
|
40
|
+
addHandler(WMsg::WM_SIZE, "vrlayoutresize",MSGTYPE::ARGLINTINT,nil)
|
41
|
+
acceptEvents [WMsg::WM_SIZE]
|
42
|
+
end
|
43
|
+
|
44
|
+
def vrinit
|
45
|
+
super
|
46
|
+
vrLayoutinit
|
47
|
+
end
|
48
|
+
|
49
|
+
def rearrange
|
50
|
+
a=self.clientrect
|
51
|
+
sendMessage WMsg::WM_SIZE,0,MAKELPARAM(a[2]-a[0],a[3]-a[1])
|
52
|
+
end
|
53
|
+
|
54
|
+
def self_vrlayoutresize(*arg)
|
55
|
+
self_layout_arrange(*arg)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self_layout_arrange(xw,yh)
|
59
|
+
@_vr_layoutframe.move 0,0,xw,yh if @_vr_layoutframe
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
##########################################
|
65
|
+
|
66
|
+
module VRVertLayoutManager
|
67
|
+
=begin
|
68
|
+
== VRVertLayoutManager
|
69
|
+
On window resizing, each controls on the window is re-arranged
|
70
|
+
to vertical arrangement. each control's width is window width and
|
71
|
+
each height is one n-th of window's height.
|
72
|
+
|
73
|
+
=== Methods
|
74
|
+
--- addControl(type,name,caption,astyle)
|
75
|
+
Create a new control and add on the window.
|
76
|
+
The arguments are same as VRParent#addControl
|
77
|
+
without args ((|x|)),((|y|)),((|w|)),((|h|))
|
78
|
+
=end
|
79
|
+
|
80
|
+
include VRLayoutManager
|
81
|
+
|
82
|
+
VR_ADDCONTROL_FEWARGS=true
|
83
|
+
|
84
|
+
def addControl(type,name,caption,style=0)
|
85
|
+
@_vr_layoutframe = VRVertLayoutFrame.new unless @_vr_layoutframe
|
86
|
+
r=vr_addControlOriginal(type,name,caption,0,@controls.size*10,10,10,style)
|
87
|
+
@_vr_layoutframe.register(r)
|
88
|
+
rearrange
|
89
|
+
return r
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
module VRHorizLayoutManager
|
94
|
+
=begin
|
95
|
+
== VRHorizLayoutManager
|
96
|
+
On window resizing, each controls on the window is re-arranged
|
97
|
+
to horizontal arrangement. each control's height is window height and
|
98
|
+
each width is one n-th of window's width.
|
99
|
+
|
100
|
+
=== Methods
|
101
|
+
--- addControl(type,name,caption,astyle)
|
102
|
+
Create a new control and add on the window.
|
103
|
+
The arguments are same as VRParent#addControl
|
104
|
+
without args ((|x|)),((|y|)),((|w|)),((|h|))
|
105
|
+
=end
|
106
|
+
|
107
|
+
include VRLayoutManager
|
108
|
+
|
109
|
+
VR_ADDCONTROL_FEWARGS=true
|
110
|
+
|
111
|
+
def addControl(type,name,caption,style=0)
|
112
|
+
@_vr_layoutframe = VRHorizLayoutFrame.new unless @_vr_layoutframe
|
113
|
+
r=vr_addControlOriginal(type,name,caption,0,@controls.size*10,10,10,style)
|
114
|
+
@_vr_layoutframe.register(r)
|
115
|
+
rearrange
|
116
|
+
return r
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
module VRGridLayoutManager
|
121
|
+
=begin
|
122
|
+
== VRGridLayoutManager
|
123
|
+
On window resizing, each controls on the window is re-arranged
|
124
|
+
with the grid which devides the window height and width by the number
|
125
|
+
specified by ((<setDimension>)) method.
|
126
|
+
|
127
|
+
=== Methods
|
128
|
+
--- setDimension(x,y)
|
129
|
+
Devides windows width by ((|x|)) and height by ((|y|)).
|
130
|
+
|
131
|
+
--- addControl(type,name,caption,x,y,w,h,astyle)
|
132
|
+
Create a new control and add on the window.
|
133
|
+
The arguments are same as VRParent#addControl but
|
134
|
+
args ((|x|)),((|y|)),((|w|)),((|h|)) are under grid dimension.
|
135
|
+
=end
|
136
|
+
include VRLayoutManager
|
137
|
+
|
138
|
+
def setDimension(x,y)
|
139
|
+
unless @_vr_layoutframe then
|
140
|
+
@_vr_layoutframe = VRGridLayoutFrame.new(x,y)
|
141
|
+
else
|
142
|
+
@_vr_layoutframe.setDimension(x,y)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
def addControl(type,name,caption,x,y,w,h,style=0)
|
146
|
+
@_vr_layoutframe = VRGridLayoutFrame.new unless @_vr_layoutframe
|
147
|
+
r=vr_addControlOriginal(type,name,caption,0,@controls.size*10,10,10,style)
|
148
|
+
@_vr_layoutframe.register(r,x,y,w,h)
|
149
|
+
rearrange
|
150
|
+
return r
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
module VRFullsizeLayoutManager
|
155
|
+
=begin
|
156
|
+
== VRFullsizeLayoutManager
|
157
|
+
This is a LayoutManager for only one control, whose size is full size
|
158
|
+
on the window.
|
159
|
+
=== Methods
|
160
|
+
--- addControl(type,name,caption,astyle)
|
161
|
+
You can call this method only once.
|
162
|
+
=end
|
163
|
+
|
164
|
+
|
165
|
+
include VRVertLayoutManager
|
166
|
+
VR_ADDCONTROL_FEWARGS=true
|
167
|
+
|
168
|
+
def addControl(*arg)
|
169
|
+
super
|
170
|
+
def self.addControl(*arg)
|
171
|
+
raise "addControl twice"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|