home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n08
/
sketchsc.exe
/
STROKE.H
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-01
|
4KB
|
102 lines
//-----------------------------------------------------------------------
// STROKE.H: Definitions for drawing_element, stroke, line
//-----------------------------------------------------------------------
#ifndef STROKE_H__
#define STROKE_H__
#include "mywin.h"
// A drawing_element is not serializable because it's an abstract class.
// Classes that derive from drawing_element must be serializeable, and
// they should secify CObject (not drawing_element) in their
// IMPLEMENT_SERIAL macros.
class drawing_element : public CObject
{
unsigned short width; // actually a pen_width, but type-conversion problems
// in Serialize preclude use of the enum.
protected:
virtual void Serialize(CArchive& ar);
void draw_line ( device *echo_dc, const CPoint &start, const CPoint &end ) const;
void erase_line( device *echo_dc, const CPoint &start, const CPoint &end ) const;
void drawing_element::adjust_rect_for_pen_width( CRect *bound ) const;
public:
virtual void start_load ( const CPoint &first_point, device *echo_to_here ) =0;
virtual void mouse_has_moved( const CPoint &new_point, device *echo_to_here ) =0;
virtual int end_load ( const CPoint &end_point, device *echo_to_here ) =0;
virtual void draw ( device *dc ) const =0;
virtual void render_as_text ( device *dc ) const =0;
virtual void invalidate ( CWnd *p ) const =0;
virtual unsigned is_in ( CRect region ) const =0;
public:
virtual ~drawing_element();
drawing_element( unsigned use_thick_line = 0 );
};
//======================================================================/
class stroke : public drawing_element
{
enum serialize_schema { version = 1 };
CRect bounding; // bounding rectangle for the stroke
CArray<CPoint, CPoint> points; // connect these to form the stroke
CPoint prev_point; // Used only for loading, but the
// size overhead is low in comparison
// to the points list.
protected:
DECLARE_SERIAL( stroke );
virtual void Serialize ( CArchive &ar );
public:
virtual ~stroke( void );
stroke( unsigned use_thick_lines = 0 );
virtual void start_load ( const CPoint &first_point,
device *echo_to_here );
virtual void mouse_has_moved( const CPoint &new_point,
device *echo_to_here );
virtual int end_load ( const CPoint &end_point,
device *echo_to_here );
virtual void draw ( device *dc ) const;
virtual void render_as_text ( device *dc ) const;
virtual unsigned is_in ( CRect region ) const;
virtual void invalidate ( CWnd *p ) const;
};
//======================================================================/
class line : public drawing_element
{
enum serialize_schema { version = 1 };
CPoint first, last;
protected:
DECLARE_SERIAL( line );
virtual void Serialize ( CArchive &ar );
public:
virtual ~line( void );
line( unsigned use_thick_lines = 0 );
virtual void start_load ( const CPoint &first_point,
device *echo_to_here );
virtual void mouse_has_moved( const CPoint &new_point,
device *echo_to_here );
virtual int end_load ( const CPoint &end_point,
device *echo_to_here );
virtual void draw ( device *dc ) const;
virtual void render_as_text ( device *dc ) const;
virtual unsigned is_in ( CRect region ) const;
virtual void invalidate ( CWnd *p ) const;
};
#endif // STROKE_H__