exerb 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,148 @@
|
|
1
|
+
###################################
|
2
|
+
#
|
3
|
+
# vrtimer.rb
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
5
|
+
# Copyright 1999-2005 Nishikawa,Yasuhiro
|
6
|
+
#
|
7
|
+
# More information at http://vruby.sourceforge.net/index.html
|
8
|
+
#
|
9
|
+
#
|
10
|
+
###################################
|
11
|
+
|
12
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
13
|
+
require VR_DIR+'vruby'
|
14
|
+
require "Win32API"
|
15
|
+
|
16
|
+
=begin
|
17
|
+
= VisualuRuby(tmp) Module(s) for Timer
|
18
|
+
<<<handlers.rd
|
19
|
+
=end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
module VRTimerFeasible
|
24
|
+
=begin
|
25
|
+
== VRTimerFeasible
|
26
|
+
Interval Timers.
|
27
|
+
This module prepares create/delete interval timers.
|
28
|
+
|
29
|
+
=== Methods
|
30
|
+
--- addTimer(interval=1000,timername="self")
|
31
|
+
Creates an interval timer whose name is defined by ((|timername|)).
|
32
|
+
Interval timers invoke ((|timername|))_timer method every interval times
|
33
|
+
in millisecond.
|
34
|
+
|
35
|
+
--- deleteTimer(timername="self")
|
36
|
+
Deletes an interval timer whose name is ((|timername|))
|
37
|
+
|
38
|
+
--- timeralive?(timername="self")
|
39
|
+
Returns boolean whether timer is alive or not.
|
40
|
+
|
41
|
+
=== Event handler
|
42
|
+
--- ????_timer
|
43
|
+
Fired every interval times by the interval timer.
|
44
|
+
=end
|
45
|
+
|
46
|
+
|
47
|
+
include VRMessageHandler
|
48
|
+
|
49
|
+
SetTimer = Win32API.new("USER32", "SetTimer",['L', 'I', 'I', 'L'], 'I')
|
50
|
+
KillTimer = Win32API.new("USER32", "KillTimer",['L', 'L'], 'I')
|
51
|
+
WM_TIMER = 275
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def newtimerid
|
56
|
+
@_vr_timernextid=0 unless defined? @_vr_timernextid
|
57
|
+
@_vr_timernextid+=1
|
58
|
+
end
|
59
|
+
|
60
|
+
public
|
61
|
+
|
62
|
+
def self_vrtimer(id) # WM_TIMER handler
|
63
|
+
name=@_vr_timers[id][0].dup
|
64
|
+
class << name
|
65
|
+
def name; self; end
|
66
|
+
end
|
67
|
+
# name += "_"+"timer"
|
68
|
+
# selfmsg_dispatching(name)
|
69
|
+
controlmsg_dispatching(name,"timer")
|
70
|
+
#
|
71
|
+
__send__(name) if respond_to?(name)
|
72
|
+
end
|
73
|
+
|
74
|
+
def vrinit
|
75
|
+
super
|
76
|
+
timerfeasibleinit
|
77
|
+
end
|
78
|
+
|
79
|
+
def timerfeasibleinit
|
80
|
+
@_vr_timerinterval=1000
|
81
|
+
addHandler WM_TIMER, "vrtimer", MSGTYPE::ARGWINT,nil #check
|
82
|
+
addEvent WM_TIMER
|
83
|
+
addNoRelayMessages [WM_TIMER]
|
84
|
+
end
|
85
|
+
|
86
|
+
def addTimer(interval=1000,timername="self")
|
87
|
+
id=newtimerid
|
88
|
+
SetTimer.call(self.hWnd,id,interval,0)
|
89
|
+
@_vr_timers=[] unless defined? @_vr_timers
|
90
|
+
@_vr_timers[id] = [timername,interval]
|
91
|
+
id
|
92
|
+
end
|
93
|
+
|
94
|
+
def deleteTimer(timername="self")
|
95
|
+
id=timerid(timername)
|
96
|
+
|
97
|
+
if id then
|
98
|
+
KillTimer.call(self.hWnd,id)
|
99
|
+
@_vr_timers[id]=nil
|
100
|
+
else
|
101
|
+
raise RuntimeError,"No such Timer"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def timerid(timername="self")
|
106
|
+
return nil unless @_vr_timers
|
107
|
+
r=nil
|
108
|
+
1.upto(@_vr_timers.size-1) do |i|
|
109
|
+
if @_vr_timers[i] and @_vr_timers[i][0]==timername then
|
110
|
+
r=i
|
111
|
+
end
|
112
|
+
end
|
113
|
+
r
|
114
|
+
end
|
115
|
+
|
116
|
+
def timeralive?(tname="self")
|
117
|
+
timerid(tname).is_a?(Integer)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
=begin sample
|
122
|
+
require 'vrcontrol'
|
123
|
+
module Test
|
124
|
+
include VRTimerFeasible
|
125
|
+
|
126
|
+
def construct
|
127
|
+
self.caption="test"
|
128
|
+
go=addControl VRButton,"delete","delete",10,10,100,20
|
129
|
+
addTimer 1000,"t1"
|
130
|
+
addTimer 1200,"t2"
|
131
|
+
end
|
132
|
+
|
133
|
+
def t1_timer
|
134
|
+
p "t1"
|
135
|
+
end
|
136
|
+
def t2_timer
|
137
|
+
print timeralive?("t1") ,":", timeralive?("t2"),"\n"
|
138
|
+
end
|
139
|
+
|
140
|
+
def delete_clicked
|
141
|
+
deleteTimer "t1"
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
VRLocalScreen.showForm(Test)
|
147
|
+
VRLocalScreen.messageloop
|
148
|
+
=end
|
@@ -0,0 +1,273 @@
|
|
1
|
+
###################################
|
2
|
+
#
|
3
|
+
# vrtooltip.rb
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
5
|
+
# Copyright 2001-2005 Nishikawa,Yasuhiro
|
6
|
+
#
|
7
|
+
# More information at http://vruby.sourceforge.net/index.html
|
8
|
+
#
|
9
|
+
###################################
|
10
|
+
|
11
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
12
|
+
require VR_DIR+'vruby'
|
13
|
+
|
14
|
+
module WMsg
|
15
|
+
TTM_ACTIVATE = WM_USER + 1
|
16
|
+
TTM_SETDELAYTIME = WM_USER + 3
|
17
|
+
TTM_ADDTOOL = WM_USER + 4
|
18
|
+
TTM_DELTOOL = WM_USER + 5
|
19
|
+
TTM_RELAYEVENT = WM_USER + 7
|
20
|
+
TTM_GETTOOLINFO = WM_USER + 8
|
21
|
+
TTM_SETTOOLINFO = WM_USER + 9
|
22
|
+
TTM_GETTEXT = WM_USER + 11
|
23
|
+
TTM_GETTOOLCOUNT = WM_USER + 13
|
24
|
+
TTM_TRACKACTIVATE = WM_USER + 17
|
25
|
+
TTM_TRACKPOSITION = WM_USER + 18
|
26
|
+
TTM_SETTIPBKCOLOR = WM_USER + 19
|
27
|
+
TTM_SETTIPTEXTCOLOR= WM_USER + 20
|
28
|
+
TTM_GETDELAYTIME = WM_USER + 21
|
29
|
+
TTM_GETTIPBKCOLOR = WM_USER + 22
|
30
|
+
TTM_GETTIPTEXTCOLOR= WM_USER + 23
|
31
|
+
TTM_SETMAXTIPWIDTH = WM_USER + 24
|
32
|
+
TTM_GETMAXTIPWIDTH = WM_USER + 25
|
33
|
+
|
34
|
+
TTN_NEEDTEXT = 0x100000000-520
|
35
|
+
TTN_SHOW = 0x100000000-521
|
36
|
+
TTN_POP = 0x100000000-522
|
37
|
+
end
|
38
|
+
|
39
|
+
module WConst
|
40
|
+
TTF_IDISHWND = 1
|
41
|
+
TTF_CENTERTIP = 2
|
42
|
+
TTF_SUBCLASS = 16
|
43
|
+
end
|
44
|
+
|
45
|
+
module WStruct
|
46
|
+
TOOLINFO = "IILLllllLp"
|
47
|
+
end
|
48
|
+
|
49
|
+
class VRTooltip < SWin::Window
|
50
|
+
=begin
|
51
|
+
== VRTooltip
|
52
|
+
This is a class for Tooltip window.
|
53
|
+
Tooltip windows are created by VRForm.createTooltip()
|
54
|
+
|
55
|
+
=== Methods
|
56
|
+
--- addTool(cntl,text)
|
57
|
+
Assigns a tooltip text for ((|cntl|)).
|
58
|
+
Returns a tooltip identifier.
|
59
|
+
--- addToolArea([sx,sy,ex,ey],text,wnd=self)
|
60
|
+
Assigns a tooltip text for the area in the parent window.
|
61
|
+
((|sx|)) and ((|sy|)) indicate left-top corner,
|
62
|
+
and ((|ex|)) and ((|ey|)) indicate right-bottom corner.
|
63
|
+
Returns a tooltip identifier.
|
64
|
+
--- delTool(idf)
|
65
|
+
Deletes a tool identified by ((|idf|)) returned by addTool or addToolArea
|
66
|
+
--- enumTool
|
67
|
+
Yields all tool identifiers.
|
68
|
+
--- maxtipwidth
|
69
|
+
--- maxtipwidth=(mw)
|
70
|
+
About the tooltip width.
|
71
|
+
If you are to use multiline tooltip, set this parameter.
|
72
|
+
--- autopopTime
|
73
|
+
--- autopopTime=
|
74
|
+
Sets/Gets time length that tooltip remains visible.
|
75
|
+
--- initialTime
|
76
|
+
--- initialTime=
|
77
|
+
Sets/Gets time length that the pointer must remain stationary.
|
78
|
+
--- reshowTime
|
79
|
+
--- reshowTime=
|
80
|
+
Sets/Gets time length to reshow another tool's tooltip.
|
81
|
+
|
82
|
+
--- bkColor
|
83
|
+
--- bkColor=
|
84
|
+
Sets/Gets background color of tooltip window
|
85
|
+
|
86
|
+
--- textColor
|
87
|
+
--- textColor=
|
88
|
+
Sets/Gets text color of tooltip window
|
89
|
+
|
90
|
+
--- activate=(f)
|
91
|
+
((|f|)) is boolean. This activates/deactivates the tooltip.
|
92
|
+
=end
|
93
|
+
|
94
|
+
class VRTooltipTool
|
95
|
+
attr :hwnd
|
96
|
+
attr :uid
|
97
|
+
attr :tool
|
98
|
+
def initialize(hwnd,uid,tool)
|
99
|
+
@hwnd,@uid,@tool = hwnd,uid,tool
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
def initialize
|
105
|
+
self.classname = "tooltips_class32"
|
106
|
+
self.style=1
|
107
|
+
self.exstyle= WExStyle::WS_EX_TOPMOST | WExStyle::WS_EX_TOOLWINDOW
|
108
|
+
@_vr_tools={}
|
109
|
+
end
|
110
|
+
|
111
|
+
def classcheck(cls,obj)
|
112
|
+
(eval("defined?(#{cls})") and obj.is_a?(eval(cls)))
|
113
|
+
end
|
114
|
+
|
115
|
+
def createTIPTOOLCore(wnd=@parent)
|
116
|
+
size=4*10
|
117
|
+
flag=WConst::TTF_SUBCLASS
|
118
|
+
hwnd=wnd.hWnd
|
119
|
+
uid= sx= sy= ex= ey= 0
|
120
|
+
hinst=@screen.application.hInstance
|
121
|
+
text=""
|
122
|
+
[size,flag,hwnd,uid,sx,sy,ex,ey,hinst,text]
|
123
|
+
end
|
124
|
+
|
125
|
+
def addToolCore(ti)
|
126
|
+
tis=ti.pack(WStruct::TOOLINFO)
|
127
|
+
sendMessage WMsg::TTM_ADDTOOL,0,tis
|
128
|
+
end
|
129
|
+
|
130
|
+
def getTOOLINFOCore(hwnd,uid)
|
131
|
+
ti=createTIPTOOLCore
|
132
|
+
ti[2]=hwnd
|
133
|
+
ti[3]=uid
|
134
|
+
ti[9] = "\0\0\0\0" * (1024/4+1) # /* Thanks, Wayne Vucenic */
|
135
|
+
tis = ti.pack(WStruct::TOOLINFO)
|
136
|
+
sendMessage WMsg::TTM_GETTOOLINFO,0,tis
|
137
|
+
tis.unpack(WStruct::TOOLINFO)
|
138
|
+
end
|
139
|
+
|
140
|
+
public
|
141
|
+
|
142
|
+
def setparam(parent,screen)
|
143
|
+
@parent,@screen = parent,screen unless defined? @screen
|
144
|
+
end
|
145
|
+
|
146
|
+
def activate=(f)
|
147
|
+
i = if f then 1 else 0 end
|
148
|
+
sendMessage WMsg::TTM_ACTIVATE,i,0
|
149
|
+
end
|
150
|
+
|
151
|
+
def maxtipwidth=(w)
|
152
|
+
s=[w].pack("L")
|
153
|
+
sendMessage WMsg::TTM_SETMAXTIPWIDTH,0,s
|
154
|
+
end
|
155
|
+
|
156
|
+
def maxtipwidth
|
157
|
+
sendMessage WMsg::TTM_GETMAXTIPWIDTH,0,0
|
158
|
+
end
|
159
|
+
|
160
|
+
def autopopTime
|
161
|
+
sendMessage WMsg::TTM_GETDELAYTIME,2,0
|
162
|
+
end
|
163
|
+
def initialTime
|
164
|
+
sendMessage WMsg::TTM_GETDELAYTIME,3,0
|
165
|
+
end
|
166
|
+
def reshowTime
|
167
|
+
sendMessage WMsg::TTM_GETDELAYTIME,1,0
|
168
|
+
end
|
169
|
+
def autopopTime=(msec)
|
170
|
+
sendMessage WMsg::TTM_SETDELAYTIME,2,MAKELPARAM(msec,0)
|
171
|
+
end
|
172
|
+
def initialTime=(msec)
|
173
|
+
sendMessage WMsg::TTM_SETDELAYTIME,3,MAKELPARAM(msec,0)
|
174
|
+
end
|
175
|
+
def reshowTime=(msec)
|
176
|
+
sendMessage WMsg::TTM_SETDELAYTIME,1,MAKELPARAM(msec,0)
|
177
|
+
end
|
178
|
+
|
179
|
+
def bkColor
|
180
|
+
sendMessage WMsg::TTM_GETTIPBKCOLOR,0,0
|
181
|
+
end
|
182
|
+
def bkColor=(c)
|
183
|
+
sendMessage WMsg::TTM_SETTIPBKCOLOR,c.to_i,0
|
184
|
+
end
|
185
|
+
def textColor
|
186
|
+
sendMessage WMsg::TTM_GETTIPTEXTCOLOR,0,0
|
187
|
+
end
|
188
|
+
def textColor=(c)
|
189
|
+
sendMessage WMsg::TTM_SETTIPTEXTCOLOR,c.to_i,0
|
190
|
+
end
|
191
|
+
|
192
|
+
def addTool(cnt,text)
|
193
|
+
if classcheck("VRStatic",cnt) then
|
194
|
+
sx=cnt.x; sy=cnt.y; ex=sx+cnt.w; ey=sy+cnt.h
|
195
|
+
rect = [sx,sy,ex,ey]
|
196
|
+
return addToolArea(rect,text)
|
197
|
+
end
|
198
|
+
if classcheck("VRToolbar::VRToolbarButton",cnt) then
|
199
|
+
rect = [0,0,0,0].pack("LLLL")
|
200
|
+
cnt.toolbar.sendMessage WMsg::TB_GETITEMRECT,cnt.index,rect
|
201
|
+
return addToolArea(rect.unpack("LLLL"),text,cnt.toolbar)
|
202
|
+
end
|
203
|
+
|
204
|
+
ti = createTIPTOOLCore
|
205
|
+
ti[1] |= WConst::TTF_IDISHWND
|
206
|
+
ti[3] = cnt.hWnd
|
207
|
+
ti[9] =text
|
208
|
+
addToolCore(ti)
|
209
|
+
@_vr_tools[ ti[2,2] ] = VRTooltipTool.new(@parent.hWnd,cnt.hWnd,cnt)
|
210
|
+
end
|
211
|
+
|
212
|
+
def addToolArea(rect,text,wnd=@parent)
|
213
|
+
sx,sy,ex,ey = *rect
|
214
|
+
ti = createTIPTOOLCore wnd
|
215
|
+
ti[3] = @parent.newControlID
|
216
|
+
ti[4]=sx ; ti[5]=sy; ti[6]=ex ; ti[7]=ey
|
217
|
+
ti[9] =text
|
218
|
+
addToolCore(ti)
|
219
|
+
@_vr_tools[ ti[2,2] ] = VRTooltipTool.new(@parent.hWnd,ti[3],rect)
|
220
|
+
end
|
221
|
+
|
222
|
+
def delTool(ttt)
|
223
|
+
raise "Requires VRTooltipTool (#{ttt.class})" unless ttt.is_a?(VRTooltipTool)
|
224
|
+
ti=createTIPTOOLCore
|
225
|
+
ti[2] = ttt.hwnd
|
226
|
+
ti[3] = ttt.uid
|
227
|
+
tts = ti.pack(WStruct::TOOLINFO)
|
228
|
+
@_vr_tools.delete(ti[2,2])
|
229
|
+
sendMessage WMsg::TTM_DELTOOL,0,tts
|
230
|
+
end
|
231
|
+
|
232
|
+
def enumTool
|
233
|
+
r = sendMessage WMsg::TTM_GETTOOLCOUNT,0,0
|
234
|
+
raise "Unknown error" if r!=@_vr_tools.size
|
235
|
+
@_vr_tools.each do |key,val|
|
236
|
+
yield val
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def getTextOf(ttt,maxlength=1024) # there is no way to determine the length
|
241
|
+
ti = createTIPTOOLCore
|
242
|
+
buffer = "\0\0\0\0" * (maxlength/4+1)
|
243
|
+
ti[2] = ttt.hwnd
|
244
|
+
ti[3] = ttt.uid
|
245
|
+
ti[9] = buffer
|
246
|
+
tis = ti.pack(WStruct::TOOLINFO)
|
247
|
+
sendMessage WMsg::TTM_GETTEXT,0,tis
|
248
|
+
buffer.gsub!(/\0.*/,'')
|
249
|
+
buffer
|
250
|
+
end
|
251
|
+
|
252
|
+
def setTextOf(ttt,text)
|
253
|
+
ti = getTOOLINFOCore(ttt.hwnd,ttt.uid)
|
254
|
+
ti[9] = text
|
255
|
+
tis = ti.pack(WStruct::TOOLINFO)
|
256
|
+
sendMessage WMsg::TTM_SETTOOLINFO,0,tis
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
|
262
|
+
class VRForm
|
263
|
+
attr :tooltip
|
264
|
+
def createTooltip
|
265
|
+
return tooltip if defined?(@tooltip) && @tooltip
|
266
|
+
@tooltip = @screen.factory.newwindow(self,VRTooltip)
|
267
|
+
@tooltip.setparam self,@screen
|
268
|
+
@tooltip.create
|
269
|
+
@tooltip.etc = newControlID # error occurs if this line is before creation
|
270
|
+
@tooltip.top(-1)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
@@ -0,0 +1,143 @@
|
|
1
|
+
###################################
|
2
|
+
#
|
3
|
+
# vrtray.rb
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
5
|
+
# Copyright 2002-2005 Nishikawa,Yasuhiro
|
6
|
+
#
|
7
|
+
# More information at http://vruby.sourceforge.net/index.html
|
8
|
+
#
|
9
|
+
###################################
|
10
|
+
|
11
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
12
|
+
require VR_DIR+'vruby'
|
13
|
+
|
14
|
+
module VRTrayiconFeasible
|
15
|
+
=begin
|
16
|
+
== VRTrayiconFeasible
|
17
|
+
This modules is included to create/delete/modify tray icons.
|
18
|
+
|
19
|
+
=== Methods
|
20
|
+
--- create_trayicon(icon=DEFAULTICON,tiptext="",icon_id=0)
|
21
|
+
Creates new trayicon in the tasktray.((|icon|)) is hIcon of the trayicon and
|
22
|
+
the trayicon has tooltip text ((|tiptext|)).
|
23
|
+
When argument ((|icon|)) is nil, icon will set as DEFAULTICON.
|
24
|
+
To distinguish multiple trayicon, ((|icon_id|)) information is added to it.
|
25
|
+
--- delete_trayicon(icon_id=0)
|
26
|
+
Deletes the trayicon specified by ((|icon_id|))
|
27
|
+
--- modify_trayicon(hicon,tiptext,iconid=0)
|
28
|
+
Modifies the trayicon's icon/tiptext.
|
29
|
+
|
30
|
+
=== Event Handlers
|
31
|
+
--- self_traymousemove(icon_id)
|
32
|
+
Fired when mouse cursor is moved over the trayicon.
|
33
|
+
--- self_traylbuttondown(icon_id)
|
34
|
+
Fired when mouse left-button down on the trayicon.
|
35
|
+
--- self_traylbuttonup(icon_id)
|
36
|
+
Fired when mouse left-button up on the trayicon.
|
37
|
+
--- self_trayrbuttondown(icon_id)
|
38
|
+
Fired when mouse right-button down on the trayicon.
|
39
|
+
--- self_trayrbuttonup(icon_id)
|
40
|
+
Fired when mouse right-button up on the trayicon.
|
41
|
+
=end
|
42
|
+
|
43
|
+
|
44
|
+
include VRUserMessageUseable
|
45
|
+
|
46
|
+
Shell_NotifyIcon=Win32API.new("shell32","Shell_NotifyIcon","IP","I")
|
47
|
+
|
48
|
+
NOTIFYICONDATA_a = "IIIIII"
|
49
|
+
DEFAULTICON = Win32API.new("user32","LoadIcon","II","I").call(0,32512)
|
50
|
+
|
51
|
+
NIF_MESSAGE = 1
|
52
|
+
NIF_ICON = 2
|
53
|
+
NIF_TIP = 4
|
54
|
+
NIM_ADD = 0
|
55
|
+
NIM_MODIFY = 1
|
56
|
+
NIM_DELETE = 2
|
57
|
+
|
58
|
+
def vrinit
|
59
|
+
super
|
60
|
+
trayiconfeasibleinit
|
61
|
+
end
|
62
|
+
|
63
|
+
def trayiconfeasibleinit
|
64
|
+
@_vr_traynotify_msg = registerUserMessage(ReservedMsg::WM_VR_TRAYNOTIFY,"_vr_traynotify")
|
65
|
+
end
|
66
|
+
|
67
|
+
def create_trayicon(icon=DEFAULTICON,tiptext="",iconid=0)
|
68
|
+
icon = DEFAULTICON unless icon
|
69
|
+
tip = tiptext.to_s
|
70
|
+
s = [4*6+64,
|
71
|
+
self.hWnd,iconid,NIF_MESSAGE|NIF_ICON|NIF_TIP,
|
72
|
+
@_vr_traynotify_msg,icon ].pack(NOTIFYICONDATA_a) <<
|
73
|
+
tip << "\0"*(64-tip.length)
|
74
|
+
Shell_NotifyIcon.call(NIM_ADD,s)
|
75
|
+
end
|
76
|
+
|
77
|
+
def delete_trayicon(iconid=0)
|
78
|
+
s = [4*6+64,
|
79
|
+
self.hWnd,iconid,0,0,0].pack(NOTIFYICONDATA_a) << "\0"*64
|
80
|
+
Shell_NotifyIcon.call(NIM_DELETE,s)
|
81
|
+
end
|
82
|
+
|
83
|
+
def modify_trayicon(hicon,tiptext,iconid=0)
|
84
|
+
flag=0
|
85
|
+
if hicon then
|
86
|
+
flag |= NIF_ICON
|
87
|
+
end
|
88
|
+
if tiptext then
|
89
|
+
flag |= NIF_TIP
|
90
|
+
end
|
91
|
+
tip = tiptext.to_s
|
92
|
+
s = [4*6+64, self.hWnd,iconid,flag,0,hicon.to_i].pack(NOTIFYICONDATA_a) <<
|
93
|
+
tip << "\0"*(64-tip.length)
|
94
|
+
Shell_NotifyIcon.call(NIM_MODIFY,s)
|
95
|
+
end
|
96
|
+
|
97
|
+
def self__vr_traynotify(wparam,lparam)
|
98
|
+
case lparam
|
99
|
+
when WMsg::WM_MOUSEMOVE
|
100
|
+
selfmsg_dispatching("traymousemove",wparam)
|
101
|
+
when WMsg::WM_LBUTTONDOWN
|
102
|
+
selfmsg_dispatching("traylbuttondown",wparam)
|
103
|
+
when WMsg::WM_LBUTTONUP
|
104
|
+
selfmsg_dispatching("traylbuttonup",wparam)
|
105
|
+
when WMsg::WM_RBUTTONDOWN
|
106
|
+
selfmsg_dispatching("trayrbuttondown",wparam)
|
107
|
+
when WMsg::WM_RBUTTONUP
|
108
|
+
selfmsg_dispatching("trayrbuttonup",wparam)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
module VRTasktraySensitive
|
115
|
+
=begin
|
116
|
+
== VRTasktraySensitive
|
117
|
+
This modules enables to sense the tasktray creation on restarting explorer.
|
118
|
+
The deleted tasktray icons can be created again using this module and writing
|
119
|
+
in its event handler how to do it.
|
120
|
+
|
121
|
+
=== Event Handlers
|
122
|
+
--- self_taskbarcreated
|
123
|
+
Fired when the explorer restarts and creates its tasktray.
|
124
|
+
=end
|
125
|
+
|
126
|
+
RegisterWindowMessage = Win32API.new("user32","RegisterWindowMessage","P","L")
|
127
|
+
|
128
|
+
def vrinit
|
129
|
+
super
|
130
|
+
tasktraysensitive
|
131
|
+
end
|
132
|
+
|
133
|
+
def tasktraysensitive # coded by Katonbo-san
|
134
|
+
# get message ID of 'TaskbarCreated' message
|
135
|
+
id_taskbar_created = RegisterWindowMessage.call('TaskbarCreated')
|
136
|
+
|
137
|
+
# prepare 'TaskbarCreated' message handler
|
138
|
+
addHandler(id_taskbar_created, 'taskbarcreated', MSGTYPE::ARGNONE, nil)
|
139
|
+
addEvent(id_taskbar_created)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
|