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