]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
8a0681f9 | 2 | // Name: wx/msw/tbarmsw.h |
3a5bcc4d | 3 | // Purpose: wxToolBar for older Windowses |
2bda0e17 | 4 | // Author: Julian Smart |
8a0681f9 | 5 | // Modified by: 13.12.99 by VZ during toolbar classes reorganization |
2bda0e17 KB |
6 | // Created: 01/02/97 |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_TBARMSW_H_ |
13 | #define _WX_TBARMSW_H_ | |
2bda0e17 | 14 | |
8f177c8e | 15 | #if wxUSE_TOOLBAR |
d1c7e624 | 16 | |
2bda0e17 KB |
17 | #include "wx/tbarbase.h" |
18 | ||
63ec432b | 19 | extern WXDLLEXPORT_DATA(const wxChar) wxButtonBarNameStr[]; |
2bda0e17 | 20 | |
81d66cf3 JS |
21 | class WXDLLEXPORT wxMemoryDC; |
22 | ||
8a0681f9 | 23 | // ---------------------------------------------------------------------------- |
3a5bcc4d | 24 | // wxToolBar for older Windowses |
8a0681f9 | 25 | // ---------------------------------------------------------------------------- |
2bda0e17 | 26 | |
8a0681f9 | 27 | class WXDLLEXPORT wxToolBar : public wxToolBarBase |
2bda0e17 | 28 | { |
2bda0e17 | 29 | public: |
8a0681f9 VZ |
30 | // construction |
31 | wxToolBar() { Init(); } | |
7c0ea335 VZ |
32 | |
33 | wxToolBar(wxWindow *parent, | |
34 | wxWindowID id, | |
35 | const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, | |
8a0681f9 VZ |
37 | long style = wxNO_BORDER|wxTB_HORIZONTAL, |
38 | const wxString& name = wxButtonBarNameStr) | |
7c0ea335 | 39 | { |
8a0681f9 VZ |
40 | Init(); |
41 | ||
42 | Create(parent, id, pos, size, style, name); | |
7c0ea335 VZ |
43 | } |
44 | ||
8a0681f9 VZ |
45 | bool Create(wxWindow *parent, |
46 | wxWindowID id, | |
47 | const wxPoint& pos = wxDefaultPosition, | |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = wxNO_BORDER|wxTB_HORIZONTAL, | |
50 | const wxString& name = wxButtonBarNameStr); | |
51 | ||
52 | ~wxToolBar(); | |
53 | ||
54 | // implement/override base class (pure) virtuals | |
55 | virtual wxToolBarToolBase *AddTool(int id, | |
56 | const wxBitmap& bitmap, | |
57 | const wxBitmap& pushedBitmap, | |
58 | bool toggle, | |
59 | wxCoord xPos, | |
bfbb0b4c | 60 | wxCoord yPos = wxDefaultCoord, |
8a0681f9 VZ |
61 | wxObject *clientData = NULL, |
62 | const wxString& helpString1 = wxEmptyString, | |
63 | const wxString& helpString2 = wxEmptyString); | |
64 | ||
65 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
66 | ||
67 | virtual void SetToolBitmapSize(const wxSize& size); | |
68 | virtual wxSize GetToolSize() const; | |
69 | ||
70 | virtual bool Realize(); | |
71 | ||
72 | // implementation only from now on | |
73 | // ------------------------------- | |
74 | ||
77ffb593 | 75 | // Handle wxWidgets events |
8a0681f9 VZ |
76 | void OnPaint(wxPaintEvent& event); |
77 | void OnMouseEvent(wxMouseEvent& event); | |
78 | ||
79 | protected: | |
80 | void Init(); | |
81 | ||
82 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
83 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
84 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); | |
85 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
86 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
87 | ||
88 | virtual wxToolBarToolBase *CreateTool(int id, | |
a3399e6c VZ |
89 | const wxString& label, |
90 | const wxBitmap& bmpNormal, | |
91 | const wxBitmap& bmpDisabled, | |
92 | wxItemKind kind, | |
8a0681f9 | 93 | wxObject *clientData, |
a3399e6c VZ |
94 | const wxString& shortHelp, |
95 | const wxString& longHelp); | |
8a0681f9 VZ |
96 | virtual wxToolBarToolBase *CreateTool(wxControl *control); |
97 | ||
98 | void DoRedrawTool(wxToolBarToolBase *tool); | |
99 | ||
100 | void DrawTool(wxDC& dc, wxToolBarToolBase *tool); | |
101 | void DrawTool(wxDC& dc, wxToolBarToolBase *tool, int state); | |
102 | ||
103 | void GetSysColors(); | |
104 | bool InitGlobalObjects(); | |
105 | void FreeGlobalObjects(); | |
106 | void PatB(WXHDC hdc,int x,int y,int dx,int dy, long rgb); | |
107 | void CreateMask(WXHDC hDC, int xoffset, int yoffset, int dx, int dy); | |
108 | void DrawBlankButton(WXHDC hdc, int x, int y, int dx, int dy, int state); | |
109 | void DrawButton(WXHDC hdc, int x, int y, int dx, int dy, | |
1dbe8708 | 110 | wxToolBarToolBase *tool, int state); |
8a0681f9 VZ |
111 | WXHBITMAP CreateDitherBitmap(); |
112 | bool CreateDitherBrush(); | |
113 | bool FreeDitherBrush(); | |
114 | WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo); | |
115 | WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap); | |
116 | ||
117 | int m_currentRowsOrColumns; | |
118 | int m_pressedTool, m_currentTool; | |
119 | ||
120 | wxCoord m_xPos, m_yPos; | |
121 | wxCoord m_lastX, m_lastY; | |
122 | ||
123 | WXHBRUSH m_hbrDither; | |
124 | WXDWORD m_rgbFace; | |
125 | WXDWORD m_rgbShadow; | |
126 | WXDWORD m_rgbHilight; | |
127 | WXDWORD m_rgbFrame; | |
128 | ||
129 | // | |
130 | // m_hdcMono is the DC that holds a mono bitmap, m_hbmMono | |
131 | // that is used to create highlights | |
132 | // of button faces. | |
133 | // m_hbmDefault hold the default bitmap if there is one. | |
134 | // | |
135 | WXHDC m_hdcMono; | |
136 | WXHBITMAP m_hbmMono; | |
137 | WXHBITMAP m_hbmDefault; | |
138 | ||
7c0ea335 | 139 | private: |
8a0681f9 | 140 | DECLARE_EVENT_TABLE() |
7c0ea335 VZ |
141 | DECLARE_DYNAMIC_CLASS(wxToolBar) |
142 | }; | |
143 | ||
8f177c8e | 144 | #endif // wxUSE_TOOLBAR |
7c0ea335 | 145 | |
2bda0e17 | 146 | #endif |
bbcdf8bc | 147 | // _WX_TBARMSW_H_ |