Class: TkTitledFrame
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_fixed_button, #add_fixed_menu_button, #add_fixed_sep, #create_frame, #menu_button, #visible?
Constructor Details
#initialize(parent = nil, title = nil, img = nil, keys = nil) ⇒ TkTitledFrame
Returns a new instance of TkTitledFrame.
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
|
# File 'lib/a-tkcommons.rb', line 888
def initialize(parent=nil, title=nil, img=nil , keys=nil)
super(parent, keys)
@state = 'normal'
@title = title
@img = img
@left_label = create_left_label
@right_label = create_right_label
@right_labels_text = Hash.new
@ap = Array.new
@apx = Array.new
@apy = Array.new
@apw = Array.new
@aph = Array.new
@top.bind_append("Double-Button-1", proc{resize})
@left_label.bind_append("Double-Button-1", proc{resize})
@right_label.bind_append("Double-Button-1", proc{resize})
end
|
Instance Attribute Details
#frame ⇒ Object
Returns the value of attribute frame.
885
886
887
|
# File 'lib/a-tkcommons.rb', line 885
def frame
@frame
end
|
#parent ⇒ Object
Returns the value of attribute parent.
887
888
889
|
# File 'lib/a-tkcommons.rb', line 887
def parent
@parent
end
|
#top ⇒ Object
Returns the value of attribute top.
886
887
888
|
# File 'lib/a-tkcommons.rb', line 886
def top
@top
end
|
Instance Method Details
#__create_left_label(_frame) ⇒ Object
914
915
916
917
918
919
920
921
922
923
924
|
# File 'lib/a-tkcommons.rb', line 914
def __create_left_label(_frame)
@title.nil??_text_title ='':_text_title = @title+' :: '
_img=@img
TkLabel.new(_frame, Arcadia.style('titlelabel')){
text _text_title
anchor 'w'
compound 'left'
image TkAllPhotoImage.new('file' => _img) if _img
pack('side'=> 'left','anchor'=> 'e')
}
end
|
#__create_right_label(_frame) ⇒ Object
926
927
928
929
930
931
932
933
934
|
# File 'lib/a-tkcommons.rb', line 926
def __create_right_label(_frame)
TkLabel.new(_frame, Arcadia.style('titlelabel')){
anchor 'w'
font "#{Arcadia.conf('titlelabel.font')} italic"
foreground Arcadia.conf('titlecontext.foreground')
compound 'left'
pack('side'=> 'left','anchor'=> 'e')
}
end
|
#create_left_label ⇒ Object
906
907
908
|
# File 'lib/a-tkcommons.rb', line 906
def create_left_label
__create_left_label(@top)
end
|
#create_right_label ⇒ Object
910
911
912
|
# File 'lib/a-tkcommons.rb', line 910
def create_right_label
__create_right_label(@top)
end
|
def top_text(_text)
@right_label.text(_text)
end
977
978
979
980
|
# File 'lib/a-tkcommons.rb', line 977
def head_buttons
@bmaxmin = add_fixed_button('[ ]',proc{resize}, W_MAX_GIF)
end
|
#last_caption(_name) ⇒ Object
961
962
963
|
# File 'lib/a-tkcommons.rb', line 961
def last_caption(_name)
@right_labels_text[_name]
end
|
#maximize ⇒ Object
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
|
# File 'lib/a-tkcommons.rb', line 1004
def maximize
if @state == 'normal'
p = TkWinfo.parent(self)
while (p != nil) && (TkWinfo.manager(p)=='place')
Tk.messageBox('message'=>p.to_s)
@ap << p
@apx << TkPlace.info(p)['x']
@apy << TkPlace.info(p)['y']
@apw << TkPlace.info(p)['width']
@aph << TkPlace.info(p)['height']
p.place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
p.raise
p = TkWinfo.parent(p)
end
@state = 'maximize'
self.raise
else
@ap.each_index{|i|
@ap[i].place('x'=>@apx[i], 'y'=>@apy[i],'width'=>@apw[i], 'height'=>@aph[i],'relheight'=>1, 'relwidth'=>1)
@ap[i].raise
}
self.raise
@ap.clear
@apx.clear
@apy.clear
@state = 'normal'
end
end
|
#maximized? ⇒ Boolean
1000
1001
1002
|
# File 'lib/a-tkcommons.rb', line 1000
def maximized?
@state == 'maximize'
end
|
#resize ⇒ Object
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
|
# File 'lib/a-tkcommons.rb', line 982
def resize
p = TkWinfo.parent(@parent)
if @state == 'normal'
if p.kind_of?(AGTkSplittedFrames)
p.maximize(@parent)
@bmaxmin.image(TkPhotoImage.new('dat' => W_NORM_GIF))
end
@state = 'maximize'
else
if p.kind_of?(AGTkSplittedFrames)
p.minimize(@parent)
@bmaxmin.image(TkPhotoImage.new('dat' =>W_MAX_GIF))
end
@state = 'normal'
end
self.raise
end
|
#restore_caption(_name) ⇒ Object
965
966
967
968
969
970
971
|
# File 'lib/a-tkcommons.rb', line 965
def restore_caption(_name)
if @right_labels_text[_name]
top_text(@right_labels_text[_name])
else
top_text('')
end
end
|
#save_caption(_name, _caption) ⇒ Object
957
958
959
|
# File 'lib/a-tkcommons.rb', line 957
def save_caption(_name, _caption)
@right_labels_text[_name] = _caption
end
|
#title(_text = nil) ⇒ Object
936
937
938
939
940
941
942
943
944
945
946
947
|
# File 'lib/a-tkcommons.rb', line 936
def title(_text=nil)
if _text.nil?
return @title
else
@title=_text
if _text.strip.length == 0
@left_label.text('')
else
@left_label.text(_text+'::')
end
end
end
|
#top_text(_text = nil) ⇒ Object
949
950
951
952
953
954
955
|
# File 'lib/a-tkcommons.rb', line 949
def top_text(_text=nil)
if _text.nil?
return @right_label.text
else
@right_label.text(_text)
end
end
|