]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
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 and Markus Holzem | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __TBARMSWH__ | |
13 | #define __TBARMSWH__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "tbarmsw.h" | |
17 | #endif | |
18 | ||
19 | #if USE_BUTTONBAR && USE_TOOLBAR | |
20 | #include "wx/tbarbase.h" | |
21 | ||
22 | WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr; | |
23 | ||
24 | // Non-Win95 (WIN32, WIN16, UNIX) version | |
25 | ||
26 | class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase | |
27 | { | |
28 | DECLARE_DYNAMIC_CLASS(wxToolBarMSW) | |
29 | public: | |
30 | /* | |
31 | * Public interface | |
32 | */ | |
33 | wxToolBarMSW(void); | |
34 | ||
35 | #if WXWIN_COMPATIBILITY > 0 | |
36 | inline wxToolBarMSW(wxWindow *parent, int x, int y, int w, int h, | |
37 | long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 2, | |
38 | const char *name = wxButtonBarNameStr) | |
39 | { | |
40 | Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name); | |
41 | } | |
42 | #endif | |
debe6624 JS |
43 | inline wxToolBarMSW(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
44 | long style = wxNO_BORDER, int orientation = wxVERTICAL, | |
45 | int RowsOrColumns = 2, const wxString& name = wxButtonBarNameStr) | |
2bda0e17 KB |
46 | { |
47 | Create(parent, id, pos, size, style, orientation, RowsOrColumns, name); | |
48 | } | |
debe6624 JS |
49 | bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
50 | long style = wxNO_BORDER, int orientation = wxVERTICAL, | |
51 | int RowsOrColumns = 2, const wxString& name = wxButtonBarNameStr); | |
2bda0e17 KB |
52 | |
53 | ~wxToolBarMSW(void); | |
54 | ||
55 | // Handle wxWindows events | |
56 | void OnPaint(wxPaintEvent& event); | |
57 | void OnSize(wxSizeEvent& event); | |
58 | void OnMouseEvent(wxMouseEvent& event); | |
59 | ||
60 | // If pushedBitmap is NULL, a reversed version of bitmap is | |
61 | // created and used as the pushed/toggled image. | |
62 | // If toggle is TRUE, the button toggles between the two states. | |
debe6624 JS |
63 | wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, |
64 | bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL, | |
2bda0e17 KB |
65 | const wxString& helpString1 = "", const wxString& helpString2 = ""); |
66 | ||
67 | void DrawTool(wxDC& dc, wxMemoryDC& memDc, wxToolBarTool *tool); | |
68 | ||
69 | // New members | |
70 | // Set default bitmap size | |
71 | virtual void SetDefaultSize(const wxSize& size); | |
debe6624 | 72 | void EnableTool(int toolIndex, bool enable); // additional drawing on enabling |
2bda0e17 KB |
73 | |
74 | // The button size is bigger than the bitmap size | |
75 | wxSize GetDefaultButtonSize(void) const; | |
76 | protected: | |
77 | void DrawTool(wxDC& dc, wxToolBarTool *tool, int state); | |
78 | ||
79 | void GetSysColors(void); | |
80 | bool InitGlobalObjects(void); | |
81 | void FreeGlobalObjects(void); | |
82 | void PatB(WXHDC hdc,int x,int y,int dx,int dy, long rgb); | |
83 | void CreateMask(WXHDC hDC, int xoffset, int yoffset, int dx, int dy); | |
84 | void DrawBlankButton(WXHDC hdc, int x, int y, int dx, int dy, int state); | |
85 | void DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBarTool *tool, int state); | |
86 | WXHBITMAP CreateDitherBitmap(); | |
87 | bool CreateDitherBrush(void); | |
88 | bool FreeDitherBrush(void); | |
89 | WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo); | |
90 | WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap); | |
91 | ||
92 | protected: | |
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 | #define DEFAULTBITMAPX 16 | |
114 | #define DEFAULTBITMAPY 15 | |
115 | #define DEFAULTBUTTONX 24 | |
116 | #define DEFAULTBUTTONY 22 | |
117 | #define DEFAULTBARHEIGHT 27 | |
118 | ||
119 | // | |
120 | // States (not all of them currently used) | |
121 | // | |
122 | #define wxTBSTATE_CHECKED 0x01 // radio button is checked | |
123 | #define wxTBSTATE_PRESSED 0x02 // button is being depressed (any style) | |
124 | #define wxTBSTATE_ENABLED 0x04 // button is enabled | |
125 | #define wxTBSTATE_HIDDEN 0x08 // button is hidden | |
126 | #define wxTBSTATE_INDETERMINATE 0x10 // button is indeterminate | |
127 | ||
128 | #endif // USE_TOOL/BUTTONBAR | |
129 | #endif | |
130 | // __TBARMSWH__ |