Class: Iup::Label
- Includes:
- ButtonCallback, DragDropAttributes, ImageAttributes
- Defined in:
- lib/wrapped/label.rb
Overview
A static control used to display some text or an image, or act as a separator.
Example
(1) label with text and setting font and colors:
Iup::Label.new("Iup Label Text") do |l|
l.bgcolor = '255 255 0'
l.fgcolor = '0 0 255'
l.font = 'Courier, Normal 14'
l.alignment = 'ACENTER'
end
(2) label with image aligned to right
Iup::Label.new do |l|
l.image = img_star
end
(3) label as a horizontal separator
Iup::Label.new do |l|
l.separator = 'HORIZONTAL'
end
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#alignment ⇒ Object
:attr: alignment Sets the horizontal and vertical alignment.
-
#ellipsis ⇒ Object
:attr: ellipsis If set, adds “…” to the text if there is inadequate space, values ‘yes’ / ‘no’.
-
#expand ⇒ Object
:attr: expand Allows label to fill available space in indicated direction.
-
#initialize(text = nil) {|_self| ... } ⇒ Label
constructor
Creates an instance of a label.
-
#padding ⇒ Object
:attr: padding Margin in x and y directions, value as “mxn”.
-
#position ⇒ Object
:attr_reader: position Returns position in pixels within client window as “x,y”.
-
#rastersize ⇒ Object
:attr: rastersize Size of the label, in pixels, value as “widthxheight”.
-
#screenposition ⇒ Object
:attr_reader: screenposition returns position in pixels on screen as “x,y”.
-
#separator ⇒ Object
:attr: separator ‘horizontal’ / ‘vertical’, makes line into a line separator.
-
#spacing ⇒ Object
:attr: spacing Space between image and text, value as a number.
-
#tip ⇒ Object
:attr: tip Tooltip string.
-
#title ⇒ Object
:attr: title text to display (unless label has an image or is a separator).
Methods included from ButtonCallback
Methods included from DragDropAttributes
#dragbegin_cb=, #dragdata_cb=, #dragdatasize_cb=, #dragend_cb=, #dragsource, #dragsourcemove, #dragtypes, #dropdata_cb=, #dropmotion_cb=, #droptarget, #droptypes
Methods included from AttributeBuilders
#define_attribute, #define_id_attribute, #define_id_reader, #define_id_writer, #define_property_attribute, #define_property_reader, #define_property_writer, #define_reader, #define_writer
Methods included from ImageAttributes
#image, #image=, #iminactive, #iminactive=, #impress, #impress=
Methods included from AttributeReference
Methods inherited from Widget
#active, #assign_handle, #bgcolor, #destroy, #enterwindow_cb=, #fgcolor, #font, #getfocus_cb=, #help_cb=, #k_any=, #killfocus_cb=, #leavewindow_cb=, #map_cb=, #maxsize, #minsize, #open_controls, #size, #unmap_cb=, #visible, #wid, #zorder
Methods included from CallbackSetter
Constructor Details
#initialize(text = nil) {|_self| ... } ⇒ Label
Creates an instance of a label. If a block is given, the new instance is yielded to it.
-
text- optional text to use for label.
36 37 38 39 40 41 |
# File 'lib/wrapped/label.rb', line 36 def initialize text=nil @handle = IupLib.IupLabel(text) # run any provided block on instance, to set up further attributes yield self if block_given? end |
Instance Method Details
#alignment ⇒ Object
:attr: alignment Sets the horizontal and vertical alignment. The value is a string “horizontal:vertical”, with horizontal options ALEFT, ACENTER, ARIGHT and vertical options ATOP, ACENTER, ABOTTOM. Partial values also accepted, e.g. “ARIGHT”, “:ATOP”.
52 |
# File 'lib/wrapped/label.rb', line 52 define_attribute :alignment |
#ellipsis ⇒ Object
:attr: ellipsis If set, adds “…” to the text if there is inadequate space, values ‘yes’ / ‘no’.
58 |
# File 'lib/wrapped/label.rb', line 58 define_attribute :ellipsis |
#expand ⇒ Object
:attr: expand Allows label to fill available space in indicated direction. Values ‘no’ / ‘horizontal’ / ‘vertical’ / ‘yes’.
64 |
# File 'lib/wrapped/label.rb', line 64 define_attribute :expand |
#padding ⇒ Object
:attr: padding Margin in x and y directions, value as “mxn”.
69 |
# File 'lib/wrapped/label.rb', line 69 define_attribute :padding |
#position ⇒ Object
:attr_reader: position Returns position in pixels within client window as “x,y”.
74 |
# File 'lib/wrapped/label.rb', line 74 define_reader :position |
#rastersize ⇒ Object
:attr: rastersize Size of the label, in pixels, value as “widthxheight”.
79 |
# File 'lib/wrapped/label.rb', line 79 define_attribute :rastersize |
#screenposition ⇒ Object
:attr_reader: screenposition returns position in pixels on screen as “x,y”.
84 |
# File 'lib/wrapped/label.rb', line 84 define_reader :screenposition |
#separator ⇒ Object
:attr: separator ‘horizontal’ / ‘vertical’, makes line into a line separator.
89 |
# File 'lib/wrapped/label.rb', line 89 define_attribute :separator |
#spacing ⇒ Object
:attr: spacing Space between image and text, value as a number.
94 |
# File 'lib/wrapped/label.rb', line 94 define_attribute :spacing |
#tip ⇒ Object
:attr: tip Tooltip string.
99 |
# File 'lib/wrapped/label.rb', line 99 define_attribute :tip |
#title ⇒ Object
:attr: title text to display (unless label has an image or is a separator).
104 |
# File 'lib/wrapped/label.rb', line 104 define_attribute :title |