]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
15 #include "wx/statbmp.h"
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
,wxControl
)
25 wxStaticBitmap::wxStaticBitmap(void)
29 wxStaticBitmap::wxStaticBitmap( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
30 const wxPoint
&pos
, const wxSize
&size
,
31 long style
, const wxString
&name
)
33 Create( parent
, id
, bitmap
, pos
, size
, style
, name
);
36 bool wxStaticBitmap::Create( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
37 const wxPoint
&pos
, const wxSize
&size
,
38 long style
, const wxString
&name
)
40 if (!PreCreation( parent
, pos
, size
) ||
41 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
43 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
49 m_widget
= gtk_image_new();
55 m_parent
->DoAddChild( this );
60 void wxStaticBitmap::SetBitmap( const wxBitmap
&bitmap
)
66 // always use pixbuf, because pixmap mask does not
67 // work with disabled images in some themes
68 gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget
), m_bitmap
.GetPixbuf());
71 SetSize(GetBestSize());
77 wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
79 // TODO: overload to allow using gtk_pixmap_new?
80 return GetDefaultAttributesFromGTKWidget(gtk_label_new
);
83 #endif // wxUSE_STATBMP