]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/statbmp.cpp
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 // For compilers that support precompilation, includes "wx.h".
10 #include "wx/wxprec.h"
14 #include "wx/statbmp.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 wxStaticBitmap::wxStaticBitmap(void)
26 wxStaticBitmap::wxStaticBitmap( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
27 const wxPoint
&pos
, const wxSize
&size
,
28 long style
, const wxString
&name
)
30 Create( parent
, id
, bitmap
, pos
, size
, style
, name
);
33 bool wxStaticBitmap::Create( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
34 const wxPoint
&pos
, const wxSize
&size
,
35 long style
, const wxString
&name
)
37 if (!PreCreation( parent
, pos
, size
) ||
38 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
40 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
46 m_widget
= gtk_image_new();
47 g_object_ref(m_widget
);
53 m_parent
->DoAddChild( this );
58 void wxStaticBitmap::SetBitmap( const wxBitmap
&bitmap
)
64 // always use pixbuf, because pixmap mask does not
65 // work with disabled images in some themes
66 gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget
), m_bitmap
.GetPixbuf());
69 SetSize(GetBestSize());
75 wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
77 return GetDefaultAttributesFromGTKWidget(gtk_image_new());
80 #endif // wxUSE_STATBMP