home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ICHECKBX.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
8KB
|
162 lines
#ifndef _ICHECKBX_
#define _ICHECKBX_
/*******************************************************************************
* FILE NAME: icheckbx.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* ICheckBox - This class creates and manages the check box control window. *
* *
* 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 _ISETBUT_
#include <isetbut.hpp>
#endif
// Forward declarations for other classes:
class IRectangle;
class ISize;
class IWindowHandle;
#ifndef _IRECT_
#include <irect.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class ICheckBox : public ISettingButton {
typedef ISettingButton Inherited;
/*******************************************************************************
* The ICheckBox class creates and operates on a check box. A check box is a *
* square box with associated text that represents a choice. When a user *
* selects the choice, the check box is filled to indicate that the choice is *
* selected. The user can clear the check box by selecting the choice again, *
* thereby deselecting the choice. *
* *
* Selection of a check box can be processed by subclassing the ISelectHandler *
* class and adding the handler either to the check box or to its owner window. *
* *
* *
* EXAMPLE: *
* ICheckBox chkbxChoice(ID_CHOICE, this, this, IRectangle(10,10,80,22)); *
* chkbxChoice.setText("Hot and Spicy"); *
*******************************************************************************/
public:
/*--------------- Style ---------------------------------------------------
The following functions provide a means to set and query check box styles:
Style - Nested class that provides static members that define the set of
valid check box styles. These styles can be used in conjunction
with the styles defined by the nested classes IWindow::Style,
IControl::Style, and IButton::Style. For example, you could
define an instance of the ICheckBox::Style class and initialize
it like:
ICheckBox::Style
style = ICheckBox::autoSelect | IControl::tabStop;
An object of this type is provided when the check box is created.
A customizable default is used if no styles are specified. Once
the object is constructed, ICheckBox, IWindow, IControl, and
IButton member functions can be used to set or query the
object's style.
The declaration of the ICheckBox::Style nested class is
generated by the INESTEDBITFLAGCLASSDEF3 macro.
The valid check box styles are:
classDefaultStyle - Original default style for this class, which is
autoSelect | IWindow::visible.
autoSelect - A selection technique in which moving the keyboard
cursor automatically changes the current selection.
The following functions provide a means of getting and setting the default
style for this class:
defaultStyle - Returns the current default style. This is the same as
classDefaultStyle unless setDefaultStyle has been
called.
setDefaultStyle - Sets the default style for all subsequent check boxes.
-------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF3(Style, ICheckBox, IWindow,
IControl, IButton);
// style class definition
static const Style
classDefaultStyle,
autoSelect;
static Style
defaultStyle();
static void
setDefaultStyle(Style style);
/*------------------------ Constructors ----------------------------------------
| You can construct instances of this class in the following ways: |
| - From a control ID, parent and owner windows, rectangle, and style. |
| This creates the specified check box control and an object for it. |
| - From the ID of a check box control on a dialog window. |
| This creates the object for the specified check box control. |
| - From the window handle of an existing check box control. |
| This creates the object for the specified check box control. |
------------------------------------------------------------------------------*/
ICheckBox(unsigned long id,
IWindow* parent,
IWindow* owner,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
ICheckBox(unsigned long id,
IWindow* parentDialog);
ICheckBox(const IWindowHandle& handle);
virtual ~ICheckBox();
/*-------------------------------- Overloaded AutoSelect -----------------------
| The following operations are overloaded since the actual style setting is |
| different: |
| enableAutoSelect - Sets the check box control to the autoSelect style, or |
| removes the autoSelect style from the control. |
| disableAutoSelect - Removes the autoSelect style from the check box control.|
| isAutoSelect - Returns true if the check box control has the |
| autoSelect style set; otherwise, it returns false. |
------------------------------------------------------------------------------*/
virtual ICheckBox
&enableAutoSelect(Boolean turnOn=true),
&disableAutoSelect();
virtual Boolean
isAutoSelect() const;
protected:
/*----------------------------- Layout Size ------------------------------------
| calcMinimumSize - Returns the recommended minimum size of this check box |
| control. The size is based on the text string length |
| and the current font. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize() const;
private:
/*--------------------------------- Private ----------------------------------*/
ICheckBox(const ICheckBox&);
ICheckBox& operator=(const ICheckBox&);
static Style
currentDefaultStyle;
}; // class ICheckBox
INESTEDBITFLAGCLASSFUNCS(Style, ICheckBox);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _ICHECKBX_ */