]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/bmpbuttn.cpp
defer creating bitmap representation until it is needed
[wxWidgets.git] / src / gtk / bmpbuttn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/bmpbuttn.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #if wxUSE_BMPBUTTON
14
15 #include "wx/bmpbuttn.h"
16
17 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxButton)
18
19 bool wxBitmapButton::Create(wxWindow *parent,
20 wxWindowID id,
21 const wxBitmap& bitmap,
22 const wxPoint& pos,
23 const wxSize& size,
24 long style,
25 const wxValidator& validator,
26 const wxString& name)
27 {
28 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
29 validator, name) )
30 return false;
31
32 if ( bitmap.IsOk() )
33 {
34 SetBitmapLabel(bitmap);
35
36 // we need to adjust the size after setting the bitmap as it may be too
37 // big for the default button size
38 SetInitialSize(size);
39 }
40
41 return true;
42 }
43 #endif // wxUSE_BMPBUTTON