home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
I3STATBX.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
179 lines
#ifndef _I3STATBX_
#define _I3STATBX_
/*******************************************************************************
* FILE NAME: i3statbx.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* I3stateCheckBox - This class creates and manages the three-state 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 I3StateCheckBox : public ISettingButton {
typedef ISettingButton Inherited;
/*******************************************************************************
* The I3StateCheckBox class creates and manages the three-state check box *
* control window. *
* *
* Selection of a three-state check box can be processed by subclassing the *
* ISelectHandler class and adding the handler to either the three-state check *
* box or its owner window. *
* *
* *
* EXAMPLE: *
* To use this control, create an instance of its class as follows: *
* I3StateCheckBox s3bxChoice(ID_CHOICE, this, this, *
* IRectangle(10,10,80,22)); *
* s3bxChoice.setText("Sweet and Sour"); *
*******************************************************************************/
public:
/*--------------- Style ---------------------------------------------------
The following functions provide a means to set or query three-state check
box styles:
Style - Nested class that provides static members that define the set of
valid three-state 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
I3StateCheckBox::Style class and initialize it like:
I3StateCheckBox::Style
style = I3StateCheckBox::autoSelect | IControl::tabStop;
An object of this type is provided when the three-state check
box is created. A customizable default is used if no styles are
specified. Once the object is constructed, I3StateCheckBox,
IWindow, IControl, and IButton member functions can be used to
set or query the object's style.
The declaration of the I3StateCheckBox::Style nested class is
generated by the INESTEDBITFLAGCLASSDEF3 macro.
The valid three-state check box styles are:
classDefaultStyle - Original default style for this class. This
style 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 three-state
check boxes.
-------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF3(Style, I3StateCheckBox,
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. |
| Creates the specified three-state check box control and an object for it.|
| - From the ID of a three-state check box control on a dialog window. |
| Creates the object for the specified three-state check box control. |
| - From the window handle of an existing three-state check box control. |
| Creates the object for the specified three-state check box control. |
------------------------------------------------------------------------------*/
I3StateCheckBox(unsigned long id,
IWindow* parent,
IWindow* owner,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
I3StateCheckBox(unsigned long id,
IWindow* parentDialog);
I3StateCheckBox(const IWindowHandle& handle);
virtual ~I3StateCheckBox();
/*-------------------------------- Overloaded AutoSelect -----------------------
| The following operations are overloaded since the actual style setting is |
| different: |
| enableAutoSelect - Sets the three-state check box control to the autoSelect|
| style. |
| disableAutoSelect - Removes the autoSelect style from the three-state check |
| box control. |
| isAutoSelect - Returns true if the three-state check box control has |
| the autoSelect style set; otherwise, it returns false. |
------------------------------------------------------------------------------*/
virtual I3StateCheckBox
&enableAutoSelect(Boolean turnOn=true),
&disableAutoSelect();
virtual Boolean
isAutoSelect() const;
/*-------------------------------- Halftone Operations -------------------------
| selectHalftone - Selects a halftone three-state check box control. |
| isHalftone - Returns true if the three-state check box control has |
| been selected as halftone. |
------------------------------------------------------------------------------*/
I3StateCheckBox&
selectHalftone();
Boolean
isHalftone() const;
protected:
/*----------------------------- Layout Size ------------------------------------
| calcMinimumSize - Returns the recommended minimum size of this three-state |
| check box control. The size is based on the text string |
| length and the current font. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize() const;
private:
/*--------------------------------- Private ----------------------------------*/
I3StateCheckBox(const I3StateCheckBox&);
I3StateCheckBox& operator=(const I3StateCheckBox&);
static Style
currentDefaultStyle;
}; // I3StateCheckBox
INESTEDBITFLAGCLASSFUNCS(Style, I3StateCheckBox);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _I3STATBX_ */