]> git.saurik.com Git - wxWidgets.git/blob - src/qt/bmpbuttn.cpp
fixed (rare but fatal) bug in wxWindowDisabler
[wxWidgets.git] / src / qt / bmpbuttn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: bmpbuttn.cpp
3 // Purpose: wxBitmapButton
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "bmpbuttn.h"
14 #endif
15
16 #include "wx/bmpbuttn.h"
17
18 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
19
20 bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
21 const wxPoint& pos,
22 const wxSize& size, long style,
23 const wxValidator& validator,
24 const wxString& name)
25 {
26 m_buttonBitmap = bitmap;
27 SetName(name);
28 SetValidator(validator);
29 parent->AddChild(this);
30
31 m_backgroundColour = parent->GetDefaultBackgroundColour() ;
32 m_foregroundColour = parent->GetDefaultForegroundColour() ;
33 m_windowStyle = style;
34 m_marginX = 0;
35 m_marginY = 0;
36
37 int x = pos.x;
38 int y = pos.y;
39 int width = size.x;
40 int height = size.y;
41
42 if (id == -1)
43 m_windowId = NewControlId();
44 else
45 m_windowId = id;
46
47 if ( width == -1 && bitmap.Ok())
48 width = bitmap.GetWidth() + 2*m_marginX;
49
50 if ( height == -1 && bitmap.Ok())
51 height = bitmap.GetHeight() + 2*m_marginY;
52
53 /* TODO: create bitmap button
54 */
55
56 return FALSE;
57 }
58
59 void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
60 {
61 m_buttonBitmap = bitmap;
62 }
63