]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1c383dba | 2 | // Name: wx/msw/tbar95.h |
8a0681f9 | 3 | // Purpose: wxToolBar (Windows 95 toolbar) class |
2bda0e17 KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
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_TBAR95_H_ |
13 | #define _WX_TBAR95_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
8a0681f9 | 16 | #pragma interface "tbar95.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
d427503c | 19 | #if wxUSE_TOOLBAR |
2bda0e17 | 20 | |
bdc72a22 VZ |
21 | #include "wx/dynarray.h" |
22 | ||
8a0681f9 | 23 | class WXDLLEXPORT wxToolBar : public wxToolBarBase |
2bda0e17 | 24 | { |
1c383dba | 25 | public: |
8a0681f9 VZ |
26 | // ctors and dtor |
27 | wxToolBar() { Init(); } | |
2bda0e17 | 28 | |
8a0681f9 | 29 | wxToolBar(wxWindow *parent, |
1c383dba VZ |
30 | wxWindowID id, |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | long style = wxNO_BORDER | wxTB_HORIZONTAL, | |
34 | const wxString& name = wxToolBarNameStr) | |
35 | { | |
36 | Init(); | |
2bda0e17 | 37 | |
1c383dba VZ |
38 | Create(parent, id, pos, size, style, name); |
39 | } | |
2bda0e17 | 40 | |
1c383dba VZ |
41 | bool Create(wxWindow *parent, |
42 | wxWindowID id, | |
43 | const wxPoint& pos = wxDefaultPosition, | |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = wxNO_BORDER | wxTB_HORIZONTAL, | |
46 | const wxString& name = wxToolBarNameStr); | |
2bda0e17 | 47 | |
8a0681f9 | 48 | virtual ~wxToolBar(); |
2bda0e17 | 49 | |
8a0681f9 VZ |
50 | // override/implement base class virtuals |
51 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
2bda0e17 | 52 | |
8a0681f9 | 53 | virtual bool Realize(); |
4fabb575 | 54 | |
1c383dba VZ |
55 | virtual void SetToolBitmapSize(const wxSize& size); |
56 | virtual wxSize GetToolSize() const; | |
14b72bf5 | 57 | |
1c383dba | 58 | virtual void SetRows(int nRows); |
81d66cf3 | 59 | |
8a0681f9 VZ |
60 | // implementation only from now on |
61 | // ------------------------------- | |
62 | ||
c631abda VZ |
63 | virtual void SetWindowStyleFlag(long style); |
64 | ||
1c383dba VZ |
65 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
66 | virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); | |
2bda0e17 | 67 | |
1c383dba VZ |
68 | void OnMouseEvent(wxMouseEvent& event); |
69 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
0090a153 | 70 | void OnEraseBackground(wxEraseEvent& event); |
2bda0e17 | 71 | |
8a328874 RR |
72 | void SetFocus() {} |
73 | ||
566fb299 VZ |
74 | static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); |
75 | ||
2bda0e17 | 76 | protected: |
1c383dba VZ |
77 | // common part of all ctors |
78 | void Init(); | |
79 | ||
278c927d VZ |
80 | // create the native toolbar control |
81 | bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); | |
24998710 VZ |
82 | |
83 | // recreate the control completely | |
84 | void Recreate(); | |
85 | ||
8a0681f9 VZ |
86 | // implement base class pure virtuals |
87 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
88 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
bdc72a22 | 89 | |
8a0681f9 VZ |
90 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); |
91 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
92 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
bdc72a22 | 93 | |
8a0681f9 | 94 | virtual wxToolBarToolBase *CreateTool(int id, |
a3399e6c VZ |
95 | const wxString& label, |
96 | const wxBitmap& bmpNormal, | |
97 | const wxBitmap& bmpDisabled, | |
98 | wxItemKind kind, | |
8a0681f9 | 99 | wxObject *clientData, |
a3399e6c VZ |
100 | const wxString& shortHelp, |
101 | const wxString& longHelp); | |
8a0681f9 | 102 | virtual wxToolBarToolBase *CreateTool(wxControl *control); |
2bda0e17 | 103 | |
7509fa8c | 104 | // override WndProc mainly to process WM_SIZE |
c140b7e7 | 105 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
7c0ea335 | 106 | |
24998710 VZ |
107 | // return the appropriate size and flags for the toolbar control |
108 | virtual wxSize DoGetBestSize() const; | |
109 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
110 | ||
7509fa8c VZ |
111 | // handlers for various events |
112 | bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); | |
113 | bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); | |
114 | void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); | |
115 | ||
24998710 VZ |
116 | // should be called whenever the toolbar size changes |
117 | void UpdateSize(); | |
118 | ||
8a0681f9 VZ |
119 | // the big bitmap containing all bitmaps of the toolbar buttons |
120 | WXHBITMAP m_hBitmap; | |
121 | ||
122 | // the total number of toolbar elements | |
123 | size_t m_nButtons; | |
7c0ea335 | 124 | |
a8945eef MB |
125 | // the tool the cursor is in |
126 | wxToolBarToolBase *m_pInTool; | |
127 | ||
7c0ea335 | 128 | private: |
8a0681f9 | 129 | DECLARE_EVENT_TABLE() |
7c0ea335 | 130 | DECLARE_DYNAMIC_CLASS(wxToolBar) |
22f3361e | 131 | DECLARE_NO_COPY_CLASS(wxToolBar) |
2bda0e17 KB |
132 | }; |
133 | ||
d427503c VZ |
134 | #endif // wxUSE_TOOLBAR |
135 | ||
2bda0e17 | 136 | #endif |
bbcdf8bc | 137 | // _WX_TBAR95_H_ |