diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-09 14:38:15 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-09 14:38:15 +0000 |
commit | edc03a2912b60f319d5b424460f385c9926d3e37 (patch) | |
tree | ae22ede91660a9e74cd8282f2cf28aa0d1408118 /ext/tk | |
parent | 8edab1a9b47f91ac5b26844ac2890c9eaf163eec (diff) | |
download | ruby-edc03a2912b60f319d5b424460f385c9926d3e37.tar.gz |
* overrided instance methods, which are private methods on the super
class, are changed to 'private'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk')
-rw-r--r-- | ext/tk/lib/tk.rb | 26 | ||||
-rw-r--r-- | ext/tk/lib/tkcanvas.rb | 22 | ||||
-rw-r--r-- | ext/tk/lib/tkdialog.rb | 1 | ||||
-rw-r--r-- | ext/tk/lib/tkentry.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tkscrollbox.rb | 1 | ||||
-rw-r--r-- | ext/tk/lib/tktext.rb | 3 | ||||
-rw-r--r-- | ext/tk/sample/demos-en/dialog1.rb | 3 | ||||
-rw-r--r-- | ext/tk/sample/demos-en/dialog2.rb | 3 | ||||
-rw-r--r-- | ext/tk/sample/demos-jp/dialog1.rb | 3 | ||||
-rw-r--r-- | ext/tk/sample/demos-jp/dialog2.rb | 3 | ||||
-rw-r--r-- | ext/tk/sample/tkalignbox.rb | 83 | ||||
-rw-r--r-- | ext/tk/sample/tkcombobox.rb | 7 | ||||
-rw-r--r-- | ext/tk/sample/tkmultilistbox.rb | 1 | ||||
-rw-r--r-- | ext/tk/sample/tkoptdb.rb | 1 | ||||
-rw-r--r-- | ext/tk/sample/tktextframe.rb | 1 |
15 files changed, 143 insertions, 17 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 69c214175a..a73f15e367 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -4458,6 +4458,8 @@ class TkRoot<TkWindow def create_self @path = '.' end + private :create_self + def path "." end @@ -4626,6 +4628,7 @@ class TkToplevel<TkWindow tk_call 'toplevel', @path end end + private :create_self def specific_class @classname @@ -4744,6 +4747,7 @@ class TkFrame<TkWindow tk_call 'frame', @path end end + private :create_self def database_classname @classname @@ -4801,6 +4805,7 @@ class TkLabelFrame<TkFrame tk_call 'labelframe', @path end end + private :create_self end TkLabelframe = TkLabelFrame @@ -4815,6 +4820,7 @@ class TkPanedWindow<TkWindow tk_call 'panedwindow', @path end end + private :create_self def add(*args) keys = args.pop @@ -4929,6 +4935,8 @@ class TkLabel<TkWindow tk_call 'label', @path end end + private :create_self + def textvariable(v) configure 'textvariable', tk_trace_variable(v) end @@ -4945,6 +4953,8 @@ class TkButton<TkLabel tk_call 'button', @path end end + private :create_self + def invoke tk_send 'invoke' end @@ -4965,6 +4975,8 @@ class TkRadioButton<TkButton tk_call 'radiobutton', @path end end + private :create_self + def deselect tk_send 'deselect' self @@ -4990,6 +5002,8 @@ class TkCheckButton<TkRadioButton tk_call 'checkbutton', @path end end + private :create_self + def toggle tk_send 'toggle' self @@ -5008,6 +5022,7 @@ class TkMessage<TkLabel tk_call 'message', @path end end + private :create_self end class TkScale<TkWindow @@ -5026,6 +5041,7 @@ class TkScale<TkWindow tk_call 'scale', @path end end + private :create_self def _wrap_command_arg(cmd) proc{|val| @@ -5094,6 +5110,7 @@ class TkScrollbar<TkWindow tk_call 'scrollbar', @path end end + private :create_self def delta(deltax=None, deltay=None) number(tk_send('delta', deltax, deltay)) @@ -5130,6 +5147,7 @@ class TkTextWin<TkWindow def create_self fail RuntimeError, "TkTextWin is an abstract class" end + private :create_self def bbox(index) list(tk_send('bbox', index)) @@ -5170,6 +5188,8 @@ module TkTreatListItemFont def __item_pathname(tagOrId) self.path + ';' + tagOrId.to_s end + + private :__conf_cmd, :__item_pathname end class TkListbox<TkTextWin @@ -5187,6 +5207,7 @@ class TkListbox<TkTextWin tk_call 'listbox', @path end end + private :create_self def activate(y) tk_send 'activate', y @@ -5338,6 +5359,8 @@ module TkTreatMenuEntryFont def __item_pathname(tagOrId) self.path + ';' + tagOrId.to_s end + + private :__conf_cmd, :__item_pathname end class TkMenu<TkWindow @@ -5354,6 +5377,8 @@ class TkMenu<TkWindow tk_call 'menu', @path end end + private :create_self + def activate(index) tk_send 'activate', index self @@ -5591,6 +5616,7 @@ class TkMenubutton<TkLabel tk_call 'menubutton', @path end end + private :create_self end class TkOptionMenubutton<TkMenubutton diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb index 58177584af..32b5ac7af8 100644 --- a/ext/tk/lib/tkcanvas.rb +++ b/ext/tk/lib/tkcanvas.rb @@ -23,6 +23,8 @@ module TkTreatCItemFont self.path + ';' + tagOrId.to_s end end + + private :__conf_cmd, :__item_pathname end class TkCanvas<TkWindow @@ -44,6 +46,7 @@ class TkCanvas<TkWindow tk_call 'canvas', @path end end + private :create_self def tagid(tag) if tag.kind_of?(TkcItem) || tag.kind_of?(TkcTag) @@ -701,6 +704,7 @@ class TkcGroup<TkcTag Tk_cGroup_ID[1].succ! add(*args) if args != [] end + private :create_self def include(*tags) for i in tags @@ -777,6 +781,7 @@ class TkcItem<TkObject end def create_self(*args); end private :create_self + def id @id end @@ -795,54 +800,71 @@ class TkcArc<TkcItem def create_self(*args) tk_call(@path, 'create', 'arc', *args) end + private :create_self end + class TkcBitmap<TkcItem CItemTypeToClass['bitmap'] = self def create_self(*args) tk_call(@path, 'create', 'bitmap', *args) end + private :create_self end + class TkcImage<TkcItem CItemTypeToClass['image'] = self def create_self(*args) tk_call(@path, 'create', 'image', *args) end + private :create_self end + class TkcLine<TkcItem CItemTypeToClass['line'] = self def create_self(*args) tk_call(@path, 'create', 'line', *args) end + private :create_self end + class TkcOval<TkcItem CItemTypeToClass['oval'] = self def create_self(*args) tk_call(@path, 'create', 'oval', *args) end + private :create_self end + class TkcPolygon<TkcItem CItemTypeToClass['polygon'] = self def create_self(*args) tk_call(@path, 'create', 'polygon', *args) end + private :create_self end + class TkcRectangle<TkcItem CItemTypeToClass['rectangle'] = self def create_self(*args) tk_call(@path, 'create', 'rectangle', *args) end + private :create_self end + class TkcText<TkcItem CItemTypeToClass['text'] = self def create_self(*args) tk_call(@path, 'create', 'text', *args) end + private :create_self end + class TkcWindow<TkcItem CItemTypeToClass['window'] = self def create_self(*args) tk_call(@path, 'create', 'window', *args) end + private :create_self end class TkImage<TkObject diff --git a/ext/tk/lib/tkdialog.rb b/ext/tk/lib/tkdialog.rb index d5c13dca1a..a581f3becc 100644 --- a/ext/tk/lib/tkdialog.rb +++ b/ext/tk/lib/tkdialog.rb @@ -139,6 +139,7 @@ class TkDialog2 < TkWindow @command.call(self) end end + private :create_self def show if @default_button.kind_of? String diff --git a/ext/tk/lib/tkentry.rb b/ext/tk/lib/tkentry.rb index e0589802d2..fe9a7b6277 100644 --- a/ext/tk/lib/tkentry.rb +++ b/ext/tk/lib/tkentry.rb @@ -117,6 +117,7 @@ class TkEntry<TkLabel configure(keys) end end + private :create_self def configure(slot, value=None) if slot.kind_of? Hash @@ -269,6 +270,7 @@ class TkSpinbox<TkEntry configure(keys) end end + private :create_self def identify(x, y) tk_send 'identify', x, y diff --git a/ext/tk/lib/tkscrollbox.rb b/ext/tk/lib/tkscrollbox.rb index 6236430491..3f1191c740 100644 --- a/ext/tk/lib/tkscrollbox.rb +++ b/ext/tk/lib/tkscrollbox.rb @@ -26,4 +26,5 @@ class TkScrollbox<TkListbox configure keys if keys end + private :initialize_composite end diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb index d7cb055a40..44dc6cc3b8 100644 --- a/ext/tk/lib/tktext.rb +++ b/ext/tk/lib/tktext.rb @@ -21,6 +21,8 @@ module TkTreatTextTagFont self.path + ';' + tagOrId end end + + private :__conf_cmd, :__item_pathname end class TkText<TkTextWin @@ -57,6 +59,7 @@ class TkText<TkTextWin end init_instance_variable end + private :create_self def index(index) tk_send 'index', index diff --git a/ext/tk/sample/demos-en/dialog1.rb b/ext/tk/sample/demos-en/dialog1.rb index d2b34e6b46..374fedc985 100644 --- a/ext/tk/sample/demos-en/dialog1.rb +++ b/ext/tk/sample/demos-en/dialog1.rb @@ -2,6 +2,9 @@ # a dialog box with a local grab (called by 'widget') # class TkDialog_Demo1 < TkDialog + ############### + private + ############### def title "Dialog with local grab" end diff --git a/ext/tk/sample/demos-en/dialog2.rb b/ext/tk/sample/demos-en/dialog2.rb index c441dda62f..21bf25c88d 100644 --- a/ext/tk/sample/demos-en/dialog2.rb +++ b/ext/tk/sample/demos-en/dialog2.rb @@ -2,6 +2,9 @@ # a dialog box with a global grab (called by 'widget') # class TkDialog_Demo2 < TkDialog + ############### + private + ############### def title "Dialog with global grab" end diff --git a/ext/tk/sample/demos-jp/dialog1.rb b/ext/tk/sample/demos-jp/dialog1.rb index 317b6d9eb3..5b578a981d 100644 --- a/ext/tk/sample/demos-jp/dialog1.rb +++ b/ext/tk/sample/demos-jp/dialog1.rb @@ -2,6 +2,9 @@ # a dialog box with a local grab (called by 'widget') # class TkDialog_Demo1 < TkDialog + ############### + private + ############### def title "Dialog with local grab" end diff --git a/ext/tk/sample/demos-jp/dialog2.rb b/ext/tk/sample/demos-jp/dialog2.rb index 295522e562..4819f18a03 100644 --- a/ext/tk/sample/demos-jp/dialog2.rb +++ b/ext/tk/sample/demos-jp/dialog2.rb @@ -2,6 +2,9 @@ # a dialog box with a global grab (called by 'widget') # class TkDialog_Demo2 < TkDialog + ############### + private + ############### def title "Dialog with global grab" end diff --git a/ext/tk/sample/tkalignbox.rb b/ext/tk/sample/tkalignbox.rb index cca91c9b0d..b56c9cc11e 100644 --- a/ext/tk/sample/tkalignbox.rb +++ b/ext/tk/sample/tkalignbox.rb @@ -12,6 +12,17 @@ require 'tk' class TkAlignBox < TkFrame def initialize(*args) + if self.class == TkAlignBox + fail RuntimeError, "TkAlignBox is an abstract class" + end + @padx = 0 + @pady = 0 + if args[-1].kind_of? Hash + keys = _symbolkey2str(args.pop) + @padx = keys.delete('padx') || 0 + @pady = keys.delete('pady') || 0 + args.push(keys) + end super(*args) @max_width = 0 @max_height = 0 @@ -53,7 +64,6 @@ class TkAlignBox < TkFrame @max_height = sz if @max_height < sz } align - self end def <<(widget) @@ -71,7 +81,6 @@ class TkAlignBox < TkFrame sz = widget.winfo_reqheight @max_height = sz if @max_height < sz align - self end def delete(idx) @@ -87,46 +96,85 @@ class TkAlignBox < TkFrame ret end + def padx(size = nil) + if size + @padx = size + align + else + @padx + end + end + + def pady(size = nil) + if size + @pady = size + align + else + @pady + end + end + attr_accessor :propagate end class TkHBox < TkAlignBox def _set_framesize bd = self.borderwidth - self.width(@max_width * @widgets.size + 2 * bd) - self.height(@max_height + 2 * bd) + self.width((@max_width + 2*@padx) * @widgets.size + 2*bd) + self.height(@max_height + 2*@pady + 2*bd) end + private :_set_framesize + def _place_config(widget, idx, cnt) - widget.place_in(self, 'relx'=>idx/cnt, 'relwidth'=>1.0/cnt, - 'relheight'=>1.0) + widget.place_in(self, + 'relx'=>idx/cnt, 'x'=>@padx, + 'rely'=>0, 'y'=>@pady, + 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, + 'relheight'=>1.0, 'height'=>-2*@pady) end + private :_place_config end TkHLBox = TkHBox class TkHRBox < TkHBox def _place_config(widget, idx, cnt) - widget.place_in(self, 'relx'=>(cnt - idx - 1)/cnt, 'relwidth'=>1.0/cnt, - 'relheight'=>1.0) + widget.place_in(self, + 'relx'=>(cnt - idx - 1)/cnt, 'x'=>@padx, + 'rely'=>0, 'y'=>@pady, + 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, + 'relheight'=>1.0, 'height'=>-2*@pady) end + private :_place_config end class TkVBox < TkAlignBox def _set_framesize - self.width(@max_width + 2 * bd) - self.height(@max_height * @widgets.size + 2 * bd) + bd = self.borderwidth + self.width(@max_width + 2*@padx + 2*bd) + self.height((@max_height + 2*@pady) * @widgets.size + 2*bd) end + private :_set_framesize + def _place_config(widget, idx, cnt) - widget.place_in(self, 'rely'=>idx/cnt, 'relheight'=>1.0/cnt, - 'relwidth'=>1.0) + widget.place_in(self, + 'relx'=>0, 'x'=>@padx, + 'rely'=>idx/cnt, 'y'=>@pady, + 'relwidth'=>1.0, 'width'=>-2*@padx, + 'relheight'=>1.0/cnt, 'height'=>-2*@pady) end + private :_place_config end TkVTBox = TkVBox class TkVBBox < TkVBox def _place_config(widget, idx, cnt) - widget.place_in(self, 'rely'=>(cnt - idx - 1)/cnt, 'relheight'=>1.0/cnt, - 'relwidth'=>1.0) + widget.place_in(self, + 'relx'=>0, 'x'=>@padx, + 'rely'=>(cnt - idx - 1)/cnt, 'y'=>@pady, + 'relwidth'=>1.0, 'width'=>-2*@padx, + 'relheight'=>1.0/cnt, 'height'=>-2*@pady) end + private :_place_config end ################################################ @@ -139,6 +187,13 @@ if __FILE__ == $0 TkButton.new(f, :text=>'aaa'), TkButton.new(f, :text=>'aaaa')) + f = TkHBox.new(:borderwidth=>3, :relief=>'ridge', + :padx=>7, :pady=>3, :background=>'yellow').pack + f.add(TkButton.new(f, :text=>'a'), + TkButton.new(f, :text=>'aa', :font=>'Helvetica 16'), + TkButton.new(f, :text=>'aaa'), + TkButton.new(f, :text=>'aaaa')) + f = TkVBox.new(:borderwidth=>5, :relief=>'groove').pack f.add(TkButton.new(f, :text=>'a'), TkButton.new(f, :text=>'aa', :font=>'Helvetica 30'), diff --git a/ext/tk/sample/tkcombobox.rb b/ext/tk/sample/tkcombobox.rb index 08a2dd73a7..f0cbdac3ba 100644 --- a/ext/tk/sample/tkcombobox.rb +++ b/ext/tk/sample/tkcombobox.rb @@ -24,6 +24,9 @@ static unsigned char down_arrow_bits[] = { 0x10, 0x00, 0x10, 0x00, 0x00, 0x00}; EOD + ############################ + private + ############################ def initialize_composite(keys={}) keys = _symbolkey2str(keys) @@ -64,9 +67,6 @@ EOD configure keys unless keys.empty? end - ############################ - private - ############################ def _show_up_arrow unless @up_arrow.winfo_mapped? @up_arrow.pack(:side=>:top, :fill=>:x) @@ -330,6 +330,7 @@ EOD configure keys unless keys.empty? end + private :initialize_composite def scrollbar(mode) @lst.scrollbar(mode) diff --git a/ext/tk/sample/tkmultilistbox.rb b/ext/tk/sample/tkmultilistbox.rb index 9b66d401b9..1896c66dac 100644 --- a/ext/tk/sample/tkmultilistbox.rb +++ b/ext/tk/sample/tkmultilistbox.rb @@ -182,6 +182,7 @@ class TkMultiListbox < TkListbox delegate('borderwidth', @frame) delegate('relief', @frame) end + private :initialize_composite # set 'mode' option of listboxes def mode(sel_mode) diff --git a/ext/tk/sample/tkoptdb.rb b/ext/tk/sample/tkoptdb.rb index ab8515ac16..897701c222 100644 --- a/ext/tk/sample/tkoptdb.rb +++ b/ext/tk/sample/tkoptdb.rb @@ -33,6 +33,7 @@ cmd = TkOptionDB.new_proc_class(:BTN_CMD, [:show_msg, :bye_msg], 3) { print "==>#{str.tainted?} (<<< $SAFE=#{$SAFE}): " str end + private :__check_proc_string__ end } diff --git a/ext/tk/sample/tktextframe.rb b/ext/tk/sample/tktextframe.rb index d1076c5b72..78efdf0970 100644 --- a/ext/tk/sample/tktextframe.rb +++ b/ext/tk/sample/tktextframe.rb @@ -51,6 +51,7 @@ class TkTextFrame < TkText # do configure configure keys unless keys.empty? end + private :initialize_composite # set background color of text widget def textbackground(color = nil) |