]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/statbmp.cpp
Deallocate wxThreadSpecificInfo when wxThread ends.
[wxWidgets.git] / src / gtk1 / statbmp.cpp
CommitLineData
1a56f55c 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/gtk1/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
83624f79
RR
16#include "gdk/gdk.h"
17#include "gtk/gtk.h"
18
1a56f55c
RR
19//-----------------------------------------------------------------------------
20// wxStaticBitmap
21//-----------------------------------------------------------------------------
22
1a56f55c
RR
23wxStaticBitmap::wxStaticBitmap(void)
24{
58614078 25}
1a56f55c 26
c35414db
VZ
27wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
28 const wxPoint &pos, const wxSize &size,
debe6624 29 long style, const wxString &name )
1a56f55c 30{
a93109d5 31 Create( parent, id, bitmap, pos, size, style, name );
58614078 32}
1a56f55c 33
4fab7128
VS
34// empty bitmap, so that we can create GtkPixmap widget:
35static char * bogus_xpm[] = {
36"2 2 1 1",
03647350 37" c None",
4fab7128
VS
38" ",
39" "};
32d4bfd1 40
c35414db 41bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
32d4bfd1
VZ
42 const wxPoint &pos, const wxSize &size,
43 long style, const wxString &name )
1a56f55c 44{
a93109d5 45 m_needParent = TRUE;
c35414db 46
4dcaf11a
RR
47 if (!PreCreation( parent, pos, size ) ||
48 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
49 {
4fab7128
VS
50 wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
51 return false;
4dcaf11a 52 }
1a56f55c 53
a93109d5 54 m_bitmap = bitmap;
c35414db 55
a1b806b9 56 wxBitmap bmp(bitmap.IsOk() ? bitmap : wxBitmap(bogus_xpm));
4fab7128 57 m_widget = gtk_pixmap_new(bmp.GetPixmap(), NULL);
4fab7128 58
a1b806b9 59 if (bitmap.IsOk())
4fab7128 60 SetBitmap(bitmap);
31528cd3 61
abdeb9e7 62 PostCreation(size);
f03fc89f 63 m_parent->DoAddChild( this );
c35414db 64
4fab7128 65 return true;
58614078 66}
1a56f55c 67
c35414db 68void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
1a56f55c 69{
a93109d5 70 m_bitmap = bitmap;
c35414db 71
a1b806b9 72 if (m_bitmap.IsOk())
a93109d5 73 {
d3b9f782 74 GdkBitmap *mask = NULL;
4fab7128
VS
75 if (m_bitmap.GetMask())
76 mask = m_bitmap.GetMask()->GetBitmap();
3d257b8d 77
7e52dfd2 78 gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask);
31528cd3 79
9f884528
RD
80 InvalidateBestSize();
81 SetSize(GetBestSize());
a93109d5 82 }
58614078 83}
dcf924a3 84
9d522606
RD
85// static
86wxVisualAttributes
87wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
88{
89 // TODO: overload to allow using gtk_pixmap_new?
90 return GetDefaultAttributesFromGTKWidget(gtk_label_new);
91}
92
1e6feb95 93#endif // wxUSE_STATBMP
f68586e5 94