home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IGROUPBX.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
8KB
|
175 lines
#ifndef _IGROUPBX_
#define _IGROUPBX_
/*******************************************************************************
* FILE NAME: igroupbx.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IGroupBox - This class creates and manages the group 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 _ITEXTCTL_
#include <itextctl.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
#ifndef _IRECT_
#include <irect.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes:
class IColor;
class IRectangle;
class ISize;
class IWindowHandle;
class IGroupBox : public ITextControl {
typedef ITextControl
Inherited;
/*******************************************************************************
* The IGroupBox class creates and manages the group box control window. *
* *
* Example: *
* IGroupBox gbxGroup(ID_GROUPBOX, this, this, IRectangle(10,10,110,210)); *
* gbxGroup.setText("Colors"); *
*******************************************************************************/
public:
/*--------------------- Style ---------------------------------------------
The following functions provide a means to set and query group box styles:
Style - Nested class that provides static members that define the set of
valid group box styles. These styles can be used in conjunction
with the styles defined by the IWindow::Style nested class. For
example, you could define an instance of the IGroupBox::Style
class and initialize it like:
IGroupBox::Style
style = IWindow::visible;
An object of this type is provided when the group box is
created. A customizable default is used if no styles are
specified. Once the object is constructed, IGroupBox and
IWindow member functions can be used to set or query the
object's style.
The declaration of the IGroupBox::Style nested class is
generated by the INESTEDBITFLAGCLASSDEF1 macro.
The valid group box styles are:
classDefaultStyle - Original default style for this class, which is
IWindow::visible.
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 group boxes.
-------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF1(Style, IGroupBox, IWindow);
// style class definition
static const Style
classDefaultStyle;
static Style
defaultStyle();
static void
setDefaultStyle(Style style);
/*------------------------- Constructors/Destructor ----------------------------
| You can construct an instance of this class in the following ways: |
| - From a control ID, parent and owner windows, rectangle, and style. |
| This creates the specified group box control and an object for it. |
| - From the ID of a group box control on a dialog window. This creates |
| the object for the specified group box control. |
| - From the window handle of an existing group box control. This creates |
| the object for the specified group box control. |
------------------------------------------------------------------------------*/
IGroupBox ( unsigned long id,
IWindow* parent,
IWindow* owner,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IGroupBox ( unsigned long id,
IWindow* parentDialog );
IGroupBox ( const IWindowHandle& handle );
virtual
~IGroupBox ( );
/*------------------------------- Enumerations ---------------------------------
| The following enumeration is defined: |
| ColorArea - Used to replace the color for a particular region. |
| Values are: |
| foreground - Sets the foreground color used for the text. |
| border - Sets the color of the border that surrounds the |
| group box window. |
------------------------------------------------------------------------------*/
enum ColorArea {
foreground,
border
};
/*----------------------------- Color Functions --------------------------------
| These functions are used to change or return the colors used by the control: |
| setColor - Changes the color of the displayed text. |
| color - Returns the color of the displayed text. |
------------------------------------------------------------------------------*/
IGroupBox
&setColor ( ColorArea value, const IColor& color );
IColor
color ( ColorArea value ) const;
/*-------------------------------- Overrides -----------------------------------
| This class overrides the following inherited function: |
| setText - Sets the text for the group box and notifies a parent canvas to |
| update the layout for its children, if appropriate. |
------------------------------------------------------------------------------*/
virtual IGroupBox
&setText ( const char* text ),
&setText ( const IResourceId& text );
protected:
/*------------------------------- Layout Size ----------------------------------
| calcMinimumSize - Returns the recommended minimum size of this group box |
| control. The size is based on the current font and the |
| text string limit. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize() const;
private:
/*--------------------------------- Private ----------------------------------*/
IGroupBox ( const IGroupBox& );
IGroupBox
&operator= ( const IGroupBox& );
static Style
currentDefaultStyle;
}; // class IGroupBox
INESTEDBITFLAGCLASSFUNCS(Style, IGroupBox);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IGROUPBX_ */