home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
odtlktv4.zip
/
ODTLKT
/
TOOLKIT
/
SAMPLES
/
OPENDOC
/
PARTS
/
PUSHBTN
/
PUSHBTN.HPP
< prev
next >
Wrap
Text File
|
1995-12-15
|
5KB
|
116 lines
/***********************************************************************
*
* File Name : PUSHBTN.HPP
*
* Description : PushButtonPart class header file.
*
* Notes : N/A
*
* (C) COPYRIGHT International Business Machines Corp. 1995
* All Rights Reserved
* Licensed Materials - Property of IBM
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* DISCLAIMER OF WARRANTIES. The following [enclosed] code is
* sample code created by IBM Corporation. This sample code is not
* part of any standard or IBM product and is provided to you solely
* for the purpose of assisting you in the development of your
* applications. The code is provided "AS IS", without
* warranty of any kind. IBM shall not be liable for any damages
* arising out of your use of the sample code, even if they have been
* advised of the possibility of such damages.
*
***********************************************************************/
#ifndef _PUSHBTN_HPP_
#define _PUSHBTN_HPP_
#define TEXTBUFFERSIZE 30 // Buffer size for the text show on push button
#define MSGBUFFERSIZE 300 // Buffer size for message
#define IDS_PUSHBUTTONMSG 1 // Message ID
#define PB_ID 100 // Push button ID
#define PB_INITTEXT 200 // Push button initial text ID
#define PB_WIDTH 100 // Width of push button in OD coordinates
#define PB_HEIGHT 50 // Height of push button in OD coordinates
#define FIXED2LONG(f) (((f) + 0x8000) >> 16)
#define SMALLICONSIZE 16
#define LARGEICONSIZE 32
#define THUMBNAILSIZE 64
#define IDB_BMP 301
#define IDI_ICON 1
// The Title bar text of message window, when user press the Push Button.
#define kTitleBarText "IBM OpenDoc Push Button Part Sample 1.1"
// The Push Button module name is defined for obtaining module
// resources such as the default Push Button text and messages text.
#define MODULENAME "pushbtn.dll"
// Push Button part storage unit properties.
static const ODPropertyName kODPropPushButtonAttr = \
"+//ISO 9070/ANSI::113722::US::CI LABS::IBM:PushButtonPart:Attributes";
// Push Button values types to add to the storage unit properties.
static const ODValueType kPushButtonAttrType = \
"+//ISO 9070/ANSI::113722::US::CI LABS::IBM:PushButton:Attributes";
static const ODValueType kPushButtonTextType = \
"+//ISO 9070/ANSI::113722::US::CI LABS::IBM:PushButton:Text";
// Push Button types for the OpenDoc registration process.
const ODType kKindPushButtonPart = "PushButtonPart:pushbtn";
const ODType kKindDisplayName = "Push Button Part Kind";
const ODType kPartHandlerDisplayName = "Push Button Part";
const ODType kPartHandlerName = "PushButtonPart";
const ODType kCategory = "Control";
// OpenDoc class utility for constructing an ODPOINTL object from a POINTL.
class ODPOINTL : public POINTL
{
public:
operator ODPoint() const { ODPoint pt = {MAKEFIXED(x,0),MAKEFIXED(y,0)}; return pt; } ;
ODPOINTL( ODPoint pt) {x = FIXED2LONG(pt.x); y = FIXED2LONG(pt.y); };
ODPOINTL( int x1, int y1) { x = x1; y = y1; };
ODPOINTL( ) { x = y = 0; };
//ODPOINTL( POINTL & pt) { } ;
};
// OpenDoc class utility for constructing an ODRECTL object from a RECTL.
class ODRECTL : public RECTL
{
public:
operator ODRect() const { ODRect rct = {
MAKEFIXED(xLeft,0),
MAKEFIXED(yTop,0),
MAKEFIXED(xRight,0),
MAKEFIXED(yBottom,0)
}; return rct; } ;
ODRECTL( ODRect rct) {
xLeft = FIXED2LONG(rct.left);
yBottom = FIXED2LONG(rct.bottom);
xRight = FIXED2LONG(rct.right);
yTop = FIXED2LONG(rct.top);
};
ODRECTL( ODPoint botLeft, ODPoint topRight) {
xLeft = FIXED2LONG(botLeft.x);
yBottom = FIXED2LONG(botLeft.y);
xRight = FIXED2LONG(topRight.x);
yTop = FIXED2LONG(topRight.y);
};
ODRECTL( ) { xLeft = yBottom = xRight = yTop = 0; };
ODRECTL( RECTL & rct) { *this = *(ODRECTL *)&rct ;}
};
// Handy functions and macros for dealing with ref-counted objectes
#define ODReleaseObject(ev, object) \
do { \
if (object!=kODNULL) { \
object->Release(ev); \
object = kODNULL; \
} \
} while(0)
#endif // _PUSHBTN_HPP_