home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
gpbhdr.zip
/
GRBTNHDR.CPP
Wrap
C/C++ Source or Header
|
1994-09-19
|
3KB
|
62 lines
class AGraphicPushButtonResizeHandler : public IResizeHandler {
typedef IResizeHandler
Inherited;
/*******************************************************************************
* The AGraphicPushButtonResizeHandler class handles the notification that an *
* IGraphicPushButton has been resized. *
* *
* A resizing event notifies a window or control that it has grown or shrunk *
* on the screen. If the AGraphicPushButtonResizeHandler object is attached to *
* an IGraphicPushButton control, it will be called to process the resizing event.*
* *
* SGraphicPushButtonResizeHandler processes the resizing event by creating an *
* IResizeEvent object and routing it to the virtual windowResize function. This*
* virtual function automatically sizes the drawing window that makes up the *
* IGraphicPushButton control.
*******************************************************************************/
public:
/*-------------------------- Constructor/Destructor ----------------------------
| The only way to construct instances of this class is by using the default |
| constructor, which takes no arguments. |
------------------------------------------------------------------------------*/
AGraphicPushButtonResizeHandler ( );
virtual
~AGraphicPushButtonResizeHandler ( );
protected:
/*----------------------------- Event Processing -------------------------------
| windowResize - This handles the resizing event, by sizing the drawing |
| window portion of the IGraphicPushButton. |
------------------------------------------------------------------------------*/
virtual Boolean
windowResize ( IResizeEvent& event );
}; // AGraphicPushButtonResizeHandler
/*******************************************************************/
AGraphicPushButtonResizeHandler :: AGraphicPushButtonResizeHandler ( )
{}
/*******************************************************************/
AGraphicPushButtonResizeHandler :: ~AGraphicPushButtonResizeHandler ( )
{}
/*******************************************************************/
Boolean AGraphicPushButtonResizeHandler :: windowResize( IResizeEvent& evt )
{
IGraphicPushButton* button = (IGraphicPushButton*)evt.window();
if (evt.oldSize() != evt.newSize() && !(button->isSizeToGraphic()))
{ // Size change occurred
long inith = 3, //SPECIFY WHATEVER BORDER
initw = 3, //SIZE YOU WANT HERE!!!!!!!!!!!!
width = -initw,
height = -inith;
if ((width += evt.newSize().width() ) < 0)
width = 0;
if ((height+= evt.newSize().height()) < 0)
height = 0;
button->graphicWindow().moveSizeTo(IRectangle(initw,inith,width,height));
} // End size change occurred
return true;
}