Class: VRTwoPaneFrame

Inherits:
Object show all
Defined in:
lib/vr/vrlayout2.rb

Direct Known Subclasses

VRHorizTwoPaneFrame, VRVertTwoPaneFrame

Defined Under Namespace

Modules: VRTwoPaneFrameUsable

Constant Summary collapse

SPLITTER_MOVEWINDOW =

VRTwoPaneFrame

This is a base class for twopane frames.

Methods

— register(*controls) — move(x,y,w,h)

same as ((<VRLayoutFrame>))

— setup(parent)

Call this method to combine the frame to the window.

— window_parent

Find the first actual window object from its parent or ancestors.
0
SPLITTER_DRAWLINE =
1
Cursor =
"Size"
PatBlt =
Win32API.new("gdi32","PatBlt","IIIIII","I")
@@_vr_paned_splitter_movingmethod =
SPLITTER_DRAWLINE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pane1, pane2) ⇒ VRTwoPaneFrame

Returns a new instance of VRTwoPaneFrame.



210
211
212
213
214
215
216
# File 'lib/vr/vrlayout2.rb', line 210

def initialize(pane1,pane2)
  @pane1,@pane2 = pane1,pane2 
  @_vr_dragging=false
  @ratio=0.5
  @separatorheight=4
  @_vr_splitter_last=nil
end

Instance Attribute Details

#ratioObject (readonly)

Returns the value of attribute ratio.



147
148
149
# File 'lib/vr/vrlayout2.rb', line 147

def ratio
  @ratio
end

#separatorheightObject (readonly)

Returns the value of attribute separatorheight.



148
149
150
# File 'lib/vr/vrlayout2.rb', line 148

def separatorheight
  @separatorheight
end

Instance Method Details

#_vr_relayoutObject



263
# File 'lib/vr/vrlayout2.rb', line 263

def _vr_relayout() raise "using base class #{self.class}" end

#dragendObject



238
239
240
241
242
243
# File 'lib/vr/vrlayout2.rb', line 238

def dragend
  return unless @_vr_dragging
  @parent.releaseCapture
  @_vr_dragging=false
  splitterDragEnd
end

#dragstartObject



233
234
235
236
# File 'lib/vr/vrlayout2.rb', line 233

def dragstart
  @parent.setCapture
  @_vr_dragging=true
end

#hittest(x, y) ⇒ Object



218
219
220
221
222
223
224
225
226
227
# File 'lib/vr/vrlayout2.rb', line 218

def hittest(x,y)
  return unless @_vr_lxs
  if (@_vr_lxs < x) and (x  < @_vr_lxe) and
     (@_vr_lys < y) and (y  < @_vr_lye) 
  then
    true
  else
    false
  end
end

#move(x, y, w, h) ⇒ Object



256
257
258
259
# File 'lib/vr/vrlayout2.rb', line 256

def move(x,y,w,h)
  @_vr_lx,@_vr_ly,@_vr_lw,@_vr_lh = x,y,w,h
  self._vr_relayout
end

#setDragCurObject



229
230
231
# File 'lib/vr/vrlayout2.rb', line 229

def setDragCur
  @_vr_app.setCursor @_vr_dragcur if @_vr_app
end

#setup(parent) ⇒ Object



245
246
247
248
249
250
251
252
253
254
# File 'lib/vr/vrlayout2.rb', line 245

def setup(parent)
  raise "setup twice" if defined? @parent
  @parent = parent
  @_vr_app = parent.instance_eval("@screen.application") # parent.application
  @_vr_dragcur = eval("@_vr_app::SysCursors::#{self.class::Cursor}()")
  parent.extend VRTwoPaneFrameUsable
  parent._vr_twopaneframesinit
  parent._vr_twopaneframes.push self
  self
end

#splitter_operation_typeObject



139
140
141
# File 'lib/vr/vrlayout2.rb', line 139

def splitter_operation_type
   @@_vr_paned_splitter_movingmethod
end

#splitter_operation_type=(tp) ⇒ Object



143
144
145
# File 'lib/vr/vrlayout2.rb', line 143

def splitter_operation_type=(tp)
   @@_vr_paned_splitter_movingmethod=tp
end

#splitterDragEnd(x, y) ⇒ Object



262
# File 'lib/vr/vrlayout2.rb', line 262

def splitterDragEnd(x,y) end

#splitterDragging(x, y) ⇒ Object



261
# File 'lib/vr/vrlayout2.rb', line 261

def splitterDragging(x,y) end

#window_parentObject



202
203
204
205
206
207
208
# File 'lib/vr/vrlayout2.rb', line 202

def window_parent
  a=self
  while(! a.is_a?(SWin::Window) ) do
    a = a.instance_eval("@parent")
  end
  return a
end