class MyRendererList

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

form[RW]
list[RW]
model[RW]
pc[RW]
scroller[RW]

Public Class Methods

new(pc) click to toggle source
Calls superclass method
# File lib/FormHolder/Form/InputHolder/List.rb, line 84
        def initialize(pc)
                @pc=pc
                @list=List.new(self)
                @scroller=Gtk::ScrolledWindow.new
                buttons=Gtk::HButtonBox.new.set_layout_style(Gtk::ButtonBox::END)
                super()
                pack_start(scroller)
                pack_start(buttons,false,false) unless target.to_i == -1
                button=ListButton.new
                pc.add_observer(button)
                button.signal_connect('clicked') do |c|
                        @form=Myform::MyFormHolder.new("dialog",self,@pc.target_runmode,target)
                        @form.set_parentM(parentM)
                        ret=form.run(text.to_i)
                        list.update(ret) if ret and ret>0
                end
                buttons.pack_start(button)
                scroller.set_hscrollbar_policy(Gtk::POLICY_AUTOMATIC).add(list)
                list.set_model(@model=MyRendererModel.new(list))
                list.selection.signal_connect('changed'){|me|
                                if me.selected then 
                                        edebug("#{self} selection changed by user: #{pc.default} -> #{me.selected[0]}. emiting signal","list-list","debug")
                                        pc.changed
                                        pc.notify_observers(pc)
                                        run_events(item['id'],'form_item-Action')
                                end
                        }

#               signal_connect('key-press-event'){|me,key| list.model.update_filter(me,key)}
        end

Public Instance Methods

item() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 118
def item
        pc.item
end
parentM() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 122
def parentM
        pc.parentM
end
parentselected() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 144
def parentselected
        pc.parentselected
end
qrow() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 166
def qrow
        parentM.qrow
end
query() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 162
def query
        parentM.query
end
set_label(label) click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 148
def set_label(label)
        pc.set_label(label)
end
set_model(model) click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 140
def set_model(model)
        list.set_model(model)
end
set_selected(id_to_select) click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 130
def set_selected(id_to_select)
        list.set_selected(id_to_select)
end
set_sensitive(sens) click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 156
def set_sensitive(sens)
        @list.set_sensitive(sens)
        self
end
target() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 152
def target
        pc.target
end
text() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 126
def text
        list.selection.selected[0] if !list.selection.selected.nil?
end
to_s() click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 170
def to_s
        "List: (#{item['description']})"
end
update(id_to_select=item['default']) click to toggle source
# File lib/FormHolder/Form/InputHolder/List.rb, line 134
def update(id_to_select=item['default'])
        run_events(item['id'],'form_item-BeforeUpdate')
        list.update(id_to_select)
        run_events(item['id'],'form_item-AfterUpdate')
end