class HelpIndex

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

help[R]

Public Class Methods

new(help) click to toggle source
Calls superclass method
# File lib/ManqodHelp/HelpIndex.rb, line 6
def initialize(help)
        @help=help
        @path=Array.new
        super()
        set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC)
        @data=Gtk::ListStore.new(String,TrueClass)
        @filter=Gtk::TreeModelFilter.new(@data)
        @filter.set_visible_column(1)
        @sorter=Gtk::TreeModelSort.new(@filter).set_sort_column_id(0)
        @widget=Gtk::TreeView.new(@sorter)
        column=Gtk::TreeViewColumn.new("Index",renderer=Gtk::CellRendererText.new, {:text => 0}).set_sort_column_id(0)
        @widget.append_column(column)
        add_with_viewport(@widget)
        @widget.signal_connect("cursor-changed"){|me|
                if me.cursor
                        item=@sorter.get_iter(me.cursor[0])[0]
                        @path.push(item) if help.browser.load_item(item)
                        @help.update_back_button
                end
        }

end

Public Instance Methods

can_go_back?() click to toggle source
# File lib/ManqodHelp/HelpIndex.rb, line 58
def can_go_back?
        @path.size > 1
end
go_back() click to toggle source
# File lib/ManqodHelp/HelpIndex.rb, line 51
def go_back
        if can_go_back?
                @path.pop
                set_cursor(@path.pop)
                @help.update_back_button
        end
end
populate() click to toggle source
# File lib/ManqodHelp/HelpIndex.rb, line 29
def populate
        @data.clear
        @help.browser.items.each_key{|key|
                i=@data.append
                i[0]=key
                i[1]=true
        }
        self
end
refilter() click to toggle source
# File lib/ManqodHelp/HelpIndex.rb, line 38
def refilter
        @data.each{|model,path,iter|
                iter[1]=iter[0].upcase.index(@help.filter.text.upcase) != nil
        }
        @filter.refilter
end
set_cursor(item) click to toggle source
# File lib/ManqodHelp/HelpIndex.rb, line 44
def set_cursor(item)
        found=nil
        loaded=false
        @data.each{|model,path,iter| found=path if item.upcase == iter[0].upcase}
        loaded=@widget.set_cursor(@sorter.convert_child_path_to_path(@filter.convert_child_path_to_path(found)),nil,false) if found
        loaded
end