]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "statbmp.h"
15 #include "wx/statbmp.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
,wxControl
)
23 wxStaticBitmap::wxStaticBitmap(void)
27 wxStaticBitmap::wxStaticBitmap( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
28 const wxPoint
&pos
, const wxSize
&size
,
29 const long style
, const wxString
&name
)
31 Create( parent
, id
, bitmap
, pos
, size
, style
, name
);
34 bool wxStaticBitmap::Create( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
35 const wxPoint
&pos
, const wxSize
&size
,
36 const long style
, const wxString
&name
)
40 wxSize newSize
= size
;
42 PreCreation( parent
, id
, pos
, size
, style
, name
);
48 GdkBitmap
*mask
= NULL
;
49 if (m_bitmap
.GetMask()) mask
= m_bitmap
.GetMask()->GetBitmap();
50 m_widget
= gtk_pixmap_new( m_bitmap
.GetPixmap(), mask
);
52 if (newSize
.x
== -1) newSize
.x
= m_bitmap
.GetWidth();
53 if (newSize
.y
== -1) newSize
.y
= m_bitmap
.GetHeight();
54 SetSize( newSize
.x
, newSize
.y
);
58 m_widget
= gtk_label_new( "Bitmap" );
68 void wxStaticBitmap::SetBitmap( const wxBitmap
&bitmap
)
74 GdkBitmap
*mask
= NULL
;
75 if (m_bitmap
.GetMask()) mask
= m_bitmap
.GetMask()->GetBitmap();
76 gtk_pixmap_set( GTK_PIXMAP(m_widget
), m_bitmap
.GetPixmap(), mask
);