]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tbar95.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/tbar95.h
3 // Purpose: wxToolBar (Windows 95 toolbar) class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "tbar95.h"
21 #include "wx/dynarray.h"
23 class WXDLLEXPORT wxToolBar
: public wxToolBarBase
27 wxToolBar() { Init(); }
29 wxToolBar(wxWindow
*parent
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
33 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
34 const wxString
& name
= wxToolBarNameStr
)
38 Create(parent
, id
, pos
, size
, style
, name
);
41 bool Create(wxWindow
*parent
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
45 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
46 const wxString
& name
= wxToolBarNameStr
);
50 // override/implement base class virtuals
51 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
53 virtual bool Realize();
55 virtual void SetToolBitmapSize(const wxSize
& size
);
56 virtual wxSize
GetToolSize() const;
58 virtual void SetRows(int nRows
);
60 // implementation only from now on
61 // -------------------------------
63 virtual void SetWindowStyleFlag(long style
);
65 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
66 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
68 void OnMouseEvent(wxMouseEvent
& event
);
69 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
70 void OnEraseBackground(wxEraseEvent
& event
);
74 static WXHBITMAP
MapBitmap(WXHBITMAP bitmap
, int width
, int height
);
77 // common part of all ctors
80 // create the native toolbar control
81 bool MSWCreateToolbar(const wxPoint
& pos
, const wxSize
& size
);
83 // recreate the control completely
86 // implement base class pure virtuals
87 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
88 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
90 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
91 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
92 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
94 virtual wxToolBarToolBase
*CreateTool(int id
,
95 const wxString
& label
,
96 const wxBitmap
& bmpNormal
,
97 const wxBitmap
& bmpDisabled
,
100 const wxString
& shortHelp
,
101 const wxString
& longHelp
);
102 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
);
104 // override WndProc mainly to process WM_SIZE
105 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
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;
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
);
116 // should be called whenever the toolbar size changes
119 // the big bitmap containing all bitmaps of the toolbar buttons
122 // the total number of toolbar elements
125 // the tool the cursor is in
126 wxToolBarToolBase
*m_pInTool
;
129 DECLARE_EVENT_TABLE()
130 DECLARE_DYNAMIC_CLASS(wxToolBar
)
131 DECLARE_NO_COPY_CLASS(wxToolBar
)
134 #endif // wxUSE_TOOLBAR