Class: VRDialogComponent

Inherits:
SWin::Dialog
  • Object
show all
Includes:
VRParent
Defined in:
lib/vr/vrdialog.rb

Direct Known Subclasses

VRInputbox, VRModalDialog, VRModelessDialog

Defined Under Namespace

Modules: VRInitDialogHandler

Constant Summary collapse

IDOK =
1
IDCANCEL =
2
IDABORT =
3
IDRETRY =
4
IDIGNORE =
5
IDYES =
6
IDNO =
7
IDCLOSE =
8
IDHELP =
DLGMAX_ID  = 9

Constants included from VRParent

VRParent::DEFAULT_FONT, VRParent::VR_ADDCONTROL_FEWARGS

Instance Attribute Summary collapse

Attributes included from VRParent

#screen

Class Method Summary collapse

Instance Method Summary collapse

Methods included from VRParent

#addArrayedControl, #addControl, #clearControls, #construct, #countControls, #createControl, #deleteControl, #newControlID, #parentinit, #registerControl, #registerControlAsArrayed, #self_created, #send_parent

Constructor Details

#initialize(*arg) ⇒ VRDialogComponent

Returns a new instance of VRDialogComponent.



201
202
203
# File 'lib/vr/vrdialog.rb', line 201

def initialize(*arg)
  @options={}
end

Instance Attribute Details

#optionsObject (readonly)

hash



167
168
169
# File 'lib/vr/vrdialog.rb', line 167

def options
  @options
end

Class Method Details

.new(screen, template) ⇒ Object

obsolete



205
206
207
208
209
210
211
212
# File 'lib/vr/vrdialog.rb', line 205

def self.new(screen,template)   # obsolete
  r=screen.factory.newdialog(template.to_template,self)
  r.parentinit(screen)
  r.options={}
  r.addEvent WMsg::WM_INITDIALOG 
  r.addEvent WMsg::WM_COMMAND
  return r
end

.new2(screen) {|opt, template| ... } ⇒ Object

obsolete

Yields:

  • (opt, template)


214
215
216
217
218
219
220
221
# File 'lib/vr/vrdialog.rb', line 214

def self.new2(screen)   # obsolete
  template = VRDialogTemplate.new
  opt={}
  yield(opt,template)
  r=self.new(screen,template)
  r.options=opt if opt.is_a?(Hash)
  return r
end

Instance Method Details

#centering(target = @parent) ⇒ Object

contributed by Yuya-san./modified by nyasu.



190
191
192
193
194
195
196
197
198
199
# File 'lib/vr/vrdialog.rb', line 190

def centering(target = @parent) #contributed by Yuya-san./modified by nyasu.
  unless target.is_a?(SWin::Window) then
    target = @screen
  end
  raise "No specified centering target" unless target

  x = target.x + target.w / 2 - self.w / 2
  y = target.y + target.h / 2 - self.h / 2
  self.move(x, y, self.w, self.h)
end

#create(*arg) ⇒ Object



176
177
178
# File 'lib/vr/vrdialog.rb', line 176

def create(*arg)
  self.open(*arg)
end

#open(parent = @parent, modal = true) ⇒ Object



241
242
243
244
# File 'lib/vr/vrdialog.rb', line 241

def open(parent=@parent,modal=true)
  @parent=parent
  super parent,modal
end

#setButtonAs(control, newid) ⇒ Object

contributed by Katonbo-san.



180
181
182
183
184
185
186
187
188
# File 'lib/vr/vrdialog.rb', line 180

def setButtonAs(control, newid) #contributed by Katonbo-san.
  if newid > DLGMAX_ID then
    raise "id[#{newid}] is too big"
  end
  id = control.etc
  @controls[newid] = @controls[id]
#    control.etc = newid
#    @controls.delete(id)
end

#setscreen(scr) ⇒ Object



173
174
175
# File 'lib/vr/vrdialog.rb', line 173

def setscreen(scr)
  @screen=scr
end

#vrinitObject



169
170
171
# File 'lib/vr/vrdialog.rb', line 169

def vrinit
  extend VRWinComponent::VRInitBlocker
end