home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IOUTLBOX.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
185 lines
#ifndef _IOUTLBOX_
#define _IOUTLBOX_
/*******************************************************************************
* FILE NAME: ioutlbox.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IOutlineBox - This class creates and manages an unfilled rectangle control.*
* *
* 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 _ICONTROL_
#include <icontrol.hpp>
#endif
// Forward declarations for other classes:
class IRectangle;
class ISize;
class IWindowHandle;
class IColor;
#ifndef _IRECT_
#include <irect.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IOutlineBox : public IControl {
typedef IControl Inherited;
/*******************************************************************************
* The IOutlineBox class creates and manages an unfilled rectangle control. *
* *
* EXAMPLE: *
* IOutlineBox olbx1(ID_BKGNDRECT, this, this, IRectangle(10,10,110,210)); *
* *
* IOutlineBox olbx2(ID_FGNDRECT, this, this, IRectangle(120,10,220,210)); *
* olbx2.setOutlineType(IOutlineBox::foreground); *
* *
* IOutlineBox olbx3(ID_HTONERECT, this, this, IRectangle(230,10,330,210)); *
* olbx3.setOutlineType(IOutlineBox::halftone); *
*******************************************************************************/
public:
/*------------------- Style -----------------------------------------------
The following functions provide a means to set and query outline box styles:
Style - Nested class that provides static members that define the set of
valid outline 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
IOutlineBox::Style class and initialize it like:
IOutlineBox::Style
style = IOutlineBox::halftoneFrame | IWindow::visible;
An object of this type is provided when the outline box is
created. A customizable default is used if no styles are
specified. Once the object is constructed, IOutlineBox and
IWindow member functions can be used to set or query the
object's style.
The declaration of the IOutlineBox::Style nested class is
generated by the INESTEDBITFLAGCLASSDEF1 macro.
The valid outline box styles are:
classDefaultStyle - Original default style for this class, which is
foregroundFrame | IWindow::visible.
backgroundFrame - Causes the outline box to have a frame equal to the
background color.
foregroundFrame - Causes the outline box to have a frame equal to the
foreground color.
halftoneFrame - Causes the outline box to have the frame shaded in a
halftone of the foreground color.
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 outline boxes.
-------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF1(Style, IOutlineBox, IWindow);
// style class definition
static const Style
classDefaultStyle,
backgroundFrame,
foregroundFrame,
halftoneFrame;
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 outline box control and an object for it. |
| - From the ID of an outline box control on a dialog window. This |
| creates the object for the specified outline box control. |
| - From the window handle of an existing outline box control. This |
| creates the object for the specified outline box control. |
------------------------------------------------------------------------------*/
IOutlineBox(unsigned long id,
IWindow* parent,
IWindow* owner,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IOutlineBox(unsigned long id,
IWindow* parentDialog);
IOutlineBox(const IWindowHandle& handle);
/*---------------------------- Enumerations ------------------------------------
| The following enumerations are defined: |
| OutlineType - Enumeration that specifies outline type parameters. Values |
| are: |
| foreground - Uses the currently set foreground color. |
| background - Uses the system background color. |
| halftone - Uses halftone shading in the foreground color.|
| |
| ColorArea - Enumeration that is used to replace the color for a |
| particular region. The value is: |
| fillRegion - Sets the color with which the outline is |
| drawn. This overides the currently set |
| OutlineType. |
------------------------------------------------------------------------------*/
enum OutlineType {
foreground,
background,
halftone };
enum ColorArea {
fillRegion};
/*-------------------------------- Filltype ------------------------------------
| setOutlineType - Sets the type of outline. |
| outlineType - Returns the type of outline. |
------------------------------------------------------------------------------*/
IOutlineBox&
setOutlineType(OutlineType type);
OutlineType
outlineType() const;
/*----------------------------- Color Functions --------------------------------
| setColor - Changes the color of the given color region. |
| color - Returns the color of the given color region. |
------------------------------------------------------------------------------*/
IOutlineBox
&setColor(ColorArea value, const IColor& color);
IColor
color(ColorArea value) const;
protected:
private:
/*--------------------------------- PRIVATE ----------------------------------*/
IOutlineBox(const IOutlineBox&);
IOutlineBox& operator=(const IOutlineBox&);
static Style
currentDefaultStyle;
}; // class IOutlineBox
INESTEDBITFLAGCLASSFUNCS(Style, IOutlineBox);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif // _IOUTLBOX_