]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/statbmp.cpp
6d6f82649c4fadc58eeb2b083441e546cb391c64
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"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
,wxControl
)
26 wxStaticBitmap::wxStaticBitmap(void)
30 wxStaticBitmap::wxStaticBitmap( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
31 const wxPoint
&pos
, const wxSize
&size
,
32 long style
, const wxString
&name
)
34 Create( parent
, id
, bitmap
, pos
, size
, style
, name
);
37 bool wxStaticBitmap::Create( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
38 const wxPoint
&pos
, const wxSize
&size
,
39 long style
, const wxString
&name
)
41 if (!PreCreation( parent
, pos
, size
) ||
42 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
44 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
50 m_widget
= gtk_image_new();
56 m_parent
->DoAddChild( this );
61 void wxStaticBitmap::SetBitmap( const wxBitmap
&bitmap
)
67 GdkBitmap
*mask
= (GdkBitmap
*) NULL
;
68 if (m_bitmap
.GetMask())
69 mask
= m_bitmap
.GetMask()->GetBitmap();
71 if (m_bitmap
.HasPixbuf())
73 gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget
),
74 m_bitmap
.GetPixbuf());
77 gtk_image_set_from_pixmap(GTK_IMAGE(m_widget
),
78 m_bitmap
.GetPixmap(), mask
);
81 SetSize(GetBestSize());
87 wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
89 // TODO: overload to allow using gtk_pixmap_new?
90 return GetDefaultAttributesFromGTKWidget(gtk_label_new
);
93 #endif // wxUSE_STATBMP