]> git.saurik.com Git - wxWidgets.git/blame - include/wx/bmpbuttn.h
Smartphone fix.
[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
22WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
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
29class WXDLLEXPORT wxBitmapButtonBase : public wxButton
30{
31public:
6463b9f5
JS
32 wxBitmapButtonBase()
33 : m_bmpNormal(), m_bmpSelected(), m_bmpFocus(), m_bmpDisabled()
34 , m_marginX(0), m_marginY(0)
35 { }
1e6feb95
VZ
36
37 // set the bitmaps
38 void SetBitmapLabel(const wxBitmap& bitmap)
39 { m_bmpNormal = bitmap; OnSetBitmap(); }
40 void SetBitmapSelected(const wxBitmap& sel)
41 { m_bmpSelected = sel; OnSetBitmap(); };
42 void SetBitmapFocus(const wxBitmap& focus)
43 { m_bmpFocus = focus; OnSetBitmap(); };
44 void SetBitmapDisabled(const wxBitmap& disabled)
45 { m_bmpDisabled = disabled; OnSetBitmap(); };
46 void SetLabel(const wxBitmap& bitmap)
47 { SetBitmapLabel(bitmap); }
48
49 // retrieve the bitmaps
50 const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; }
51 const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; }
52 const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; }
53 const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
54 wxBitmap& GetBitmapLabel() { return m_bmpNormal; }
55 wxBitmap& GetBitmapSelected() { return m_bmpSelected; }
56 wxBitmap& GetBitmapFocus() { return m_bmpFocus; }
57 wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; }
58
59 // set/get the margins around the button
60 virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
61 int GetMarginX() const { return m_marginX; }
62 int GetMarginY() const { return m_marginY; }
63
cc0bffac
RD
64 virtual void ApplyParentThemeBackground(const wxColour& bg)
65 { SetBackgroundColour(bg); }
66
bd507486 67
1e6feb95
VZ
68protected:
69 // function called when any of the bitmaps changes
9f884528 70 virtual void OnSetBitmap() { InvalidateBestSize(); }
1e6feb95
VZ
71
72 // the bitmaps for various states
73 wxBitmap m_bmpNormal,
74 m_bmpSelected,
75 m_bmpFocus,
76 m_bmpDisabled;
77
78 // the margins around the bitmap
79 int m_marginX,
80 m_marginY;
fc7a2a60 81
210a651b
DW
82private:
83 // Prevent Virtual function hiding warnings
84 void SetLabel(const wxString& rsLabel)
fc7a2a60
VZ
85 { wxWindowBase::SetLabel(rsLabel); }
86
87 DECLARE_NO_COPY_CLASS(wxBitmapButtonBase)
1e6feb95
VZ
88};
89
90#if defined(__WXUNIVERSAL__)
91 #include "wx/univ/bmpbuttn.h"
92#elif defined(__WXMSW__)
93 #include "wx/msw/bmpbuttn.h"
2049ba38 94#elif defined(__WXMOTIF__)
1e6feb95 95 #include "wx/motif/bmpbuttn.h"
2049ba38 96#elif defined(__WXGTK__)
1e6feb95 97 #include "wx/gtk/bmpbuttn.h"
34138703 98#elif defined(__WXMAC__)
1e6feb95 99 #include "wx/mac/bmpbuttn.h"
e64df9bc
DE
100#elif defined(__WXCOCOA__)
101 #include "wx/cocoa/bmpbuttn.h"
1777b9bb 102#elif defined(__WXPM__)
1e6feb95 103 #include "wx/os2/bmpbuttn.h"
c801d85f
KB
104#endif
105
1e6feb95
VZ
106#endif // wxUSE_BMPBUTTON
107
108#endif // _WX_BMPBUTTON_H_BASE_