home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IBUTTON.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
172 lines
#ifndef _IBUTTON_
#define _IBUTTON_
/*******************************************************************************
* FILE NAME: ibutton.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IButton - The IButton class is the abstract base class for button controls.*
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _ITEXTCTL_
#include <itextctl.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes:
class IColor;
class IButton : public ITextControl {
typedef ITextControl
Inherited;
/*******************************************************************************
* The IButton class is the abstract base class for button controls. This *
* class contains the common functions for all button controls. Actual button *
* controls are created by deriving from this base class. *
*******************************************************************************/
public:
/*----------------------- Style -----------------------------------------------
The following functions provide a means to set and query button styles:
Style - Nested class that provides static members that define the set of
valid button styles. These styles can be used in conjunction
with the styles defined by the nested classes IWindow::Style and
IControl::Style. For example, you could define an instance of
the IButton::Style class and initialize it like:
IButton::Style
style = IControl::tabStop;
An object of this type is provided when the button is created. A
customizable default is used if no styles are specified. Once
the object is constructed, IButton, IWindow, and IControl member
functions can be used to set or query the object's style.
The declaration of the IButton::Style nested class is generated
by the INESTEDBITFLAGCLASSDEF2 macro.
The valid button styles are:
noPointerFocus - Buttons with this style do not set the focus to
themselves when the user clicks on them using the mouse.
This enables the cursor to stay on a control for which
information is required, rather than moving to the
button. This has no effect on keyboard interaction.
-----------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF2(Style, IButton, IWindow, IControl);
// style class definition
static const Style
noPointerFocus;
/*-------------------------- Constructor/Destructor ----------------------------
| Instances of this class cannot be created. |
------------------------------------------------------------------------------*/
IButton ( );
virtual
~IButton ( );
/*------------------------------- Mouse Focus ----------------------------------
| The following functions are used to set and query whether the button can |
| receive the input focus when clicked with the mouse pointer: |
| enableMouseClickFocus - Enables the button to receive the focus when the |
| user clicks on the button using the mouse. |
| disableMouseClickFocus - Prevents the button from receiving the focus |
| when the user clicks on the button using the |
| mouse. |
| allowsMouseClickFocus - Queries whether the button can receive the focus. |
------------------------------------------------------------------------------*/
IButton
&enableMouseClickFocus ( Boolean turnOn = true ),
&disableMouseClickFocus ( );
Boolean
allowsMouseClickFocus ( ) const;
/*----------------------------- Highlight State --------------------------------
| These operations test and set a button's highlight state. A highlighted |
| button will have the same appearance as if the mouse selection button (mouse |
| button 1) was pressed while the mouse pointer was over the button control: |
| isHighlighted - Returns true if the button's highlight state is set. |
| highlight - Sets the button's highlight state. |
| unhighlight - Turns off the button's highlight state. |
------------------------------------------------------------------------------*/
Boolean
isHighlighted ( ) const;
virtual IButton
&highlight ( ),
&unhighlight ( );
/*----------------------------- Click the Button -------------------------------
| click - Simulates the user clicking on the button control using the |
| mouse selection button. |
------------------------------------------------------------------------------*/
virtual IButton
&click ( );
/*------------------------------- Enumerations ---------------------------------
| The following enumerations are defined: |
| ColorArea - Used to replace the color for a particular region. |
| Values are: |
| foreground - Sets the color of the foreground text. |
| disabledForeground - Sets the foreground color for disabled |
| text. |
| background - Sets the color of the background of |
| the button window. |
| highlightForeground - Sets the foreground color for |
| highlighted text. |
| border - Sets the color of the border that |
| surrounds the button window. |
------------------------------------------------------------------------------*/
enum ColorArea {
foreground,
background,
disabledForeground,
highlightForeground,
border
};
/*----------------------------- Color Functions --------------------------------
| setColor - Changes the color of the given region. |
| color - Returns the color of the given region. |
------------------------------------------------------------------------------*/
IButton
&setColor ( ColorArea value, const IColor& color );
IColor
color ( ColorArea value ) const;
/*-------------------------------- Overrides -----------------------------------
| This class overrides the following inherited functions: |
| setText - Sets the text for the button and notifies a parent canvas to |
| update the layout for its children, if appropriate. |
------------------------------------------------------------------------------*/
virtual IButton
&setText ( const char* text ),
&setText ( const IResourceId& text );
protected:
private:
/*--------------------------------- Private ----------------------------------*/
IButton ( const IButton& );
IButton
&operator= ( const IButton& );
}; // class IButton
INESTEDBITFLAGCLASSFUNCS(Style, IButton);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IBUTTON_ */