home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- #ifndef _WDRAW_HPP_INCLUDED
- #define _WDRAW_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WVECTOR_HPP_INCLUDED
- # include "wvector.hpp"
- #endif
- #ifndef _WCANVAS_HPP_INCLUDED
- # include "wcanvas.hpp"
- #endif
-
- struct WPaintEventData;
- class WWindow;
-
- // Note: While this is in fact inherited from a WCanvas, it does so
- // only so that the appropriate properties can be set.
-
- class WCMCLASS WDrawPrimitive : public WCanvas {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WDrawPrimitive();
-
- ~WDrawPrimitive();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- virtual WBool Draw( WCanvas * canvas );
-
- /**********************************************************
- * Others
- *********************************************************/
- };
-
- extern template WVector<WDrawPrimitive>;
-
- class WCMCLASS WDrawPrimitiveGroup : public WObject {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WDrawPrimitiveGroup( WWindow *drawWindow=NULL );
-
- ~WDrawPrimitiveGroup();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- WWindow *GetDrawWindow() const;
- WBool SetDrawWindow( WWindow *drawWindow );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- // AddDrawPrimitive
-
- void AddDrawPrimitive( WDrawPrimitive * drawPrimitive );
-
- // RemoveDrawPrimitive
-
- void RemoveDrawPrimitive( WDrawPrimitive * drawPrimitive );
-
- /**********************************************************
- * Others
- *********************************************************/
-
- WBool PaintEventHandler( WWindow * window, WPaintEventData * event );
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- private:
-
- WWindow * _drawWindow;
- WVector< WDrawPrimitive > _drawPrimitives;
- };
-
- class WCMCLASS WDrawRectangle : public WDrawPrimitive {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WDrawRectangle();
-
- WDrawRectangle( const WRect & rect, WBool fill );
-
- ~WDrawRectangle();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // Fill
-
- WBool GetFill() const;
- WBool SetFill( WBool fill );
-
- // Rectangle
-
- WRect GetRectangle() const;
- WBool SetRectangle( const WRect & rect );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- /**********************************************************
- * Overrides
- *********************************************************/
-
- virtual WBool Draw( WCanvas * canvas );
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- private:
-
- WRect _rect;
- WBool _fill;
- };
-
- class WCMCLASS WDrawEllipse : public WDrawPrimitive {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WDrawEllipse();
-
- WDrawEllipse( const WRect & rect, WBool fill );
-
- ~WDrawEllipse();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // Fill
-
- WBool GetFill() const;
- WBool SetFill( WBool fill );
-
- // Rectangle
-
- WRect GetRectangle() const;
- WBool SetRectangle( const WRect & rect );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- /**********************************************************
- * Overrides
- *********************************************************/
-
- virtual WBool Draw( WCanvas * canvas );
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- private:
-
- WRect _rect;
- WBool _fill;
- };
-
- class WCMCLASS WDrawLine : public WDrawPrimitive {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WDrawLine();
-
- WDrawLine( const WPoint & endPoint );
- WDrawLine( const WPoint & startPoint, const WPoint & endPoint );
-
- ~WDrawLine();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // EndPoint
-
- WPoint GetEndPoint() const;
- WBool SetEndPoint( const WPoint & endPoint );
-
- // StartPoint
-
- WPoint GetStartPoint() const;
- WBool SetStartPoint( const WPoint & startPoint );
-
- // UseStartPoint
-
- WBool GetUseStartPoint() const;
- WBool SetUseStartPoint( WBool useStartPoint );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- /**********************************************************
- * Overrides
- *********************************************************/
-
- virtual WBool Draw( WCanvas * canvas );
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- private:
-
- WPoint _startPoint;
- WPoint _endPoint;
- WBool _useStartPoint;
- };
-
- class WCMCLASS WDrawText : public WDrawPrimitive {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WDrawText();
-
- WDrawText( const WChar * string, WInt numChars=-1 );
- WDrawText( const WPoint & pt, const WChar * string,
- WInt numChars=-1 );
- WDrawText( const WRect & rect, const WChar * string,
- WInt numChars=-1, WULong flags=WDrawTextDefault );
-
- ~WDrawText();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // DrawPosition
- //
- // Note: DrawPosition is mutually exclusive with DrawRectangle
-
- WPoint GetDrawPosition() const;
- WBool SetDrawPosition( const WPoint & drawPosition );
-
- // DrawRectangle
- //
- // Note: DrawRectangle is mutually exclusive with DrawPosition
-
- WRect GetDrawRectangle() const;
- WBool SetDrawRectangle( const WRect & drawRectangle );
-
- // Flags
-
- WULong GetFlags() const;
- WBool SetFlags( WULong flags=WDrawTextDefault );
-
- // NumCharacters
-
- WInt GetNumCharacters() const;
- WBool SetNumCharacters( WInt numChars=-1 );
-
- // Text
-
- const WChar *GetText() const;
- WBool SetText( const WChar * text );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- /**********************************************************
- * Overrides
- *********************************************************/
-
- virtual WBool Draw( WCanvas * canvas );
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- private:
-
- const WChar * _string;
- WInt _numChars;
- WULong _flags;
- WPoint _drawPosition;
- WRect _drawRect;
- WBool _usePos;
- WBool _useRect;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WDRAW_HPP_INCLUDED
-