Class: Fox::FXToggleButton

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

Overview

The toggle button provides a two-state button, which toggles between the on and the off state each time it is pressed. For each state, the toggle button has a unique icon and text label.

Events

The following messages are sent by FXToggleButton to its target:

SEL_COMMAND

sent when the toggle button is pressed.

SEL_KEYPRESS

sent when a key goes down; the message data is an FXEvent instance.

SEL_KEYRELEASE

sent when a key goes up; the message data is an FXEvent instance.

SEL_LEFTBUTTONPRESS

sent when the left mouse button goes down; the message data is an FXEvent instance.

SEL_LEFTBUTTONRELEASE

sent when the left mouse button goes up; the message data is an FXEvent instance.

Toggle button flags

TOGGLEBUTTON_AUTOGRAY

Automatically gray out when not updated

TOGGLEBUTTON_AUTOHIDE

Automatically hide toggle button when not updated

TOGGLEBUTTON_TOOLBAR

Toolbar style toggle button [flat look]

TOGGLEBUTTON_KEEPSTATE

Draw button according to state

TOGGLEBUTTON_NORMAL

FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT

Direct Known Subclasses

FXTriStateButton

Instance Attribute Summary collapse

Attributes inherited from FXLabel

#font, #helpText, #icon, #iconPosition, #justify, #text, #textColor, #tipText

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 FXLabel

#to_s

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(p, text1, text2, icon1 = nil, icon2 = nil, target = nil, selector = 0, opts = TOGGLEBUTTON_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXToggleButton

Return an initialized FXToggleButton instance.

Parameters:

p

the parent window for this toggle button Fox::FXComposite

text1

the text for this toggle button’s first state [String]

text2

the text for this toggle button’s second state [String]

icon1

the icon, if any, for this toggle button’s first state Fox::FXIcon

icon2

the icon, if any, for this toggle button’s second state Fox::FXIcon

target

the message target, if any, for this toggle button Fox::FXObject

selector

the message identifier for this toggle button [Integer]

opts

toggle button options [Integer]

x

initial x-position [Integer]

y

initial y-position [Integer]

width

initial width [Integer]

height

initial height [Integer]

padLeft

internal padding on the left side, in pixels [Integer]

padRight

internal padding on the right side, in pixels [Integer]

padTop

internal padding on the top side, in pixels [Integer]

padBottom

internal padding on the bottom side, in pixels [Integer]



67
68
# File 'rdoc-sources/FXToggleButton.rb', line 67

def initialize(p, text1, text2, icon1=nil, icon2=nil, target=nil, selector=0, opts=TOGGLEBUTTON_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theToggleButton
end

Instance Attribute Details

#altHelpTextObject

Alternate status line help text, shown when toggled [String]



37
38
39
# File 'rdoc-sources/FXToggleButton.rb', line 37

def altHelpText
  @altHelpText
end

#altIconObject

Alternate icon, shown when toggled Fox::FXIcon



31
32
33
# File 'rdoc-sources/FXToggleButton.rb', line 31

def altIcon
  @altIcon
end

#altTextObject

Alternate text, shown when toggled [String]



28
29
30
# File 'rdoc-sources/FXToggleButton.rb', line 28

def altText
  @altText
end

#altTipTextObject

Alternate tool tip message, shown when toggled [String]



40
41
42
# File 'rdoc-sources/FXToggleButton.rb', line 40

def altTipText
  @altTipText
end

#stateObject

Toggled state [true or false]



34
35
36
# File 'rdoc-sources/FXToggleButton.rb', line 34

def state
  @state
end

#toggleStyleObject

Toggle button style [Integer]



43
44
45
# File 'rdoc-sources/FXToggleButton.rb', line 43

def toggleStyle
  @toggleStyle
end