]>
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 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_TBAR95_H_
13 #define _WX_MSW_TBAR95_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "tbar95.h"
21 #include "wx/dynarray.h"
22 #include "wx/imaglist.h"
24 class WXDLLEXPORT wxToolBar
: public wxToolBarBase
28 wxToolBar() { Init(); }
30 wxToolBar(wxWindow
*parent
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
,
34 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
35 const wxString
& name
= wxToolBarNameStr
)
39 Create(parent
, id
, pos
, size
, style
, name
);
42 bool Create(wxWindow
*parent
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
46 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
47 const wxString
& name
= wxToolBarNameStr
);
51 // override/implement base class virtuals
52 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
54 virtual bool Realize();
56 virtual void SetToolBitmapSize(const wxSize
& size
);
57 virtual wxSize
GetToolSize() const;
59 virtual void SetRows(int nRows
);
61 // implementation only from now on
62 // -------------------------------
64 virtual void SetWindowStyleFlag(long style
);
66 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
67 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
69 void OnMouseEvent(wxMouseEvent
& event
);
70 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
71 void OnEraseBackground(wxEraseEvent
& event
);
75 static WXHBITMAP
MapBitmap(WXHBITMAP bitmap
, int width
, int height
);
78 // common part of all ctors
81 // create the native toolbar control
82 bool MSWCreateToolbar(const wxPoint
& pos
, const wxSize
& size
);
84 // recreate the control completely
87 // implement base class pure virtuals
88 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
89 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
91 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
92 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
93 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
95 virtual wxToolBarToolBase
*CreateTool(int id
,
96 const wxString
& label
,
97 const wxBitmap
& bmpNormal
,
98 const wxBitmap
& bmpDisabled
,
100 wxObject
*clientData
,
101 const wxString
& shortHelp
,
102 const wxString
& longHelp
);
103 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
);
105 // override WndProc mainly to process WM_SIZE
106 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
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;
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
);
117 // should be called whenever the toolbar size changes
120 // create m_disabledImgList (but doesn't fill it), set it to NULL if it is
122 void CreateDisabledImageList();
125 // the big bitmap containing all bitmaps of the toolbar buttons
128 // the image list with disabled images, may be NULL if we use
129 // system-provided versions of them
130 wxImageList
*m_disabledImgList
;
132 // the total number of toolbar elements
135 // the tool the cursor is in
136 wxToolBarToolBase
*m_pInTool
;
139 DECLARE_EVENT_TABLE()
140 DECLARE_DYNAMIC_CLASS(wxToolBar
)
141 DECLARE_NO_COPY_CLASS(wxToolBar
)
144 #endif // wxUSE_TOOLBAR
146 #endif // _WX_MSW_TBAR95_H_