diff options
Diffstat (limited to 'ext/tk/lib/tk/menu.rb')
-rw-r--r-- | ext/tk/lib/tk/menu.rb | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb index 0e4f419e15..3e122e6987 100644 --- a/ext/tk/lib/tk/menu.rb +++ b/ext/tk/lib/tk/menu.rb @@ -155,13 +155,13 @@ class Tk::Menu<TkWindow _fromUTF8(tk_send_without_enc('invoke', _get_eval_enc_str(index))) end def insert(index, type, keys=nil) - tk_send_without_enc('insert', _get_eval_enc_str(index), + tk_send_without_enc('insert', _get_eval_enc_str(index), type, *hash_kv(keys, true)) self end def delete(first, last=nil) if last - tk_send_without_enc('delete', _get_eval_enc_str(first), + tk_send_without_enc('delete', _get_eval_enc_str(first), _get_eval_enc_str(last)) else tk_send_without_enc('delete', _get_eval_enc_str(first)) @@ -170,7 +170,7 @@ class Tk::Menu<TkWindow end def popup(x, y, index=nil) if index - tk_call_without_enc('tk_popup', path, x, y, + tk_call_without_enc('tk_popup', path, x, y, _get_eval_enc_str(index)) else tk_call_without_enc('tk_popup', path, x, y) @@ -214,7 +214,7 @@ class Tk::Menu<TkWindow def entrycget(index, key) case key.to_s when 'text', 'label', 'show' - _fromUTF8(tk_send_without_enc('entrycget', + _fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), "-#{key}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('entrycget', index, "-#{key}")) @@ -234,20 +234,20 @@ class Tk::Menu<TkWindow end def entryconfigure(index, key, val=None) if key.kind_of? Hash - if (key['font'] || key[:font] || - key['kanjifont'] || key[:kanjifont] || - key['latinfont'] || key[:latinfont] || + if (key['font'] || key[:font] || + key['kanjifont'] || key[:kanjifont] || + key['latinfont'] || key[:latinfont] || key['asciifont'] || key[:asciifont]) tagfont_configure(index, _symbolkey2str(key)) else - tk_send_without_enc('entryconfigure', _get_eval_enc_str(index), + tk_send_without_enc('entryconfigure', _get_eval_enc_str(index), *hash_kv(key, true)) end else - if (key == 'font' || key == :font || - key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + if (key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if val == None tagfontobj(index) @@ -284,16 +284,16 @@ class Tk::Menu<TkWindow else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -331,16 +331,16 @@ class Tk::Menu<TkWindow else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -509,18 +509,18 @@ class Tk::Menubutton<Tk::Label if keys and keys != None unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ # tk_call_without_enc('menubutton', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? tk_call_without_enc('destroy', @path) rescue nil - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end @@ -571,7 +571,7 @@ class Tk::OptionMenubutton<Tk::Menubutton parent = nil if !args.empty? && (args[0].kind_of?(TkWindow) || args[0] == nil) keys.delete('parent') # ignore - parent = args.shift + parent = args.shift else parent = keys.delete('parent') end @@ -579,7 +579,7 @@ class Tk::OptionMenubutton<Tk::Menubutton @variable = nil if !args.empty? && (args[0].kind_of?(TkVariable) || args[0] == nil) keys.delete('variable') # ignore - @variable = args.shift + @variable = args.shift else @variable = keys.delete('variable') end @@ -593,7 +593,7 @@ class Tk::OptionMenubutton<Tk::Menubutton end install_win(if parent then parent.path end) - @menu = OptionMenu.new(tk_call('tk_optionMenu', + @menu = OptionMenu.new(tk_call('tk_optionMenu', @path, @variable.id, *args)) configure(keys) if keys @@ -612,7 +612,7 @@ class Tk::OptionMenubutton<Tk::Menubutton self end def add(value) - @menu.add('radiobutton', 'variable'=>@variable, + @menu.add('radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -623,7 +623,7 @@ class Tk::OptionMenubutton<Tk::Menubutton @menu.invoke(index) end def insert(index, value) - @menu.insert(index, 'radiobutton', 'variable'=>@variable, + @menu.insert(index, 'radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -677,5 +677,5 @@ end Tk::OptionMenuButton = Tk::OptionMenubutton #TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton #TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton -Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, +Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, :TkOptionMenubutton, :TkOptionMenuButton) |