]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statbmp.cpp
Commented out call that breaks metal style setting before Create
[wxWidgets.git] / src / gtk / statbmp.cpp
CommitLineData
1a56f55c
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbmp.cpp
3// Purpose:
4// Author: Robert Roebling
a81258be
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
1a56f55c
RR
8/////////////////////////////////////////////////////////////////////////////
9
14f355c2
VS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
1a56f55c 12
dcf924a3
RR
13#if wxUSE_STATBMP
14
1e6feb95
VZ
15#include "wx/statbmp.h"
16
83624f79
RR
17#include "gdk/gdk.h"
18#include "gtk/gtk.h"
19
1a56f55c
RR
20//-----------------------------------------------------------------------------
21// wxStaticBitmap
22//-----------------------------------------------------------------------------
23
24IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
25
26wxStaticBitmap::wxStaticBitmap(void)
27{
58614078 28}
1a56f55c 29
c35414db
VZ
30wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
31 const wxPoint &pos, const wxSize &size,
debe6624 32 long style, const wxString &name )
1a56f55c 33{
a93109d5 34 Create( parent, id, bitmap, pos, size, style, name );
58614078 35}
1a56f55c 36
c35414db 37bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
32d4bfd1
VZ
38 const wxPoint &pos, const wxSize &size,
39 long style, const wxString &name )
1a56f55c 40{
a93109d5 41 m_needParent = TRUE;
c35414db 42
4dcaf11a
RR
43 if (!PreCreation( parent, pos, size ) ||
44 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
45 {
4fab7128
VS
46 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
47 return false;
4dcaf11a 48 }
1a56f55c 49
a93109d5 50 m_bitmap = bitmap;
c35414db 51
4fab7128 52 m_widget = gtk_image_new();
4fab7128
VS
53
54 if (bitmap.Ok())
55 SetBitmap(bitmap);
31528cd3 56
abdeb9e7 57 PostCreation(size);
f03fc89f 58 m_parent->DoAddChild( this );
c35414db 59
4fab7128 60 return true;
58614078 61}
1a56f55c 62
c35414db 63void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
1a56f55c 64{
a93109d5 65 m_bitmap = bitmap;
c35414db 66
a93109d5
RR
67 if (m_bitmap.Ok())
68 {
4fab7128
VS
69 GdkBitmap *mask = (GdkBitmap *) NULL;
70 if (m_bitmap.GetMask())
71 mask = m_bitmap.GetMask()->GetBitmap();
3d257b8d 72
4fab7128 73 if (m_bitmap.HasPixbuf())
32d4bfd1 74 {
4fab7128
VS
75 gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget),
76 m_bitmap.GetPixbuf());
32d4bfd1 77 }
31528cd3 78 else
4fab7128
VS
79 gtk_image_set_from_pixmap(GTK_IMAGE(m_widget),
80 m_bitmap.GetPixmap(), mask);
31528cd3 81
9f884528
RD
82 InvalidateBestSize();
83 SetSize(GetBestSize());
a93109d5 84 }
58614078 85}
dcf924a3 86
9d522606
RD
87// static
88wxVisualAttributes
89wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
90{
91 // TODO: overload to allow using gtk_pixmap_new?
92 return GetDefaultAttributesFromGTKWidget(gtk_label_new);
93}
94
1e6feb95 95#endif // wxUSE_STATBMP
f68586e5 96