class IndicatorWindow

Attributes

bg[RW]
fg[RW]
label[R]
layout[RW]
value[R]

Public Class Methods

list() click to toggle source
# File lib/profanity_fe/indicator_window.rb, line 4
def IndicatorWindow.list
        @@list
end
new(*args) click to toggle source
Calls superclass method
# File lib/profanity_fe/indicator_window.rb, line 16
def initialize(*args)
        @fg = [ '444444', 'ffff00' ]
        @bg = [ nil, nil ]
        @label = '*'
        @value = nil
        @@list.push(self)
        super(*args)
end

Public Instance Methods

label=(str) click to toggle source
# File lib/profanity_fe/indicator_window.rb, line 11
def label=(str)
        @label = str
        redraw
end
redraw() click to toggle source
# File lib/profanity_fe/indicator_window.rb, line 33
def redraw
        setpos(0,0)
        if @value
                if @value.is_a?(Integer)
                        attron(color_pair(get_color_pair_id(@fg[@value], @bg[@value]))|Curses::A_NORMAL) { addstr @label }
                else
                        attron(color_pair(get_color_pair_id(@fg[1], @bg[1]))|Curses::A_NORMAL) { addstr @label }
                end
        else
                attron(color_pair(get_color_pair_id(@fg[0], @bg[0]))|Curses::A_NORMAL) { addstr @label }
        end
        noutrefresh
        true
end
update(new_value) click to toggle source
# File lib/profanity_fe/indicator_window.rb, line 24
def update(new_value)
        if new_value == @value
                false
        else
                @value = new_value
                redraw
        end
end