]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/gdiobj.h
converted to 16 colors
[wxWidgets.git] / include / wx / msw / gdiobj.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gdiobj.h
3 // Purpose: wxGDIObject class: base class for other GDI classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GDIOBJ_H_
13 #define _WX_GDIOBJ_H_
14
15 #include "wx/object.h"
16
17 #ifdef __GNUG__
18 #pragma interface "gdiobj.h"
19 #endif
20
21 // wxGDIRefData is the reference-counted data part of a GDI object.
22 // It contains another counter, m_usageCount, which counts the number
23 // of times this object has been used; e.g. in SetFont, the count
24 // is incremented. This is different from reference counting,
25 // where only the constructors, destructors and (un)clone operations
26 // affect the reference count.
27 // THIS IS NOW BEING REMOVED AS REDUNDANT AND ERROR-PRONE
28
29 class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
30 public:
31 inline wxGDIRefData(void)
32 {
33 }
34 };
35
36 #define M_GDIDATA ((wxGDIRefData *)m_refData)
37
38 class WXDLLEXPORT wxGDIObject: public wxObject
39 {
40 DECLARE_DYNAMIC_CLASS(wxGDIObject)
41 public:
42 inline wxGDIObject(void) { m_visible = FALSE; };
43 inline ~wxGDIObject(void) {};
44
45 // Creates the resource
46 virtual bool RealizeResource(void) { return FALSE; };
47
48 // Frees the resource
49 virtual bool FreeResource(bool WXUNUSED(force) = FALSE) { return FALSE; };
50
51 virtual bool IsFree(void) const { return FALSE; };
52
53 inline bool IsNull(void) const { return (m_refData == 0); }
54
55 // Returns handle.
56 virtual WXHANDLE GetResourceHandle(void) { return 0; }
57
58 virtual bool GetVisible(void) { return m_visible; }
59 virtual void SetVisible(bool v) { m_visible = v; }
60
61 protected:
62 bool m_visible; // Can a pointer to this object be safely taken?
63 // - only if created within FindOrCreate...
64 };
65
66 #endif
67 // _WX_GDIOBJ_H_