]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticBitmap
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 #include "wx/window.h"
16 #include "wx/os2/private.h"
20 #include "wx/statbmp.h"
25 // ---------------------------------------------------------------------------
27 // ---------------------------------------------------------------------------
29 #if !USE_SHARED_LIBRARY
30 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
33 // ---------------------------------------------------------------------------
35 // ---------------------------------------------------------------------------
37 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
38 const wxBitmap
& bitmap
,
47 if (parent
) parent
->AddChild(this);
49 m_backgroundColour
= parent
->GetBackgroundColour() ;
50 m_foregroundColour
= parent
->GetForegroundColour() ;
53 m_windowId
= (int)NewControlId();
57 m_windowStyle
= style
;
64 m_windowStyle
= style
;
66 m_isIcon
= bitmap
.IsKindOf(CLASSINFO(wxIcon
));
68 // TODO: create static bitmap control
69 wxCHECK_MSG( m_hWnd
, FALSE
, wxT("Failed to create static bitmap") );
73 // Subclass again for purposes of dialog editing mode
76 SetFont(GetParent()->GetFont());
78 SetSize(x
, y
, width
, height
);
83 bool wxStaticBitmap::ImageIsOk() const
85 if ( m_isIcon
&& m_image
.icon
)
86 return m_image
.icon
->Ok();
87 else if ( m_image
.bitmap
)
88 return m_image
.bitmap
->Ok();
93 void wxStaticBitmap::Free()
98 delete m_image
.bitmap
;
103 wxSize
wxStaticBitmap::DoGetBestSize()
105 // reuse the current size (as wxWindow does) instead of using some
106 // arbitrary default size (as wxControl, our immediate base class, does)
107 return wxWindow::DoGetBestSize();
110 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
114 m_isIcon
= bitmap
.IsKindOf(CLASSINFO(wxIcon
));
116 m_image
.icon
= new wxIcon((const wxIcon
&)bitmap
);
118 m_image
.bitmap
= new wxBitmap(bitmap
);
125 // TODO: redraw bitmap