]>
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
20 #include "wx/tbarbase.h"
22 WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr
;
24 class WXDLLEXPORT wxMemoryDC
;
26 // Non-Win95 (WIN32, WIN16, UNIX) version
28 class WXDLLEXPORT wxToolBarMSW
: public wxToolBarBase
30 DECLARE_DYNAMIC_CLASS(wxToolBarMSW
)
37 inline wxToolBarMSW(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
38 long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, const wxString
& name
= wxButtonBarNameStr
)
40 Create(parent
, id
, pos
, size
, style
, name
);
42 bool Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
43 long style
= wxNO_BORDER
|wxTB_HORIZONTAL
, const wxString
& name
= wxButtonBarNameStr
);
47 // Handle wxWindows events
48 void OnPaint(wxPaintEvent
& event
);
49 void OnSize(wxSizeEvent
& event
);
50 void OnMouseEvent(wxMouseEvent
& event
);
52 // If pushedBitmap is NULL, a reversed version of bitmap is
53 // created and used as the pushed/toggled image.
54 // If toggle is TRUE, the button toggles between the two states.
55 wxToolBarTool
*AddTool(int toolIndex
, const wxBitmap
& bitmap
, const wxBitmap
& pushedBitmap
= wxNullBitmap
,
56 bool toggle
= FALSE
, long xPos
= -1, long yPos
= -1, wxObject
*clientData
= NULL
,
57 const wxString
& helpString1
= "", const wxString
& helpString2
= "");
59 void DrawTool(wxDC
& dc
, wxMemoryDC
& memDc
, wxToolBarTool
*tool
);
61 // Set default bitmap size
62 virtual void SetToolBitmapSize(const wxSize
& size
);
63 void EnableTool(int toolIndex
, bool enable
); // additional drawing on enabling
65 // The button size is bigger than the bitmap size
66 wxSize
GetToolSize(void) const;
70 // The post-tool-addition call
71 bool Realize() { Layout(); return TRUE
; };
74 void DrawTool(wxDC
& dc
, wxToolBarTool
*tool
, int state
);
76 void GetSysColors(void);
77 bool InitGlobalObjects(void);
78 void FreeGlobalObjects(void);
79 void PatB(WXHDC hdc
,int x
,int y
,int dx
,int dy
, long rgb
);
80 void CreateMask(WXHDC hDC
, int xoffset
, int yoffset
, int dx
, int dy
);
81 void DrawBlankButton(WXHDC hdc
, int x
, int y
, int dx
, int dy
, int state
);
82 void DrawButton(WXHDC hdc
, int x
, int y
, int dx
, int dy
, wxToolBarTool
*tool
, int state
);
83 WXHBITMAP
CreateDitherBitmap();
84 bool CreateDitherBrush(void);
85 bool FreeDitherBrush(void);
86 WXHBITMAP
CreateMappedBitmap(WXHINSTANCE hInstance
, void *lpBitmapInfo
);
87 WXHBITMAP
CreateMappedBitmap(WXHINSTANCE hInstance
, WXHBITMAP hBitmap
);
90 int m_currentRowsOrColumns
;
91 long m_lastX
, m_lastY
;
100 // m_hdcMono is the DC that holds a mono bitmap, m_hbmMono
101 // that is used to create highlights
103 // m_hbmDefault hold the default bitmap if there is one.
107 WXHBITMAP m_hbmDefault
;
109 DECLARE_EVENT_TABLE()
113 // States (not all of them currently used)
115 #define wxTBSTATE_CHECKED 0x01 // radio button is checked
116 #define wxTBSTATE_PRESSED 0x02 // button is being depressed (any style)
117 #define wxTBSTATE_ENABLED 0x04 // button is enabled
118 #define wxTBSTATE_HIDDEN 0x08 // button is hidden
119 #define wxTBSTATE_INDETERMINATE 0x10 // button is indeterminate
121 #endif // wxUSE_TOOL/BUTTONBAR