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