1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nagai 2003-12-09 14:38:15 +00:00
parent 8edab1a9b4
commit edc03a2912
16 changed files with 154 additions and 17 deletions

View file

@ -1,3 +1,14 @@
Tue Dec 9 23:32:23 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb, ext/tk/lib/tkcanvas.rb, ext/tk/lib/tkdialog.rb,
ext/tk/lib/tkentry.rb, ext/tk/lib/tkscrollbox.rb, ext/tk/lib/tktext.rb,
ext/tk/sample/tkalignbox.rb, ext/tk/sample/tkcombobox.rb,
ext/tk/sample/tkmultilistbox.rb, ext/tk/sample/tkoptdb.rb, ext/tk/sample/tktextframe.rb,
ext/tk/sample/demos-en/dialog1.rb, ext/tk/sample/demos-en/dialog2.rb,
ext/tk/sample/demos-jp/dialog1.rb, ext/tk/sample/demos-jp/dialog2.rb:
overrided instance methods, which are private methods on the super
class, are changed to 'private'
Tue Dec 9 19:53:02 2003 akira yamada <akira@ruby-lang.org>
* lib/uri/generic.rb (URI::Generic#route_from0): make case insensitive

View file

@ -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

View file

@ -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

View file

@ -139,6 +139,7 @@ class TkDialog2 < TkWindow
@command.call(self)
end
end
private :create_self
def show
if @default_button.kind_of? String

View file

@ -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

View file

@ -26,4 +26,5 @@ class TkScrollbox<TkListbox
configure keys if keys
end
private :initialize_composite
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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'),

View file

@ -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)

View file

@ -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)

View file

@ -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
}

View file

@ -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)