Class: Cosmos::CanvaslabelWidget
- Includes:
- Widget
- Defined in:
- lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb
Instance Attribute Summary
Attributes included from Widget
#item, #item_name, #limits_set, #limits_state, #packet, #packet_name, #polling_period, #screen, #settings, #target_name, #value, #value_type
Instance Method Summary collapse
-
#initialize(parent_layout, x, y, text, font_size = 12, color = 'black') ⇒ CanvaslabelWidget
constructor
A new instance of CanvaslabelWidget.
- #paint(painter) ⇒ Object
Methods included from Widget
#context_menu, #get_tooltip_text, included, #process_settings, #set_setting, #set_subsetting, #shutdown, #update_widget
Constructor Details
#initialize(parent_layout, x, y, text, font_size = 12, color = 'black') ⇒ CanvaslabelWidget
Returns a new instance of CanvaslabelWidget.
18 19 20 21 22 23 24 25 26 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb', line 18 def initialize(parent_layout, x, y, text, font_size = 12, color='black') super() @x = x.to_i @y = y.to_i @text = text @color = Cosmos::getColor(color) @font = Cosmos.getFont("helvetica", font_size.to_i) parent_layout.add_repaint(self) end |
Instance Method Details
#paint(painter) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb', line 28 def paint(painter) painter.save painter.setPen(@color) painter.setFont(@font) painter.drawText(@x, @y, @text) painter.restore end |