]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/statbmp.cpp
ff7fc98b4f1a921331433b32b77144d58bc660b2
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"
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
,wxControl
)
25 wxStaticBitmap::wxStaticBitmap(void)
29 wxStaticBitmap::wxStaticBitmap( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
30 const wxPoint
&pos
, const wxSize
&size
,
31 long style
, const wxString
&name
)
33 Create( parent
, id
, bitmap
, pos
, size
, style
, name
);
36 bool wxStaticBitmap::Create( wxWindow
*parent
, wxWindowID id
, const wxBitmap
&bitmap
,
37 const wxPoint
&pos
, const wxSize
&size
,
38 long style
, const wxString
&name
)
42 wxSize newSize
= size
;
44 PreCreation( parent
, id
, pos
, size
, style
, name
);
50 GdkBitmap
*mask
= (GdkBitmap
*) NULL
;
51 if (m_bitmap
.GetMask()) mask
= m_bitmap
.GetMask()->GetBitmap();
52 m_widget
= gtk_pixmap_new( m_bitmap
.GetPixmap(), mask
);
54 if (newSize
.x
== -1) newSize
.x
= m_bitmap
.GetWidth();
55 if (newSize
.y
== -1) newSize
.y
= m_bitmap
.GetHeight();
56 SetSize( newSize
.x
, newSize
.y
);
60 m_widget
= gtk_label_new( "Bitmap" );
63 m_parent
->DoAddChild( this );
72 void wxStaticBitmap::SetBitmap( const wxBitmap
&bitmap
)
78 GdkBitmap
*mask
= (GdkBitmap
*) NULL
;
79 if (m_bitmap
.GetMask()) mask
= m_bitmap
.GetMask()->GetBitmap();
80 gtk_pixmap_set( GTK_PIXMAP(m_widget
), m_bitmap
.GetPixmap(), mask
);