Module: VRTwoPane

Includes:
VRParent
Included in:
VRHorizTwoPane, VRVertTwoPane
Defined in:
lib/vr/vrtwopane.rb

Constant Summary collapse

SPLITTER_MOVEWINDOW =
0
SPLITTER_DRAWLINE =
1
PatBlt =
Win32API.new("gdi32","PatBlt","IIIIII","I")

Constants included from VRParent

VRParent::DEFAULT_FONT, VRParent::VR_ADDCONTROL_FEWARGS

Instance Attribute Summary collapse

Attributes included from VRParent

#screen

Instance Method Summary collapse

Methods included from VRParent

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

Instance Attribute Details

#pane_1Object (readonly)

Returns the value of attribute pane_1.



50
51
52
# File 'lib/vr/vrtwopane.rb', line 50

def pane_1
  @pane_1
end

#pane_2Object (readonly)

Returns the value of attribute pane_2.



51
52
53
# File 'lib/vr/vrtwopane.rb', line 51

def pane_2
  @pane_2
end

#ratioObject (readonly)

Returns the value of attribute ratio.



48
49
50
# File 'lib/vr/vrtwopane.rb', line 48

def ratio
  @ratio
end

#separatorheightObject (readonly)

Returns the value of attribute separatorheight.



49
50
51
# File 'lib/vr/vrtwopane.rb', line 49

def separatorheight
  @separatorheight
end

Instance Method Details

#addControlIllegal(*arg) ⇒ Object



86
87
88
# File 'lib/vr/vrtwopane.rb', line 86

def addControlIllegal(*arg)
  raise "added more than two child windows."
end

#addControlLower(type, name, caption, style = 0) ⇒ Object



82
83
84
85
# File 'lib/vr/vrtwopane.rb', line 82

def addControlLower(type,name,caption,style=0)
  @pane_2=addControl(type,name,caption,0,20,10,10,style)
  @_vr_acmethod=self.method(:addControlIllegal)
end

#addControlUpper(type, name, caption, style = 0) ⇒ Object



78
79
80
81
# File 'lib/vr/vrtwopane.rb', line 78

def addControlUpper(type,name,caption,style=0)
  @pane_1=addControl(type,name,caption,0,0,10,10,style)
  @_vr_acmethod=self.method(:addControlLower)
end

#addPanedControl(*args) ⇒ Object



90
91
92
# File 'lib/vr/vrtwopane.rb', line 90

def addPanedControl(*args)
  @_vr_acmethod.call(*args)
end

#resizepane(*arg) ⇒ Object



121
# File 'lib/vr/vrtwopane.rb', line 121

def resizepane(*arg) end

#self_vrpaneresize(w, h) ⇒ Object



113
114
115
116
117
# File 'lib/vr/vrtwopane.rb', line 113

def self_vrpaneresize(w,h)
  return unless @pane_1 and @pane_2
  x,y,w,h = self.clientrect
  resizepane(x,y,w,h,@ratio)
end

#self_vrseplbuttondown(shift, x, y) ⇒ Object



94
95
96
97
98
99
# File 'lib/vr/vrtwopane.rb', line 94

def self_vrseplbuttondown(shift,x,y)
  setCapture
  @_vr_dragging=true
  @_vr_app.setCursor @_vr_dragcur
  x,y,@_vr_w,@_vr_h = self.clientrect   #attr w,h is the size when drag starts.
end

#self_vrseplbuttonup(shift, x, y) ⇒ Object



101
102
103
104
105
# File 'lib/vr/vrtwopane.rb', line 101

def self_vrseplbuttonup(shift,x,y)
  releaseCapture
  @_vr_dragging=false
  splitterDragEnd(x,y)
end

#self_vrsepmousemove(shift, x, y) ⇒ Object



107
108
109
110
111
# File 'lib/vr/vrtwopane.rb', line 107

def self_vrsepmousemove(shift,x,y)
  @_vr_app.setCursor @_vr_dragcur
  return unless @_vr_dragging
  splitterDragging(x,y)
end

#splitterDragEnd(*arg) ⇒ Object



119
# File 'lib/vr/vrtwopane.rb', line 119

def splitterDragEnd(*arg) end

#splitterDragging(*arg) ⇒ Object



120
# File 'lib/vr/vrtwopane.rb', line 120

def splitterDragging(*arg) end

#twopaneinitObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vr/vrtwopane.rb', line 57

def twopaneinit
  @_vr_paned_splitter_movingmethod = SPLITTER_DRAWLINE
  @_vr_dragging=false
  @pane_1 = @pane_2 = nil
  @ratio=0.5
  @separatorheight=6
  @_vr_app=@screen.application
  @_vr_acmethod=self.method(:addControlUpper) unless defined? @_vr_acmethod
  addHandler WMsg::WM_LBUTTONUP,  "vrseplbuttonup",  MSGTYPE::ARGINTSINTSINT,nil
  addHandler WMsg::WM_LBUTTONDOWN,"vrseplbuttondown",MSGTYPE::ARGINTSINTSINT,nil
  addHandler WMsg::WM_SIZE,       "vrpaneresize",    MSGTYPE::ARGLINTINT,nil
  addHandler WMsg::WM_MOUSEMOVE,  "vrsepmousemove",  MSGTYPE::ARGINTSINTSINT,nil
  acceptEvents [
    WMsg::WM_SIZE,WMsg::WM_LBUTTONUP,WMsg::WM_LBUTTONDOWN,WMsg::WM_MOUSEMOVE
   ]
end

#vrinitObject



73
74
75
76
# File 'lib/vr/vrtwopane.rb', line 73

def vrinit
  super
  twopaneinit
end