]> git.saurik.com Git - wxWidgets.git/blob - src/msw/bmpbuttn.cpp
Hack compilation using the latest MinGW release.
[wxWidgets.git] / src / msw / bmpbuttn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/bmpbuttn.cpp
3 // Purpose: wxBitmapButton
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_BMPBUTTON
19
20 #include "wx/bmpbuttn.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/log.h"
24 #include "wx/dcmemory.h"
25 #include "wx/image.h"
26 #endif
27
28 #include "wx/msw/private.h"
29 #include "wx/msw/dc.h" // for wxDCTemp
30
31 #include "wx/msw/uxtheme.h"
32
33 #if wxUSE_UXTHEME
34 // no need to include tmschema.h
35 #ifndef BP_PUSHBUTTON
36 #define BP_PUSHBUTTON 1
37
38 #define PBS_NORMAL 1
39 #define PBS_HOT 2
40 #define PBS_PRESSED 3
41 #define PBS_DISABLED 4
42 #define PBS_DEFAULTED 5
43
44 #define TMT_CONTENTMARGINS 3602
45 #endif
46 #endif // wxUSE_UXTHEME
47
48 #ifndef ODS_NOFOCUSRECT
49 #define ODS_NOFOCUSRECT 0x0200
50 #endif
51
52 // ----------------------------------------------------------------------------
53 // macros
54 // ----------------------------------------------------------------------------
55
56 BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase)
57 EVT_SYS_COLOUR_CHANGED(wxBitmapButton::OnSysColourChanged)
58 END_EVENT_TABLE()
59
60 /*
61 TODO PROPERTIES :
62
63 long "style" , wxBU_AUTODRAW
64 bool "default" , 0
65 bitmap "selected" ,
66 bitmap "focus" ,
67 bitmap "disabled" ,
68 */
69
70 bool wxBitmapButton::Create(wxWindow *parent,
71 wxWindowID id,
72 const wxBitmap& bitmap,
73 const wxPoint& pos,
74 const wxSize& size, long style,
75 const wxValidator& validator,
76 const wxString& name)
77 {
78 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
79 validator, name) )
80 return false;
81
82 if ( bitmap.IsOk() )
83 SetBitmapLabel(bitmap);
84
85 if ( !size.IsFullySpecified() )
86 {
87 // As our bitmap has just changed, our best size has changed as well so
88 // reset the initial size using the new value.
89 SetInitialSize(size);
90 }
91
92 return true;
93 }
94
95 #endif // wxUSE_BMPBUTTON