Class: GtkGimdb::ManagerBox

Inherits:
Gtk::HBox
  • Object
show all
Includes:
GetText
Defined in:
lib/gimdb/manager_box.rb

Instance Method Summary (collapse)

Constructor Details

- (ManagerBox) initialize(klass, field)

A new instance of ManagerBox



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gimdb/manager_box.rb', line 6

def initialize(klass, field)
  bindtextdomain($DOMAIN, :path => $LOCALEDIR)
  super()
  @comboboxentry = Gtk::ComboBoxEntry.new
  @image_add  = Gtk::Image.new(Gtk::Stock::ADD, Gtk::IconSize::BUTTON)
  @image_edit = Gtk::Image.new(Gtk::Stock::EDIT, Gtk::IconSize::BUTTON)
  @image_del  = Gtk::Image.new(Gtk::Stock::DELETE, Gtk::IconSize::BUTTON)
  @button = Gtk::Button.new(_('Add'))
  @button.image = @image_add
  @button.image.show
  @klass = klass.to_s.classify.constantize
  @field = field
  @objs = @klass.all.collect{|o| o.send(@field)}
  @status = :add
  @pos = 0
  setting_up { |t| yield(t) }
end