Class: AGTk
- Inherits:
-
AG
- Object
- AG
- AGTk
- Defined in:
- lib/tk/al-tk.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#canvas ⇒ Object
readonly
Returns the value of attribute canvas.
-
#l_manager ⇒ Object
readonly
Returns the value of attribute l_manager.
-
#x0 ⇒ Object
Returns the value of attribute x0.
-
#x3 ⇒ Object
Returns the value of attribute x3.
-
#y0 ⇒ Object
Returns the value of attribute y0.
-
#y3 ⇒ Object
Returns the value of attribute y3.
Class Method Summary collapse
Instance Method Summary collapse
-
#activate ⇒ Object
def updatep(_family, prop, value, _call_from_inspector=false) if _call_from_inspector && [‘place’,‘pack’,‘grid’,‘layout_man’].include?(_family) @l_manager.deactivate end super(_family, prop,value, _call_from_inspector) if _call_from_inspector && _family == ‘place’ @l_manager.place_manager.initx0x3 end if _call_from_inspector && [‘place’,‘pack’,‘grid’,‘layout_man’].include?(_family) @l_manager.activate end Tk.update end.
- #active_move_tab ⇒ Object
- #contains_events ⇒ Object
- #delete ⇒ Object
- #getFileName ⇒ Object
- #has_events ⇒ Object
-
#initialize(_ag_parent = nil, _object = nil) ⇒ AGTk
constructor
A new instance of AGTk.
- #new_object ⇒ Object
- #popup ⇒ Object
- #popup_items(_popup_menu) ⇒ Object
- #properties ⇒ Object
- #update_property(_sender, _family, _name, _value) ⇒ Object
Constructor Details
#initialize(_ag_parent = nil, _object = nil) ⇒ AGTk
Returns a new instance of AGTk.
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
# File 'lib/tk/al-tk.rb', line 905 def initialize(_ag_parent = nil, _object = nil) #Tk.update if _object != nil && _ag_parent == nil super(_ag_parent, _object) if (defined? @obj) if @ag_parent != nil ppress = proc{ @l_manager.deactivate_last } prelease = proc{ @l_manager.activate } @obj.bind_append("ButtonPress-1", ppress) @obj.bind_append("ButtonRelease-1", prelease) @parent = TkWinfo.parent(@obj) end @l_manager = AGTkLManager.new(self, _object == nil) end popup build_sons if _object != nil end |
Instance Attribute Details
#canvas ⇒ Object (readonly)
Returns the value of attribute canvas.
902 903 904 |
# File 'lib/tk/al-tk.rb', line 902 def canvas @canvas end |
#l_manager ⇒ Object (readonly)
Returns the value of attribute l_manager.
902 903 904 |
# File 'lib/tk/al-tk.rb', line 902 def l_manager @l_manager end |
#x0 ⇒ Object
Returns the value of attribute x0.
902 903 904 |
# File 'lib/tk/al-tk.rb', line 902 def x0 @x0 end |
#x3 ⇒ Object
Returns the value of attribute x3.
902 903 904 |
# File 'lib/tk/al-tk.rb', line 902 def x3 @x3 end |
#y0 ⇒ Object
Returns the value of attribute y0.
902 903 904 |
# File 'lib/tk/al-tk.rb', line 902 def y0 @y0 end |
#y3 ⇒ Object
Returns the value of attribute y3.
902 903 904 |
# File 'lib/tk/al-tk.rb', line 902 def y3 @y3 end |
Class Method Details
.class_renderer ⇒ Object
1023 1024 1025 |
# File 'lib/tk/al-tk.rb', line 1023 def AGTk.class_renderer AGTkRenderer end |
.class_sniffer ⇒ Object
1027 1028 1029 |
# File 'lib/tk/al-tk.rb', line 1027 def AGTk.class_sniffer AGTkSniffer end |
.class_wrapped ⇒ Object
1019 1020 1021 |
# File 'lib/tk/al-tk.rb', line 1019 def AGTk.class_wrapped nil end |
Instance Method Details
#activate ⇒ Object
def updatep(_family, prop, value, _call_from_inspector=false)
if _call_from_inspector && ['place','pack','grid','layout_man'].include?(_family)
@l_manager.deactivate
end
super(_family, prop,value, _call_from_inspector)
if _call_from_inspector && _family == 'place'
@l_manager.place_manager.initx0x3
end
if _call_from_inspector && ['place','pack','grid','layout_man'].include?(_family)
@l_manager.activate
end
Tk.update
end
1070 1071 1072 1073 1074 |
# File 'lib/tk/al-tk.rb', line 1070 def activate super @l_manager.activate if defined? @l_manager self end |
#active_move_tab ⇒ Object
982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 |
# File 'lib/tk/al-tk.rb', line 982 def active_move_tab @obj.bind("Enter", proc{@canvas_of_move = TkCanvas.new(@obj) _lx = 30 _ly = 43 _x = (@x3 - @x0)/2 - _lx/2 _y = (@y3 - @y0)/2 - _ly/2 TkcImage.new(@canvas_of_move, _lx/2, _ly/2){ image TkAllPhotoImage.new('file' => 'skull.bmp') } @canvas_of_move.configure('cursor'=>'draft_small') @canvas_of_move.place('x' => _x , 'y' => _y, 'width' => _lx, 'height' => _ly ) @canvas_of_move.bind("1", proc{|e| do_press(e.x, e.y)}) @canvas_of_move.bind("B1-Motion", proc{|x, y| do_movobj(x,y)},"%x %y") @canvas_of_move.bind_append("ButtonPress-1", proc{@l_manager.deactivate_last}) @canvas_of_move.bind_append("ButtonPress-1", proc{|e| do_press(e.x, e.y)}) @canvas_of_move.bind("ButtonRelease-1", proc{ @l_manager.activate }) } ) @obj.bind("Leave", proc{@canvas_of_move.destroy}) @obj.bind("Motion", proc{|x, y| @canvas_of_move.place('x' =>x - 5, 'y' => y - 5)},"%x %y") end |
#contains_events ⇒ Object
1035 1036 1037 1038 1039 1040 1041 |
# File 'lib/tk/al-tk.rb', line 1035 def contains_events result = has_events self.sons.each{|son| result = result || son.contains_events } return result end |
#delete ⇒ Object
def retrive_values
@props['layout_man']['manager']['value'] = @props['layout_man']['manager']['get'].call
end
1047 1048 1049 1050 |
# File 'lib/tk/al-tk.rb', line 1047 def delete @l_manager.deactivate if defined? @l_manager super() end |
#getFileName ⇒ Object
1052 1053 1054 |
# File 'lib/tk/al-tk.rb', line 1052 def getFileName __FILE__ end |
#has_events ⇒ Object
1031 1032 1033 |
# File 'lib/tk/al-tk.rb', line 1031 def has_events result = defined?(@persistent) && @persistent['events'] != nil end |
#new_object ⇒ Object
1009 1010 1011 1012 1013 1014 1015 1016 1017 |
# File 'lib/tk/al-tk.rb', line 1009 def new_object if self.class.class_wrapped if @ag_parent @obj = self.class.class_wrapped.new(@ag_parent.obj) else @obj = self.class.class_wrapped.new end end end |
#popup ⇒ Object
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 |
# File 'lib/tk/al-tk.rb', line 959 def popup if @obj _parent = nil if @ag_parent != nil _parent = @ag_parent.obj end @obj.bind("Button-3", proc{|x,y| = TkMenu.new( :parent=>_parent, :tearoff=>0, :relief=>'groove', :title => @obj.class.to_s ) popup_items() _x = TkWinfo.pointerx(@obj) _y = TkWinfo.pointery(@obj) .popup(_x,_y) @obj.callback_break }, "%x %y") end end |
#popup_items(_popup_menu) ⇒ Object
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 |
# File 'lib/tk/al-tk.rb', line 943 def popup_items() .insert('end', :command, :label=>self.class.class_wrapped.to_s, :background => 'white', :hidemargin => false ) .insert('end', :command, :label=>'Delete', :hidemargin => false, :command=> proc{self.delete} ) end |
#properties ⇒ Object
926 927 928 929 930 931 932 |
# File 'lib/tk/al-tk.rb', line 926 def properties super publish('winfo','name'=>'path','get'=> proc{@obj.path}, 'def'=> 'nodef') publish('winfo','name'=>'id','get'=> proc{TkWinfo.id(@obj)}, 'def'=> 'nodef') publish('winfo','name'=>'parent','get'=> proc{TkWinfo.parent(@obj)}, 'def'=> 'nodef') end |
#update_property(_sender, _family, _name, _value) ⇒ Object
934 935 936 937 938 939 940 |
# File 'lib/tk/al-tk.rb', line 934 def update_property(_sender, _family,_name,_value) super if _sender != self && ['x','y','width','height','text'].include?(_name) @l_manager.refresh end end |