Class: VRControl
- Inherits:
-
VRWinComponent
- Object
- SWin::Window
- VRWinComponent
- VRControl
- Defined in:
- lib/vr/vruby.rb
Direct Known Subclasses
VRActiveXControl, VRMediaView, VRNotifyControl, VRPanel, VRScrollbar, VRStdControl
Constant Summary collapse
- WINCLASSINFO =
[nil,0]
Instance Attribute Summary collapse
-
#handlers ⇒ Object
readonly
VRControl Base class for controls.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from VRWinComponent
Class Method Summary collapse
Instance Method Summary collapse
- #add_parentcall(func) ⇒ Object
- #call_parenthandler(handlername, *arg) ⇒ Object
- #create ⇒ Object
- #setFont(font, redraw = true) ⇒ Object
Methods inherited from VRWinComponent
#_init, #exwinstyle, #hide, #maximizebox, #maximizebox=, #minimizebox, #minimizebox=, #setscreen, #sizebox, #sizebox=, #tabstop, #tabstop=, #vrinit, #winstyle
Instance Attribute Details
#handlers ⇒ Object (readonly)
VRControl
Base class for controls.
Methods
— add_parentcall(funcname)
Makes event handlers to be passed through to its parent window.
For example, add_parentcall("btn1_clicked") provides a new event
((| ????_btn1_clicked |)) on its parent window.
(???? is the name of the control).
— call_parenthandler(handlername,*arg)
Calls event handler of parent window in ctrlname_handlername(*arg) style.
— setFont(font,redraw=true)
Sets drawing font to ((|font|)). Control will be re-drawn if redraw flag.
625 626 627 |
# File 'lib/vr/vruby.rb', line 625 def handlers @handlers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
627 628 629 |
# File 'lib/vr/vruby.rb', line 627 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
626 627 628 |
# File 'lib/vr/vruby.rb', line 626 def parent @parent end |
Class Method Details
.Controltype ⇒ Object
631 632 633 |
# File 'lib/vr/vruby.rb', line 631 def self.Controltype() self::WINCLASSINFO end |
Instance Method Details
#add_parentcall(func) ⇒ Object
641 642 643 644 645 646 647 648 649 650 |
# File 'lib/vr/vruby.rb', line 641 def add_parentcall(func) funcname=@name+"_"+func evalstr= "def self_"+func+"(*arg) "+ "if parent.respond_to?('"+funcname+"') then "+ "parent.__send__('"+funcname+"',*arg) "+ "end "+ "end" instance_eval(evalstr) end |
#call_parenthandler(handlername, *arg) ⇒ Object
664 665 666 |
# File 'lib/vr/vruby.rb', line 664 def call_parenthandler(handlername,*arg) @parent.controlmsg_dispatching(self,handlername,*arg) end |
#create ⇒ Object
635 636 637 638 639 |
# File 'lib/vr/vruby.rb', line 635 def create super self_created if respond_to?("self_created") self end |
#setFont(font, redraw = true) ⇒ Object
652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/vr/vruby.rb', line 652 def setFont(font,redraw=true) if self.dopaint then super font end if font.is_a?(SWin::Font) then self.properties["font"]=font sendMessage WMsg::WM_SETFONT,font.hfont, ( (redraw)? 1 : 0 ) else raise "#{font} is not a font." end end |