]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/bmpbuttn.h
Small changes
[wxWidgets.git] / include / wx / os2 / bmpbuttn.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: bmpbuttn.h
3// Purpose: wxBitmapButton class
37f214d5 4// Author: David Webster
0e320a79 5// Modified by:
37f214d5 6// Created: 10/13/99
0e320a79 7// RCS-ID: $Id$
37f214d5
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_BMPBUTTN_H_
13#define _WX_BMPBUTTN_H_
14
0e320a79
DW
15#include "wx/button.h"
16
17WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
18
19#define wxDEFAULT_BUTTON_MARGIN 4
20
21class WXDLLEXPORT wxBitmapButton: public wxButton
22{
23 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
24 public:
25 inline wxBitmapButton() { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; }
26 inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
29 const wxValidator& validator = wxDefaultValidator,
30 const wxString& name = wxButtonNameStr)
31 {
32 Create(parent, id, bitmap, pos, size, style, validator, name);
33 }
34
35 bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
38 const wxValidator& validator = wxDefaultValidator,
39 const wxString& name = wxButtonNameStr);
40
41 virtual void SetLabel(const wxBitmap& bitmap)
42 {
43 SetBitmapLabel(bitmap);
44 }
45
46 virtual void SetBitmapLabel(const wxBitmap& bitmap);
47
37f214d5
DW
48#if WXWIN_COMPATIBILITY
49 wxBitmap *GetBitmap() const { return (wxBitmap *) & m_buttonBitmap; }
50#endif
51
0e320a79
DW
52 inline wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }
53 inline wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_buttonBitmapSelected; }
54 inline wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
55 inline wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
56
57 inline void SetBitmapSelected(const wxBitmap& sel) { m_buttonBitmapSelected = sel; };
58 inline void SetBitmapFocus(const wxBitmap& focus) { m_buttonBitmapFocus = focus; };
59 inline void SetBitmapDisabled(const wxBitmap& disabled) { m_buttonBitmapDisabled = disabled; };
60
61 inline void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
62 inline int GetMarginX() { return m_marginX; }
63 inline int GetMarginY() { return m_marginY; }
64
37f214d5
DW
65 virtual void SetDefault();
66// virtual bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
0e320a79
DW
67 virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
68 virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
69 virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
0e320a79
DW
70
71 protected:
72 wxBitmap m_buttonBitmap;
73 wxBitmap m_buttonBitmapSelected;
74 wxBitmap m_buttonBitmapFocus;
75 wxBitmap m_buttonBitmapDisabled;
76 int m_marginX;
77 int m_marginY;
78private:
54da4255
DW
79 virtual void SetLabel(const wxString& string)
80 { wxButton::SetLabel(string); };
0e320a79
DW
81};
82
83#endif
84 // _WX_BMPBUTTN_H_