]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tbarmsw.h
image update
[wxWidgets.git] / include / wx / msw / tbarmsw.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbarmsw.h
3 // Purpose: wxToolBarMSW class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TBARMSW_H_
13 #define _WX_TBARMSW_H_
14
15 #ifdef __GNUG__
16 #pragma interface "tbarmsw.h"
17 #endif
18
19 #if wxUSE_BUTTONBAR && wxUSE_TOOLBAR
20 #include "wx/tbarbase.h"
21
22 WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr;
23
24 class WXDLLEXPORT wxMemoryDC;
25
26 // Non-Win95 (WIN32, WIN16, UNIX) version
27
28 class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase
29 {
30 DECLARE_DYNAMIC_CLASS(wxToolBarMSW)
31 public:
32 /*
33 * Public interface
34 */
35 wxToolBarMSW(void);
36
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)
39 {
40 Create(parent, id, pos, size, style, name);
41 }
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);
44
45 ~wxToolBarMSW(void);
46
47 // Handle wxWindows events
48 void OnPaint(wxPaintEvent& event);
49 void OnSize(wxSizeEvent& event);
50 void OnMouseEvent(wxMouseEvent& event);
51
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 = wxEmptyString, const wxString& helpString2 = wxEmptyString);
58
59 void DrawTool(wxDC& dc, wxMemoryDC& memDc, wxToolBarTool *tool);
60
61 // Set default bitmap size
62 virtual void SetToolBitmapSize(const wxSize& size);
63 void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
64
65 // The button size is bigger than the bitmap size
66 wxSize GetToolSize(void) const;
67
68 void Layout(void);
69
70 // The post-tool-addition call
71 bool Realize() { Layout(); return TRUE; };
72
73 protected:
74 void DrawTool(wxDC& dc, wxToolBarTool *tool, int state);
75
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);
88
89 protected:
90 int m_currentRowsOrColumns;
91 long m_lastX, m_lastY;
92
93 WXHBRUSH m_hbrDither;
94 WXDWORD m_rgbFace;
95 WXDWORD m_rgbShadow;
96 WXDWORD m_rgbHilight;
97 WXDWORD m_rgbFrame;
98
99 //
100 // m_hdcMono is the DC that holds a mono bitmap, m_hbmMono
101 // that is used to create highlights
102 // of button faces.
103 // m_hbmDefault hold the default bitmap if there is one.
104 //
105 WXHDC m_hdcMono;
106 WXHBITMAP m_hbmMono;
107 WXHBITMAP m_hbmDefault;
108
109 DECLARE_EVENT_TABLE()
110 };
111
112 //
113 // States (not all of them currently used)
114 //
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
120
121 #endif // wxUSE_TOOL/BUTTONBAR
122 #endif
123 // _WX_TBARMSW_H_