]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gdicmn.h
AIX patches from Hans-Joachim Baader <hans-joachim.baader@cjt.de>
[wxWidgets.git] / include / wx / gdicmn.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: gdicmn.h
3// Purpose: Common GDI classes, types and declarations
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c)
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_GDICMNH__
13#define _WX_GDICMNH__
c801d85f
KB
14
15#ifdef __GNUG__
16#pragma interface "gdicmn.h"
17#endif
18
19#include "wx/object.h"
20#include "wx/list.h"
21#include "wx/hash.h"
34138703 22#include "wx/string.h"
c801d85f 23#include "wx/setup.h"
34138703 24#include "wx/colour.h"
c801d85f
KB
25
26// Standard cursors
27typedef enum {
f97c9854 28 wxCURSOR_NONE = 0,
c801d85f
KB
29 wxCURSOR_ARROW = 1,
30 wxCURSOR_BULLSEYE,
31 wxCURSOR_CHAR,
32 wxCURSOR_CROSS,
33 wxCURSOR_HAND,
34 wxCURSOR_IBEAM,
35 wxCURSOR_LEFT_BUTTON,
36 wxCURSOR_MAGNIFIER,
37 wxCURSOR_MIDDLE_BUTTON,
38 wxCURSOR_NO_ENTRY,
39 wxCURSOR_PAINT_BRUSH,
40 wxCURSOR_PENCIL,
41 wxCURSOR_POINT_LEFT,
42 wxCURSOR_POINT_RIGHT,
43 wxCURSOR_QUESTION_ARROW,
44 wxCURSOR_RIGHT_BUTTON,
45 wxCURSOR_SIZENESW,
46 wxCURSOR_SIZENS,
47 wxCURSOR_SIZENWSE,
48 wxCURSOR_SIZEWE,
49 wxCURSOR_SIZING,
50 wxCURSOR_SPRAYCAN,
51 wxCURSOR_WAIT,
52 wxCURSOR_WATCH,
53 wxCURSOR_BLANK
54#ifdef __X__
55 /* Not yet implemented for Windows */
56 , wxCURSOR_CROSS_REVERSE,
57 wxCURSOR_DOUBLE_ARROW,
58 wxCURSOR_BASED_ARROW_UP,
59 wxCURSOR_BASED_ARROW_DOWN
60#endif
f97c9854 61} wxStockCursor;
c801d85f 62
6a6c0a8b 63class WXDLLEXPORT wxSize
c801d85f
KB
64{
65public:
66 long x;
67 long y;
6a6c0a8b 68 inline wxSize() { x = 0; y = 0; }
c801d85f
KB
69 inline wxSize(long xx, long yy) { x = xx; y = yy; }
70 inline wxSize(const wxSize& sz) { x = sz.x; y = sz.y; }
71 inline void operator = (const wxSize& sz) { x = sz.x; y = sz.y; }
6a6c0a8b
JS
72 inline wxSize operator + (const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
73 inline wxSize operator - (const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
c801d85f
KB
74 inline void Set(long xx, long yy) { x = xx; y = yy; }
75 inline long GetX() const { return x; }
76 inline long GetY() const { return y; }
77};
78
79// Point
6a6c0a8b 80class WXDLLEXPORT wxRealPoint
c801d85f 81{
c801d85f
KB
82 public:
83 double x;
84 double y;
6a6c0a8b
JS
85 inline wxRealPoint() { x = 0.0; y = 0.0; };
86 inline wxRealPoint(double _x, double _y) { x = _x; y = _y; };
87 inline wxRealPoint operator + (const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); }
88 inline wxRealPoint operator - (const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); }
c801d85f
KB
89
90 inline void operator = (const wxRealPoint& pt) { x = pt.x; y = pt.y; }
91};
92
6a6c0a8b 93class WXDLLEXPORT wxPoint
c801d85f 94{
c801d85f 95 public:
2049ba38 96#if defined(__WXMSW__) && !defined(__WIN32__)
6a6c0a8b
JS
97 int x;
98 int y;
99#else
c801d85f
KB
100 long x;
101 long y;
6a6c0a8b
JS
102#endif
103
104 inline wxPoint() { x = 0; y = 0; };
c801d85f 105 wxPoint(long the_x, long the_y) { x = the_x; y = the_y; };
6a6c0a8b
JS
106 wxPoint(const wxPoint& pt) { x = pt.x; y = pt.y; };
107
c801d85f 108 inline void operator = (const wxPoint& pt) { x = pt.x; y = pt.y; }
6a6c0a8b
JS
109 inline wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); }
110 inline wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); }
c801d85f
KB
111};
112
113#if WXWIN_COMPATIBILITY
114#define wxIntPoint wxPoint
115#define wxRectangle wxRect
116#endif
117
6a6c0a8b
JS
118class WXDLLEXPORT wxRect
119{
c801d85f 120public:
6a6c0a8b 121 wxRect() ;
debe6624 122 wxRect(long x, long y, long w, long h);
c801d85f
KB
123 wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
124 wxRect(const wxPoint& pos, const wxSize& size);
125 wxRect(const wxRect& rect);
126
6a6c0a8b 127 inline long GetX() const { return x; }
debe6624 128 inline void SetX(long X) { x = X; }
6a6c0a8b 129 inline long GetY() const { return y; }
debe6624 130 inline void SetY(long Y) { y = Y; }
c801d85f 131 inline long GetWidth() const { return width; }
debe6624 132 inline void SetWidth(long w) { width = w; }
c801d85f 133 inline long GetHeight() const { return height; }
debe6624 134 inline void SetHeight(long h) { height = h; }
c801d85f 135
6a6c0a8b
JS
136 inline wxPoint GetPosition() { return wxPoint(x, y); }
137 inline wxSize GetSize() { return wxSize(width, height); }
c801d85f 138
6a6c0a8b
JS
139 inline long GetLeft() const { return x; }
140 inline long GetTop() const { return y; }
141 inline long GetBottom() const { return y + height; }
142 inline long GetRight() const { return x + width; }
c801d85f
KB
143
144 wxRect& operator = (const wxRect& rect);
145 bool operator == (const wxRect& rect);
146 bool operator != (const wxRect& rect);
147public:
148 long x, y, width, height;
149};
150
151class WXDLLEXPORT wxBrush;
152class WXDLLEXPORT wxPen;
153class WXDLLEXPORT wxBitmap;
154class WXDLLEXPORT wxIcon;
155class WXDLLEXPORT wxCursor;
156class WXDLLEXPORT wxFont;
157class WXDLLEXPORT wxPalette;
158class WXDLLEXPORT wxPalette;
76ed8f8d 159class WXDLLEXPORT wxRegion;
c801d85f
KB
160
161/*
162 * Bitmap flags
163 */
164
165// Hint to indicate filetype
166#define wxBITMAP_TYPE_BMP 1
167#define wxBITMAP_TYPE_BMP_RESOURCE 2
168#define wxBITMAP_TYPE_ICO 3
169#define wxBITMAP_TYPE_ICO_RESOURCE 4
170#define wxBITMAP_TYPE_CUR 5
171#define wxBITMAP_TYPE_CUR_RESOURCE 6
172#define wxBITMAP_TYPE_XBM 7
173#define wxBITMAP_TYPE_XBM_DATA 8
174#define wxBITMAP_TYPE_XPM 9
175#define wxBITMAP_TYPE_XPM_DATA 10
176#define wxBITMAP_TYPE_TIF 11
177#define wxBITMAP_TYPE_TIF_RESOURCE 12
178#define wxBITMAP_TYPE_GIF 13
179#define wxBITMAP_TYPE_GIF_RESOURCE 14
180#define wxBITMAP_TYPE_PNG 15
181#define wxBITMAP_TYPE_PNG_RESOURCE 16
56b9c741
VS
182#define wxBITMAP_TYPE_JPEG 17
183#define wxBITMAP_TYPE_JPEG_RESOURCE 18
c801d85f
KB
184#define wxBITMAP_TYPE_ANY 50
185
186#define wxBITMAP_TYPE_RESOURCE wxBITMAP_TYPE_BMP_RESOURCE
187
188class WXDLLEXPORT wxBitmap;
189class WXDLLEXPORT wxCursor;
190class WXDLLEXPORT wxIcon;
34138703
JS
191class WXDLLEXPORT wxColour;
192class WXDLLEXPORT wxString;
c801d85f
KB
193
194// Management of pens, brushes and fonts
195class WXDLLEXPORT wxPenList: public wxList
196{
197 DECLARE_DYNAMIC_CLASS(wxPenList)
198 public:
6a6c0a8b 199 inline wxPenList()
c801d85f 200 { }
6a6c0a8b 201 ~wxPenList();
c801d85f
KB
202 void AddPen(wxPen *pen);
203 void RemovePen(wxPen *pen);
debe6624 204 wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
c801d85f
KB
205};
206
207class WXDLLEXPORT wxBrushList: public wxList
208{
209 DECLARE_DYNAMIC_CLASS(wxBrushList)
210 public:
6a6c0a8b 211 inline wxBrushList()
c801d85f 212 { }
6a6c0a8b 213 ~wxBrushList();
c801d85f
KB
214 void AddBrush(wxBrush *brush);
215 void RemoveBrush(wxBrush *brush);
debe6624 216 wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
c801d85f
KB
217};
218
219WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
220
221class WXDLLEXPORT wxFontList: public wxList
222{
223 DECLARE_DYNAMIC_CLASS(wxFontList)
224 public:
6a6c0a8b 225 inline wxFontList()
c801d85f 226 { }
6a6c0a8b 227 ~wxFontList();
c801d85f
KB
228 void AddFont(wxFont *font);
229 void RemoveFont(wxFont *font);
debe6624
JS
230 wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
231 bool underline = FALSE, const wxString& face = wxEmptyString);
c801d85f
KB
232};
233
234class WXDLLEXPORT wxColourDatabase: public wxList
235{
236 DECLARE_CLASS(wxColourDatabase)
237 public:
238 wxColourDatabase(int type);
6a6c0a8b 239 ~wxColourDatabase() ;
c801d85f
KB
240 // Not const because it may add a name to the database
241 wxColour *FindColour(const wxString& colour) ;
242 wxString FindName(const wxColour& colour) const;
6a6c0a8b 243 void Initialize();
c801d85f
KB
244};
245
246class WXDLLEXPORT wxBitmapList: public wxList
247{
248 DECLARE_DYNAMIC_CLASS(wxBitmapList)
249 public:
6a6c0a8b
JS
250 wxBitmapList();
251 ~wxBitmapList();
c801d85f
KB
252
253 void AddBitmap(wxBitmap *bitmap);
254 void RemoveBitmap(wxBitmap *bitmap);
255};
256
257// Lists of GDI objects
258WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList;
259WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList;
260WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList;
261WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList;
262
263// Stock objects
264WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT;
265WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT;
266WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT;
267WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT;
268
269WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN;
270WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN;
271WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN;
272WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN;
273WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN;
274WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN;
275WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN;
276WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN;
277WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN;
278WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN;
279
280WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH;
281WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH;
282WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH;
283WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH;
284WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH;
285WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH;
286WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH;
287WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH;
288WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH;
289WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH;
290
291WXDLLEXPORT_DATA(extern wxColour*) wxBLACK;
292WXDLLEXPORT_DATA(extern wxColour*) wxWHITE;
293WXDLLEXPORT_DATA(extern wxColour*) wxRED;
294WXDLLEXPORT_DATA(extern wxColour*) wxBLUE;
295WXDLLEXPORT_DATA(extern wxColour*) wxGREEN;
296WXDLLEXPORT_DATA(extern wxColour*) wxCYAN;
297WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY;
298
299// 'Null' objects
300WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap;
301WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon;
302WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor;
303WXDLLEXPORT_DATA(extern wxPen) wxNullPen;
304WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush;
305WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette;
306WXDLLEXPORT_DATA(extern wxFont) wxNullFont;
307WXDLLEXPORT_DATA(extern wxColour) wxNullColour;
308
309// Stock cursors types
310WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR;
311WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR;
312WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR;
313
314WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
6a6c0a8b 315extern void WXDLLEXPORT wxInitializeStockObjects();
a3622daa 316extern void WXDLLEXPORT wxInitializeStockLists();
6a6c0a8b 317extern void WXDLLEXPORT wxDeleteStockObjects();
a3622daa 318extern void WXDLLEXPORT wxDeleteStockLists();
c801d85f 319
6a6c0a8b 320extern bool WXDLLEXPORT wxColourDisplay();
c801d85f
KB
321
322// Returns depth of screen
6a6c0a8b
JS
323extern int WXDLLEXPORT wxDisplayDepth();
324#define wxGetDisplayDepth wxDisplayDepth
c801d85f
KB
325
326extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
6a6c0a8b 327extern wxSize WXDLLEXPORT wxGetDisplaySize();
c801d85f
KB
328
329extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
330
8cb50e4b 331// Useful macro for creating icons portably
c801d85f 332
2049ba38 333#ifdef __WXMSW__
8cb50e4b
JS
334// Load from a resource
335# define wxICON(X) wxIcon("" #X "")
336
621793f4 337#elif defined(__WXGTK__)
8cb50e4b 338// Initialize from an included XPM
e52f60e6 339# define wxICON(X) wxIcon( (const char**) X##_xpm )
621793f4
JS
340#elif defined(__WXMOTIF__)
341// Initialize from an included XPM
342# define wxICON(X) wxIcon( X##_xpm )
c801d85f 343#else
8cb50e4b
JS
344
345// This will usually mean something on any platform
346# define wxICON(X) wxIcon("" #X "")
c801d85f
KB
347#endif
348
349/*
350 Example:
8cb50e4b
JS
351 wxIcon *icon = new wxICON(mondrian);
352 expands into:
353 wxIcon *icon = new wxIcon("mondrian"); // On wxMSW
354 wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK
c801d85f
KB
355 */
356
a3622daa
VZ
357class WXDLLEXPORT wxResourceCache: public wxList
358{
fd3f686c
VZ
359public:
360 wxResourceCache() { }
361 wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
362 ~wxResourceCache();
363
364private:
365 DECLARE_DYNAMIC_CLASS(wxResourceCache)
a3622daa
VZ
366};
367
c801d85f 368#endif
34138703 369 // _WX_GDICMNH__