home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ICOLOR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
10KB
|
204 lines
#ifndef _ICOLOR_
#define _ICOLOR_
/*******************************************************************************
* FILE NAME: icolor.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IColor - color class *
* IDeviceColor - color class *
* IGUIColor - color class *
* *
* 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 _IBASE_
#include <ibase.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes:
class IColor;
class IColorIndex;
class IGUIColor;
class IColor : public IBase {
/*******************************************************************************
* The IColor class is used to query and set the color of various areas of the *
* User Interface Class Library controls. This class is the base for the other *
* color classes. *
*******************************************************************************/
public:
/*------------------------ Constructors ----------------------------------------
| You can construct instances of this class in the following ways: |
| |
| - From the default constructor (protected). |
| The resulting instance represents black because the red, green, and |
| blue components are all set to 0. |
| - From a Color enumerator value. |
| A specified color enumerator value is used to set the red, green, and |
| blue components. |
| - From separate red, green, and blue values. |
| The separate component values are stored. |
------------------------------------------------------------------------------*/
enum Color {white, black, blue, red, pink, green,
cyan, yellow, darkGray, darkBlue,
darkRed, darkPink, darkGreen, darkCyan,
brown, paleGray };
IColor(Color value);
IColor(unsigned char red, unsigned char green,
unsigned char blue);
/*-------------------------------- Accessors -----------------------------------
| These function provide means of getting and setting the accessible |
| attributes of instances of this class: |
| redMix - Returns the value of the red component. |
| greenMix - Returns the value of the green component. |
| blueMix - Returns the value of the blue component. |
| asRGBLong - Returns the red, green, and blue color value as a long. |
| index - Returns the logical color table index closest to the red, |
| green, and blue values. |
| value - Determines the color enumerator value given a color index. |
------------------------------------------------------------------------------*/
unsigned char
redMix() const,
greenMix() const,
blueMix() const;
long
asRGBLong() const;
virtual long
index() const;
IColor::Color
value() const;
/*--------------------------- Set Functions ------------------------------------
|The following functions are used to change the color value: |
| setRed - Sets the red color mix. |
| setGreen - Sets the green color mix. |
| setBlue - Sets the blue color mix. |
------------------------------------------------------------------------------*/
IColor
&setRed(unsigned char redMix),
&setGreen(unsigned char greenMix),
&setBlue(unsigned char blueMix);
protected:
/*--------------------------- Default Constructor ------------------------------
| IColor - Default constructor. |
------------------------------------------------------------------------------*/
IColor();
private:
unsigned char
ucClRed,
ucClGreen,
ucClBlue;
}; // IColor
class IDeviceColor : public IColor {
/*******************************************************************************
* The IDeviceColor class deals with device-independent color indices. *
*******************************************************************************/
typedef IColor inherited;
public:
/*------------------------ Constructor -----------------------------------------
| The only way to construct instances of this class is from a DeviceColor |
| value. The internal device color is set from the DeviceColor provided. |
| |
| DeviceColor - Determines the device-independent color of the object being |
| constructed (defaultColor, background, neutral). |
------------------------------------------------------------------------------*/
enum DeviceColor { defaultColor, background, neutral };
IDeviceColor(DeviceColor);
/*-------------------------------- Accessor ------------------------------------
| This function provides a means of getting and setting the accessible |
| attributes of instances of this class: |
| index - Returns the index value of DeviceColor. |
------------------------------------------------------------------------------*/
virtual long
index() const;
private:
/*--------------------------------- Private ----------------------------------*/
long
lClDeviceColor;
}; // IDeviceColor
class IGUIColor : public IColor {
/*******************************************************************************
* The IGUIColor class's instances correspond to one of the system SYSCLR_* *
* colors in Presentation Manager. *
*******************************************************************************/
typedef IColor inherited;
public:
/*------------------------ Constructor -----------------------------------------
| The only way to construct instances of this class is from a system |
| color-index (SysColor) value. The internal system color value is set from |
| the SysColor provided. |
------------------------------------------------------------------------------*/
enum SysColor {shadowIconHiliteBgnd, shadowIconHiliteFgnd,
shadowIconText,
entryFieldBgnd, listBoxBgnd,
disableMenuText, menuHiliteText,
menuHiliteBgnd, notebookPageBgnd,
inactiveScrollBar, defaultControl,
buttonLight, buttonMiddle,
buttonDark, defaultButton,
titleLine,
menuShadow, dialogShadow,
iconText,
dialogBgnd, hiliteFgnd,
hiliteBgnd, inactiveTitleTextBgnd,
activeTitleTextBgnd, inactiveTitleText,
activeTitleText, outputText, windowStaticText,
scrollBar, desktopBgnd, activeTitleBgnd,
inactiveTitleBgnd, menuBgnd, windowBgnd,
frameBorder, menuText, windowText,
titleText, sizeBar, scrollArrow,
activeFrameBorder, inactiveFrameBorder,
mainWindowBgnd, helpWindowBgnd,
helpText, helpHiliteText };
IGUIColor(SysColor value);
/*-------------------------------- Accessors -----------------------------------
| These functions provide means of getting and setting the accessible |
| attributes of instances of this class: |
| setColor - Changes a system color for all windows. |
| index - Returns a system color-index (SysColor) value for the object. |
------------------------------------------------------------------------------*/
void
setColor(const IColor& newColor);
virtual long
index() const;
private:
/*--------------------------------- PRIVATE ----------------------------------*/
static long
index(IGUIColor::SysColor cValue);
long
lClSysColor;
}; // IGUIColor
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
/*--------------------------------- INLINES ----------------------------------*/
#ifndef I_NO_INLINES
#include <icolor.inl>
#endif
#endif /* _ICOLOR_ */