]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tbar95.h
fixed status bar positioning to work both with and without sizers (patch 1199639...
[wxWidgets.git] / include / wx / msw / tbar95.h
CommitLineData
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
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 21#include "wx/dynarray.h"
8d0a7b56 22#include "wx/imaglist.h"
bdc72a22 23
8a0681f9 24class WXDLLEXPORT wxToolBar : public wxToolBarBase
2bda0e17 25{
1c383dba 26public:
8a0681f9
VZ
27 // ctors and dtor
28 wxToolBar() { Init(); }
2bda0e17 29
8a0681f9 30 wxToolBar(wxWindow *parent,
1c383dba
VZ
31 wxWindowID id,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize,
34 long style = wxNO_BORDER | wxTB_HORIZONTAL,
35 const wxString& name = wxToolBarNameStr)
36 {
37 Init();
2bda0e17 38
1c383dba
VZ
39 Create(parent, id, pos, size, style, name);
40 }
2bda0e17 41
1c383dba
VZ
42 bool Create(wxWindow *parent,
43 wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 long style = wxNO_BORDER | wxTB_HORIZONTAL,
47 const wxString& name = wxToolBarNameStr);
2bda0e17 48
8a0681f9 49 virtual ~wxToolBar();
2bda0e17 50
8a0681f9
VZ
51 // override/implement base class virtuals
52 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
2bda0e17 53
8a0681f9 54 virtual bool Realize();
4fabb575 55
1c383dba
VZ
56 virtual void SetToolBitmapSize(const wxSize& size);
57 virtual wxSize GetToolSize() const;
14b72bf5 58
1c383dba 59 virtual void SetRows(int nRows);
81d66cf3 60
8a0681f9
VZ
61 // implementation only from now on
62 // -------------------------------
63
c631abda
VZ
64 virtual void SetWindowStyleFlag(long style);
65
1c383dba
VZ
66 virtual bool MSWCommand(WXUINT param, WXWORD id);
67 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
2bda0e17 68
1c383dba
VZ
69 void OnMouseEvent(wxMouseEvent& event);
70 void OnSysColourChanged(wxSysColourChangedEvent& event);
0090a153 71 void OnEraseBackground(wxEraseEvent& event);
2bda0e17 72
8a328874
RR
73 void SetFocus() {}
74
566fb299
VZ
75 static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height);
76
2bda0e17 77protected:
1c383dba
VZ
78 // common part of all ctors
79 void Init();
80
278c927d
VZ
81 // create the native toolbar control
82 bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size);
24998710
VZ
83
84 // recreate the control completely
85 void Recreate();
86
8a0681f9
VZ
87 // implement base class pure virtuals
88 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
89 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
bdc72a22 90
8a0681f9
VZ
91 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
92 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
93 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
bdc72a22 94
8a0681f9 95 virtual wxToolBarToolBase *CreateTool(int id,
a3399e6c
VZ
96 const wxString& label,
97 const wxBitmap& bmpNormal,
98 const wxBitmap& bmpDisabled,
99 wxItemKind kind,
8a0681f9 100 wxObject *clientData,
a3399e6c
VZ
101 const wxString& shortHelp,
102 const wxString& longHelp);
8a0681f9 103 virtual wxToolBarToolBase *CreateTool(wxControl *control);
2bda0e17 104
7509fa8c 105 // override WndProc mainly to process WM_SIZE
c140b7e7 106 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
7c0ea335 107
24998710
VZ
108 // return the appropriate size and flags for the toolbar control
109 virtual wxSize DoGetBestSize() const;
110 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
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
124
8a0681f9
VZ
125 // the big bitmap containing all bitmaps of the toolbar buttons
126 WXHBITMAP m_hBitmap;
127
8d0a7b56
VZ
128 // the image list with disabled images, may be NULL if we use
129 // system-provided versions of them
130 wxImageList *m_disabledImgList;
131
8a0681f9
VZ
132 // the total number of toolbar elements
133 size_t m_nButtons;
7c0ea335 134
a8945eef
MB
135 // the tool the cursor is in
136 wxToolBarToolBase *m_pInTool;
137
7c0ea335 138private:
8a0681f9 139 DECLARE_EVENT_TABLE()
7c0ea335 140 DECLARE_DYNAMIC_CLASS(wxToolBar)
22f3361e 141 DECLARE_NO_COPY_CLASS(wxToolBar)
2bda0e17
KB
142};
143
d427503c
VZ
144#endif // wxUSE_TOOLBAR
145
8d0a7b56
VZ
146#endif // _WX_MSW_TBAR95_H_
147