]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbmp.cpp
Added wxAcceleratorTable, wxFrame::SetAcceleratorTable and additions to process it...
[wxWidgets.git] / src / gtk1 / statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbmp.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "statbmp.h"
13 #endif
14
15 #include "wx/statbmp.h"
16
17 //-----------------------------------------------------------------------------
18 // wxStaticBitmap
19 //-----------------------------------------------------------------------------
20
21 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
22
23 wxStaticBitmap::wxStaticBitmap(void)
24 {
25 };
26
27 wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
28 const wxPoint &pos, const wxSize &size,
29 long style, const wxString &name )
30 {
31 Create( parent, id, bitmap, pos, size, style, name );
32 };
33
34 bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
35 const wxPoint &pos, const wxSize &size,
36 long style, const wxString &name )
37 {
38 m_needParent = TRUE;
39
40 wxSize newSize = size;
41
42 PreCreation( parent, id, pos, size, style, name );
43
44 m_bitmap = bitmap;
45
46 if (m_bitmap.Ok())
47 {
48 GdkBitmap *mask = NULL;
49 if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
50 m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
51
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 );
55 }
56 else
57 {
58 m_widget = gtk_label_new( "Bitmap" );
59 }
60
61 PostCreation();
62
63 Show( TRUE );
64
65 return TRUE;
66 };
67
68 void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
69 {
70 m_bitmap = bitmap;
71
72 if (m_bitmap.Ok())
73 {
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 );
77 }
78 };
79