]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tbarmsw.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxToolBarMSW class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TBARMSW_H_
13 #define _WX_TBARMSW_H_
16 #pragma interface "tbarmsw.h"
19 #if wxUSE_BUTTONBAR && wxUSE_TOOLBAR
21 #include "wx/tbarbase.h"
23 WXDLLEXPORT_DATA(extern const wxChar
*) wxButtonBarNameStr
;
25 class WXDLLEXPORT wxMemoryDC
;
27 // Non-Win95 (WIN32, WIN16, UNIX) version
29 class WXDLLEXPORT wxToolBarMSW
: public wxToolBarBase
31 DECLARE_DYNAMIC_CLASS(wxToolBarMSW
)
38 inline wxToolBarMSW(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
39 long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, const wxString
& name
= wxButtonBarNameStr
)
41 Create(parent
, id
, pos
, size
, style
, name
);
43 bool Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
44 long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, const wxString
& name
= wxButtonBarNameStr
);
48 // Handle wxWindows events
49 void OnPaint(wxPaintEvent
& event
);
50 void OnSize(wxSizeEvent
& event
);
51 void OnMouseEvent(wxMouseEvent
& event
);
53 // If pushedBitmap is NULL, a reversed version of bitmap is
54 // created and used as the pushed/toggled image.
55 // If toggle is TRUE, the button toggles between the two states.
56 wxToolBarTool
*AddTool(int toolIndex
, const wxBitmap
& bitmap
, const wxBitmap
& pushedBitmap
= wxNullBitmap
,
57 bool toggle
= FALSE
, long xPos
= -1, long yPos
= -1, wxObject
*clientData
= NULL
,
58 const wxString
& helpString1
= wxEmptyString
, const wxString
& helpString2
= wxEmptyString
);
60 void DrawTool(wxDC
& dc
, wxMemoryDC
& memDc
, wxToolBarTool
*tool
);
62 // Set default bitmap size
63 virtual void SetToolBitmapSize(const wxSize
& size
);
64 void EnableTool(int toolIndex
, bool enable
); // additional drawing on enabling
66 // The button size is bigger than the bitmap size
67 wxSize
GetToolSize(void) const;
71 // The post-tool-addition call
72 bool Realize() { Layout(); return TRUE
; };
75 void DrawTool(wxDC
& dc
, wxToolBarTool
*tool
, int state
);
77 void GetSysColors(void);
78 bool InitGlobalObjects(void);
79 void FreeGlobalObjects(void);
80 void PatB(WXHDC hdc
,int x
,int y
,int dx
,int dy
, long rgb
);
81 void CreateMask(WXHDC hDC
, int xoffset
, int yoffset
, int dx
, int dy
);
82 void DrawBlankButton(WXHDC hdc
, int x
, int y
, int dx
, int dy
, int state
);
83 void DrawButton(WXHDC hdc
, int x
, int y
, int dx
, int dy
, wxToolBarTool
*tool
, int state
);
84 WXHBITMAP
CreateDitherBitmap();
85 bool CreateDitherBrush(void);
86 bool FreeDitherBrush(void);
87 WXHBITMAP
CreateMappedBitmap(WXHINSTANCE hInstance
, void *lpBitmapInfo
);
88 WXHBITMAP
CreateMappedBitmap(WXHINSTANCE hInstance
, WXHBITMAP hBitmap
);
91 int m_currentRowsOrColumns
;
92 long m_lastX
, m_lastY
;
101 // m_hdcMono is the DC that holds a mono bitmap, m_hbmMono
102 // that is used to create highlights
104 // m_hbmDefault hold the default bitmap if there is one.
108 WXHBITMAP m_hbmDefault
;
110 DECLARE_EVENT_TABLE()
114 // States (not all of them currently used)
116 #define wxTBSTATE_CHECKED 0x01 // radio button is checked
117 #define wxTBSTATE_PRESSED 0x02 // button is being depressed (any style)
118 #define wxTBSTATE_ENABLED 0x04 // button is enabled
119 #define wxTBSTATE_HIDDEN 0x08 // button is hidden
120 #define wxTBSTATE_INDETERMINATE 0x10 // button is indeterminate
122 class WXDLLEXPORT wxToolBar
: public wxToolBarMSW
127 wxToolBar(wxWindow
*parent
,
129 const wxPoint
& pos
= wxDefaultPosition
,
130 const wxSize
& size
= wxDefaultSize
,
131 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
132 const wxString
& name
= wxToolBarNameStr
)
133 : wxToolBarMSW(parent
, id
, pos
, size
, style
, name
)
138 DECLARE_DYNAMIC_CLASS(wxToolBar
)
141 #endif // wxUSE_TOOL/BUTTONBAR