Class: ButtonMenuItem
- Inherits:
-
Gtk::Button
- Object
- Gtk::Button
- ButtonMenuItem
- Includes:
- ManqodCommon, Observable
- Defined in:
- lib/ButtonMenu/ButtonMenuItem.rb
Overview
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])
Constant Summary
Constants included from ManqodCommon
ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING
Constants included from Eprint
Instance Attribute Summary collapse
-
#menu_id ⇒ Object
Returns the value of attribute menu_id.
-
#modname ⇒ Object
Returns the value of attribute modname.
-
#parent_menu ⇒ Object
Returns the value of attribute parent_menu.
-
#submenu ⇒ Object
Returns the value of attribute submenu.
-
#target ⇒ Object
Returns the value of attribute target.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(menu_id, parent_menu) ⇒ ButtonMenuItem
constructor
A new instance of ButtonMenuItem.
- #resize_image(new_size) ⇒ Object
- #show_up(caller) ⇒ Object
- #to_s ⇒ Object
- #update(notifier) ⇒ Object
Methods included from ManqodCommon
#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #qrow, #query, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick
Methods included from Eprint
#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception
Constructor Details
#initialize(menu_id, parent_menu) ⇒ ButtonMenuItem
Returns a new instance of ButtonMenuItem.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 8 def initialize(,) @menu_id= @submenu=nil @parent_menu= @image_size=nil if row=admin.qrow("select gtkmenu.*, modules.modname from gtkmenu left join modules on gtkmenu.module = modules.id where gtkmenu.id='#{}'") @modname=row["modname"] if row["module"].to_i == -1 @target=nil else @target=row['target'] end @text=row['display'] @image_id=row['imageid'].to_i end super() set_use_underline(true) set_relief(Gtk::ReliefStyle::NONE) set_no_show_all(true) set_label(text) # set_image(Gtk::Image.new(image_of_id(@image_id,"gtk-large-toolbar"))) # resize_image("gtk-large-toolbar") set_image_position(Gtk::PositionType::TOP) signal_connect("clicked"){|me| edebug(self.inspect+" clicked, so emiting signal","menu","debug") ..hide_tree show_up(self) self.changed notify_observers(self) } self end |
Instance Attribute Details
#menu_id ⇒ Object
Returns the value of attribute menu_id.
45 46 47 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 45 def @menu_id end |
#modname ⇒ Object
Returns the value of attribute modname.
49 50 51 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 49 def modname @modname end |
#parent_menu ⇒ Object
Returns the value of attribute parent_menu.
48 49 50 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 48 def @parent_menu end |
#submenu ⇒ Object
Returns the value of attribute submenu.
46 47 48 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 46 def @submenu end |
#target ⇒ Object
Returns the value of attribute target.
44 45 46 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 44 def target @target end |
#text ⇒ Object
Returns the value of attribute text.
47 48 49 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 47 def text @text end |
Instance Method Details
#resize_image(new_size) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 74 def resize_image(new_size) if @image_size!=new_size set_image(Gtk::Image.new(image_of_id(@image_id,new_size))) @image_size=new_size end end |
#show_up(caller) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 61 def show_up(caller) edebug(inspect+" showup","menu","debug") if if caller==self .show_items("gtk-small-toolbar",nil) else .show_items("gtk-large-toolbar",caller) end .show_up(self) if else .show_up() if end end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 57 def to_s "ButtonMenuItem(#{text})" end |
#update(notifier) ⇒ Object
51 52 53 54 55 |
# File 'lib/ButtonMenu/ButtonMenuItem.rb', line 51 def update(notifier) edebug(self.inspect+" we've been called, so emiting signal","menu","debug") changed notify_observers(notifier) end |