]>
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 | ||
8d0a7b56 VZ |
12 | #ifndef _WX_MSW_TBAR95_H_ |
13 | #define _WX_MSW_TBAR95_H_ | |
2bda0e17 | 14 | |
d427503c | 15 | #if wxUSE_TOOLBAR |
2bda0e17 | 16 | |
bdc72a22 | 17 | #include "wx/dynarray.h" |
8d0a7b56 | 18 | #include "wx/imaglist.h" |
bdc72a22 | 19 | |
8a0681f9 | 20 | class WXDLLEXPORT wxToolBar : public wxToolBarBase |
2bda0e17 | 21 | { |
1c383dba | 22 | public: |
8a0681f9 VZ |
23 | // ctors and dtor |
24 | wxToolBar() { Init(); } | |
2bda0e17 | 25 | |
8a0681f9 | 26 | wxToolBar(wxWindow *parent, |
1c383dba VZ |
27 | wxWindowID id, |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, | |
30 | long style = wxNO_BORDER | wxTB_HORIZONTAL, | |
31 | const wxString& name = wxToolBarNameStr) | |
32 | { | |
33 | Init(); | |
2bda0e17 | 34 | |
1c383dba VZ |
35 | Create(parent, id, pos, size, style, name); |
36 | } | |
2bda0e17 | 37 | |
1c383dba VZ |
38 | bool Create(wxWindow *parent, |
39 | wxWindowID id, | |
40 | const wxPoint& pos = wxDefaultPosition, | |
41 | const wxSize& size = wxDefaultSize, | |
42 | long style = wxNO_BORDER | wxTB_HORIZONTAL, | |
43 | const wxString& name = wxToolBarNameStr); | |
2bda0e17 | 44 | |
8a0681f9 | 45 | virtual ~wxToolBar(); |
2bda0e17 | 46 | |
8a0681f9 VZ |
47 | // override/implement base class virtuals |
48 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
2bda0e17 | 49 | |
8a0681f9 | 50 | virtual bool Realize(); |
4fabb575 | 51 | |
1c383dba VZ |
52 | virtual void SetToolBitmapSize(const wxSize& size); |
53 | virtual wxSize GetToolSize() const; | |
14b72bf5 | 54 | |
1c383dba | 55 | virtual void SetRows(int nRows); |
81d66cf3 | 56 | |
bbd321ff RD |
57 | virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); |
58 | virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); | |
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 | ||
6f02a879 VZ |
76 | // override WndProc mainly to process WM_SIZE |
77 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
78 | ||
79 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
80 | ||
2bda0e17 | 81 | protected: |
1c383dba VZ |
82 | // common part of all ctors |
83 | void Init(); | |
84 | ||
278c927d VZ |
85 | // create the native toolbar control |
86 | bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); | |
24998710 VZ |
87 | |
88 | // recreate the control completely | |
89 | void Recreate(); | |
90 | ||
8a0681f9 VZ |
91 | // implement base class pure virtuals |
92 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
93 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
bdc72a22 | 94 | |
8a0681f9 VZ |
95 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); |
96 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
97 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
bdc72a22 | 98 | |
8a0681f9 | 99 | virtual wxToolBarToolBase *CreateTool(int id, |
a3399e6c VZ |
100 | const wxString& label, |
101 | const wxBitmap& bmpNormal, | |
102 | const wxBitmap& bmpDisabled, | |
103 | wxItemKind kind, | |
8a0681f9 | 104 | wxObject *clientData, |
a3399e6c VZ |
105 | const wxString& shortHelp, |
106 | const wxString& longHelp); | |
8a0681f9 | 107 | virtual wxToolBarToolBase *CreateTool(wxControl *control); |
2bda0e17 | 108 | |
24998710 VZ |
109 | // return the appropriate size and flags for the toolbar control |
110 | virtual wxSize DoGetBestSize() const; | |
24998710 | 111 | |
7509fa8c VZ |
112 | // handlers for various events |
113 | bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); | |
114 | bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); | |
115 | void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); | |
116 | ||
24998710 VZ |
117 | // should be called whenever the toolbar size changes |
118 | void UpdateSize(); | |
119 | ||
8d0a7b56 VZ |
120 | // create m_disabledImgList (but doesn't fill it), set it to NULL if it is |
121 | // unneeded | |
122 | void CreateDisabledImageList(); | |
123 | ||
2588b9c4 VZ |
124 | // get the Windows toolbar style of this control |
125 | long GetMSWToolbarStyle() const; | |
126 | ||
8d0a7b56 | 127 | |
8a0681f9 VZ |
128 | // the big bitmap containing all bitmaps of the toolbar buttons |
129 | WXHBITMAP m_hBitmap; | |
130 | ||
8d0a7b56 VZ |
131 | // the image list with disabled images, may be NULL if we use |
132 | // system-provided versions of them | |
133 | wxImageList *m_disabledImgList; | |
134 | ||
8a0681f9 VZ |
135 | // the total number of toolbar elements |
136 | size_t m_nButtons; | |
7c0ea335 | 137 | |
a8945eef MB |
138 | // the tool the cursor is in |
139 | wxToolBarToolBase *m_pInTool; | |
140 | ||
7c0ea335 | 141 | private: |
8a0681f9 | 142 | DECLARE_EVENT_TABLE() |
7c0ea335 | 143 | DECLARE_DYNAMIC_CLASS(wxToolBar) |
22f3361e | 144 | DECLARE_NO_COPY_CLASS(wxToolBar) |
2bda0e17 KB |
145 | }; |
146 | ||
d427503c VZ |
147 | #endif // wxUSE_TOOLBAR |
148 | ||
8d0a7b56 VZ |
149 | #endif // _WX_MSW_TBAR95_H_ |
150 |