]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statbmp.cpp
don't use deprecated toolbar API
[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
4a4a02ac 17#include <gtk/gtk.h>
83624f79 18
1a56f55c
RR
19//-----------------------------------------------------------------------------
20// wxStaticBitmap
21//-----------------------------------------------------------------------------
22
23IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
24
25wxStaticBitmap::wxStaticBitmap(void)
26{
58614078 27}
1a56f55c 28
c35414db
VZ
29wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
30 const wxPoint &pos, const wxSize &size,
debe6624 31 long style, const wxString &name )
1a56f55c 32{
a93109d5 33 Create( parent, id, bitmap, pos, size, style, name );
58614078 34}
1a56f55c 35
c35414db 36bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
32d4bfd1
VZ
37 const wxPoint &pos, const wxSize &size,
38 long style, const wxString &name )
1a56f55c 39{
4dcaf11a
RR
40 if (!PreCreation( parent, pos, size ) ||
41 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
42 {
4fab7128
VS
43 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
44 return false;
4dcaf11a 45 }
1a56f55c 46
a93109d5 47 m_bitmap = bitmap;
c35414db 48
4fab7128 49 m_widget = gtk_image_new();
4fab7128
VS
50
51 if (bitmap.Ok())
52 SetBitmap(bitmap);
31528cd3 53
abdeb9e7 54 PostCreation(size);
f03fc89f 55 m_parent->DoAddChild( this );
c35414db 56
4fab7128 57 return true;
58614078 58}
1a56f55c 59
c35414db 60void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
1a56f55c 61{
a93109d5 62 m_bitmap = bitmap;
c35414db 63
a93109d5
RR
64 if (m_bitmap.Ok())
65 {
4a4a02ac
PC
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());
31528cd3 69
9f884528
RD
70 InvalidateBestSize();
71 SetSize(GetBestSize());
a93109d5 72 }
58614078 73}
dcf924a3 74
9d522606
RD
75// static
76wxVisualAttributes
77wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
78{
79 // TODO: overload to allow using gtk_pixmap_new?
80 return GetDefaultAttributesFromGTKWidget(gtk_label_new);
81}
82
1e6feb95 83#endif // wxUSE_STATBMP
f68586e5 84