]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "statbmp.h"
14 #include "wx/statbmp.h"
16 //-----------------------------------------------------------------------------
18 //-----------------------------------------------------------------------------
20 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
,wxControl
)
22 wxStaticBitmap::wxStaticBitmap(void)
26 wxStaticBitmap::wxStaticBitmap( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
27 const wxPoint
&pos
, const wxSize
&size
,
28 long style
, const wxString
&name
)
30 Create( parent
, id
, bitmap
, pos
, size
, style
, name
);
33 bool wxStaticBitmap::Create( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
34 const wxPoint
&pos
, const wxSize
&size
,
35 long style
, const wxString
&name
)
39 wxSize newSize
= size
;
41 PreCreation( parent
, id
, pos
, size
, style
, name
);
47 GdkBitmap
*mask
= (GdkBitmap
*) NULL
;
48 if (m_bitmap
.GetMask()) mask
= m_bitmap
.GetMask()->GetBitmap();
49 m_widget
= gtk_pixmap_new( m_bitmap
.GetPixmap(), mask
);
51 if (newSize
.x
== -1) newSize
.x
= m_bitmap
.GetWidth();
52 if (newSize
.y
== -1) newSize
.y
= m_bitmap
.GetHeight();
53 SetSize( newSize
.x
, newSize
.y
);
57 m_widget
= gtk_label_new( "Bitmap" );
60 m_parent
->AddChild( this );
62 (m_parent
->m_insertCallback
)( m_parent
, this );
71 void wxStaticBitmap::SetBitmap( const wxBitmap
&bitmap
)
77 GdkBitmap
*mask
= (GdkBitmap
*) NULL
;
78 if (m_bitmap
.GetMask()) mask
= m_bitmap
.GetMask()->GetBitmap();
79 gtk_pixmap_set( GTK_PIXMAP(m_widget
), m_bitmap
.GetPixmap(), mask
);