exerb 6.0.1
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/.gitignore +8 -0
- data/ChangeLog.ja.rd +305 -0
- data/README.en.txt +12 -0
- data/README.ja.html +143 -0
- data/README.ja.txt +6 -0
- data/README.md +50 -0
- data/Rakefile +205 -0
- data/bin/exerb +185 -0
- data/bin/mkexy +47 -0
- data/doc/LGPL +513 -0
- data/doc/class.ja.html +92 -0
- data/doc/command.ja.html +109 -0
- data/doc/core.ja.html +72 -0
- data/doc/example.ja.html +89 -0
- data/doc/faq.ja.html +59 -0
- data/doc/inside.ja.rd +404 -0
- data/doc/license.ja.html +62 -0
- data/doc/logo.gif +0 -0
- data/doc/misc.ja.html +72 -0
- data/doc/navi.gif +0 -0
- data/doc/recipe.ja.html +317 -0
- data/doc/style.css +187 -0
- data/doc/tutorial.ja.html +182 -0
- data/example/Makefile +54 -0
- data/example/cat_n.rb +14 -0
- data/example/exception.rb +9 -0
- data/example/ext/Win32API.so +0 -0
- data/example/ext/swin.so +0 -0
- data/example/msgbox.rb +14 -0
- data/example/rubytk.rb +22 -0
- data/example/runtime.ico +0 -0
- data/example/runtime.rb +19 -0
- data/example/vr/clipboard.rb +106 -0
- data/example/vr/compat/rubycompat.rb +18 -0
- data/example/vr/compat/vrcomctl.rb +12 -0
- data/example/vr/compat/vrcontrol.rb +50 -0
- data/example/vr/compat/vrmmedia.rb +24 -0
- data/example/vr/contrib/inifile.rb +116 -0
- data/example/vr/contrib/msgboxconst.rb +55 -0
- data/example/vr/contrib/toolbar.rb +371 -0
- data/example/vr/contrib/vrctlcolor.rb +110 -0
- data/example/vr/contrib/vrhotkey.rb +35 -0
- data/example/vr/contrib/vrlistviewex.rb +71 -0
- data/example/vr/contrib/vrstdscrollbar.rb +414 -0
- data/example/vr/contrib/vrwincomponent.rb +54 -0
- data/example/vr/dragdropformat.rb +209 -0
- data/example/vr/rscutil.rb +168 -0
- data/example/vr/sysmod.rb +249 -0
- data/example/vr/vractivex.rb +56 -0
- data/example/vr/vrclipboard.rb +53 -0
- data/example/vr/vrcomctl.rb +1819 -0
- data/example/vr/vrcontrol.rb +1374 -0
- data/example/vr/vrdde.rb +623 -0
- data/example/vr/vrddrop.rb +190 -0
- data/example/vr/vrdialog.rb +406 -0
- data/example/vr/vrhandler.rb +195 -0
- data/example/vr/vrlayout.old.rb +209 -0
- data/example/vr/vrlayout.rb +173 -0
- data/example/vr/vrlayout2.rb +340 -0
- data/example/vr/vrmargin.rb +141 -0
- data/example/vr/vrmgdlayout.rb +381 -0
- data/example/vr/vrmmedia.rb +287 -0
- data/example/vr/vrolednd.rb +192 -0
- data/example/vr/vrowndraw.rb +108 -0
- data/example/vr/vrrichedit.rb +366 -0
- data/example/vr/vrtimer.rb +148 -0
- data/example/vr/vrtooltip.rb +273 -0
- data/example/vr/vrtray.rb +143 -0
- data/example/vr/vrtvitem.rb +118 -0
- data/example/vr/vrtwopane.rb +223 -0
- data/example/vr/vruby.rb +1051 -0
- data/example/vr/winconst.rb +158 -0
- data/example/vruby.rb +38 -0
- data/exerb.gemspec +26 -0
- data/extconf.rb +7 -0
- data/lib/exerb/archive.rb +143 -0
- data/lib/exerb/config.rb +51 -0
- data/lib/exerb/error.rb +15 -0
- data/lib/exerb/executable.rb +68 -0
- data/lib/exerb/file_table.rb +189 -0
- data/lib/exerb/mkexy.rb +81 -0
- data/lib/exerb/name_table.rb +120 -0
- data/lib/exerb/recipe.rb +465 -0
- data/lib/exerb/resource.rb +190 -0
- data/lib/exerb/resource/base.rb +29 -0
- data/lib/exerb/resource/binary.rb +31 -0
- data/lib/exerb/resource/dialog.rb +30 -0
- data/lib/exerb/resource/group_icon.rb +85 -0
- data/lib/exerb/resource/icon.rb +52 -0
- data/lib/exerb/resource/version_info.rb +155 -0
- data/lib/exerb/resource_library.rb +120 -0
- data/lib/exerb/utility.rb +95 -0
- data/lib/exerb/utility2.rb +122 -0
- data/lib/exerb/version.rb +13 -0
- data/lib/exerb/win32/const/resource.rb +51 -0
- data/lib/exerb/win32/icon_file.rb +78 -0
- data/lib/exerb/win32/pe_file.rb +59 -0
- data/lib/exerb/win32/resource_directory.rb +105 -0
- data/lib/exerb/win32/resource_directory_root.rb +67 -0
- data/lib/exerb/win32/resource_entry.rb +98 -0
- data/lib/exerb/win32/struct/base.rb +43 -0
- data/lib/exerb/win32/struct/icon_dir_entry.rb +83 -0
- data/lib/exerb/win32/struct/icon_header.rb +43 -0
- data/lib/exerb/win32/struct/icon_res_entry.rb +48 -0
- data/lib/exerb/win32/struct/image_dos_header.rb +73 -0
- data/lib/exerb/win32/struct/image_file_header.rb +47 -0
- data/lib/exerb/win32/struct/image_nt_headers32.rb +53 -0
- data/lib/exerb/win32/struct/image_optional_header32.rb +107 -0
- data/lib/exerb/win32/struct/image_resource_data_entry.rb +45 -0
- data/lib/exerb/win32/struct/image_resource_directory.rb +47 -0
- data/lib/exerb/win32/struct/image_resource_directory_entry.rb +72 -0
- data/lib/exerb/win32/struct/image_section_header.rb +53 -0
- data/lib/exerb/win32/struct/version_info_block.rb +75 -0
- data/lib/exerb/win32/struct/vs_fixed_file_info.rb +62 -0
- data/src/exerb/cui.c +48 -0
- data/src/exerb/default.rb +1 -0
- data/src/exerb/exerb.c +877 -0
- data/src/exerb/exerb.h +92 -0
- data/src/exerb/gui.c +176 -0
- data/src/exerb/module.c +138 -0
- data/src/exerb/module.h +7 -0
- data/src/exerb/patch.c +27 -0
- data/src/exerb/resource.h +22 -0
- data/src/exerb/resource.rc +121 -0
- data/src/exerb/ruby.ico +0 -0
- data/src/exerb/utility.c +263 -0
- data/src/exerb/utility.h +33 -0
- data/test/alltests.rb +16 -0
- data/test/test-argv.rb +26 -0
- data/test/test-argv/test-argv.rb +9 -0
- data/test/test-argv/test-argv.ret +1 -0
- data/test/test-dollarzero.rb +26 -0
- data/test/test-dollarzero/test-dollarzero.rb +10 -0
- data/test/test-dollarzero/test-dollarzero.ret +2 -0
- data/test/test-dot.rb +26 -0
- data/test/test-dot/dot.dot.dot.rb +9 -0
- data/test/test-dot/dot.dot.rb +9 -0
- data/test/test-dot/test-dot.rb +13 -0
- data/test/test-dot/test-dot.ret +5 -0
- data/test/test-exitcode.rb +28 -0
- data/test/test-exitcode/test-exitcode.rb +9 -0
- data/test/test-kcode.rb +43 -0
- data/test/test-kcode/euc.rb +10 -0
- data/test/test-kcode/euc.ret +2 -0
- data/test/test-kcode/none.rb +10 -0
- data/test/test-kcode/none.ret +2 -0
- data/test/test-kcode/sjis.rb +10 -0
- data/test/test-kcode/sjis.ret +2 -0
- data/test/test-kcode/utf8.rb +10 -0
- data/test/test-kcode/utf8.ret +2 -0
- data/test/test-loadpath.rb +24 -0
- data/test/test-loadpath/test-loadpath.rb +9 -0
- data/test/test-nest.rb +18 -0
- data/test/test-nest/foo.rb +1 -0
- data/test/test-nest/foo/bar.rb +2 -0
- data/test/test-nest/foo/foo.rb +1 -0
- data/test/test-nest/test-nest.rb +1 -0
- data/test/test-nest/test-nest.ret +1 -0
- data/test/test-preload.rb +24 -0
- data/test/test-preload/test-preload.rb +9 -0
- data/test/test-regexp.rb +26 -0
- data/test/test-regexp/test-regexp.rb +23 -0
- data/test/test-regexp/test-regexp.ret +13 -0
- data/test/test-require1.rb +26 -0
- data/test/test-require1/require1.rb +9 -0
- data/test/test-require1/require2.rb +9 -0
- data/test/test-require1/require3.rb +9 -0
- data/test/test-require1/require4.rb +9 -0
- data/test/test-require1/require5.rb +9 -0
- data/test/test-require1/require6.rb +9 -0
- data/test/test-require1/test-require1.rb +41 -0
- data/test/test-require1/test-require1.ret +27 -0
- data/test/test-socket.rb +26 -0
- data/test/test-socket/test-socket.rb +7 -0
- data/test/test-socket/test-socket.ret +1 -0
- data/test/testcase.rb +66 -0
- data/vendor/mkexports.rb +167 -0
- metadata +352 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
###############################
|
|
2
|
+
#
|
|
3
|
+
# contrib/toolbar.rb
|
|
4
|
+
#
|
|
5
|
+
# These modules/classes are contributed by Yukimi_Sake-san.
|
|
6
|
+
# Modified by nyasu <nyasu@osk.3web.ne.jp>
|
|
7
|
+
# Distributed at http://vruby.sourceforge.net/index.html
|
|
8
|
+
#
|
|
9
|
+
###############################
|
|
10
|
+
|
|
11
|
+
module WMsg
|
|
12
|
+
# WM_USER = 0x400
|
|
13
|
+
TB_ENABLEBUTTON = WM_USER + 1
|
|
14
|
+
TB_CHECKBUTTON = WM_USER + 2
|
|
15
|
+
TB_PRESSBUTTON = WM_USER + 3
|
|
16
|
+
TB_HIDEBUTTON = WM_USER + 4
|
|
17
|
+
TB_INDETERMINATE = WM_USER + 5
|
|
18
|
+
TB_ISBUTTONENABLED = WM_USER + 9
|
|
19
|
+
TB_ISBUTTONCHECKED = WM_USER + 10
|
|
20
|
+
TB_ISBUTTONPRESSED = WM_USER + 11
|
|
21
|
+
TB_ISBUTTONHIDDEN = WM_USER + 12
|
|
22
|
+
TB_ISBUTTONINDETERMINATE = WM_USER + 13
|
|
23
|
+
TB_SETSTATE = WM_USER + 17
|
|
24
|
+
TB_GETSTATE = WM_USER + 18
|
|
25
|
+
TB_ADDBITMAP = WM_USER + 19
|
|
26
|
+
TB_ADDBUTTONS = WM_USER + 20
|
|
27
|
+
TB_INSERTBUTTON = WM_USER + 21
|
|
28
|
+
TB_DELETEBUTTON = WM_USER + 22
|
|
29
|
+
TB_GETBUTTON = WM_USER + 23
|
|
30
|
+
TB_BUTTONCOUNT = WM_USER + 24
|
|
31
|
+
TB_COMMANDTOINDEX = WM_USER + 25
|
|
32
|
+
TB_SAVERESTOREA = WM_USER + 26
|
|
33
|
+
TB_SAVERESTOREW = WM_USER + 76
|
|
34
|
+
TB_CUSTOMIZE = WM_USER + 27
|
|
35
|
+
TB_ADDSTRINGA = WM_USER + 28
|
|
36
|
+
TB_GETITEMRECT = WM_USER + 29
|
|
37
|
+
TB_BUTTONSTRUCTSIZE = WM_USER + 30
|
|
38
|
+
TB_SETBUTTONSIZE = WM_USER + 31
|
|
39
|
+
TB_SETBITMAPSIZE = WM_USER + 32
|
|
40
|
+
TB_AUTOSIZE = WM_USER + 33
|
|
41
|
+
TB_GETTOOLTIPS = WM_USER + 35
|
|
42
|
+
TB_SETTOOLTIPS = WM_USER + 36
|
|
43
|
+
TB_SETPARENT = WM_USER + 37
|
|
44
|
+
TB_SETROWS = WM_USER + 39
|
|
45
|
+
TB_GETROWS = WM_USER + 40
|
|
46
|
+
TB_GETBITMAPFLAGS = WM_USER + 41
|
|
47
|
+
TB_SETCMDID = WM_USER + 42
|
|
48
|
+
TB_CHANGEBITMAP = WM_USER + 43
|
|
49
|
+
TB_GETBITMAP = WM_USER + 44
|
|
50
|
+
TB_GETBUTTONTEXTA = WM_USER + 45
|
|
51
|
+
TB_REPLACEBITMAP = WM_USER + 46
|
|
52
|
+
TB_SETINDENT = WM_USER + 47
|
|
53
|
+
TB_SETIMAGELIST = WM_USER + 48
|
|
54
|
+
TB_GETIMAGELIST = WM_USER + 49
|
|
55
|
+
TB_LOADIMAGES = WM_USER + 50
|
|
56
|
+
TB_GETRECT = WM_USER + 51 # wParam is the Cmd instead of index
|
|
57
|
+
TB_SETHOTIMAGELIST = WM_USER + 52
|
|
58
|
+
TB_GETHOTIMAGELIST = WM_USER + 53
|
|
59
|
+
TB_SETDISABLEDIMAGELIST = WM_USER + 54
|
|
60
|
+
TB_GETDISABLEDIMAGELIST = WM_USER + 55
|
|
61
|
+
TB_SETSTYLE = WM_USER + 56
|
|
62
|
+
TB_GETSTYLE = WM_USER + 57
|
|
63
|
+
TB_GETBUTTONSIZE = WM_USER + 58
|
|
64
|
+
TB_SETBUTTONWIDTH = WM_USER + 59
|
|
65
|
+
TB_SETMAXTEXTROWS = WM_USER + 60
|
|
66
|
+
TB_GETTEXTROWS = WM_USER + 61
|
|
67
|
+
TB_GETBUTTONTEXTW = WM_USER + 75
|
|
68
|
+
TB_ADDSTRINGW = WM_USER + 77
|
|
69
|
+
|
|
70
|
+
TBBF_LARGE = 1
|
|
71
|
+
|
|
72
|
+
TB_GETBUTTONINFO = WM_USER + 65
|
|
73
|
+
TB_SETBUTTONINFO = WM_USER + 66
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
TBN_FIRST = -700
|
|
77
|
+
TBN_GETBUTTONINFO = TBN_FIRST-0
|
|
78
|
+
TBN_BEGINDRAG = TBN_FIRST-1
|
|
79
|
+
TBN_ENDDRAG = TBN_FIRST-2
|
|
80
|
+
TBN_BEGINADJUST = TBN_FIRST-3
|
|
81
|
+
TBN_ENDADJUST = TBN_FIRST-4
|
|
82
|
+
TBN_RESET = TBN_FIRST-5
|
|
83
|
+
TBN_QUERYINSERT = TBN_FIRST-6
|
|
84
|
+
TBN_QUERYDELETE = TBN_FIRST-7
|
|
85
|
+
TBN_TOOLBARCHANGE = TBN_FIRST-8
|
|
86
|
+
TBN_CUSTHELP = TBN_FIRST-9
|
|
87
|
+
TBN_GETBUTTONINFOW = TBN_FIRST-20
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
module WConst
|
|
91
|
+
TBSTATE_CHECKED = 1
|
|
92
|
+
TBSTATE_PRESSED = 2
|
|
93
|
+
TBSTATE_ENABLED = 4
|
|
94
|
+
TBSTATE_HIDDEN = 8
|
|
95
|
+
TBSTATE_INDETERMINATE = 16
|
|
96
|
+
TBSTATE_WRAP = 32
|
|
97
|
+
|
|
98
|
+
TBSTYLE_BUTTON = 0
|
|
99
|
+
TBSTYLE_SEP = 1
|
|
100
|
+
TBSTYLE_CHECK = 2
|
|
101
|
+
TBSTYLE_GROUP = 4
|
|
102
|
+
TBSTYLE_CHECKGROUP = (TBSTYLE_GROUP|TBSTYLE_CHECK)
|
|
103
|
+
TBSTYLE_TOOLTIPS = 256
|
|
104
|
+
TBSTYLE_WRAPABLE = 512
|
|
105
|
+
TBSTYLE_ALTDRAG = 1024
|
|
106
|
+
TBSTYLE_FLAT = 2048
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
TBIF_IMAGE = 0x00000001
|
|
110
|
+
TBIF_TEXT = 0x00000002
|
|
111
|
+
TBIF_STATE = 0x00000004
|
|
112
|
+
TBIF_STYLE = 0x00000008
|
|
113
|
+
TBIF_LPARAM = 0x00000010
|
|
114
|
+
TBIF_COMMAND = 0x00000020
|
|
115
|
+
TBIF_SIZE = 0x00000040
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
module WStruct
|
|
119
|
+
TB_BUTTON = "IICCCCLI"
|
|
120
|
+
# int iBitmap;int idCommand; BYTE fsState; BYTE fsStyle;
|
|
121
|
+
# BYTE[2] fsReserved; DWORD dwData;int iString;
|
|
122
|
+
TBNOTIFY = NMHDR+"I"+TB_BUTTON+"IP"
|
|
123
|
+
# NMHDR hdr; int iItem; TBBUTTON tbButton;
|
|
124
|
+
# int cchText; LPTSTR pszText;
|
|
125
|
+
TBADDBITMAP="UU"
|
|
126
|
+
#HINSTANCE hInst; UINT nID;
|
|
127
|
+
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
module VRToolbarUseable
|
|
131
|
+
=begin
|
|
132
|
+
== VRToolbarUseable
|
|
133
|
+
If you include this module in parent, you can solve the fault of a notify
|
|
134
|
+
events at the time of including a VRComCtlContainer, since toolbar buttons
|
|
135
|
+
are set to _vr_toolbar_buttons which is an original variable.
|
|
136
|
+
When not including this module , toolbar buttons are set to _vr_contorols
|
|
137
|
+
for back compatibility.
|
|
138
|
+
=end
|
|
139
|
+
require 'vr/vrcontrol'
|
|
140
|
+
include VRStdControlContainer
|
|
141
|
+
attr :_vr_toolbar_buttons
|
|
142
|
+
alias self_wmcommand_org self_wmcommand
|
|
143
|
+
|
|
144
|
+
def self_wmcommand(msg)
|
|
145
|
+
if @_vr_toolbar_buttons then
|
|
146
|
+
tbbid=LOWORD(msg.wParam)
|
|
147
|
+
tbbmid=HIWORD(msg.wParam)
|
|
148
|
+
c = @_vr_toolbar_buttons[tbbid]
|
|
149
|
+
if c then
|
|
150
|
+
c._vr_cmdhandlers[tbbmid].each{|shandler|
|
|
151
|
+
args=msgarg2handlerarg(shandler[1],msg,shandler[2])
|
|
152
|
+
c.__send__(shandler[0],*args) if c.respond_to?(shandler[0])
|
|
153
|
+
msg.retval = controlmsg_dispatching(c,shandler[0],*args)
|
|
154
|
+
} if c._vr_cmdhandlers and c._vr_cmdhandlers[tbbmid]
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
self_wmcommand_org(msg)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def registerToolbarButton(c,name,id)
|
|
161
|
+
@_vr_toolbar_buttons = {} unless @_vr_toolbar_buttons
|
|
162
|
+
c.etc= id
|
|
163
|
+
c.name=name
|
|
164
|
+
@_vr_toolbar_buttons[id]=c
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
class VRToolbar < VRNotifyControl
|
|
170
|
+
=begin
|
|
171
|
+
== VRToolbar
|
|
172
|
+
This class represents Toolbar.
|
|
173
|
+
|
|
174
|
+
=== Methods
|
|
175
|
+
--- insertButton(i,name,style=TBSTYLE_BUTTON)
|
|
176
|
+
Inserts a button as ((|i|))-th button. ((|style|)) can be
|
|
177
|
+
a constant in WConst such as TBSTYLE_BUTTON (default),
|
|
178
|
+
TBSTYLE_SEP (separator), TBSTYLE_CHECK,...
|
|
179
|
+
--- addButton(style)
|
|
180
|
+
Adds a button at last of the buttons.
|
|
181
|
+
--- deleteButton(i)
|
|
182
|
+
Deletes a button at ((|i|))-th.
|
|
183
|
+
--- clearButtons
|
|
184
|
+
Deletes all buttons.
|
|
185
|
+
--- countButtons
|
|
186
|
+
Counts buttons.
|
|
187
|
+
--- setImagelist(imglist)
|
|
188
|
+
Sets the imagelist for the toolbar. ((|imglist|)) must be an instance of
|
|
189
|
+
SWin::Imagelist.
|
|
190
|
+
--- setParent(hwnd)
|
|
191
|
+
Sets the window to nofify command messages.
|
|
192
|
+
--- autoSize
|
|
193
|
+
Resizes toolbar.
|
|
194
|
+
--- indeterminateOf(i,bool=true)
|
|
195
|
+
Sets the indeterminate state of the ((|i|))-th button.
|
|
196
|
+
--- commandToIndex(id)
|
|
197
|
+
Retrieves the index number for the button whose id is ((|id|)).
|
|
198
|
+
This id is used in WM_COMMAND messages.
|
|
199
|
+
--- enableButton(i,bool=true)
|
|
200
|
+
Enables or disables the ((|i|))-th button.
|
|
201
|
+
--- getButtonStateOf(id)
|
|
202
|
+
Gets the state of the button whose id is ((|id|)).
|
|
203
|
+
--- setButtonStateOf(i,state)
|
|
204
|
+
Sets the state of the button whose id is ((|id|)).
|
|
205
|
+
--- setButtons(buttons)
|
|
206
|
+
Sets the array of ((|button|)) to a tool bar at once.
|
|
207
|
+
((|button|)) must be an array of ((|[name,style]|))
|
|
208
|
+
--- enumButtons
|
|
209
|
+
Yields all toolbar buttons which are instance of
|
|
210
|
+
VRToolbar::VRToolbarButton.
|
|
211
|
+
=== Event Handler
|
|
212
|
+
--- ????_clicked
|
|
213
|
+
Fired when the button clicked.
|
|
214
|
+
|
|
215
|
+
== VRToolbar::VRToolbarButton
|
|
216
|
+
This class is for each toolbar buttons. This resemble menus in using it.
|
|
217
|
+
|
|
218
|
+
=== Methods
|
|
219
|
+
--- state
|
|
220
|
+
Returns the state of the button.
|
|
221
|
+
--- checked?
|
|
222
|
+
Returns true if the button is checked/pushed.
|
|
223
|
+
=end
|
|
224
|
+
|
|
225
|
+
include WConst
|
|
226
|
+
|
|
227
|
+
class VRToolbarButton
|
|
228
|
+
attr :name,1
|
|
229
|
+
attr :etc,1
|
|
230
|
+
attr :index
|
|
231
|
+
attr :toolbar
|
|
232
|
+
|
|
233
|
+
def _vr_cmdhandlers
|
|
234
|
+
{0=>[["clicked",MSGTYPE::ARGNONE,nil]]}
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def initialize(i,toolbar)
|
|
238
|
+
@index,@toolbar = i,toolbar
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def state
|
|
242
|
+
@toolbar.getButtonStateOf(@etc)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def checked?
|
|
246
|
+
(state&1)==1
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def VRToolbar.Controltype() ["ToolbarWindow32",0] end
|
|
252
|
+
|
|
253
|
+
def vrinit
|
|
254
|
+
super
|
|
255
|
+
sendMessage WMsg::TB_BUTTONSTRUCTSIZE ,20,0
|
|
256
|
+
if defined?(VRTooltip) and defined?(@parent.tooltip) and @parent.tooltip then
|
|
257
|
+
sendMessage WMsg::TB_SETTOOLTIPS,@parent.tooltip.hWnd,0
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def setButtonText(i,text)
|
|
262
|
+
if text.length>0 then
|
|
263
|
+
iid = indexToCommand(i)
|
|
264
|
+
tbi = [4*8,WConst::TBIF_TEXT,iid,0,0,0,text,text.length].pack("llllilpl")
|
|
265
|
+
sendMessage WMsg::TB_SETBUTTONINFO,i,tbi
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def insertButton(i,name,tbStyle=TBSTYLE_BUTTON)
|
|
270
|
+
@_vr_tbbuttons = -1 unless defined?(@_vr_tbbuttons)
|
|
271
|
+
@_vr_tbbuttons += 1 unless tbStyle == TBSTYLE_SEP
|
|
272
|
+
id = @parent.newControlID
|
|
273
|
+
tbb=@screen.application.arg2cstructStr(WStruct::TB_BUTTON,
|
|
274
|
+
@_vr_tbbuttons,id,
|
|
275
|
+
((tbStyle == TBSTYLE_SEP)? 0 : 4),tbStyle,0,0,0,0)
|
|
276
|
+
sendMessage WMsg::TB_INSERTBUTTON,i,tbb
|
|
277
|
+
i = commandToIndex(id)
|
|
278
|
+
r=VRToolbarButton.new(i,self)
|
|
279
|
+
if @parent.respond_to?(:registerToolbarButton) then
|
|
280
|
+
@parent.registerToolbarButton(r,name,id)
|
|
281
|
+
else
|
|
282
|
+
@parent.registerControl(r,name,id)
|
|
283
|
+
end
|
|
284
|
+
r
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def addButton(name,tbStyle=TBSTYLE_BUTTON)
|
|
288
|
+
insertButton(0xffff,name,tbStyle)
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def deleteButton(i)
|
|
292
|
+
sendMessage WMsg::TB_DELETEBUTTON,i,0
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def countButtons
|
|
296
|
+
r=sendMessage WMsg::TB_BUTTONCOUNT,0,0
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def clearButtons
|
|
300
|
+
(countButtons-1).downto(0) do |i|
|
|
301
|
+
deleteButton(i)
|
|
302
|
+
refresh
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def setParent(win)
|
|
307
|
+
hwnd = if win.is_a?(SWin::Window) then win.hwnd else win end
|
|
308
|
+
sendMessage WMsg::TB_SETPARENT,hwnd,0
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def autoSize
|
|
312
|
+
sendMessage WMsg::TB_AUTOSIZE ,0,0
|
|
313
|
+
refresh
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
def indeterminateOf(i,bool=true)
|
|
317
|
+
sendMessage WMsg::TB_INDETERMINATE,i,(if bool then -1 else 0 end)
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def setImagelist(imagelist)
|
|
321
|
+
raise "not Imagelist" unless imagelist.is_a?(SWin::Imagelist)
|
|
322
|
+
self.properties["imagelist"]=imagelist
|
|
323
|
+
sendMessage WMsg::TB_SETIMAGELIST,0,imagelist.himagelist
|
|
324
|
+
refresh
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
def commandToIndex(id)
|
|
328
|
+
sendMessage WMsg::TB_COMMANDTOINDEX,id,0
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def indexToCommand(i)
|
|
332
|
+
getButton(i)[1]
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def checked?(i)
|
|
336
|
+
(getButtonStateOf(i) & 1)==1
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def setButtonStateOf(id,state)
|
|
340
|
+
sendMessage WMsg::TB_SETSTATE,id,state
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def getButtonStateOf(id)
|
|
344
|
+
sendMessage WMsg::TB_GETSTATE,id,0
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
def enableButton(id,bool=true)
|
|
348
|
+
sendMessage WMsg::TB_ENABLEBUTTON,id,(if bool then 1 else 0 end)
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
def getButton(i)
|
|
352
|
+
tbb=@screen.application.arg2cstructStr(WStruct::TB_BUTTON,
|
|
353
|
+
0,0,0,0,0,0,0,0)
|
|
354
|
+
sendMessage WMsg::TB_GETBUTTON ,i ,tbb
|
|
355
|
+
@screen.application.unpack(tbb,WStruct::TB_BUTTON)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def setButtons(a)
|
|
359
|
+
a.each{|i| addButton(i[0], (i[1] ? i[1] : TBSTYLE_BUTTON))}
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
def enumButtons
|
|
363
|
+
raise "Use VRToolbarUseable" unless parent.respond_to? :_vr_toolbar_buttons
|
|
364
|
+
n = countButtons
|
|
365
|
+
raise "unknown error" unless n == parent._vr_toolbar_buttons.size
|
|
366
|
+
parent._vr_toolbar_buttons.each{|key,val|
|
|
367
|
+
yield val
|
|
368
|
+
}
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
###############################
|
|
2
|
+
#
|
|
3
|
+
# contrib/vrctlcolor.rb
|
|
4
|
+
#
|
|
5
|
+
# These modules/classes are contributed by Shigitani-san.
|
|
6
|
+
# Modified by nyasu <nyasu@osk.3web.ne.jp>
|
|
7
|
+
# Distributed at http://vruby.sourceforge.net/index.html
|
|
8
|
+
#
|
|
9
|
+
###############################
|
|
10
|
+
|
|
11
|
+
=begin
|
|
12
|
+
=== VRCtlColor
|
|
13
|
+
VisualuRuby �ɂ����āAWM_CTLCOLOR ���������郂�W���[���B
|
|
14
|
+
|
|
15
|
+
=== Methods
|
|
16
|
+
--- addCtlColor(ctl)
|
|
17
|
+
WM_CTLCOLOR ��������Ƃ��ɏ�������Ώۂ̃R���g���[����o�^����B
|
|
18
|
+
�Ȃ��A�o�^����Ƃ��� ctl �ɂ� setCtlTextColor, setCtlBkColor �� 2 �̓��ك��\�b�h
|
|
19
|
+
���lj�����܂��B
|
|
20
|
+
|
|
21
|
+
--- setChildTextColor(ctl, textcolor)
|
|
22
|
+
--- setChildBkColor(ctl, bkcolor)
|
|
23
|
+
�o�^�����R���g���[���̃e�L�X�g�F�A�w�i�F��ݒ肷��B�o�^����Ă��Ȃ��R���g
|
|
24
|
+
���[�����w�肵���ꍇ�͉������Ȃ��B
|
|
25
|
+
|
|
26
|
+
--- ctl.setCtlTextColor(textcolor)
|
|
27
|
+
--- ctl.setCtlBkColor(bkcolor)
|
|
28
|
+
addCtlColor �Œlj����ꂽ���ك��\�b�h�B�R���g���[���̃e�L�X�g�F�A�w�i�F��ݒ�
|
|
29
|
+
����B
|
|
30
|
+
=end
|
|
31
|
+
|
|
32
|
+
module WMsg
|
|
33
|
+
WM_CTLCOLORMSGBOX = 0x0132
|
|
34
|
+
WM_CTLCOLOREDIT = 0x0133
|
|
35
|
+
WM_CTLCOLORLISTBOX = 0x0134
|
|
36
|
+
WM_CTLCOLORBTN = 0x0135
|
|
37
|
+
WM_CTLCOLORDLG = 0x0136
|
|
38
|
+
WM_CTLCOLORSCROLLBAR = 0x0137
|
|
39
|
+
WM_CTLCOLORSTATIC = 0x0138
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
module VRCtlColor
|
|
43
|
+
|
|
44
|
+
include VRMessageHandler
|
|
45
|
+
|
|
46
|
+
def vrctlcolorinit
|
|
47
|
+
@win32_getBkColor = Win32API.new('gdi32.dll', 'GetBkColor', 'I', 'I')
|
|
48
|
+
@win32_setBkColor = Win32API.new('gdi32.dll', 'SetBkColor', 'II', 'I')
|
|
49
|
+
@win32_setTextColor = Win32API.new('gdi32.dll', 'SetTextColor', 'II', 'I')
|
|
50
|
+
@win32_createSolidBrush = Win32API.new('gdi32.dll', 'CreateSolidBrush', 'I', 'I')
|
|
51
|
+
@win32_deleteObject = Win32API.new('gdi32.dll', 'DeleteObject', 'I', 'I')
|
|
52
|
+
|
|
53
|
+
@_vrctlcolor = Hash.new
|
|
54
|
+
@_vrctlcolor_brush = Hash.new
|
|
55
|
+
|
|
56
|
+
msgs = [ WMsg::WM_CTLCOLORMSGBOX, WMsg::WM_CTLCOLOREDIT, WMsg::WM_CTLCOLORLISTBOX,
|
|
57
|
+
WMsg::WM_CTLCOLORBTN, WMsg::WM_CTLCOLORDLG, WMsg::WM_CTLCOLORSCROLLBAR,
|
|
58
|
+
WMsg::WM_CTLCOLORSTATIC ]
|
|
59
|
+
msgs.each {|msg| addHandler(msg, 'ctlcolor', MSGTYPE::ARGINTINT, nil) }
|
|
60
|
+
acceptEvents(msgs)
|
|
61
|
+
addHandler WMsg::WM_DESTROY,"_vrdestroy",MSGTYPE::ARGNONE,nil
|
|
62
|
+
acceptEvents [WMsg::WM_DESTROY]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def vrinit
|
|
66
|
+
super
|
|
67
|
+
vrctlcolorinit
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def addCtlColor(ctl)
|
|
71
|
+
@_vrctlcolor[ctl.hWnd] = [nil, nil]
|
|
72
|
+
def ctl.setCtlTextColor(textcolor)
|
|
73
|
+
parent.setChildTextColor(self, textcolor)
|
|
74
|
+
end
|
|
75
|
+
def ctl.setCtlBkColor(bkcolor)
|
|
76
|
+
parent.setChildBkColor(self, bkcolor)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def setChildTextColor(ctl, textcolor)
|
|
81
|
+
return unless @_vrctlcolor.has_key?(ctl.hWnd)
|
|
82
|
+
@_vrctlcolor[ctl.hWnd][0] = textcolor
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def setChildBkColor(ctl, bkcolor)
|
|
86
|
+
return unless @_vrctlcolor.has_key?(ctl.hWnd)
|
|
87
|
+
@_vrctlcolor[ctl.hWnd][1] = bkcolor
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self_ctlcolor(hDC, hWnd)
|
|
91
|
+
return nil unless @_vrctlcolor.has_key?(hWnd)
|
|
92
|
+
textcolor, bkcolor = @_vrctlcolor[hWnd]
|
|
93
|
+
@win32_setTextColor.call(hDC, textcolor) unless textcolor.nil?
|
|
94
|
+
bkcolor = @win32_getBkColor.call(hDC) if bkcolor.nil?
|
|
95
|
+
@win32_setBkColor.call(hDC, bkcolor)
|
|
96
|
+
SKIP_DEFAULTHANDLER[get_brush(bkcolor)]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def get_brush(bkcolor)
|
|
100
|
+
unless @_vrctlcolor_brush.has_key?(bkcolor) then
|
|
101
|
+
@_vrctlcolor_brush[bkcolor] = @win32_createSolidBrush.call(bkcolor)
|
|
102
|
+
end
|
|
103
|
+
@_vrctlcolor_brush[bkcolor]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self__vrdestroy
|
|
107
|
+
@_vrctlcolor_brush.values.each {|brush| @win32_deleteObject.call(brush) }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end
|