]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/bmpbuttn.h
Watcom C++ mods
[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
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:
29 inline wxBitmapButton(void) { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; }
debe6624 30 inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
2bda0e17 31 const wxPoint& pos = wxDefaultPosition,
debe6624 32 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
2bda0e17
KB
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxButtonNameStr)
35 {
36 Create(parent, id, bitmap, pos, size, style, validator, name);
37 }
38
debe6624 39 bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
2bda0e17 40 const wxPoint& pos = wxDefaultPosition,
debe6624 41 const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
2bda0e17
KB
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxButtonNameStr);
44
45 virtual void SetLabel(const wxBitmap& bitmap)
46 {
47 SetBitmapLabel(bitmap);
48 }
49
50 virtual void SetBitmapLabel(const wxBitmap& bitmap);
51
52#if WXWIN_COMPATIBILITY
53 inline wxBitmap *GetBitmap(void) const { return (wxBitmap *) & m_buttonBitmap; }
54#endif
55
56 inline wxBitmap& GetBitmapLabel(void) const { return (wxBitmap&) m_buttonBitmap; }
57 inline wxBitmap& GetBitmapSelected(void) const { return (wxBitmap&) m_buttonBitmapSelected; }
58 inline wxBitmap& GetBitmapFocus(void) const { return (wxBitmap&) m_buttonBitmapFocus; }
59 inline wxBitmap& GetBitmapDisabled(void) const { return (wxBitmap&) m_buttonBitmapDisabled; }
60
61 inline void SetBitmapSelected(const wxBitmap& sel) { m_buttonBitmapSelected = sel; };
62 inline void SetBitmapFocus(const wxBitmap& focus) { m_buttonBitmapFocus = focus; };
63 inline void SetBitmapDisabled(const wxBitmap& disabled) { m_buttonBitmapDisabled = disabled; };
64
65 inline void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
66 inline int GetMarginX(void) { return m_marginX; }
67 inline int GetMarginY(void) { return m_marginY; }
68
69 // Implementation
70 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
71 virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
72 virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
73 virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
74
75 protected:
76 wxBitmap m_buttonBitmap;
77 wxBitmap m_buttonBitmapSelected;
78 wxBitmap m_buttonBitmapFocus;
79 wxBitmap m_buttonBitmapDisabled;
80 int m_marginX;
81 int m_marginY;
82};
83
84#endif
bbcdf8bc 85 // _WX_BMPBUTTN_H_