]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gdicmn.h
Moved Get/SetToolBar down into frame.h/cpp
[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
12#ifndef __GDICMNH__
13#define __GDICMNH__
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"
22#include "wx/setup.h"
23
2049ba38 24#ifdef __WXMSW__
c801d85f 25#include "wx/msw/colour.h"
2049ba38 26#elif defined(__WXMOTIF__)
c801d85f 27#include "wx/xt/colour.h"
2049ba38 28#elif defined(__WXGTK__)
c801d85f
KB
29#include "wx/gtk/colour.h"
30#endif
31
32// Standard cursors
33typedef enum {
34 wxCURSOR_ARROW = 1,
35 wxCURSOR_BULLSEYE,
36 wxCURSOR_CHAR,
37 wxCURSOR_CROSS,
38 wxCURSOR_HAND,
39 wxCURSOR_IBEAM,
40 wxCURSOR_LEFT_BUTTON,
41 wxCURSOR_MAGNIFIER,
42 wxCURSOR_MIDDLE_BUTTON,
43 wxCURSOR_NO_ENTRY,
44 wxCURSOR_PAINT_BRUSH,
45 wxCURSOR_PENCIL,
46 wxCURSOR_POINT_LEFT,
47 wxCURSOR_POINT_RIGHT,
48 wxCURSOR_QUESTION_ARROW,
49 wxCURSOR_RIGHT_BUTTON,
50 wxCURSOR_SIZENESW,
51 wxCURSOR_SIZENS,
52 wxCURSOR_SIZENWSE,
53 wxCURSOR_SIZEWE,
54 wxCURSOR_SIZING,
55 wxCURSOR_SPRAYCAN,
56 wxCURSOR_WAIT,
57 wxCURSOR_WATCH,
58 wxCURSOR_BLANK
59#ifdef __X__
60 /* Not yet implemented for Windows */
61 , wxCURSOR_CROSS_REVERSE,
62 wxCURSOR_DOUBLE_ARROW,
63 wxCURSOR_BASED_ARROW_UP,
64 wxCURSOR_BASED_ARROW_DOWN
65#endif
66} _standard_cursors_t;
67
6a6c0a8b 68class WXDLLEXPORT wxSize
c801d85f
KB
69{
70public:
71 long x;
72 long y;
6a6c0a8b 73 inline wxSize() { x = 0; y = 0; }
c801d85f
KB
74 inline wxSize(long xx, long yy) { x = xx; y = yy; }
75 inline wxSize(const wxSize& sz) { x = sz.x; y = sz.y; }
76 inline void operator = (const wxSize& sz) { x = sz.x; y = sz.y; }
6a6c0a8b
JS
77 inline wxSize operator + (const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
78 inline wxSize operator - (const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
c801d85f
KB
79 inline void Set(long xx, long yy) { x = xx; y = yy; }
80 inline long GetX() const { return x; }
81 inline long GetY() const { return y; }
82};
83
84// Point
6a6c0a8b 85class WXDLLEXPORT wxRealPoint
c801d85f 86{
c801d85f
KB
87 public:
88 double x;
89 double y;
6a6c0a8b
JS
90 inline wxRealPoint() { x = 0.0; y = 0.0; };
91 inline wxRealPoint(double _x, double _y) { x = _x; y = _y; };
92 inline wxRealPoint operator + (const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); }
93 inline wxRealPoint operator - (const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); }
c801d85f
KB
94
95 inline void operator = (const wxRealPoint& pt) { x = pt.x; y = pt.y; }
96};
97
6a6c0a8b 98class WXDLLEXPORT wxPoint
c801d85f 99{
c801d85f 100 public:
2049ba38 101#if defined(__WXMSW__) && !defined(__WIN32__)
6a6c0a8b
JS
102 int x;
103 int y;
104#else
c801d85f
KB
105 long x;
106 long y;
6a6c0a8b
JS
107#endif
108
109 inline wxPoint() { x = 0; y = 0; };
c801d85f 110 wxPoint(long the_x, long the_y) { x = the_x; y = the_y; };
6a6c0a8b
JS
111 wxPoint(const wxPoint& pt) { x = pt.x; y = pt.y; };
112
c801d85f 113 inline void operator = (const wxPoint& pt) { x = pt.x; y = pt.y; }
6a6c0a8b
JS
114 inline wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); }
115 inline wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); }
c801d85f
KB
116};
117
118#if WXWIN_COMPATIBILITY
119#define wxIntPoint wxPoint
120#define wxRectangle wxRect
121#endif
122
6a6c0a8b
JS
123class WXDLLEXPORT wxRect
124{
c801d85f 125public:
6a6c0a8b 126 wxRect() ;
debe6624 127 wxRect(long x, long y, long w, long h);
c801d85f
KB
128 wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
129 wxRect(const wxPoint& pos, const wxSize& size);
130 wxRect(const wxRect& rect);
131
6a6c0a8b 132 inline long GetX() const { return x; }
debe6624 133 inline void SetX(long X) { x = X; }
6a6c0a8b 134 inline long GetY() const { return y; }
debe6624 135 inline void SetY(long Y) { y = Y; }
c801d85f 136 inline long GetWidth() const { return width; }
debe6624 137 inline void SetWidth(long w) { width = w; }
c801d85f 138 inline long GetHeight() const { return height; }
debe6624 139 inline void SetHeight(long h) { height = h; }
c801d85f 140
6a6c0a8b
JS
141 inline wxPoint GetPosition() { return wxPoint(x, y); }
142 inline wxSize GetSize() { return wxSize(width, height); }
c801d85f 143
6a6c0a8b
JS
144 inline long GetLeft() const { return x; }
145 inline long GetTop() const { return y; }
146 inline long GetBottom() const { return y + height; }
147 inline long GetRight() const { return x + width; }
c801d85f
KB
148
149 wxRect& operator = (const wxRect& rect);
150 bool operator == (const wxRect& rect);
151 bool operator != (const wxRect& rect);
152public:
153 long x, y, width, height;
154};
155
156class WXDLLEXPORT wxBrush;
157class WXDLLEXPORT wxPen;
158class WXDLLEXPORT wxBitmap;
159class WXDLLEXPORT wxIcon;
160class WXDLLEXPORT wxCursor;
161class WXDLLEXPORT wxFont;
162class WXDLLEXPORT wxPalette;
163class WXDLLEXPORT wxPalette;
164
165/*
166 * Bitmap flags
167 */
168
169// Hint to indicate filetype
170#define wxBITMAP_TYPE_BMP 1
171#define wxBITMAP_TYPE_BMP_RESOURCE 2
172#define wxBITMAP_TYPE_ICO 3
173#define wxBITMAP_TYPE_ICO_RESOURCE 4
174#define wxBITMAP_TYPE_CUR 5
175#define wxBITMAP_TYPE_CUR_RESOURCE 6
176#define wxBITMAP_TYPE_XBM 7
177#define wxBITMAP_TYPE_XBM_DATA 8
178#define wxBITMAP_TYPE_XPM 9
179#define wxBITMAP_TYPE_XPM_DATA 10
180#define wxBITMAP_TYPE_TIF 11
181#define wxBITMAP_TYPE_TIF_RESOURCE 12
182#define wxBITMAP_TYPE_GIF 13
183#define wxBITMAP_TYPE_GIF_RESOURCE 14
184#define wxBITMAP_TYPE_PNG 15
185#define wxBITMAP_TYPE_PNG_RESOURCE 16
186#define wxBITMAP_TYPE_ANY 50
187
188#define wxBITMAP_TYPE_RESOURCE wxBITMAP_TYPE_BMP_RESOURCE
189
190class WXDLLEXPORT wxBitmap;
191class WXDLLEXPORT wxCursor;
192class WXDLLEXPORT wxIcon;
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
JS
204 wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
205 wxPen *FindOrCreatePen(const wxString& colour, int width, int style);
c801d85f
KB
206};
207
208class WXDLLEXPORT wxBrushList: public wxList
209{
210 DECLARE_DYNAMIC_CLASS(wxBrushList)
211 public:
6a6c0a8b 212 inline wxBrushList()
c801d85f 213 { }
6a6c0a8b 214 ~wxBrushList();
c801d85f
KB
215 void AddBrush(wxBrush *brush);
216 void RemoveBrush(wxBrush *brush);
debe6624
JS
217 wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
218 wxBrush *FindOrCreateBrush(const wxString& colour, int style);
c801d85f
KB
219};
220
221WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
222
223class WXDLLEXPORT wxFontList: public wxList
224{
225 DECLARE_DYNAMIC_CLASS(wxFontList)
226 public:
6a6c0a8b 227 inline wxFontList()
c801d85f 228 { }
6a6c0a8b 229 ~wxFontList();
c801d85f
KB
230 void AddFont(wxFont *font);
231 void RemoveFont(wxFont *font);
debe6624
JS
232 wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
233 bool underline = FALSE, const wxString& face = wxEmptyString);
c801d85f
KB
234};
235
236class WXDLLEXPORT wxColourDatabase: public wxList
237{
238 DECLARE_CLASS(wxColourDatabase)
239 public:
240 wxColourDatabase(int type);
6a6c0a8b 241 ~wxColourDatabase() ;
c801d85f
KB
242 // Not const because it may add a name to the database
243 wxColour *FindColour(const wxString& colour) ;
244 wxString FindName(const wxColour& colour) const;
6a6c0a8b 245 void Initialize();
c801d85f
KB
246};
247
248class WXDLLEXPORT wxBitmapList: public wxList
249{
250 DECLARE_DYNAMIC_CLASS(wxBitmapList)
251 public:
6a6c0a8b
JS
252 wxBitmapList();
253 ~wxBitmapList();
c801d85f
KB
254
255 void AddBitmap(wxBitmap *bitmap);
256 void RemoveBitmap(wxBitmap *bitmap);
257};
258
259// Lists of GDI objects
260WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList;
261WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList;
262WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList;
263WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList;
264
265// Stock objects
266WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT;
267WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT;
268WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT;
269WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT;
270
271WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN;
272WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN;
273WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN;
274WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN;
275WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN;
276WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN;
277WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN;
278WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN;
279WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN;
280WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN;
281
282WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH;
283WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH;
284WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH;
285WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH;
286WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH;
287WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH;
288WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH;
289WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH;
290WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH;
291WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH;
292
293WXDLLEXPORT_DATA(extern wxColour*) wxBLACK;
294WXDLLEXPORT_DATA(extern wxColour*) wxWHITE;
295WXDLLEXPORT_DATA(extern wxColour*) wxRED;
296WXDLLEXPORT_DATA(extern wxColour*) wxBLUE;
297WXDLLEXPORT_DATA(extern wxColour*) wxGREEN;
298WXDLLEXPORT_DATA(extern wxColour*) wxCYAN;
299WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY;
300
301// 'Null' objects
302WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap;
303WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon;
304WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor;
305WXDLLEXPORT_DATA(extern wxPen) wxNullPen;
306WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush;
307WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette;
308WXDLLEXPORT_DATA(extern wxFont) wxNullFont;
309WXDLLEXPORT_DATA(extern wxColour) wxNullColour;
310
311// Stock cursors types
312WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR;
313WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR;
314WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR;
315
316WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
6a6c0a8b
JS
317extern void WXDLLEXPORT wxInitializeStockObjects();
318extern void WXDLLEXPORT wxDeleteStockObjects();
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
331// Useful macro for create icons portably
332
2049ba38 333#ifdef __WXMSW__
c801d85f
KB
334# define wxICON(X) wxIcon(X##_icon);
335#elif defined(__X__)
336# define wxICON(X) wxIcon(X##_bits, X##_width, X##_height);
337#else
338# define wxICON wxIcon
339#endif
340
341/*
342 Example:
343 #define wxbuild_icon "wxbuild"
344
345 wxIcon *icon = new wxICON(wxbuild);
346 */
347
348#endif
349 // __GDICMNH__