#include <dialogs.h>
Inheritance diagram for TButton::
Public Methods | |
TButton (const TRect &bounds, const char *aTitle, ushort aCommand, ushort aFlags) | |
~TButton () | |
virtual void | draw () |
void | drawState (Boolean down) |
virtual TPalette& | getPalette () const |
virtual void | handleEvent (TEvent &event) |
void | makeDefault (Boolean enable) |
virtual void | press () |
virtual void | setState (ushort aState, Boolean enable) |
Static Public Methods | |
TStreamable* | build () |
Public Attributes | |
const char* | title |
Static Public Attributes | |
const char* | shadows |
const char* const | name |
Protected Methods | |
TButton (StreamableInit) | |
virtual void | write (opstream &os) |
virtual void* | read (ipstream &is) |
Protected Attributes | |
ushort | command |
uchar | flags |
Boolean | amDefault |
There can only be one default button in a window or dialog at any given time. Buttons that are peers in a group grab and release the default state via evBroadcast messages.
Definition at line 536 of file dialogs.h.
|
Constructor. Creates a TButton class with the given size by calling the TView constructor.
Constant Value Meaning bfNormal 0x00 Button is a normal, non-default button bfDefault 0x01 Button is the default button: if this bit is set this button will be highlighted as the default button bfLeftJust 0x02 Button label is left-justified; if this bit is clear the title will be centered bfBroadcast 0x04 Sends a broadcast message when pressed bfGrabFocus 0x08 The button grabs the focus when pressed It is the responsibility of the programmer to ensure that there is only one default button in a TGroup. However the default property can be passed to normal buttons by calling makeDefault().
The options data member is set to (ofSelectable | ofFirstClick | ofPreProcess | ofPostProcess) so that by default TButton responds to these events. eventMask is set to evBroadcast. |
|
Destructor. Frees the memory assigned to the button's title, then destroys the view with TView::~TView.
|
|
Constructor. Used to recover the view from a stream. Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized virtual table pointers. This is achieved by calling this constructor with an argument of type StreamableInit. |
|
Creates a new TButton. Used to recover the view from a stream. Called to create an object in certain stream-reading situations. Reimplemented from TView. |
|
Draws the button by calling TButton::drawState(False).
Reimplemented from TView. |
|
Called by draw(). Draws the button in the "down" state (no shadow) if down is True; otherwise, it draws the button in the "up" state if down is False. The appropriate palettes are used to reflect the current state (normal, default, disabled). The button label is positioned according to the bfLeftJust bit in the flags data member. |
|
Returns a reference to the standard TButton palette string. Reimplemented from TView. |
|
Handles TButton events. Responds to being pressed in any of three ways: mouse clicks on the button, its hot key being pressed, or being the default button when a cmDefault broadcast arrives. When the button is pressed, a command event is generated with putEvent(), with the command data member assigned to command and infoPtr set to this. Buttons also recognize the broadcast commands cmGrabDefault and cmReleaseDefault, to become or "unbecome" the default button, as appropriate, and cmCommandSetChanged, which causes them to check whether their commands have been enabled or disabled. Reimplemented from TView. |
|
Changes the default property of this button. Used to make this button the default with `enable' set to True, or to release the default with `enable' set to False. Three notes:
|
|
This method is called whenever the button is pressed. Its task is to send a message. The message is a broadcast message to the owner of the view if the button has the bfBroadcast bit set, otherwise the message is a command message.
|
|
Used to recover the view from a stream. Reads from the input stream `is'. Reimplemented from TView. |
|
Changes the state of the button. Calls setState(), then calls drawView() to redraw the button if it has been made sfSelected or sfActive.
Reimplemented from TView. |
|
Used to store the view in a stream. Writes to the output stream `os'. Reimplemented from TView. |
|
If True the button has the default property. The default button is automatically selected when the user presses the Enter key. If this variable is False, the button is a normal button. |
|
This is the command word of the event generated when this button is pressed. |
|
This variabile is a bitmapped data member used to indicate whether button text is left-justified or centered. The individual flags are the various bfXXXX constants.
|
|
Undocumented. Reimplemented from TView. |
|
A pointer to the shadow characters. These characters are used to draw the button shadow. |
|
This is a pointer to the label text of the button. |