]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/palette.h
setting focus explicitely when using showmodal
[wxWidgets.git] / include / wx / mac / classic / palette.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palette.h
3 // Purpose: wxPalette class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_PALETTE_H_
13 #define _WX_PALETTE_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "palette.h"
17 #endif
18
19 #include "wx/colour.h"
20 #include "wx/gdiobj.h"
21
22 class WXDLLEXPORT wxPalette;
23
24 class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
25 {
26 DECLARE_NO_COPY_CLASS(wxPaletteRefData)
27
28 friend class WXDLLEXPORT wxPalette;
29 public:
30 wxPaletteRefData();
31 ~wxPaletteRefData();
32 protected:
33 wxColour* m_palette;
34 wxInt32 m_count ;
35 };
36
37 #define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
38
39 class WXDLLEXPORT wxPalette: public wxPaletteBase
40 {
41 DECLARE_DYNAMIC_CLASS(wxPalette)
42
43 public:
44 wxPalette();
45 wxPalette(const wxPalette& palette)
46 : wxPaletteBase()
47 { Ref(palette); }
48
49 wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
50 ~wxPalette();
51 bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
52 int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const;
53 bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
54
55 virtual bool Ok() const { return (m_refData != NULL) ; }
56
57 inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
58 inline bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; }
59 inline bool operator != (const wxPalette& palette) { return m_refData != palette.m_refData; }
60
61 /* TODO: implementation
62 inline WXHPALETTE GetHPALETTE() const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
63 void SetHPALETTE(WXHPALETTE pal);
64 */
65 };
66
67 #endif
68 // _WX_PALETTE_H_