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