]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statbmp.cpp
fix for menu separator
[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
1a56f55c
RR
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation "statbmp.h"
12#endif
13
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
23IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
24
25wxStaticBitmap::wxStaticBitmap(void)
26{
58614078 27}
1a56f55c
RR
28
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
RR
35
36bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
37 const wxPoint &pos, const wxSize &size,
debe6624 38 long style, const wxString &name )
1a56f55c 39{
a93109d5 40 m_needParent = TRUE;
1a56f55c 41
a93109d5 42 wxSize newSize = size;
1a56f55c 43
a93109d5 44 PreCreation( parent, id, pos, size, style, name );
1a56f55c 45
a93109d5 46 m_bitmap = bitmap;
1a56f55c 47
a93109d5
RR
48 if (m_bitmap.Ok())
49 {
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 );
1a56f55c 53
a93109d5
RR
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 );
57 }
58 else
59 {
60 m_widget = gtk_label_new( "Bitmap" );
61 }
1a56f55c 62
a93109d5 63 m_parent->AddChild( this );
6ca41e57 64
a93109d5 65 (m_parent->m_insertCallback)( m_parent, this );
6ca41e57 66
a93109d5 67 PostCreation();
1a56f55c 68
a93109d5 69 Show( TRUE );
1a56f55c 70
a93109d5 71 return TRUE;
58614078 72}
1a56f55c
RR
73
74void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
75{
a93109d5 76 m_bitmap = bitmap;
1a56f55c 77
a93109d5
RR
78 if (m_bitmap.Ok())
79 {
80 GdkBitmap *mask = (GdkBitmap *) NULL;
81 if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
82 gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
83 }
58614078 84}