Module: VRTrayiconFeasible
Constant Summary
collapse
- Shell_NotifyIcon =
Win32API.new("shell32","Shell_NotifyIcon","IP","I")
- NOTIFYICONDATA_a =
"IIIIII"
- DEFAULTICON =
Win32API.new("user32","LoadIcon","II","I").call(0,32512)
- NIF_MESSAGE =
1
- NIF_ICON =
2
- NIF_TIP =
4
- NIM_ADD =
0
- NIM_MODIFY =
1
- NIM_DELETE =
2
VRMessageHandler::PREHANDLERSTR
Instance Method Summary
collapse
#registerUserMessage, #userMessage, #usermessageuseableinit
#acceptEvents, #addHandler, #addNoRelayMessages, #controlmsg_dispatching, #deleteHandler, #msghandlerinit, #selfmsg_dispatching
Instance Method Details
#create_trayicon(icon = DEFAULTICON, tiptext = "", iconid = 0) ⇒ Object
68
69
70
71
72
73
74
75
76
|
# File 'lib/vr/vrtray.rb', line 68
def create_trayicon(icon=DEFAULTICON,tiptext="",iconid=0)
icon = DEFAULTICON unless icon
tip = tiptext.to_s
s = [4*6+64,
self.hWnd,iconid,NIF_MESSAGE|NIF_ICON|NIF_TIP,
@_vr_traynotify_msg,icon ].pack(NOTIFYICONDATA_a) <<
tip << "\0"*(64-tip.length)
Shell_NotifyIcon.call(NIM_ADD,s)
end
|
#delete_trayicon(iconid = 0) ⇒ Object
#modify_trayicon(hicon, tiptext, iconid = 0) ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/vr/vrtray.rb', line 84
def modify_trayicon(hicon,tiptext,iconid=0)
flag=0
if hicon then
flag |= NIF_ICON
end
if tiptext then
flag |= NIF_TIP
end
tip = tiptext.to_s
s = [4*6+64, self.hWnd,iconid,flag,0,hicon.to_i].pack(NOTIFYICONDATA_a) <<
tip << "\0"*(64-tip.length)
Shell_NotifyIcon.call(NIM_MODIFY,s)
end
|
#self__vr_traynotify(wparam, lparam) ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/vr/vrtray.rb', line 98
def self__vr_traynotify(wparam,lparam)
case lparam
when WMsg::WM_MOUSEMOVE
selfmsg_dispatching("traymousemove",wparam)
when WMsg::WM_LBUTTONDOWN
selfmsg_dispatching("traylbuttondown",wparam)
when WMsg::WM_LBUTTONUP
selfmsg_dispatching("traylbuttonup",wparam)
when WMsg::WM_RBUTTONDOWN
selfmsg_dispatching("trayrbuttondown",wparam)
when WMsg::WM_RBUTTONUP
selfmsg_dispatching("trayrbuttonup",wparam)
end
end
|
#trayiconfeasibleinit ⇒ Object
64
65
66
|
# File 'lib/vr/vrtray.rb', line 64
def trayiconfeasibleinit
@_vr_traynotify_msg = registerUserMessage(ReservedMsg::WM_VR_TRAYNOTIFY,"_vr_traynotify")
end
|
59
60
61
62
|
# File 'lib/vr/vrtray.rb', line 59
def vrinit
super
trayiconfeasibleinit
end
|