Class: VER::Status::Label
- Inherits:
-
Tk::Tile::Label
- Object
- Tk::Tile::Label
- VER::Status::Label
- Defined in:
- lib/ver/status/label.rb
Direct Known Subclasses
BufferPosition, DiakonosPosition, Encoding, Filename, Mode, NanoPosition, Position, ShortFilename, Syntax
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#sticky ⇒ Object
readonly
Returns the value of attribute sticky.
-
#variable ⇒ Object
readonly
Returns the value of attribute variable.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(status, options = {}) ⇒ Label
constructor
A new instance of Label.
- #register(*events) ⇒ Object
- #setup ⇒ Object
- #style=(config) ⇒ Object
- #text ⇒ Object
- #to_s ⇒ Object
- #toggle ⇒ Object
- #update(event) ⇒ Object
Constructor Details
#initialize(status, options = {}) ⇒ Label
Returns a new instance of Label.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ver/status/label.rb', line 6 def initialize(status, = {}) @status = status @weight = .delete(:weight) || 0 @row = .delete(:row) @column = .delete(:column) @sticky = .delete(:sticky) @format = .delete(:format) || '%s' [:font] ||= .delete(:font) || text..font super id = Digest::MD5.hexdigest(tk_pathname) name = self.class.name[/::([^:]+)$/, 1] @variable = Tk::Variable.new("#{name}_#{id}") configure(textvariable: @variable) setup end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def column @column end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def format @format end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def row @row end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def status @status end |
#sticky ⇒ Object (readonly)
Returns the value of attribute sticky.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def sticky @sticky end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def variable @variable end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
4 5 6 |
# File 'lib/ver/status/label.rb', line 4 def weight @weight end |
Instance Method Details
#register(*events) ⇒ Object
32 33 34 |
# File 'lib/ver/status/label.rb', line 32 def register(*events) status.register(self, *events) end |
#setup ⇒ Object
25 26 |
# File 'lib/ver/status/label.rb', line 25 def setup end |
#style=(config) ⇒ Object
36 37 38 |
# File 'lib/ver/status/label.rb', line 36 def style=(config) configure(config) end |
#text ⇒ Object
40 41 42 |
# File 'lib/ver/status/label.rb', line 40 def text status.text end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/ver/status/label.rb', line 44 def to_s '' end |
#toggle ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ver/status/label.rb', line 48 def toggle info = grid_info if info.empty? grid_configure(@last_grid_info) true else @last_grid_info = info grid_forget false end end |
#update(event) ⇒ Object
28 29 30 |
# File 'lib/ver/status/label.rb', line 28 def update(event) variable.set(to_s) end |