home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IBMPCTL.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
10KB
|
208 lines
#ifndef _IBMPCTL_
#define _IBMPCTL_
/*******************************************************************************
* FILE NAME: ibmpctl.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IBitmapControl - This class creates and manages a bit map 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 _ISTATTXT_
#include <istattxt.hpp>
#endif
// Forward declarations for other classes:
class IBitmapHandle;
class IRectangle;
class IResourceId;
class ISize;
class IWindowHandle;
class IBitmapHandler;
#ifndef _IRECT_
#include <irect.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IBitmapControl : public IStaticText {
typedef IStaticText Inherited;
/*******************************************************************************
* The IBitmapControl class creates and manages a bit-map control. A bit-map *
* control is a bit map drawn on the background of a window. *
* *
* You can also use this class to add text to a bit map by calling the setText *
* function, which IBitmapControl inherits from IStaticText. *
* *
* EXAMPLE: *
* IBitmapControl bcBitmap(ID_BITMAP, this, this, IRectangle(10,10,30,30)), *
* IResourceId(ID_BITMAP_RES)); *
*******************************************************************************/
public:
/*--------------- Style ---------------------------------------------------
The following functions provide a means to set and query bit-map control
styles:
Style - Nested class that provides static members that define the set of
valid bit-map control 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
IBitmapControl::Style class and initialize it like:
IBitmapControl::Style
style = IBitmapControl::sizeToBitmap | IWindow::visible;
An object of this type is provided when the bit-map control is
created. A customizable default is used if no styles are
specified. Once the object is constructed, IBitmapControl and
IWindow member functions can be used to set or query the
object's style.
The declaration of the IBitmapControl::Style nested class is
generated by the INESTEDBITFLAGCLASSDEF1 macro.
The valid bit-map control styles are:
classDefaultStyle - Original default style for this class, which is
IWindow::visible.
sizeToBitmap - Sizes the window to the size of the currently set
bit map.
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 bit-map
controls.
-------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF3(Style, IBitmapControl, IWindow,IControl, IStaticText);
static const Style
classDefaultStyle,
sizeToBitmap;
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 bit map. |
| This creates a bit-map control with the specified window ID, parent |
| and owner windows, screen position and size, bit map and resource |
| library, and window style. |
| - From a non-system bit map. |
| This creates a bit-map control with the specified window ID, parent |
| and owner windows, screen position and size, bit map and resource |
| library, and window style. |
| - From a non-system bit map. |
| This creates a bit-map control with the specified window ID, parent |
| and owner windows, screen position and size, bit map, and window style. |
| - From a system bit map. |
| This creates a bit-map control with the specified window ID, parent |
| and owner windows, screen position and size, system bit map, and |
| window style. |
| - From a dialog template. |
| This creates an IBitmapControl object for the specified bit-map |
| dialog control. |
| - From an existing bit-map control. |
| This creates an IBitmapControl object for the specified bit-map |
| control's window handle. |
------------------------------------------------------------------------------*/
IBitmapControl ( unsigned long id,
IWindow* parent,
IWindow* owner,
const IResourceId& bitmapId,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IBitmapControl ( unsigned long id,
IWindow* parent,
IWindow* owner,
const unsigned long bitmapId,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IBitmapControl ( unsigned long id,
IWindow* parent,
IWindow* owner,
IBitmapHandle bitmapId = IBitmapHandle(),
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IBitmapControl ( unsigned long id,
IWindow* parent,
IWindow* owner,
ISystemBitmapHandle::Identifier bitmapId,
const IRectangle& initial= IRectangle(),
const Style& style = defaultStyle() );
IBitmapControl ( unsigned long id,
IWindow* parentDialog );
IBitmapControl ( const IWindowHandle& handle );
virtual
~IBitmapControl();
/*-------------------------------- Query/Set Handle ----------------------------
| setBitmap - Changes a bit-map control window. |
| bitmap - Returns the handle to the bit map. |
------------------------------------------------------------------------------*/
IBitmapControl
&setBitmap ( const unsigned long bmpId ),
&setBitmap ( const IResourceId& bmpId ),
&setBitmap ( IBitmapHandle handle ),
&setBitmap ( ISystemBitmapHandle::Identifier bmp );
IBitmapHandle
bitmap ( ) const;
protected:
/*----------------------------- Layout Size ------------------------------------
| calcMinimumSize - Returns the recommended minimum size of this bit-map |
| control. The size is based on the actual size of the |
| currently set bit map. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize() const;
private:
/*--------------------------------- PRIVATE ----------------------------------*/
IBitmapControl(const IBitmapControl&);
IBitmapControl& operator=(const IBitmapControl);
IBitmapControl
&initialize(const Style& bmsStyle);
static Style
currentDefaultStyle;
IBitmapHandle
bmpHandle;
Boolean
bSizeTo,
returnback;
}; // class IBitmapControl
INESTEDBITFLAGCLASSFUNCS(Style, IBitmapControl);
// global style functions
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IBMPCTL_ */