Class: TkTitledFrame
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_fixed_button, #add_fixed_menu_button, #add_fixed_panel, #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.
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
|
# File 'lib/a-tkcommons.rb', line 955
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
@right_labels_image = 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.
952
953
954
|
# File 'lib/a-tkcommons.rb', line 952
def frame
@frame
end
|
#parent ⇒ Object
Returns the value of attribute parent.
954
955
956
|
# File 'lib/a-tkcommons.rb', line 954
def parent
@parent
end
|
#top ⇒ Object
Returns the value of attribute top.
953
954
955
|
# File 'lib/a-tkcommons.rb', line 953
def top
@top
end
|
Instance Method Details
#__create_left_label(_frame) ⇒ Object
982
983
984
985
986
987
988
989
990
991
992
|
# File 'lib/a-tkcommons.rb', line 982
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
994
995
996
997
998
999
1000
1001
1002
|
# File 'lib/a-tkcommons.rb', line 994
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
974
975
976
|
# File 'lib/a-tkcommons.rb', line 974
def create_left_label
__create_left_label(@top)
end
|
#create_right_label ⇒ Object
978
979
980
|
# File 'lib/a-tkcommons.rb', line 978
def create_right_label
__create_right_label(@top)
end
|
def top_text(_text)
@right_label.text(_text)
end
1086
1087
1088
1089
|
# File 'lib/a-tkcommons.rb', line 1086
def head_buttons
@bmaxmin = add_fixed_button('[ ]',proc{resize}, W_MAX_GIF)
end
|
#last_caption(_name) ⇒ Object
1066
1067
1068
|
# File 'lib/a-tkcommons.rb', line 1066
def last_caption(_name)
@right_labels_text[_name]
end
|
#last_caption_image(_name) ⇒ Object
1070
1071
1072
|
# File 'lib/a-tkcommons.rb', line 1070
def last_caption_image(_name)
@right_labels_image[_name]
end
|
#maximize ⇒ Object
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
|
# File 'lib/a-tkcommons.rb', line 1113
def maximize
if @state == 'normal'
p = TkWinfo.parent(self)
while (p != nil) && (TkWinfo.manager(p)=='place')
Arcadia.dialog(self, 'msg'=>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
1109
1110
1111
|
# File 'lib/a-tkcommons.rb', line 1109
def maximized?
@state == 'maximize'
end
|
#resize ⇒ Object
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
|
# File 'lib/a-tkcommons.rb', line 1091
def resize
p = TkWinfo.parent(@parent)
if @state == 'normal'
if p.kind_of?(AGTkSplittedFrames)
p.maximize(@parent)
@bmaxmin.image(Arcadia.image_res(W_NORM_GIF))
end
@state = 'maximize'
else
if p.kind_of?(AGTkSplittedFrames)
p.minimize(@parent)
@bmaxmin.image(Arcadia.image_res(W_MAX_GIF))
end
@state = 'normal'
end
self.raise
end
|
#restore_caption(_name) ⇒ Object
1074
1075
1076
1077
1078
1079
1080
|
# File 'lib/a-tkcommons.rb', line 1074
def restore_caption(_name)
if @right_labels_text[_name]
top_text(@right_labels_text[_name], @right_labels_image[_name])
else
top_text_clear
end
end
|
#save_caption(_name, _caption, _image = nil) ⇒ Object
1061
1062
1063
1064
|
# File 'lib/a-tkcommons.rb', line 1061
def save_caption(_name, _caption, _image=nil)
@right_labels_text[_name] = _caption
@right_labels_image[_name] = _image
end
|
#shift_off ⇒ Object
1008
1009
1010
|
# File 'lib/a-tkcommons.rb', line 1008
def shift_off
@left_label.foreground(Arcadia.conf('titlelabel.disabledforeground'))
end
|
#shift_on ⇒ Object
1004
1005
1006
|
# File 'lib/a-tkcommons.rb', line 1004
def shift_on
@left_label.foreground(Arcadia.conf('titlelabel.foreground'))
end
|
#title(_text = nil) ⇒ Object
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
|
# File 'lib/a-tkcommons.rb', line 1012
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, _image = nil) ⇒ Object
1029
1030
1031
1032
1033
1034
1035
1036
1037
|
# File 'lib/a-tkcommons.rb', line 1029
def top_text(_text=nil, _image=nil)
if _text.nil? && _image.nil?
return @right_label.text
elsif !_text.nil? && _image.nil?
@right_label.text(_text)
else
@right_label.configure('text'=>_text, 'image'=>_image)
end
end
|
#top_text_bind_append(_tkevent, _proc = nil) ⇒ Object
1039
1040
1041
|
# File 'lib/a-tkcommons.rb', line 1039
def top_text_bind_append(_tkevent, _proc=nil)
@right_label.bind_append(_tkevent, _proc)
end
|
#top_text_bind_remove(_tkevent) ⇒ Object
1043
1044
1045
|
# File 'lib/a-tkcommons.rb', line 1043
def top_text_bind_remove(_tkevent)
@right_label.bind_remove(_tkevent)
end
|
#top_text_clear ⇒ Object
1025
1026
1027
|
# File 'lib/a-tkcommons.rb', line 1025
def top_text_clear
@right_label.configure('text'=>'', 'image'=>nil)
end
|
#top_text_hint(_text = nil) ⇒ Object
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
|
# File 'lib/a-tkcommons.rb', line 1047
def top_text_hint(_text=nil)
if _text.nil?
res = ''
res = @right_label_hint_variable.value if defined?(@right_label_hint_variable)
res
else
if !defined?(@right_label_hint_variable)
@right_label_hint_variable = TkVariable.new
Tk::BWidget::DynamicHelp::add(@right_label, 'variable'=>@right_label_hint_variable)
end
@right_label_hint_variable.value=_text
end
end
|