]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/bmpbuttn.h
Adding MSVC makefile support for building the TIFF library
[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 8// Copyright: (c) Julian Smart
1e7215e6 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"
1e7215e6 20#include "wx/bitmap.h"
2bda0e17 21
32c1cda2 22WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
2bda0e17
KB
23
24#define wxDEFAULT_BUTTON_MARGIN 4
25
26class WXDLLEXPORT wxBitmapButton: public wxButton
27{
0655ad29
VZ
28 DECLARE_DYNAMIC_CLASS(wxBitmapButton)
29
30public:
31 wxBitmapButton() { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; }
32 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
52 virtual void SetBitmapLabel(const wxBitmap& bitmap);
2bda0e17
KB
53
54#if WXWIN_COMPATIBILITY
0655ad29 55 wxBitmap *GetBitmap() const { return (wxBitmap *) & m_buttonBitmap; }
2bda0e17
KB
56#endif
57
0655ad29
VZ
58 wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }
59 wxBitmap& GetBitmapSelected() const { return (wxBitmap&) m_buttonBitmapSelected; }
60 wxBitmap& GetBitmapFocus() const { return (wxBitmap&) m_buttonBitmapFocus; }
61 wxBitmap& GetBitmapDisabled() const { return (wxBitmap&) m_buttonBitmapDisabled; }
62
63 void SetBitmapSelected(const wxBitmap& sel) { m_buttonBitmapSelected = sel; };
64 void SetBitmapFocus(const wxBitmap& focus) { m_buttonBitmapFocus = focus; };
65 void SetBitmapDisabled(const wxBitmap& disabled) { m_buttonBitmapDisabled = disabled; };
66
67 void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
68 int GetMarginX() const { return m_marginX; }
69 int GetMarginY() const { return m_marginY; }
70
71 // Implementation
72 virtual void SetDefault();
73 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
74 virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
75 virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
76 virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
77
78protected:
79 wxBitmap m_buttonBitmap;
80 wxBitmap m_buttonBitmapSelected;
81 wxBitmap m_buttonBitmapFocus;
82 wxBitmap m_buttonBitmapDisabled;
83 int m_marginX;
84 int m_marginY;
2bda0e17
KB
85};
86
87#endif
bbcdf8bc 88 // _WX_BMPBUTTN_H_