Class: ListButtonHolder
- Inherits:
-
Object
- Object
- ListButtonHolder
- Includes:
- ManqodCommon
- Defined in:
- lib/ListHolder/ListButtonHolder.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
-
#advanced_buttons ⇒ Object
readonly
Returns the value of attribute advanced_buttons.
-
#advanced_filter ⇒ Object
readonly
Returns the value of attribute advanced_filter.
-
#archive_button ⇒ Object
readonly
Returns the value of attribute archive_button.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#holder ⇒ Object
readonly
Returns the value of attribute holder.
-
#legends_button ⇒ Object
readonly
Returns the value of attribute legends_button.
-
#list_buttons ⇒ Object
readonly
Returns the value of attribute list_buttons.
-
#list_holder ⇒ Object
readonly
Returns the value of attribute list_holder.
-
#sum_button ⇒ Object
readonly
Returns the value of attribute sum_button.
Instance Method Summary collapse
- #activate_default ⇒ Object
-
#initialize(list_holder, orientation) ⇒ ListButtonHolder
constructor
A new instance of ListButtonHolder.
- #load_buttons ⇒ Object
- #set_orientation(new_orientation) ⇒ Object
- #update(notifier, reload = false) ⇒ 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(list_holder, orientation) ⇒ ListButtonHolder
Returns a new instance of ListButtonHolder.
8 9 10 11 12 13 14 15 16 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 8 def initialize(list_holder,orientation) @list_holder=list_holder @list_id=nil @default=nil @groups=Hash.new set_orientation(orientation) # list_buttons.set_layout_style(Gtk::ButtonBox::SPREAD) list_holder.list.add_observer(self) end |
Instance Attribute Details
#advanced_buttons ⇒ Object (readonly)
Returns the value of attribute advanced_buttons.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def @advanced_buttons end |
#advanced_filter ⇒ Object (readonly)
Returns the value of attribute advanced_filter.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def advanced_filter @advanced_filter end |
#archive_button ⇒ Object (readonly)
Returns the value of attribute archive_button.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def @archive_button end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def groups @groups end |
#holder ⇒ Object (readonly)
Returns the value of attribute holder.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def holder @holder end |
#legends_button ⇒ Object (readonly)
Returns the value of attribute legends_button.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def @legends_button end |
#list_buttons ⇒ Object (readonly)
Returns the value of attribute list_buttons.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def @list_buttons end |
#list_holder ⇒ Object (readonly)
Returns the value of attribute list_holder.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def list_holder @list_holder end |
#sum_button ⇒ Object (readonly)
Returns the value of attribute sum_button.
17 18 19 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 17 def @sum_button end |
Instance Method Details
#activate_default ⇒ Object
91 92 93 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 91 def activate_default @default.clicked if @default && !@list_holder.list.list_model.locked?(@list_holder.list.get_cursor_id) && @default.sensitive? end |
#load_buttons ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 64 def @default=nil @groups.clear .each{|| .destroy unless .destroyed?} # admin_rows("select * from buttons where moditemid='#{list_holder.list.get_id}' and (grp_id in (-1,0) or (select count(id) from usergroups where userid='#{nick_id}' and groupid=grp_id)>0) order by oid"){|row| return if list_holder.list.list_model.drbmodel.nil? @archive_button.update @legends_button.update @up_button.update @down_button.update list_holder.list.list_model.drbmodel.(nick_id).each{|row| =MyButton.new(row.rehash,list_holder,self) if .group && !@groups.has_key?(.group) @groups[.group]=ButtonGroup.new(self,.group) .pack_start(@groups[.group]) end if .group ..pack_start() else .pack_start() end .update(list_holder.list) @default= if @default.nil? and .function != 'add' } holder.show_all end |
#set_orientation(new_orientation) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 28 def set_orientation(new_orientation) unless new_orientation == @orientation @orientation = new_orientation @holder.remove().remove() unless @holder.nil? @holder.destroy unless @holder.nil? or @holder.destroyed? if .nil? or .destroyed? @advanced_buttons=Gtk::HBox.new.set_homogeneous(false) .pack_start(@advanced_filter=AdvancedFilterButton.new(@list_holder)) .pack_start(@sum_button=SumPanelButton.new(@list_holder)) .pack_start(@legends_button=LegendsButton.new(@list_holder)) .pack_start(@archive_button=ArchiveButton.new(@list_holder)) .pack_start(@up_button=OrderingButton.new(@list_holder,Gtk::Stock::GO_UP)) .pack_start(@down_button=OrderingButton.new(@list_holder,Gtk::Stock::GO_DOWN)) end case @orientation when Gtk::ORIENTATION_VERTICAL @holder=Gtk::VBox.new @list_buttons=Gtk::VBox.new#.set_homogeneous(false).set_layout_style(Gtk::ButtonBox::START) holder.pack_start(,false,false,0) holder.pack_start(list_holder.info,true,true) holder.pack_start(,false,false,0) else # when Gtk::ORIENTATION_HORIZONTAL @holder=Gtk::HBox.new @list_buttons=Gtk::HBox.new#.set_homogeneous(false).set_layout_style(Gtk::ButtonBox::END) holder.pack_start(,false,false,0) holder.pack_start(list_holder.info,true,true) holder.pack_end(,false,false,0) end @holder.signal_connect('destroy'){|me| @holder.remove(list_holder.info) unless list_holder.info.destroyed? } end end |
#update(notifier, reload = false) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ListHolder/ListButtonHolder.rb', line 19 def update(notifier,reload=false) if notifier.list_id == @list_id && !reload .each{|| .update(notifier)} else @list_id=notifier.list_id end self end |