]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/bmpbuttn.h
added wxTextEntry::DoGetValue() to allow returning empty string if the control curren...
[wxWidgets.git] / include / wx / msw / bmpbuttn.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
a30ccc2d 2// Name: wx/msw/bmpbuttn.h
2bda0e17
KB
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
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_BMPBUTTN_H_
13#define _WX_BMPBUTTN_H_
2bda0e17 14
2bda0e17 15#include "wx/button.h"
1e7215e6 16#include "wx/bitmap.h"
a6c255cb 17#include "wx/brush.h"
2bda0e17 18
53a2db12 19class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
2bda0e17 20{
0655ad29 21public:
5f1f21d2 22 wxBitmapButton() { Init(); }
a30ccc2d 23
1e6feb95
VZ
24 wxBitmapButton(wxWindow *parent,
25 wxWindowID id,
26 const wxBitmap& bitmap,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = wxBU_AUTODRAW,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxButtonNameStr)
0655ad29 32 {
5f1f21d2
VZ
33 Init();
34
0655ad29
VZ
35 Create(parent, id, bitmap, pos, size, style, validator, name);
36 }
37
1e6feb95
VZ
38 bool Create(wxWindow *parent,
39 wxWindowID id,
40 const wxBitmap& bitmap,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxBU_AUTODRAW,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxButtonNameStr);
2bda0e17 46
5f1f21d2
VZ
47 // override some base class methods to automatically synthesize the
48 // disabled bitmap if it wasn't set by the user
49 virtual void SetBitmapLabel(const wxBitmap& bitmap);
50 virtual void SetBitmapFocus(const wxBitmap& focus);
51 virtual void SetBitmapDisabled(const wxBitmap& disabled);
52 virtual void SetBitmapHover(const wxBitmap& hover);
53
0655ad29 54 // Implementation
d50dbf7c 55 virtual bool SetBackgroundColour(const wxColour& colour);
0655ad29
VZ
56 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
57 virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel );
58 virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel );
59 virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg );
60
c046274e 61protected:
5f1f21d2
VZ
62 // common part of all ctors
63 void Init()
64 {
65 m_disabledSetByUser =
66 m_hoverSetByUser = false;
67 }
68
7996ff80 69 // reimplement some base class virtuals
c046274e 70 virtual wxSize DoGetBestSize() const;
56c74796
VZ
71 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
72
fcf90ee1 73
a6fd0fde
VZ
74 // invalidate m_brushDisabled when system colours change
75 void OnSysColourChanged(wxSysColourChangedEvent& event);
76
1fdc16ad
VZ
77 // change the currently bitmap if we have a hover one
78 void OnMouseEnterOrLeave(wxMouseEvent& event);
79
a6fd0fde
VZ
80
81 // the brush we use to draw disabled buttons
d50dbf7c
VZ
82 wxBrush m_brushDisabled;
83
5f1f21d2
VZ
84 // true if m_bmpDisabled was set by user, false if we created it ourselves
85 // from m_bmpNormal
86 bool m_disabledSetByUser;
87
88 // true if m_bmpHover was set by user, false if it was set from m_bmpFocus
89 bool m_hoverSetByUser;
90
a6fd0fde
VZ
91
92 DECLARE_EVENT_TABLE()
fc7a2a60 93 DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton)
2bda0e17
KB
94};
95
1fdc16ad 96#endif // _WX_BMPBUTTN_H_