class FormatJustificationWidget

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)

Public Class Methods

new(fe) click to toggle source
Calls superclass method
# File lib/ManqodHelp/FormatEditor/FormatJustificationWidget.rb, line 6
def initialize(fe)
        @fe=fe
        super()
        pack_start(@fill=Gtk::ToggleButton.new(Gtk::Stock::JUSTIFY_FILL))
        pack_start(@left=Gtk::ToggleButton.new(Gtk::Stock::JUSTIFY_LEFT))
        pack_start(@center=Gtk::ToggleButton.new(Gtk::Stock::JUSTIFY_CENTER))
        pack_start(@right=Gtk::ToggleButton.new(Gtk::Stock::JUSTIFY_RIGHT))
        
        @fill.signal_connect('toggled'){|me|
                if me.active?
                        @left.set_active(false)
                        @center.set_active(false)
                        @right.set_active(false)
                        if tag=@fe.current_tag
                                tag.set_justification(Gtk::Justification::FILL).set_justification_set(true)
                                @fe.help.browser.save_current_item
                        end
                end
        }
        @left.signal_connect('toggled'){|me|
                if me.active?
                        @fill.set_active(false)
                        @center.set_active(false)
                        @right.set_active(false)
                        if tag=@fe.current_tag
                                tag.set_justification(Gtk::Justification::LEFT).set_justification_set(true)
                                @fe.help.browser.save_current_item
                        end
                end
        }
        @center.signal_connect('toggled'){|me|
                if me.active?
                        @left.set_active(false)
                        @fill.set_active(false)
                        @right.set_active(false)
                        if tag=@fe.current_tag
                                tag.set_justification(Gtk::Justification::CENTER).set_justification_set(true)
                                @fe.help.browser.save_current_item
                        end
                end
        }
        @right.signal_connect('toggled'){|me|
                if me.active?
                        @left.set_active(false)
                        @center.set_active(false)
                        @fill.set_active(false)
                        if tag=@fe.current_tag
                                tag.set_justification(Gtk::Justification::RIGHT).set_justification_set(true)
                                @fe.help.browser.save_current_item
                        end
                end
        }
        add_events(Gdk::Event::Mask::ALL_EVENTS_MASK)
end

Public Instance Methods

set_value(val) click to toggle source
# File lib/ManqodHelp/FormatEditor/FormatJustificationWidget.rb, line 60
def set_value(val)
        case val
                when Gtk::Justification::FILL then @fill.set_active(true)
                when Gtk::Justification::LEFT then @left.set_active(true)
                when Gtk::Justification::CENTER then @center.set_active(true)
                when Gtk::Justification::RIGHT then @right.set_active(true)
        end
end
value() click to toggle source
# File lib/ManqodHelp/FormatEditor/FormatJustificationWidget.rb, line 68
def value
        val=nil
        val=Gtk::Justification::FILL if @fill.active?
        val=Gtk::Justification::LEFT if @left.active?
        val=Gtk::Justification::CENTER if @center.active?
        val=Gtk::Justification::RIGHT if @right.active?
end