Class: VRDialogTemplate
Constant Summary collapse
- MultiByteToWideChar =
Win32API.new("kernel32","MultiByteToWideChar",["I","I","P","I","P","I"],"I")
Instance Attribute Summary collapse
-
#caption ⇒ Object
Returns the value of attribute caption.
-
#exstyle ⇒ Object
Returns the value of attribute exstyle.
-
#fontname ⇒ Object
Returns the value of attribute fontname.
-
#fontsize ⇒ Object
Returns the value of attribute fontsize.
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#style ⇒ Object
VRDialogTemplate Create Dialog template string for the argument of DialogBoxIndirectParam() Win32API.
-
#w ⇒ Object
readonly
Returns the value of attribute w.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #addDlgControl(ctype, caption, x, y, w, h, style = 0) ⇒ Object
- #move(x, y, w, h) ⇒ Object
- #to_template ⇒ Object
Instance Attribute Details
#caption ⇒ Object
Returns the value of attribute caption.
50 51 52 |
# File 'lib/vr/vrdialog.rb', line 50 def @caption end |
#exstyle ⇒ Object
Returns the value of attribute exstyle.
45 46 47 |
# File 'lib/vr/vrdialog.rb', line 45 def exstyle @exstyle end |
#fontname ⇒ Object
Returns the value of attribute fontname.
52 53 54 |
# File 'lib/vr/vrdialog.rb', line 52 def fontname @fontname end |
#fontsize ⇒ Object
Returns the value of attribute fontsize.
51 52 53 |
# File 'lib/vr/vrdialog.rb', line 51 def fontsize @fontsize end |
#h ⇒ Object (readonly)
Returns the value of attribute h.
49 50 51 |
# File 'lib/vr/vrdialog.rb', line 49 def h @h end |
#style ⇒ Object
VRDialogTemplate
Create Dialog template string for the argument of DialogBoxIndirectParam() Win32API.
Attributes
((|style|)),((|exstyle|)),((|caption|)),((|fontsize|)),((|fontname|)) are read/write accessible. ((|x|)),((|y|)),((|w|)),((|h|)) are read-only and access these attributes with ‘move’ method.
Methods
— move(x,y,w,h)
Sets the dialog dimension and position. The position is relative from
parent window.
— addDlgControl(ctype,caption,x,y,w,h,style=0)
Adds a control on the dialog. ((|ctype|)) is the control-class such as
VRButton.
— to_template
Create a dialog template string and return it.
44 45 46 |
# File 'lib/vr/vrdialog.rb', line 44 def style @style end |
#w ⇒ Object (readonly)
Returns the value of attribute w.
48 49 50 |
# File 'lib/vr/vrdialog.rb', line 48 def w @w end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
46 47 48 |
# File 'lib/vr/vrdialog.rb', line 46 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
47 48 49 |
# File 'lib/vr/vrdialog.rb', line 47 def y @y end |
Instance Method Details
#addDlgControl(ctype, caption, x, y, w, h, style = 0) ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'lib/vr/vrdialog.rb', line 108 def addDlgControl(ctype,,x,y,w,h,style=0) newid = @_vr_cid + $VRCONTROL_STARTID*2 @_vr_dcontrols[newid] = [ctype,"",,x,y,w,h, ctype.Controltype[1] | style | 0x50000000] #WS_VISIBLECHILD @_vr_cid+=1 return newid end |
#move(x, y, w, h) ⇒ Object
104 105 106 |
# File 'lib/vr/vrdialog.rb', line 104 def move(x,y,w,h) @x,@y,@w,@h = x,y,w,h end |
#to_template ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/vr/vrdialog.rb', line 118 def to_template tmp = [ @style,@exstyle,@_vr_dcontrols.size,@x,@y,@w,@h,0,0 ] .pack("LISSSSSSS") + mb2wc(@caption+"\0") if (@style & 0x40)>0 then # DS_SETFONT tmp << [@fontsize].pack("S") << mb2wc(@fontname+"\0") end padding_dwordAlignment(tmp) @_vr_dcontrols.each do |iid,val| tmp << [val[7],0,val[3,4],iid].flatten.pack("IISSSSS") tmp << class2param(val[0]) tmp << mb2wc(val[2]+"\0") << [0].pack("S") padding_dwordAlignment(tmp) end return tmp end |