]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statbmp.cpp
revert nested event loop support for wxGTK1 because it causes applications hangs
[wxWidgets.git] / src / gtk / statbmp.cpp
CommitLineData
1a56f55c 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/gtk/statbmp.cpp
1a56f55c
RR
3// Purpose:
4// Author: Robert Roebling
a81258be 5// Copyright: (c) 1998 Robert Roebling
65571936 6// Licence: wxWindows licence
1a56f55c
RR
7/////////////////////////////////////////////////////////////////////////////
8
14f355c2
VS
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
1a56f55c 11
dcf924a3
RR
12#if wxUSE_STATBMP
13
1e6feb95
VZ
14#include "wx/statbmp.h"
15
4a4a02ac 16#include <gtk/gtk.h>
83624f79 17
1a56f55c
RR
18//-----------------------------------------------------------------------------
19// wxStaticBitmap
20//-----------------------------------------------------------------------------
21
1a56f55c
RR
22wxStaticBitmap::wxStaticBitmap(void)
23{
58614078 24}
1a56f55c 25
c35414db
VZ
26wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
27 const wxPoint &pos, const wxSize &size,
debe6624 28 long style, const wxString &name )
1a56f55c 29{
a93109d5 30 Create( parent, id, bitmap, pos, size, style, name );
58614078 31}
1a56f55c 32
c35414db 33bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
32d4bfd1
VZ
34 const wxPoint &pos, const wxSize &size,
35 long style, const wxString &name )
1a56f55c 36{
4dcaf11a
RR
37 if (!PreCreation( parent, pos, size ) ||
38 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
39 {
4fab7128
VS
40 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
41 return false;
4dcaf11a 42 }
1a56f55c 43
a93109d5 44 m_bitmap = bitmap;
c35414db 45
4fab7128 46 m_widget = gtk_image_new();
9ff9d30c 47 g_object_ref(m_widget);
4fab7128 48
a1b806b9 49 if (bitmap.IsOk())
4fab7128 50 SetBitmap(bitmap);
31528cd3 51
abdeb9e7 52 PostCreation(size);
f03fc89f 53 m_parent->DoAddChild( this );
c35414db 54
4fab7128 55 return true;
58614078 56}
1a56f55c 57
c35414db 58void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
1a56f55c 59{
a93109d5 60 m_bitmap = bitmap;
c35414db 61
a1b806b9 62 if (m_bitmap.IsOk())
a93109d5 63 {
4a4a02ac
PC
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());
31528cd3 67
9f884528
RD
68 InvalidateBestSize();
69 SetSize(GetBestSize());
a93109d5 70 }
58614078 71}
dcf924a3 72
9d522606
RD
73// static
74wxVisualAttributes
75wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
76{
7fff16b8 77 return GetDefaultAttributesFromGTKWidget(gtk_image_new());
9d522606
RD
78}
79
1e6feb95 80#endif // wxUSE_STATBMP
f68586e5 81