]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tbarmsw.h
fixed compilation error
[wxWidgets.git] / include / wx / msw / tbarmsw.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbarmsw.h
3 // Purpose: wxToolBarMSW class
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_TBARMSW_H_
13 #define _WX_TBARMSW_H_
14
15 #ifdef __GNUG__
16 #pragma interface "tbarmsw.h"
17 #endif
18
19 #if wxUSE_BUTTONBAR && wxUSE_TOOLBAR
20
21 #include "wx/tbarbase.h"
22
23 WXDLLEXPORT_DATA(extern const wxChar*) wxButtonBarNameStr;
24
25 class WXDLLEXPORT wxMemoryDC;
26
27 // Non-Win95 (WIN32, WIN16, UNIX) version
28
29 class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase
30 {
31 DECLARE_DYNAMIC_CLASS(wxToolBarMSW)
32 public:
33 /*
34 * Public interface
35 */
36 wxToolBarMSW(void);
37
38 inline wxToolBarMSW(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
39 long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr)
40 {
41 Create(parent, id, pos, size, style, name);
42 }
43 bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
44 long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr);
45
46 ~wxToolBarMSW(void);
47
48 // Handle wxWindows events
49 void OnPaint(wxPaintEvent& event);
50 void OnSize(wxSizeEvent& event);
51 void OnMouseEvent(wxMouseEvent& event);
52
53 // If pushedBitmap is NULL, a reversed version of bitmap is
54 // created and used as the pushed/toggled image.
55 // If toggle is TRUE, the button toggles between the two states.
56 wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap,
57 bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL,
58 const wxString& helpString1 = wxEmptyString, const wxString& helpString2 = wxEmptyString);
59
60 void DrawTool(wxDC& dc, wxMemoryDC& memDc, wxToolBarTool *tool);
61
62 // Set default bitmap size
63 virtual void SetToolBitmapSize(const wxSize& size);
64 void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
65
66 // The button size is bigger than the bitmap size
67 wxSize GetToolSize(void) const;
68
69 void LayoutTools();
70
71 // The post-tool-addition call
72 bool Realize() { Layout(); return TRUE; };
73
74 protected:
75 void DrawTool(wxDC& dc, wxToolBarTool *tool, int state);
76
77 void GetSysColors(void);
78 bool InitGlobalObjects(void);
79 void FreeGlobalObjects(void);
80 void PatB(WXHDC hdc,int x,int y,int dx,int dy, long rgb);
81 void CreateMask(WXHDC hDC, int xoffset, int yoffset, int dx, int dy);
82 void DrawBlankButton(WXHDC hdc, int x, int y, int dx, int dy, int state);
83 void DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBarTool *tool, int state);
84 WXHBITMAP CreateDitherBitmap();
85 bool CreateDitherBrush(void);
86 bool FreeDitherBrush(void);
87 WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo);
88 WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap);
89
90 protected:
91 int m_currentRowsOrColumns;
92 long m_lastX, m_lastY;
93
94 WXHBRUSH m_hbrDither;
95 WXDWORD m_rgbFace;
96 WXDWORD m_rgbShadow;
97 WXDWORD m_rgbHilight;
98 WXDWORD m_rgbFrame;
99
100 //
101 // m_hdcMono is the DC that holds a mono bitmap, m_hbmMono
102 // that is used to create highlights
103 // of button faces.
104 // m_hbmDefault hold the default bitmap if there is one.
105 //
106 WXHDC m_hdcMono;
107 WXHBITMAP m_hbmMono;
108 WXHBITMAP m_hbmDefault;
109
110 DECLARE_EVENT_TABLE()
111 };
112
113 //
114 // States (not all of them currently used)
115 //
116 #define wxTBSTATE_CHECKED 0x01 // radio button is checked
117 #define wxTBSTATE_PRESSED 0x02 // button is being depressed (any style)
118 #define wxTBSTATE_ENABLED 0x04 // button is enabled
119 #define wxTBSTATE_HIDDEN 0x08 // button is hidden
120 #define wxTBSTATE_INDETERMINATE 0x10 // button is indeterminate
121
122 #endif // wxUSE_TOOL/BUTTONBAR
123 #endif
124 // _WX_TBARMSW_H_