]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tbar95.h
Move unused values into 2.4 compatibility. Source cleaning.
[wxWidgets.git] / include / wx / msw / tbar95.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/tbar95.h
3 // Purpose: wxToolBar (Windows 95 toolbar) class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TBAR95_H_
13 #define _WX_TBAR95_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "tbar95.h"
17 #endif
18
19 #if wxUSE_TOOLBAR
20
21 #include "wx/dynarray.h"
22
23 class WXDLLEXPORT wxToolBar : public wxToolBarBase
24 {
25 public:
26 // ctors and dtor
27 wxToolBar() { Init(); }
28
29 wxToolBar(wxWindow *parent,
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();
37
38 Create(parent, id, pos, size, style, name);
39 }
40
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);
47
48 virtual ~wxToolBar();
49
50 // override/implement base class virtuals
51 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
52
53 virtual bool Realize();
54
55 virtual void SetToolBitmapSize(const wxSize& size);
56 virtual wxSize GetToolSize() const;
57
58 virtual void SetRows(int nRows);
59
60 // implementation only from now on
61 // -------------------------------
62
63 virtual void SetWindowStyleFlag(long style);
64
65 virtual bool MSWCommand(WXUINT param, WXWORD id);
66 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
67
68 void OnMouseEvent(wxMouseEvent& event);
69 void OnSysColourChanged(wxSysColourChangedEvent& event);
70
71 void SetFocus() {}
72
73 static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height);
74
75 protected:
76 // common part of all ctors
77 void Init();
78
79 // create the native toolbar control
80 bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size);
81
82 // recreate the control completely
83 void Recreate();
84
85 // implement base class pure virtuals
86 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
87 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
88
89 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
90 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
91 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
92
93 virtual wxToolBarToolBase *CreateTool(int id,
94 const wxString& label,
95 const wxBitmap& bmpNormal,
96 const wxBitmap& bmpDisabled,
97 wxItemKind kind,
98 wxObject *clientData,
99 const wxString& shortHelp,
100 const wxString& longHelp);
101 virtual wxToolBarToolBase *CreateTool(wxControl *control);
102
103 // override WndProc mainly to process WM_SIZE
104 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
105
106 // return the appropriate size and flags for the toolbar control
107 virtual wxSize DoGetBestSize() const;
108 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
109
110 // handlers for various events
111 bool HandleSize(WXWPARAM wParam, WXLPARAM lParam);
112 bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam);
113 void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam);
114
115 // should be called whenever the toolbar size changes
116 void UpdateSize();
117
118 // the big bitmap containing all bitmaps of the toolbar buttons
119 WXHBITMAP m_hBitmap;
120
121 // the total number of toolbar elements
122 size_t m_nButtons;
123
124 // the tool the cursor is in
125 wxToolBarToolBase *m_pInTool;
126
127 private:
128 DECLARE_EVENT_TABLE()
129 DECLARE_DYNAMIC_CLASS(wxToolBar)
130 DECLARE_NO_COPY_CLASS(wxToolBar)
131 };
132
133 #endif // wxUSE_TOOLBAR
134
135 #endif
136 // _WX_TBAR95_H_