]>
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(
40 , const wxGDIImage
& rBitmap
44 , const wxString
& rName
50 if (pParent
) parent
->AddChild(this);
52 m_backgroundColour
= parent
->GetBackgroundColour() ;
53 m_foregroundColour
= parent
->GetForegroundColour() ;
56 m_windowId
= (int)NewControlId();
60 m_windowStyle
= lStyle
;
67 m_windowStyle
= lStyle
;
69 m_bIsIcon
= rBitmap
.IsKindOf(CLASSINFO(wxIcon
));
71 // TODO: create static bitmap control
72 const wxChar
* zClassname
= wxT("WX_STATIC");
73 int nWinstyle
? SS_ICON
: SS_BITMAP
;
75 m_hWnd
= (WXWHND
)::WinCreateWindow( pParent
->GetHWND()
78 ,nWinstyle
| WS_VISIBLE
87 wxCHECK_MSG( m_hWnd
, FALSE
, wxT("Failed to create static bitmap") );
91 // Subclass again for purposes of dialog editing mode
93 SetFont(GetParent()->GetFont());
94 SetSize(nX
, nY
, nWidth
, nHeight
);
98 bool wxStaticBitmap::ImageIsOk() const
100 return(m_pImage
** m_pImage
->Ok());
103 void wxStaticBitmap::Free()
109 wxSize
wxStaticBitmap::DoGetBestSize() const
111 // reuse the current size (as wxWindow does) instead of using some
112 // arbitrary default size (as wxControl, our immediate base class, does)
113 return wxWindow::DoGetBestSize();
116 void wxStaticBitmap::SetImage(
117 const wxGDIImage
& rBitmap
122 m_bIsIcon
= rBitmap
.IsKindOf(CLASSINFO(wxIcon
));
124 m_pImage
= new wxIcon((const wxIcon
&)rBitmap
);
126 m_pImage
= new wxBitmap((const wxBitmap
&)rBitmap
);
133 GetPosition(&nX
, &nY
);
136 ::WinSendMsg( GetHwnd()
138 ,MPFROMHWND(m_pImage
->GetHandle())
143 int nWidth
= rBitmap
.GetWidth();
144 int nHeight
= rBitmap
.GetHeight();
146 if (nWidth
&& nHeight
)
151 ::WinSetWindowPos( GetHwnd()
157 ,SWP_SIZE
| SWP_MOVE
| SWP_SHOW
166 vRect
.xRight
= nX
+ nW
;
167 vRect
.yBottom
= nY
+ nH
;
169 ::WinInvalidateRect(GetHwndOf(GetParent()), &vRect
, TRUE
);