home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IICONCTL.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
203 lines
#ifndef _IICONCTL_
#define _IICONCTL_
/*******************************************************************************
* FILE NAME: iiconctl.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IIconControl - This class creates and manages an icon 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 _IBMPCTL_
#include <ibmpctl.hpp>
#endif
// Forward declarations for other classes:
class IPointerHandle;
class IRectangle;
class IResourceId;
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 IIconControl : public IBitmapControl {
typedef IBitmapControl Inherited;
/*******************************************************************************
* The IIconControl class creates and operates upon an icon control. *
* *
* You can also use this class to add text to an icon by calling the setText *
* function, which IIconControl inherits from IStaticText. *
* *
* EXAMPLE: *
* IIconControl bcIcon(ID_ICON, this, this, IRectangle(10,10,30,30)), *
* IResourceId(ID_ICON_RES)); *
*******************************************************************************/
public:
/*------------------ Style ------------------------------------------------
The following functions provide a means to set and query icon control
styles:
Style - Nested class that provides a static member that defines the
valid icon control style. This style can be used in conjunction
with the styles defined by the IWindow::Style nested class. For
example, you could define an instance of the IIconControl::Style
class and initialize it like:
IIconControl::Style
style = IIconControl::sizeToIcon | IWindow::visible;
An object of this type is provided when the icon control is
created. A customizable default is used if no styles are
specified. Once the object is constructed, IIconControl and
IWindow member functions can be used to set or query the
object's style.
The declaration of the IIconControl::Style nested class is
generated by the INESTEDBITFLAGCLASSDEF1 macro.
The valid icon control styles are:
classDefaultStyle - Original default style for this class, which is
IWindow::visible.
sizeToIcon - Sizes the window to the size of the icon passed in
on the constructor.
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 icon controls.
-------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF3(Style, IIconControl, IWindow, IControl, IStaticText);
// style class definition
static const Style
classDefaultStyle,
sizeToIcon;
static Style
defaultStyle();
static void
setDefaultStyle(Style style);
/*------------------------ Constructors ----------------------------------------
| You can construct an instance of this class in the following ways: |
| - From a non-system icon. This creates an icon control with the |
| specified window ID, parent and owner windows, screen position and |
| size, icon and resource library, and window style. |
| - From a non-system icon. This creates an icon control with the |
| specified window ID, parent and owner windows, screen position and |
| size, icon and resource library, and window style. |
| - From a non-system icon. This creates an icon control with the |
| specified window ID, parent and owner windows, screen position and |
| size, icon and window style. |
| - From a system icon. This creates an icon control with the specified |
| window ID, parent and owner windows, screen position and size, system |
| icon, and window style. |
| - From a dialog template. This creates an IIconControl object for the |
| specified icon dialog control. |
| - From an existing icon control. This creates an IIconControl object |
| for the specified icon control's window handle. |
------------------------------------------------------------------------------*/
IIconControl(unsigned long Id,
IWindow* parent,
IWindow* owner,
const IResourceId& iconId,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IIconControl(unsigned long Id,
IWindow* parent,
IWindow* owner,
const unsigned long iconId,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IIconControl(unsigned long Id,
IWindow* parent,
IWindow* owner,
IPointerHandle iconId = IPointerHandle(),
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IIconControl(unsigned long Id,
IWindow* parent,
IWindow* owner,
ISystemPointerHandle::Identifier icon,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IIconControl(unsigned long Id,
IWindow* parentDialog);
IIconControl(const IWindowHandle& handle);
virtual
~IIconControl();
/*-------------------------------- Query/Set Handle ----------------------------
| These operations return and change the icon image in an icon control window: |
| setIcon - Sets the icon handle of the icon control window. |
| icon - Returns the handle of the currently set icon. |
------------------------------------------------------------------------------*/
IIconControl
&setIcon(const unsigned long iconId),
&setIcon(const IResourceId& iconId),
&setIcon(IPointerHandle handle),
&setIcon(ISystemPointerHandle::Identifier icon);
IPointerHandle
icon() const;
protected:
/*----------------------------- Layout Size ------------------------------------
| calcMinimumSize - Returns the recommended minimum size of this icon control. |
| The size is based on the actual size of the currently set |
| icon. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize() const;
private:
/*--------------------------------- PRIVATE ----------------------------------*/
IIconControl(const IIconControl&);
IIconControl& operator=(const IIconControl&);
IIconControl
&initialize(const Style& style);
static Style
currentDefaultStyle;
IPointerHandle
iconHandle;
Boolean
bSizeTo,
returnback,
bHalf;
}; // class IIconControl
INESTEDBITFLAGCLASSFUNCS(Style, IIconControl);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IICONCTL_ */