Class: VER::Status::Label
- Inherits:
-
Tk::Tile::Label
- Object
- Tk::Tile::Label
- VER::Status::Label
- Includes:
- LabelToggle
- 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
- #buffer ⇒ Object
- #destroyed? ⇒ Boolean
-
#initialize(status, options = {}) ⇒ Label
constructor
A new instance of Label.
- #on_destroy(event) ⇒ Object
- #register(*events) ⇒ Object
- #setup ⇒ Object
- #style=(config) ⇒ Object
- #to_s ⇒ Object
- #update(event) ⇒ Object
Methods included from LabelToggle
Constructor Details
#initialize(status, options = {}) ⇒ Label
Returns a new instance of Label.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ver/status/label.rb', line 8 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) || buffer..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 |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def column @column end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def format @format end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def row @row end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def status @status end |
#sticky ⇒ Object (readonly)
Returns the value of attribute sticky.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def sticky @sticky end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def variable @variable end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
6 7 8 |
# File 'lib/ver/status/label.rb', line 6 def weight @weight end |
Instance Method Details
#buffer ⇒ Object
41 42 43 |
# File 'lib/ver/status/label.rb', line 41 def buffer status.buffer end |
#destroyed? ⇒ Boolean
30 31 32 |
# File 'lib/ver/status/label.rb', line 30 def destroyed? @destroyed end |
#on_destroy(event) ⇒ Object
34 35 36 |
# File 'lib/ver/status/label.rb', line 34 def on_destroy(event) @destroyed = true end |
#register(*events) ⇒ Object
49 50 51 |
# File 'lib/ver/status/label.rb', line 49 def register(*events) status.register(self, *events) end |
#setup ⇒ Object
38 39 |
# File 'lib/ver/status/label.rb', line 38 def setup end |
#style=(config) ⇒ Object
53 54 55 |
# File 'lib/ver/status/label.rb', line 53 def style=(config) configure(config) unless destroyed? end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/ver/status/label.rb', line 57 def to_s '' end |
#update(event) ⇒ Object
45 46 47 |
# File 'lib/ver/status/label.rb', line 45 def update(event) variable.set(to_s) unless destroyed? end |