]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tbarmsw.h
Fixed comment bug [ 1390056 ] Wrong Documentation for TransferFromWindow
[wxWidgets.git] / include / wx / msw / tbarmsw.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/tbarmsw.h
3 // Purpose: wxToolBar for older Windowses
4 // Author: Julian Smart
5 // Modified by: 13.12.99 by VZ during toolbar classes reorganization
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 #if wxUSE_TOOLBAR
16
17 #include "wx/tbarbase.h"
18
19 extern WXDLLEXPORT_DATA(const wxChar) wxButtonBarNameStr[];
20
21 class WXDLLEXPORT wxMemoryDC;
22
23 // ----------------------------------------------------------------------------
24 // wxToolBar for older Windowses
25 // ----------------------------------------------------------------------------
26
27 class WXDLLEXPORT wxToolBar : public wxToolBarBase
28 {
29 public:
30 // construction
31 wxToolBar() { Init(); }
32
33 wxToolBar(wxWindow *parent,
34 wxWindowID id,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 long style = wxNO_BORDER|wxTB_HORIZONTAL,
38 const wxString& name = wxButtonBarNameStr)
39 {
40 Init();
41
42 Create(parent, id, pos, size, style, name);
43 }
44
45 bool Create(wxWindow *parent,
46 wxWindowID id,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = wxNO_BORDER|wxTB_HORIZONTAL,
50 const wxString& name = wxButtonBarNameStr);
51
52 ~wxToolBar();
53
54 // implement/override base class (pure) virtuals
55 virtual wxToolBarToolBase *AddTool(int id,
56 const wxBitmap& bitmap,
57 const wxBitmap& pushedBitmap,
58 bool toggle,
59 wxCoord xPos,
60 wxCoord yPos = wxDefaultCoord,
61 wxObject *clientData = NULL,
62 const wxString& helpString1 = wxEmptyString,
63 const wxString& helpString2 = wxEmptyString);
64
65 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
66
67 virtual void SetToolBitmapSize(const wxSize& size);
68 virtual wxSize GetToolSize() const;
69
70 virtual bool Realize();
71
72 // implementation only from now on
73 // -------------------------------
74
75 // Handle wxWidgets events
76 void OnPaint(wxPaintEvent& event);
77 void OnMouseEvent(wxMouseEvent& event);
78
79 protected:
80 void Init();
81
82 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
83 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
84 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
85 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
86 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
87
88 virtual wxToolBarToolBase *CreateTool(int id,
89 const wxString& label,
90 const wxBitmap& bmpNormal,
91 const wxBitmap& bmpDisabled,
92 wxItemKind kind,
93 wxObject *clientData,
94 const wxString& shortHelp,
95 const wxString& longHelp);
96 virtual wxToolBarToolBase *CreateTool(wxControl *control);
97
98 void DoRedrawTool(wxToolBarToolBase *tool);
99
100 void DrawTool(wxDC& dc, wxToolBarToolBase *tool);
101 void DrawTool(wxDC& dc, wxToolBarToolBase *tool, int state);
102
103 void GetSysColors();
104 bool InitGlobalObjects();
105 void FreeGlobalObjects();
106 void PatB(WXHDC hdc,int x,int y,int dx,int dy, long rgb);
107 void CreateMask(WXHDC hDC, int xoffset, int yoffset, int dx, int dy);
108 void DrawBlankButton(WXHDC hdc, int x, int y, int dx, int dy, int state);
109 void DrawButton(WXHDC hdc, int x, int y, int dx, int dy,
110 wxToolBarToolBase *tool, int state);
111 WXHBITMAP CreateDitherBitmap();
112 bool CreateDitherBrush();
113 bool FreeDitherBrush();
114 WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo);
115 WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap);
116
117 int m_currentRowsOrColumns;
118 int m_pressedTool, m_currentTool;
119
120 wxCoord m_xPos, m_yPos;
121 wxCoord m_lastX, m_lastY;
122
123 WXHBRUSH m_hbrDither;
124 WXDWORD m_rgbFace;
125 WXDWORD m_rgbShadow;
126 WXDWORD m_rgbHilight;
127 WXDWORD m_rgbFrame;
128
129 //
130 // m_hdcMono is the DC that holds a mono bitmap, m_hbmMono
131 // that is used to create highlights
132 // of button faces.
133 // m_hbmDefault hold the default bitmap if there is one.
134 //
135 WXHDC m_hdcMono;
136 WXHBITMAP m_hbmMono;
137 WXHBITMAP m_hbmDefault;
138
139 private:
140 DECLARE_EVENT_TABLE()
141 DECLARE_DYNAMIC_CLASS(wxToolBar)
142 };
143
144 #endif // wxUSE_TOOLBAR
145
146 #endif
147 // _WX_TBARMSW_H_