class LegendsButton
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
Attributes
list_holder[RW]
Public Class Methods
new(list_holder)
click to toggle source
Calls superclass method
# File lib/ListHolder/ListButtonHolder/LegendsButton.rb, line 8 def initialize(list_holder) @list_holder=list_holder @auto_update=false super() set_relief(Gtk::ReliefStyle::NONE) set_image(Gtk::Image.new(Gtk::Stock::SELECT_COLOR,Gtk::IconSize.from_name(get_conf(0,0,"button-size")))) signal_connect('toggled'){|me| if me.active? lmodel=Gtk::ListStore.new(String,String,String) #legend,foreground,background column=Gtk::TreeViewColumn.new("Legend",Gtk::CellRendererText.new, {:text => 0, :foreground => 1, :background => 2}) @legend_window=Gtk::Window.new(Gtk::Window::POPUP).add(legend=Gtk::TreeView.new(lmodel))#.set_modal(true) legend.selection.set_mode(Gtk::SelectionMode::NONE) legend.append_column(column) @list_holder.list.list_model.foreground_legend.each_pair{|color,legend| iter=lmodel.append iter[0]=legend iter[1]=color } @list_holder.list.list_model.background_legend.each_pair{|color,legend| iter=lmodel.append iter[0]=legend iter[2]=color } @legend_window. realize. set_transient_for(get_ancestor(Gtk::Window)). move(get_ancestor(Gtk::Window).position[0] + allocation.x + allocation.width, get_ancestor(Gtk::Window).position[1] + allocation.y + allocation.height - @legend_window.allocation.height). show_all. move(get_ancestor(Gtk::Window).position[0] + allocation.x + allocation.width, get_ancestor(Gtk::Window).position[1] + allocation.y + allocation.height - @legend_window.allocation.height) else @legend_window.destroy unless @legend_window.nil? || @legend_window.destroyed? end } end
Public Instance Methods
to_s()
click to toggle source
# File lib/ListHolder/ListButtonHolder/LegendsButton.rb, line 51 def to_s "LegendsButton of #{@list_holder}" end
update()
click to toggle source
# File lib/ListHolder/ListButtonHolder/LegendsButton.rb, line 47 def update set_no_show_all(!(!@list_holder.list.list_model.foreground_legend.empty? || !@list_holder.list.list_model.background_legend.empty?)) set_visible(!@list_holder.list.list_model.foreground_legend.empty? || !@list_holder.list.list_model.background_legend.empty?) end