Class: VRToolbar
Defined Under Namespace
Classes: VRToolbarButton
Constant Summary
Constants included
from WConst
WConst::LVIS_CUT, WConst::LVIS_DROPHILITED, WConst::LVIS_FOCUSED, WConst::LVIS_SELECTED, WConst::MB_ABORTRETRYIGNORE, WConst::MB_APPLMODAL, WConst::MB_DEFAULT_DESKTOP_ONLY, WConst::MB_DEFBUTTON1, WConst::MB_DEFBUTTON2, WConst::MB_DEFBUTTON3, WConst::MB_DEFBUTTON4, WConst::MB_DEFMASK, WConst::MB_HELP, WConst::MB_ICONASTERISK, WConst::MB_ICONERROR, WConst::MB_ICONEXCLAMATION, WConst::MB_ICONHAND, WConst::MB_ICONINFORMATION, WConst::MB_ICONMASK, WConst::MB_ICONQUESTION, WConst::MB_ICONSTOP, WConst::MB_ICONWARNING, WConst::MB_MISCMASK, WConst::MB_MODEMASK, WConst::MB_NOFOCUS, WConst::MB_OK, WConst::MB_OKCANCEL, WConst::MB_RETRYCANCEL, WConst::MB_RIGHT, WConst::MB_RTLREADING, WConst::MB_SERVICE_NOTIFICATION, WConst::MB_SETFOREGROUND, WConst::MB_SYSTEMMODAL, WConst::MB_TASKMODAL, WConst::MB_TOPMOST, WConst::MB_TYPEMASK, WConst::MB_USERICON, WConst::MB_YESNO, WConst::MB_YESNOCANCEL, WConst::RBBIM_BACKGROUND, WConst::RBBIM_CHILD, WConst::RBBIM_CHILDSIZE, WConst::RBBIM_COLORS, WConst::RBBIM_IMAGE, WConst::RBBIM_SIZE, WConst::RBBIM_STYLE, WConst::RBBIM_TEXT, WConst::SBT_NOBORDERS, WConst::SBT_OWNERDRAW, WConst::SBT_POPOUT, WConst::SBT_RTLREADING, WConst::TBIF_COMMAND, WConst::TBIF_IMAGE, WConst::TBIF_LPARAM, WConst::TBIF_SIZE, WConst::TBIF_STATE, WConst::TBIF_STYLE, WConst::TBIF_TEXT, WConst::TBSTATE_CHECKED, WConst::TBSTATE_ENABLED, WConst::TBSTATE_HIDDEN, WConst::TBSTATE_INDETERMINATE, WConst::TBSTATE_PRESSED, WConst::TBSTATE_WRAP, WConst::TBSTYLE_ALTDRAG, WConst::TBSTYLE_BUTTON, WConst::TBSTYLE_CHECK, WConst::TBSTYLE_CHECKGROUP, WConst::TBSTYLE_FLAT, WConst::TBSTYLE_GROUP, WConst::TBSTYLE_SEP, WConst::TBSTYLE_TOOLTIPS, WConst::TBSTYLE_WRAPABLE, WConst::TTF_CENTERTIP, WConst::TTF_IDISHWND, WConst::TTF_SUBCLASS, WConst::TVGN_CARET, WConst::TVGN_CHILD, WConst::TVGN_NEXT, WConst::TVGN_PARENT, WConst::TVGN_ROOT, WConst::TVI_FIRST, WConst::TVI_LAST, WConst::TVI_ROOT, WConst::TVI_SORT, WConst::WM_HOTKEY
Constants inherited
from VRControl
VRControl::WINCLASSINFO
Instance Attribute Summary
#_vr_notifyarg
Attributes inherited from VRControl
#handlers, #name, #parent
#parent, #screen
Class Method Summary
collapse
Instance Method Summary
collapse
#_vr_ntfyhandlers, #addFilterArg, #addNotifyHandler, #deleteFilterArg, #deleteNotifyHandler, #notifycontrolinit
Methods inherited from VRControl
#add_parentcall, #call_parenthandler, #create, #setFont
#_init, #create, #exwinstyle, #hide, #maximizebox, #maximizebox=, #minimizebox, #minimizebox=, #setscreen, #sizebox, #sizebox=, #tabstop, #tabstop=, #winstyle
Class Method Details
.Controltype ⇒ Object
251
|
# File 'lib/vr/contrib/toolbar.rb', line 251
def VRToolbar.Controltype() ["ToolbarWindow32",0] end
|
Instance Method Details
287
288
289
|
# File 'lib/vr/contrib/toolbar.rb', line 287
def addButton(name,tbStyle=TBSTYLE_BUTTON)
insertButton(0xffff,name,tbStyle)
end
|
311
312
313
314
|
# File 'lib/vr/contrib/toolbar.rb', line 311
def autoSize
sendMessage WMsg::TB_AUTOSIZE ,0,0
refresh
end
|
#checked?(i) ⇒ Boolean
342
343
344
|
# File 'lib/vr/contrib/toolbar.rb', line 342
def checked?(i)
(getButtonStateOf(i) & 1)==1
end
|
299
300
301
302
303
304
|
# File 'lib/vr/contrib/toolbar.rb', line 299
def clearButtons
(countButtons-1).downto(0) do |i|
deleteButton(i)
refresh
end
end
|
#commandToIndex(id) ⇒ Object
334
335
336
|
# File 'lib/vr/contrib/toolbar.rb', line 334
def commandToIndex(id)
sendMessage WMsg::TB_COMMANDTOINDEX,id,0
end
|
295
296
297
|
# File 'lib/vr/contrib/toolbar.rb', line 295
def countButtons
r=sendMessage WMsg::TB_BUTTONCOUNT,0,0
end
|
291
292
293
|
# File 'lib/vr/contrib/toolbar.rb', line 291
def deleteButton(i)
sendMessage WMsg::TB_DELETEBUTTON,i,0
end
|
354
355
356
|
# File 'lib/vr/contrib/toolbar.rb', line 354
def enableButton(id,bool=true)
sendMessage WMsg::TB_ENABLEBUTTON,id,(if bool then 1 else 0 end)
end
|
369
370
371
372
373
374
375
376
|
# File 'lib/vr/contrib/toolbar.rb', line 369
def enumButtons
raise "Use VRToolbarUseable" unless parent.respond_to? :_vr_toolbar_buttons
n = countButtons
raise "unknown error" unless n == parent._vr_toolbar_buttons.size
parent._vr_toolbar_buttons.each{|key,val|
yield val
}
end
|
358
359
360
361
362
363
|
# File 'lib/vr/contrib/toolbar.rb', line 358
def getButton(i)
tbb=@screen.application.arg2cstructStr(WStruct::TB_BUTTON,
0,0,0,0,0,0,0,0)
sendMessage WMsg::TB_GETBUTTON ,i ,tbb
@screen.application.unpack(tbb,WStruct::TB_BUTTON)
end
|
350
351
352
|
# File 'lib/vr/contrib/toolbar.rb', line 350
def getButtonStateOf(id)
sendMessage WMsg::TB_GETSTATE,id,0
end
|
#indeterminateOf(i, bool = true) ⇒ Object
316
317
318
|
# File 'lib/vr/contrib/toolbar.rb', line 316
def indeterminateOf(i,bool=true)
sendMessage WMsg::TB_INDETERMINATE,i,(if bool then -1 else 0 end)
end
|
#indexToCommand(i) ⇒ Object
338
339
340
|
# File 'lib/vr/contrib/toolbar.rb', line 338
def indexToCommand(i)
getButton(i)[1]
end
|
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
# File 'lib/vr/contrib/toolbar.rb', line 269
def insertButton(i,name,tbStyle=TBSTYLE_BUTTON)
@_vr_tbbuttons = -1 unless defined?(@_vr_tbbuttons)
@_vr_tbbuttons += 1 unless tbStyle == TBSTYLE_SEP
id = @parent.newControlID
tbb=@screen.application.arg2cstructStr(WStruct::TB_BUTTON,
@_vr_tbbuttons,id,
((tbStyle == TBSTYLE_SEP)? 0 : 4),tbStyle,0,0,0,0)
sendMessage WMsg::TB_INSERTBUTTON,i,tbb
i = commandToIndex(id)
r=VRToolbarButton.new(i,self)
if @parent.respond_to?(:registerToolbarButton) then
@parent.registerToolbarButton(r,name,id)
else
@parent.registerControl(r,name,id)
end
r
end
|
365
366
367
|
# File 'lib/vr/contrib/toolbar.rb', line 365
def setButtons(a)
a.each{|i| addButton(i[0], (i[1] ? i[1] : TBSTYLE_BUTTON))}
end
|
346
347
348
|
# File 'lib/vr/contrib/toolbar.rb', line 346
def setButtonStateOf(id,state)
sendMessage WMsg::TB_SETSTATE,id,state
end
|
#setButtonText(i, text) ⇒ Object
261
262
263
264
265
266
267
|
# File 'lib/vr/contrib/toolbar.rb', line 261
def setButtonText(i,text)
if text.length>0 then
iid = indexToCommand(i)
tbi = [4*8,WConst::TBIF_TEXT,iid,0,0,0,text,text.length].pack("llllilpl")
sendMessage WMsg::TB_SETBUTTONINFO,i,tbi
end
end
|
#setDisabledImagelist(imagelist) ⇒ Object
327
328
329
330
331
332
|
# File 'lib/vr/contrib/toolbar.rb', line 327
def setDisabledImagelist(imagelist)
raise "not Imagelist" unless imagelist.is_a?(SWin::Imagelist)
self.properties["disabled_imagelist"]=imagelist
sendMessage WMsg::TB_SETDISABLEDIMAGELIST,0,imagelist.himagelist
refresh
end
|
#setImagelist(imagelist) ⇒ Object
320
321
322
323
324
325
|
# File 'lib/vr/contrib/toolbar.rb', line 320
def setImagelist(imagelist)
raise "not Imagelist" unless imagelist.is_a?(SWin::Imagelist)
self.properties["imagelist"]=imagelist
sendMessage WMsg::TB_SETIMAGELIST,0,imagelist.himagelist
refresh
end
|
#setParent(win) ⇒ Object
306
307
308
309
|
# File 'lib/vr/contrib/toolbar.rb', line 306
def setParent(win)
hwnd = if win.is_a?(SWin::Window) then win.hwnd else win end
sendMessage WMsg::TB_SETPARENT,hwnd,0
end
|
253
254
255
256
257
258
259
|
# File 'lib/vr/contrib/toolbar.rb', line 253
def vrinit
super
sendMessage WMsg::TB_BUTTONSTRUCTSIZE ,20,0
if defined?(VRTooltip) and defined?(@parent.tooltip) and @parent.tooltip then
sendMessage WMsg::TB_SETTOOLTIPS,@parent.tooltip.hWnd,0
end
end
|