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