Sha256: 16b16fd9151b2dc90dc2edd9c8e4cb45aa506db8f88b8d0cb52a7c93ce4bb45b
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
module VER class Status class Label < Tk::Tile::Label include LabelToggle attr_reader :status, :variable, :weight, :row, :column, :sticky, :format def initialize(status, options = {}) @status = status @weight = options.delete(:weight) || 0 @row = options.delete(:row) @column = options.delete(:column) @sticky = options.delete(:sticky) @format = options.delete(:format) || '%s' options[:font] ||= options.delete(:font) || buffer.options.font super id = Digest::MD5.hexdigest(tk_pathname) name = self.class.name[/::([^:]+)$/, 1] @variable = Tk::Variable.new("#{name}_#{id}") configure(textvariable: @variable) @destroyed = false bind('<Destroy>', &method(:on_destroy)) setup end def destroyed? @destroyed end def on_destroy(event) @destroyed = true end def setup end def buffer status.buffer end def update(event) variable.set(to_s) unless destroyed? end def register(*events) status.register(self, *events) end def style=(config) configure(config) unless destroyed? end def to_s '' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ver-2010.08 | lib/ver/status/label.rb |