]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/bmpbuttn.h
Implemented wxButton::DoGetBestSize for wxMotif. Now normal buttons
[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"
00dd3b18 20#include "wx/bitmap.h"
9b6dbb09
JS
21
22WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
23
24#define wxDEFAULT_BUTTON_MARGIN 4
25
26class WXDLLEXPORT wxBitmapButton: public wxButton
27{
83df96d6
JS
28 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
29public:
30 wxBitmapButton();
31 ~wxBitmapButton();
32 inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
35 const wxValidator& validator = wxDefaultValidator,
36 const wxString& name = wxButtonNameStr)
37 {
38 Create(parent, id, bitmap, pos, size, style, validator, name);
39 }
40
41 bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxButtonNameStr);
46
47 virtual void SetLabel(const wxBitmap& bitmap)
48 {
49 SetBitmapLabel(bitmap);
50 }
51 virtual void SetLabel(const wxString& label)
52 {
53 wxControl::SetLabel(label);
54 }
55
56 virtual void SetBitmapLabel(const wxBitmap& bitmap);
57
58 inline wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }
59 inline wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_buttonBitmapSelected; }
60 inline wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
61 inline wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
62
63 void SetBitmapSelected(const wxBitmap& sel);
64 void SetBitmapFocus(const wxBitmap& focus);
65 void SetBitmapDisabled(const wxBitmap& disabled);
66
67 inline void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
68 inline int GetMarginX() { return m_marginX; }
69 inline int GetMarginY() { return m_marginY; }
70
71 // Implementation
72 void DoSetBitmap();
73 virtual void ChangeBackgroundColour();
401eb3de 74 virtual wxSize DoGetBestSize() const;
83df96d6
JS
75
76protected:
77 wxBitmap m_buttonBitmapFocus;
78 wxBitmap m_buttonBitmap;
79 wxBitmap m_buttonBitmapOriginal; // May be different from m_buttonBitmap
80 // if m_buttonBitmap has been changed
81 // to reflect button background colour
82 wxBitmap m_buttonBitmapSelected;
83 wxBitmap m_buttonBitmapSelectedOriginal;
84
85 wxBitmap m_buttonBitmapDisabled;
86 wxBitmap m_buttonBitmapDisabledOriginal;
87
88 int m_marginX;
89 int m_marginY;
90
91 WXPixmap m_insensPixmap;
9b6dbb09
JS
92};
93
94#endif
83df96d6 95// _WX_BMPBUTTN_H_