class TkBaseTitledFrame
Attributes
frame[R]
top[R]
Public Class Methods
new(parent=nil, *args)
click to toggle source
Calls superclass method
# File lib/a-tkcommons.rb, line 1105 def initialize(parent=nil, *args) super(parent, Arcadia.style('panel')) @parent = parent @title_height = 18 @top = TkFrame.new(self){ background Arcadia.conf('titlelabel.background') }.place('x'=>0, 'y'=>0,'height'=>@title_height, 'relwidth'=>1) #.pack('fill'=> 'x','ipady'=> @title_height, 'side'=>'top') @frame = create_frame @state_frame=TkFrame.new(@top){ #background '#303b50' background Arcadia.conf('titlelabel.background') }.pack('side'=> 'left','anchor'=> 'e') @button_frame=TkFrame.new(@top){ #background '#303b50' background Arcadia.conf('titlelabel.background') }.pack('side'=> 'right','anchor'=> 'w', 'fill'=>'both', 'expand'=>'true') @buttons = Hash.new @menu_buttons = Hash.new @panels = Hash.new @last_for_frame = Hash.new @last_for_state_frame = Hash.new self.head_buttons end
Public Instance Methods
add_fixed_panel(_name='default',_side= 'right', _args=nil)
click to toggle source
# File lib/a-tkcommons.rb, line 1146 def add_fixed_panel(_name='default',_side= 'right', _args=nil) __add_panel(_name, _side, _args, @button_frame) end
add_fixed_progress(_max=100, _canc_proc=nil, _hint=nil)
click to toggle source
# File lib/a-tkcommons.rb, line 1154 def add_fixed_progress(_max=100, _canc_proc=nil, _hint=nil) __add_progress(_max, _canc_proc, @button_frame, _hint) end
add_fixed_sep(_width=0)
click to toggle source
# File lib/a-tkcommons.rb, line 1150 def add_fixed_sep(_width=0) __add_sep(_width, @button_frame) end
create_frame()
click to toggle source
# File lib/a-tkcommons.rb, line 1133 def create_frame # return Tk::ScrollFrame.new(self).place('x'=>0, 'y'=>@title_height,'height'=>-@title_height,'relheight'=>1, 'relwidth'=>1) return TkFrame.new(self,Arcadia.style('panel')).place('x'=>0, 'y'=>@title_height,'height'=>-@title_height,'relheight'=>1, 'relwidth'=>1) end
visible?()
click to toggle source
# File lib/a-tkcommons.rb, line 1362 def visible? ret = false begin ret = TkWinfo.mapped?(self) rescue Exception => e end end
Private Instance Methods
__add_panel(_name='default', _side= 'right', _args=nil, _frame=nil)
click to toggle source
# File lib/a-tkcommons.rb, line 1261 def __add_panel(_name='default', _side= 'right', _args=nil, _frame=nil) return if _frame.nil? args = Arcadia.style('panel').update('background'=>_frame.background, 'highlightbackground'=>_frame.background) args.update(_args) if _args begin last = @last_for_frame[_frame] @last_for_frame[_frame] = @panels[_name]= TkFrame.new(_frame, args){ padx 0 pady 0 if last pack('side'=> _side,'anchor'=> 'e', 'after'=>last) else pack('side'=> _side,'anchor'=> 'e') end } @panels[_name] rescue RuntimeError => e Arcadia.runtime_error(e) end end
__add_progress(_max, _canc_proc=nil, _frame=nil, _hint=nil, _side= 'left')
click to toggle source
# File lib/a-tkcommons.rb, line 1326 def __add_progress(_max, _canc_proc=nil, _frame=nil, _hint=nil, _side= 'left') return if _frame.nil? begin last = @last_for_frame[_frame] @last_for_frame[_frame] = TkFrameProgress.new(_frame, _max) if last @last_for_frame[_frame].pack('side'=> _side,'anchor'=> 'e', 'after'=>last) else @last_for_frame[_frame].pack('side'=> _side,'anchor'=> 'e') end @last_for_frame[_frame].on_cancel=_canc_proc if _canc_proc Tk::BWidget::DynamicHelp::add(@last_for_frame[_frame], 'text'=>_hint) if _hint @last_for_frame[_frame] rescue RuntimeError => e Arcadia.runtime_error(e) end end
__add_sep(_width=0, _frame=nil)
click to toggle source
# File lib/a-tkcommons.rb, line 1283 def __add_sep(_width=0, _frame=nil) return if _width <= 0 || _frame.nil? _background=_frame.background last = @last_for_frame[_frame] @last_for_frame[_frame] = TkLabel.new(_frame){|| text '' background _background if last pack('side'=> 'right','anchor'=> 'e', 'ipadx'=>_width, 'after'=>last) else pack('side'=> 'right','anchor'=> 'e', 'ipadx'=>_width) end } end
__destroy_progress(_progress, _frame)
click to toggle source
# File lib/a-tkcommons.rb, line 1348 def __destroy_progress(_progress, _frame) @last_for_frame[_frame] = nil if @last_for_frame[_frame] == _progress _progress.destroy end