Index: A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
The FlexButton class creates a standard button for use in user interfaces. The button can be labeled with either a string or an image. When the button is pressed, an ActionEvent is sent to all registered ActionListeners. To register an action listener, call AddActionListener.
#include <toolkit/button.h>
public: | |
// FlexButton members | |
enum | FlexButtonConstants; |
FlexButton(); | |
Result | AddActionListener(ActionListenerInterface& listener); |
Result | AddTitleListener(TitleListenerInterface& listener); |
void | CloseWindowWhenActivated(Boolean close); |
const void * | GetLabelBitmap(void); |
const TCHAR * | GetLabelString(void); |
void | RemoveActionListener(ActionListenerInterface& listener); |
void | RemoveTitleListener(TitleListenerInterface& listener); |
void | SetLabelBitmap(const void *bitmapData); |
void | SetLabelString(const TCHAR *label); |
protected: |
public: | ||
---|---|---|
// FlexComponent members | ||
enum | HorizontalSizePreference; | |
enum | VerticalSizePreference; | |
Result | AddComponentListener(ComponentListenerInterface& listener); | |
Result | AddFocusListener(FocusListenerInterface& listener); | |
Result | AddKeyListener(KeyListenerInterface& listener); | |
Result | AddMouseListener(MouseListenerInterface& listener); | |
Result | AddMouseMotionListener(MouseMotionListenerInterface& listener); | |
void | AddNotify(void); | |
Boolean | Contains(WinCoord x, WinCoord y); | |
Boolean | Contains(WinXYPoint& point); | |
void | DelayedDelete(void); | |
void | DoLayout(void); | |
Colorant | GetBackground(void); | |
WinRectangle | GetBounds(void) const; | |
FlexComponent * | GetComponentAt(WinCoord x, WinCoord y, Boolean visibleOnly ); | |
FlexComponent * | GetComponentAt(WinXYPoint& point, Boolean visibleOnly ); | |
Colorant | GetForeground(void); | |
FlexComponentID | GetID(void); | |
WinXYPoint | GetLocation(void); | |
Dimension | GetMinimumSize(void); | |
FlexContainer * | GetParent(void) const; | |
FlexWindow * | GetFlexWindowAncestor(void); | |
Dimension | GetPreferredSize(void); | |
Dimension | GetSize(void) const; | |
void | GetSizePreference(HorizontalSizePreference &horizontalSizePref, VerticalSizePreference &verticalSizePref); | |
void | Invalidate(void); | |
Boolean | IsEnabled(void) const; | |
Boolean | IsFocusTraversable(void); | |
Boolean | IsShowing(void) const; | |
Boolean | IsGeometryValid(void) const; | |
Boolean | IsVisible(void) const; | |
void | Paint(void); | |
void | RemoveComponentListener(ComponentListenerInterface& listener); | |
void | RemoveFocusListener(FocusListenerInterface& listener); | |
void | RemoveKeyListener(KeyListenerInterface& listener); | |
void | RemoveMouseListener(MouseListenerInterface& listener); | |
void | RemoveMouseMotionListener(MouseMotionListenerInterface& listener); | |
void | RemoveNotify(void); | |
void | Repaint(void); | |
void | Repaint(WinCoord x, WinCoord y, uint16 width, uint16 height); | |
void | RequestFocus(void); | |
Result | SetBackground(Colorant color); | |
void | SetBounds(WinCoord x, WinCoord y, uint16 width, uint16 height); | |
void | SetBounds(WinRectangle& rect); | |
void | SetEnabled(Boolean enable); | |
Result | SetForeground(Colorant color); | |
void | SetID(FlexComponentID id); | |
void | SetLocation(WinCoord x, WinCoord y); | |
void | SetLocation(const WinXYPoint& point); | |
void | SetSize(const Dimension& dimension); | |
void | SetSize(uint16 width, uint16 height); | |
void | SetSizePreference(HorizontalSizePreference horizontalSizePref, VerticalSizePreference verticalSizePref); | |
Result | SetVisible(Boolean visible); | |
void | TransferFocus(void); | |
void | Update(WinCoord x, WinCoord y, uint16 width, uint16 height); | |
void | Validate(void); | |
// Event processing methods | ||
void | ProcessActionEvent(ActionEvent& actionEvent); | |
void | ProcessComponentEvent(ComponentEvent& componentEvent); | |
void | ProcessFocusEvent(FocusEvent& focusEvent); | |
void | ProcessKeyEvent(KeyEvent& keyEvent); | |
void | ProcessMouseEvent(MouseEvent& mouseEvent); | |
void | ProcessMouseMotionEvent(MouseEvent& mouseEvent); | |
// Graphical rendering methods | ||
void * | CopyArea(const WinRectangle *bounds) const; | |
WinCoord | FontMetric( FontMetricInfo info, const TextState& textState ) const; | |
void | BrushLine( WinXYPoint p1, WinXYPoint p2, Colorant lineCOlor, WinCoord penWidth ); | |
void | DrawLine( WinXYPoint p1, WinXYPoint p2, Colorant lineColor ); | |
void | DrawHLine( WinCoord xStart, WinCoord xEnd, WinCoord yCoord, Colorant lineColor ); | |
void | DrawVLine( WinCoord xCoord, WinCoord yStart, WinCoord yEnd, Colorant lineColor); | |
void | DrawBitmap(const Bitmap& bitmap, WinXYPoint destUpLeft, Colorant color); | |
void | DrawBitmap(const Bitmap& bitmap, WinXYPoint destUpLeft); | |
void | DrawPoint( WinCoord xPos, WinCoord yPos, Colorant dotColor ); | |
void | DrawPoint( WinXYPoint point, Colorant dotColor ); | |
void | DrawString( const TCHAR string[], TextState& textState ); | |
void | DrawString( const TCHAR string[], int32 numChars, TextState& textState ); | |
void | DrawUIShape( const UIShape srcUIShape, const WinXYPoint& basePoint, Colorant fgColor, int16 parm0 , int16 parm1 , int16 parm2 , int16 parm3 ); | |
void | InvertUIShape( const UIShape srcUIShape, const WinXYPoint& basePoint, int16 parm0 , int16 parm1 , int16 parm2 , int16 parm3 ); | |
void | FillRect( WinCoord leftCorner, WinCoord topCorner, WinCoord rightCorner, WinCoord bottomCorner, Colorant fillColor ); | |
void | InvertRect( WinCoord leftCorner, WinCoord topCorner, WinCoord rightCorner, WinCoord bottomCorner ); | |
void | InvertLine( WinXYPoint p1, WinXYPoint p2 ); | |
void | InvertLine( WinCoord x1, WinCoord y1, WinCoord x2, WinCoord y2 ); | |
void | SetClipRect( const WinXYPoint& clipUpLeft, const WinXYPoint& clipLowRight ); | |
void | ClearClipRect(void); | |
void | Render(Renderer& renderer); | |
WinCoord | StringWidth( const TCHAR string[], const TextState& textState ) const; | |
WinCoord | StringWidth( const TCHAR string[], int32 numChars, const TextState& textState ) const; | |
protected: | ||
EC (static void EnsureInAppThread(void)); |
Back to the top of FlexButton
Back to the top of FlexButton
Back to the top of FlexButton
Constants for the FlexButton class.
Declared as:
enum FlexButtonConstants { FBC_STRING_LABEL_SIZE = 255 };
Back to the top of FlexButton
Class constructor.
Prototype:
FlexButton();
Back to the top of FlexButton
Result AddActionListener(ActionListenerInterface& listener);
Adds an ActionListener to receive action events on this button. An ActionEvent is sent when the button is pressed.
Parameters:
See also: RemoveActionListener()
Prototype:
Result AddActionListener(ActionListenerInterface& listener);
Back to the top of FlexButton
Result AddTitleListener(TitleListenerInterface& listener);
Adds a TitleListener to receive draw events on the button label. A TitleEvent is sent when the button's label needs to be drawn.
Parameters:
See also: RemoveTitleListener()
Prototype:
Result AddTitleListener(TitleListenerInterface& listener);
Back to the top of FlexButton
void CloseWindowWhenActivated(Boolean close);
If set TRUE, this method will cause the parent window of the button to close (the window is set not visible) when the button is activated. The parent window can be a FlexDialog, FlexFrame, or FlexWindow. This method replaces having to add an ActiveListener to the FlexButton for the sole purpose of closing a window when the button is activated.
Note that the parent window is set not visible when closed, but it is not deleted.
Parameters:
Prototype:
void CloseWindowWhenActivated(Boolean close);
Back to the top of FlexButton
const void *GetLabelBitmap(void);
Returns the pointer to the bitmap data for the label. If the label is not an image, NULL is returned. To draw the label, use DrawBitmap().
Return value: Pointer to bitmap data for label.
See also: SetLabelBitmap()
Prototype:
const void *GetLabelBitmap(void);
Back to the top of FlexButton
const TCHAR *GetLabelString(void);
Returns a pointer to the text label of the button. If the button label is an image and not text, GetLabelString will return NULL.
Return value: A const TCHAR pointer to the label; NULL if the label is not text.
See also: SetLabelString()
Prototype:
const TCHAR *GetLabelString(void);
Back to the top of FlexButton
void RemoveActionListener(ActionListenerInterface& listener);
Removes an ActionListener from this button component.
Parameters:
Prototype:
void RemoveActionListener(ActionListenerInterface& listener);
Back to the top of FlexButton
void RemoveTitleListener(TitleListenerInterface& listener);
Removes a TitleListener from this button component.
Parameters:
Prototype:
void RemoveTitleListener(TitleListenerInterface& listener);
Back to the top of FlexButton
void SetLabelBitmap(const void *bitmapData);
Sets the button label to use the supplied bitmap data. SetLabelBitmap will not make a copy of the label, so the caller needs to maintain the label memory.
The button will resize as needed and redraw after this operation.
If NULL is passed, the button will be resized to the minimum size and drawn without a label.
Parameters:
Prototype:
void SetLabelBitmap(const void *bitmapData);
Back to the top of FlexButton
void SetLabelString(const TCHAR *label);
Sets the button label to the supplied text label. SetLabelString will not make a copy of the label, so the caller needs to maintain the label memory.
The button will resize as needed and redraw after this operation.
If NULL is passed, the button will be resized to the minimum size and drawn without a label.
Parameters:
Prototype:
void SetLabelString(const TCHAR *label);
Back to the top of FlexButton