Class: Fox::FXLabel

Inherits:
FXFrame show all
Defined in:
rdoc-sources/FXLabel.rb

Overview

A label widget can be used to place a text and/or icon for explanation purposes. The text label may have an optional tooltip and/or help string. Icon and label are placed relative to the widget using the justfication options, and relative to each other as determined by the icon relationship options. A large number of arrangements is possible.

Justification modes

JUSTIFY_NORMAL

Default justification is centered text

JUSTIFY_CENTER_X

Text is centered horizontally

JUSTIFY_LEFT

Text is left-justified

JUSTIFY_RIGHT

Text is right-justified

JUSTIFY_HZ_APART

Combination of JUSTIFY_LEFT & JUSTIFY_RIGHT

JUSTIFY_CENTER_Y

Text is centered vertically

JUSTIFY_TOP

Text is aligned with label top

JUSTIFY_BOTTOM

Text is aligned with label bottom

JUSTIFY_VT_APART

Combination of JUSTIFY_TOP & JUSTIFY_BOTTOM

Relationship options for icon-labels

ICON_UNDER_TEXT

Icon appears under text

ICON_AFTER_TEXT

Icon appears after text (to its right)

ICON_BEFORE_TEXT

Icon appears before text (to its left)

ICON_ABOVE_TEXT

Icon appears above text

ICON_BELOW_TEXT

Icon appears below text

TEXT_OVER_ICON

Same as ICON_UNDER_TEXT

TEXT_AFTER_ICON

Same as ICON_BEFORE_TEXT

TEXT_BEFORE_ICON

Same as ICON_AFTER_TEXT

TEXT_ABOVE_ICON

Same as ICON_BELOW_TEXT

TEXT_BELOW_ICON

Same as ICON_ABOVE_TEXT

Normal way to show label

LABEL_NORMAL

Same as JUSTIFY_NORMAL|ICON_BEFORE_TEXT

Instance Attribute Summary collapse

Attributes inherited from FXFrame

#baseColor, #borderColor, #borderWidth, #frameStyle, #hiliteColor, #padBottom, #padLeft, #padRight, #padTop, #shadowColor

Attributes inherited from FXWindow

#accelTable, #backColor, #defaultCursor, #dragCursor, #first, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y

Attributes inherited from FXDrawable

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Instance Method Summary collapse

Methods inherited from FXWindow

#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, after?, #after?, before?, #before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #position, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=

Methods included from Responder2

#connect

Methods inherited from FXDrawable

#resize

Methods inherited from FXId

#create, #created?, #destroy, #detach, #runOnUiThread

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(parent, text, icon = nil, opts = LABEL_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXLabel

Construct label with given text and icon


66
67
# File 'rdoc-sources/FXLabel.rb', line 66

def initialize(parent, text, icon=nil, opts=LABEL_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theLabel
end

Instance Attribute Details

#fontObject

The text font Fox::FXFont


48
49
50
# File 'rdoc-sources/FXLabel.rb', line 48

def font
  @font
end

#helpTextObject

Status line help text [String]


60
61
62
# File 'rdoc-sources/FXLabel.rb', line 60

def helpText
  @helpText
end

#iconObject

The icon for this label Fox::FXIcon


45
46
47
# File 'rdoc-sources/FXLabel.rb', line 45

def icon
  @icon
end

#iconPositionObject

Icon position [Integer]


57
58
59
# File 'rdoc-sources/FXLabel.rb', line 57

def iconPosition
  @iconPosition
end

#justifyObject

Text justification mode [Integer]


54
55
56
# File 'rdoc-sources/FXLabel.rb', line 54

def justify
  @justify
end

#textObject

The text for this label [String]


42
43
44
# File 'rdoc-sources/FXLabel.rb', line 42

def text
  @text
end

#textColorObject

The text color Fox::FXColor


51
52
53
# File 'rdoc-sources/FXLabel.rb', line 51

def textColor
  @textColor
end

#tipTextObject

Tool tip message [String]


63
64
65
# File 'rdoc-sources/FXLabel.rb', line 63

def tipText
  @tipText
end

Instance Method Details

#to_sObject

Return the label's text


70
# File 'rdoc-sources/FXLabel.rb', line 70

def to_s; text; end