]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbmp.cpp
Attempt to add primary selection support, but doesn't work.
[wxWidgets.git] / src / gtk1 / statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbmp.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifdef __GNUG__
11 #pragma implementation "statbmp.h"
12 #endif
13
14 #include "wx/statbmp.h"
15
16 #include "gdk/gdk.h"
17 #include "gtk/gtk.h"
18
19 //-----------------------------------------------------------------------------
20 // wxStaticBitmap
21 //-----------------------------------------------------------------------------
22
23 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
24
25 wxStaticBitmap::wxStaticBitmap(void)
26 {
27 }
28
29 wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
30 const wxPoint &pos, const wxSize &size,
31 long style, const wxString &name )
32 {
33 Create( parent, id, bitmap, pos, size, style, name );
34 }
35
36 bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
37 const wxPoint &pos, const wxSize &size,
38 long style, const wxString &name )
39 {
40 m_needParent = TRUE;
41
42 wxSize newSize = size;
43
44 PreCreation( parent, id, pos, size, style, name );
45
46 m_bitmap = bitmap;
47
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 );
53
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 }
62
63 m_parent->DoAddChild( this );
64
65 PostCreation();
66
67 Show( TRUE );
68
69 return TRUE;
70 }
71
72 void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
73 {
74 m_bitmap = bitmap;
75
76 if (m_bitmap.Ok())
77 {
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 );
81 }
82 }