]> git.saurik.com Git - wxWidgets.git/blame - include/wx/bmpbuttn.h
include wx/bitmap.h which is required by wxButton now
[wxWidgets.git] / include / wx / bmpbuttn.h
CommitLineData
1e6feb95
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/bmpbutton.h
3// Purpose: wxBitmapButton class interface
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 25.08.00
7// RCS-ID: $Id$
8// Copyright: (c) 2000 Vadim Zeitlin
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_BMPBUTTON_H_BASE_
13#define _WX_BMPBUTTON_H_BASE_
c801d85f 14
997176a3
VZ
15#include "wx/defs.h"
16
1e6feb95
VZ
17#if wxUSE_BMPBUTTON
18
19#include "wx/bitmap.h"
20#include "wx/button.h"
21
53a2db12 22extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[];
1e6feb95
VZ
23
24// ----------------------------------------------------------------------------
25// wxBitmapButton: a button which shows bitmaps instead of the usual string.
26// It has different bitmaps for different states (focused/disabled/pressed)
27// ----------------------------------------------------------------------------
28
53a2db12 29class WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton
1e6feb95
VZ
30{
31public:
6463b9f5 32 wxBitmapButtonBase()
6b5a2b6f
VZ
33 {
34 m_marginX =
35 m_marginY = 0;
36 }
1e6feb95 37
1e6feb95
VZ
38 // set/get the margins around the button
39 virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
40 int GetMarginX() const { return m_marginX; }
41 int GetMarginY() const { return m_marginY; }
42
6b5a2b6f
VZ
43 // deprecated synonym for SetBitmapLabel()
44#if WXWIN_COMPATIBILITY_2_6
45 wxDEPRECATED( void SetLabel(const wxBitmap& bitmap) );
6b5a2b6f
VZ
46
47 // prevent virtual function hiding
48 virtual void SetLabel(const wxString& label)
faa49bfd 49 { wxWindow::SetLabel(label); }
6b5a2b6f
VZ
50#endif // WXWIN_COMPATIBILITY_2_6
51
1e6feb95
VZ
52protected:
53 // function called when any of the bitmaps changes
c46b98da 54 virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
1e6feb95 55
2352862a
VZ
56 virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; }
57 virtual void DoSetBitmap(const wxBitmap& bitmap, State which)
58 { m_bitmaps[which] = bitmap; OnSetBitmap(); }
59
1e6feb95 60 // the bitmaps for various states
2352862a 61 wxBitmap m_bitmaps[State_Max];
1e6feb95
VZ
62
63 // the margins around the bitmap
64 int m_marginX,
65 m_marginY;
fc7a2a60 66
fc7a2a60 67
c0c133e1 68 wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase);
1e6feb95
VZ
69};
70
6b5a2b6f 71#if WXWIN_COMPATIBILITY_2_6
6aad0c70
VZ
72inline void wxBitmapButtonBase::SetLabel(const wxBitmap& bitmap)
73{
74 SetBitmapLabel(bitmap);
75}
6b5a2b6f
VZ
76#endif // WXWIN_COMPATIBILITY_2_6
77
1e6feb95
VZ
78#if defined(__WXUNIVERSAL__)
79 #include "wx/univ/bmpbuttn.h"
80#elif defined(__WXMSW__)
81 #include "wx/msw/bmpbuttn.h"
2049ba38 82#elif defined(__WXMOTIF__)
1e6feb95 83 #include "wx/motif/bmpbuttn.h"
1be7a35c 84#elif defined(__WXGTK20__)
1e6feb95 85 #include "wx/gtk/bmpbuttn.h"
1be7a35c
MR
86#elif defined(__WXGTK__)
87 #include "wx/gtk1/bmpbuttn.h"
34138703 88#elif defined(__WXMAC__)
ef0e9220 89 #include "wx/osx/bmpbuttn.h"
e64df9bc
DE
90#elif defined(__WXCOCOA__)
91 #include "wx/cocoa/bmpbuttn.h"
1777b9bb 92#elif defined(__WXPM__)
1e6feb95 93 #include "wx/os2/bmpbuttn.h"
9b4da627
VZ
94#elif defined(__WXPALMOS__)
95 #include "wx/palmos/bmpbuttn.h"
c801d85f
KB
96#endif
97
1e6feb95
VZ
98#endif // wxUSE_BMPBUTTON
99
100#endif // _WX_BMPBUTTON_H_BASE_