home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
yacl-012.zip
/
ui
/
pen.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-08
|
3KB
|
145 lines
#ifndef _pen_h_
#define _pen_h_
/*
*
* Copyright (C) 1994, M. A. Sridhar
*
*
* This software is Copyright M. A. Sridhar, 1994. You are free
* to copy, modify or distribute this software as you see fit,
* and to use it for any purpose, provided this copyright
* notice and the following disclaimer are included with all
* copies.
*
* DISCLAIMER
*
* The author makes no warranties, either expressed or implied,
* with respect to this software, its quality, performance,
* merchantability, or fitness for any particular purpose. This
* software is distributed AS IS. The user of this software
* assumes all risks as to its quality and performance. In no
* event shall the author be liable for any direct, indirect or
* consequential damages, even if the author has been advised
* as to the possibility of such damages.
*
*/
#if defined(__GNUC__)
#pragma interface
#endif
#include "ui/dsplrsrc.h"
#include "ui/color.h"
#include "ui/rectangl.h"
// The properties of the Pen class determine the color and style in which
// lines are drawn on a DrawingSurface.
enum UI_PenPattern {
UIPen_None, UIPen_Solid, UIPen_Dash, UIPen_Dot
};
class CL_EXPORT UI_Pen : public UI_DisplayResource {
public:
UI_Pen (UI_DrawingSurface* ctxt, short pen_size = 1,
UI_Color pen_color = UI_Color (UIColor_Black),
UI_PenPattern patrn = UIPen_Solid);
~UI_Pen ();
// ------------------ Attribute querying methods ----------------
short Thickness ();
// Return the thickness of the pen, in pixels.
UI_PenPattern Pattern ();
// Return the pattern of the pen.
UI_Color Color();
// Return the color of the pen.
// ------------------ Attribute setting methods ------------------
void Thickness (short size);
// Set the thickness of the pen. Under Microsoft Windows, Pens with
// thickness greater than one pixel will always have pattern {\tt
// UIPen_Solid}. This is a limitation imposed by Windows.
void Pattern (UI_PenPattern );
// Set the pen's pattern.
void Color (UI_Color newColor);
// Set the pen's color.
// ---------------------- Basic methods ---------------------------
const char* ClassName () const { return "UI_Pen";};
// ------------------- End public protocol ------------------------
protected:
short _size;
UI_Color _color;
UI_PenPattern _pattern;
UI_Point _position;
void _Setup();
#if defined(__OS2__)
public:
long OS2Pattern () const;
// [OS/2-specific, internal use only]
#endif
};
inline short UI_Pen::Thickness()
{
return _size;
}
inline UI_PenPattern UI_Pen::Pattern()
{
return _pattern;
}
inline UI_Color UI_Pen::Color()
{
return _color;
}
// inline UI_Point UI_Pen::Position() const
// {
// return _position;
// }
#endif