]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/bmpbuttn.h
wxMotif::wxFont supports encodings too (and shares 99% of font code with wxGTK)
[wxWidgets.git] / include / wx / msw / bmpbuttn.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: bmpbuttn.h
3// Purpose: wxBitmapButton class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_BMPBUTTN_H_
13#define _WX_BMPBUTTN_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "bmpbuttn.h"
17#endif
18
19#include "wx/button.h"
20
32c1cda2 21WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
2bda0e17
KB
22
23#define wxDEFAULT_BUTTON_MARGIN 4
24
25class WXDLLEXPORT wxBitmapButton: public wxButton
26{
0655ad29
VZ
27 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
28
29public:
30 wxBitmapButton() { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; }
31 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 }
50
51 virtual void SetBitmapLabel(const wxBitmap& bitmap);
2bda0e17
KB
52
53#if WXWIN_COMPATIBILITY
0655ad29 54 wxBitmap *GetBitmap() const { return (wxBitmap *) & m_buttonBitmap; }
2bda0e17
KB
55#endif
56
0655ad29
VZ
57 wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }
58 wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_buttonBitmapSelected; }
59 wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
60 wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
61
62 void SetBitmapSelected(const wxBitmap& sel) { m_buttonBitmapSelected = sel; };
63 void SetBitmapFocus(const wxBitmap& focus) { m_buttonBitmapFocus = focus; };
64 void SetBitmapDisabled(const wxBitmap& disabled) { m_buttonBitmapDisabled = disabled; };
65
66 void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
67 int GetMarginX() const { return m_marginX; }
68 int GetMarginY() const { return m_marginY; }
69
70 // Implementation
71 virtual void SetDefault();
72 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
73 virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
74 virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
75 virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
76
77protected:
78 wxBitmap m_buttonBitmap;
79 wxBitmap m_buttonBitmapSelected;
80 wxBitmap m_buttonBitmapFocus;
81 wxBitmap m_buttonBitmapDisabled;
82 int m_marginX;
83 int m_marginY;
2bda0e17
KB
84};
85
86#endif
bbcdf8bc 87 // _WX_BMPBUTTN_H_