summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/menu.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-08 18:14:15 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-08 18:14:15 +0000
commitb9bdee95f10922c0f4adbb51d2496c63d7d1ecdc (patch)
treee4586165010be9bac4462f8c53f267c126cdd041 /ext/tk/lib/tk/menu.rb
parent642e10156c3554e2f1c922f0b3f6e0f8bd26ec16 (diff)
* ext/tcltklib/tcltklib.c (ip_init): set root-win title to "ruby" when
the running script is '-e one-liner' or '-' (stdin). * ext/tcltklib/extconf.rb: add find_library("#{lib}#{ver}",..) for stub libs * ext/tk/lib/tk/textmark.rb: TkTextMarkCurrent and TkTextMarkAnchor have a wrong parent class. * ext/tk/lib/tk/dialog.rb: rename TkDialog2 --> TkDialogObj and TkWarning2 --> TkWarningObj (old names are changed to alias names) * ext/tk/lib/tk/dialog.rb: bug fix of treatment of 'prev_command' option and hashes for configuration * ext/tk/lib/tk/dialog.rb: add TkDialogObj#name to return the button name * ext/tk/lib/tk/radiobutton.rb: rename enbugged method value() ==> get_value() and value=(val) ==> set_value(val). * ext/tk/lib/tk/menu.rb: add TkMenu.new_menuspec * ext/tk/lib/tk/menu.rb: add alias (TkMenuButton = TkMenubutton, TkOptionMenuButton = TkOptionMenubutton) * ext/tk/lib/tk/event.rb: new method aliases (same as option keys of event_generate) for Event object * ext/tk/lib/tk/font.rb: configinfo returns proper types of values * ext/tk/lib/tk.rb: bind methods accept subst_args + block * ext/tk/lib/tk/canvas.rb: ditto * ext/tk/lib/tk/canvastag.rb: ditto * ext/tk/lib/tk/frame.rb: ditto * ext/tk/lib/tk/text.rb: ditto * ext/tk/lib/tk/texttag.rb: ditto * ext/tk/lib/tk/toplevel.rb: ditto * ext/tk/lib/tkextlib/*: ditto and bug fix git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/menu.rb')
-rw-r--r--ext/tk/lib/tk/menu.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index 1972193e51..8a33b482c7 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -3,6 +3,7 @@
#
require 'tk'
require 'tk/itemconfig'
+require 'tk/menuspec'
module TkMenuEntryConfig
include TkItemConfigMethod
@@ -33,6 +34,7 @@ end
class TkMenu<TkWindow
include TkMenuEntryConfig
+ extend TkMenuSpec
TkCommandNames = ['menu'.freeze].freeze
WidgetClassName = 'Menu'.freeze
@@ -47,6 +49,24 @@ class TkMenu<TkWindow
#end
#private :create_self
+ def self.new_menuspec(menu_spec, parent = nil, tearoff = false, keys = nil)
+ if parent.kind_of?(Hash)
+ keys = _symbolkey2str(parent)
+ parent = keys.delete('parent')
+ tearoff = keys.delete('tearoff')
+ elsif tearoff.kind_of?(Hash)
+ keys = _symbolkey2str(tearoff)
+ tearoff = keys.delete('tearoff')
+ elsif keys
+ keys = _symbolkey2str(keys)
+ else
+ keys = {}
+ end
+
+ widgetname = keys.delete('widgetname')
+ _create_menu(parent, menu_spec, widgetname, tearoff, keys)
+ end
+
def tagid(id)
#id.to_s
_get_eval_string(id)
@@ -389,6 +409,7 @@ class TkMenubutton<TkLabel
end
private :create_self
end
+TkMenuButton = TkMenubutton
class TkOptionMenubutton<TkMenubutton
@@ -509,3 +530,4 @@ class TkOptionMenubutton<TkMenubutton
@menu.current_entryconfiginfo(index, key)
end
end
+TkOptionMenuButton = TkOptionMenubutton