]>
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_
17 #include "wx/dynarray.h"
18 #include "wx/imaglist.h"
20 class WXDLLEXPORT wxToolBar
: public wxToolBarBase
24 wxToolBar() { Init(); }
26 wxToolBar(wxWindow
*parent
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
31 const wxString
& name
= wxToolBarNameStr
)
35 Create(parent
, id
, pos
, size
, style
, name
);
38 bool Create(wxWindow
*parent
,
40 const wxPoint
& pos
= wxDefaultPosition
,
41 const wxSize
& size
= wxDefaultSize
,
42 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
43 const wxString
& name
= wxToolBarNameStr
);
47 // override/implement base class virtuals
48 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
50 virtual bool Realize();
52 virtual void SetToolBitmapSize(const wxSize
& size
);
53 virtual wxSize
GetToolSize() const;
55 virtual void SetRows(int nRows
);
57 // implementation only from now on
58 // -------------------------------
60 virtual void SetWindowStyleFlag(long style
);
62 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
63 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
65 void OnMouseEvent(wxMouseEvent
& event
);
66 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
67 void OnEraseBackground(wxEraseEvent
& event
);
71 static WXHBITMAP
MapBitmap(WXHBITMAP bitmap
, int width
, int height
);
73 // override WndProc mainly to process WM_SIZE
74 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
76 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
79 // common part of all ctors
82 // create the native toolbar control
83 bool MSWCreateToolbar(const wxPoint
& pos
, const wxSize
& size
);
85 // recreate the control completely
88 // implement base class pure virtuals
89 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
90 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
92 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
93 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
94 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
96 virtual wxToolBarToolBase
*CreateTool(int id
,
97 const wxString
& label
,
98 const wxBitmap
& bmpNormal
,
99 const wxBitmap
& bmpDisabled
,
101 wxObject
*clientData
,
102 const wxString
& shortHelp
,
103 const wxString
& longHelp
);
104 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
);
106 // return the appropriate size and flags for the toolbar control
107 virtual wxSize
DoGetBestSize() const;
109 // handlers for various events
110 bool HandleSize(WXWPARAM wParam
, WXLPARAM lParam
);
111 bool HandlePaint(WXWPARAM wParam
, WXLPARAM lParam
);
112 void HandleMouseMove(WXWPARAM wParam
, WXLPARAM lParam
);
114 // should be called whenever the toolbar size changes
117 // create m_disabledImgList (but doesn't fill it), set it to NULL if it is
119 void CreateDisabledImageList();
122 // the big bitmap containing all bitmaps of the toolbar buttons
125 // the image list with disabled images, may be NULL if we use
126 // system-provided versions of them
127 wxImageList
*m_disabledImgList
;
129 // the total number of toolbar elements
132 // the tool the cursor is in
133 wxToolBarToolBase
*m_pInTool
;
136 DECLARE_EVENT_TABLE()
137 DECLARE_DYNAMIC_CLASS(wxToolBar
)
138 DECLARE_NO_COPY_CLASS(wxToolBar
)
141 #endif // wxUSE_TOOLBAR
143 #endif // _WX_MSW_TBAR95_H_