-void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
-{
- int currentX, currentY;
- GetPosition(¤tX, ¤tY);
- int x1 = x;
- int y1 = y;
+ SetName(name);
+ if (parent)
+ parent->AddChild(this);
+
+ m_backgroundColour = parent->GetBackgroundColour() ;
+ m_foregroundColour = parent->GetForegroundColour() ;
+
+ if ( id == -1 )
+ m_windowId = (int)NewControlId();
+ else
+ m_windowId = id;
+
+ int x = pos.x;
+ int y = pos.y;
+ int width = size.x;
+ int height = size.y;
+
+ m_windowStyle = style;
+
+ // we may have either bitmap or icon: if a bitmap with mask is passed, we
+ // will transform it to an icon ourselves because otherwise the mask will
+ // be ignored by Windows
+ wxIcon *icon = (wxIcon *)NULL;
+ m_isIcon = bitmap.IsKindOf(CLASSINFO(wxIcon));
+
+#ifdef __WIN16__
+ wxASSERT_MSG( !m_isIcon, "Icons are not supported in wxStaticBitmap under WIN16." );
+#endif
+
+#ifndef __WIN16__
+ if ( !m_isIcon )
+ {
+ const wxBitmap& bmp = (const wxBitmap&)bitmap;
+ wxMask *mask = bmp.GetMask();
+ if ( mask && mask->GetMaskBitmap() )
+ {
+ icon = new wxIcon;
+ icon->CopyFromBitmap(bmp);
+
+ m_isIcon = TRUE;
+ }
+ }
+#endif
+
+#ifdef __WIN32__
+ // create a static control with either SS_BITMAP or SS_ICON style depending
+ // on what we have here
+ const wxChar *classname = wxT("STATIC");
+ int winstyle = m_isIcon ? SS_ICON : SS_BITMAP;
+#else // Win16
+ const wxChar *classname = wxT("BUTTON");
+ int winstyle = BS_OWNERDRAW;
+#endif // Win32
+
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ winstyle |= WS_CLIPSIBLINGS;
+
+
+ m_hWnd = (WXHWND)::CreateWindow
+ (
+ classname,
+ wxT(""),
+ // NOT DISABLED!!! We want to move it in Dialog Editor.
+ winstyle | WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */ , // | WS_DISABLED,
+ 0, 0, 0, 0,
+ (HWND)parent->GetHWND(),
+ (HMENU)m_windowId,
+ wxGetInstance(),
+ NULL
+ );