]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/bmpbuttn.h
Added support for extra bitmap for toggled tool.
[wxWidgets.git] / include / wx / motif / bmpbuttn.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: bmpbuttn.h
3// Purpose: wxBitmapButton class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_BMPBUTTN_H_
13#define _WX_BMPBUTTN_H_
14
15#ifdef __GNUG__
16#pragma interface "bmpbuttn.h"
17#endif
18
19#include "wx/button.h"
20
21WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
22
23#define wxDEFAULT_BUTTON_MARGIN 4
24
25class WXDLLEXPORT wxBitmapButton: public wxButton
26{
27 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
28 public:
a4294b78
JS
29 wxBitmapButton();
30 ~wxBitmapButton();
9b6dbb09
JS
31 inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
32 const wxPoint& pos = wxDefaultPosition,
33 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
34 const wxValidator& validator = wxDefaultValidator,
35 const wxString& name = wxButtonNameStr)
36 {
37 Create(parent, id, bitmap, pos, size, style, validator, name);
38 }
39
40 bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxButtonNameStr);
45
46 virtual void SetLabel(const wxBitmap& bitmap)
47 {
48 SetBitmapLabel(bitmap);
49 }
c330a2cf
JS
50 virtual void SetLabel(const wxString& label)
51 {
52 wxControl::SetLabel(label);
53 }
9b6dbb09
JS
54
55 virtual void SetBitmapLabel(const wxBitmap& bitmap);
56
57 inline wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }
58 inline wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_buttonBitmapSelected; }
59 inline wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
60 inline wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
61
a4294b78
JS
62 void SetBitmapSelected(const wxBitmap& sel);
63 void SetBitmapFocus(const wxBitmap& focus);
64 void SetBitmapDisabled(const wxBitmap& disabled);
9b6dbb09
JS
65
66 inline void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
67 inline int GetMarginX() { return m_marginX; }
68 inline int GetMarginY() { return m_marginY; }
69
321db4b6
JS
70// Implementation
71 void DoSetBitmap();
72 virtual void ChangeBackgroundColour();
73
9b6dbb09 74 protected:
321db4b6 75 wxBitmap m_buttonBitmapFocus;
9b6dbb09 76 wxBitmap m_buttonBitmap;
321db4b6
JS
77 wxBitmap m_buttonBitmapOriginal; // May be different from m_buttonBitmap
78 // if m_buttonBitmap has been changed
79 // to reflect button background colour
9b6dbb09 80 wxBitmap m_buttonBitmapSelected;
321db4b6
JS
81 wxBitmap m_buttonBitmapSelectedOriginal;
82
9b6dbb09 83 wxBitmap m_buttonBitmapDisabled;
321db4b6 84 wxBitmap m_buttonBitmapDisabledOriginal;
a4294b78 85
9b6dbb09
JS
86 int m_marginX;
87 int m_marginY;
a4294b78
JS
88
89 WXPixmap m_insensPixmap;
9b6dbb09
JS
90};
91
92#endif
93 // _WX_BMPBUTTN_H_