// create the control of the given class with the given style, returns FALSE
// if creation failed
- bool MSWCreateControl(const wxChar *classname, WXDWORD style);
+ //
+ // All parameters except classname and style are optional, if the
+ // size/position are not given, they should be set later with SetSize() and,
+ // label (the title of the window), of course, is left empty. The extended
+ // style is determined from the style and the app 3D settings automatically
+ // if it's not specified explicitly.
+ bool MSWCreateControl(const wxChar *classname,
+ WXDWORD style,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& label = wxEmptyString,
+ WXDWORD exstyle = (WXDWORD)-1);
// determine the extended styles combination for this window (may slightly
// modify style parameter, this is why it's non const)
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBOX_H_
#define _WX_STATBOX_H_
#ifdef __GNUG__
-#pragma interface "statbox.h"
+ #pragma interface "statbox.h"
#endif
#include "wx/control.h"
// implementation from now on
// --------------------------
- void OnEraseBackground(wxEraseEvent& event);
-
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
protected:
virtual wxSize DoGetBestSize();
-
-private:
- DECLARE_EVENT_TABLE()
};
#endif
HBITMAP hbitmap = iconInfo.hbmColor;
- wxBitmap bmpMask(width, height, 1);
- bmpMask.SetHBITMAP((WXHBITMAP)iconInfo.hbmMask);
-
- SetMask(new wxMask(bmpMask));
+ wxMask *mask = new wxMask;
+ mask->SetMaskBitmap((WXHBITMAP)iconInfo.hbmMask);
#endif // Win16/32
m_refData = new wxBitmapRefData;
M_BITMAPDATA->m_hBitmap = (WXHBITMAP)hbitmap;
M_BITMAPDATA->m_ok = TRUE;
+#ifndef __WIN16__
+ SetMask(mask);
+#endif // !Win16
+
return TRUE;
}
{
if (wxTheBitmapList)
wxTheBitmapList->DeleteObject(this);
-
- delete GetMask();
}
bool wxBitmap::FreeResource(bool WXUNUSED(force))
m_isBeingDeleted = TRUE;
}
-bool wxControl::MSWCreateControl(const wxChar *classname, WXDWORD style)
+bool wxControl::MSWCreateControl(const wxChar *classname,
+ WXDWORD style,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxString& label,
+ WXDWORD exstyle)
{
// VZ: if someone could put a comment here explaining what exactly this is
// needed for, it would be nice...
bool want3D;
+ // if no extended style given, determine it ourselves
+ if ( exstyle == (WXDWORD)-1 )
+ {
+ exstyle = GetExStyle(style, &want3D);
+ }
+
// all controls have these childs (wxWindows creates all controls visible
// by default)
style |= WS_CHILD | WS_VISIBLE;
m_hWnd = (WXHWND)::CreateWindowEx
(
- GetExStyle(style, &want3D), // extended style
+ exstyle, // extended style
classname, // the kind of control to create
- NULL, // the window name
+ label, // the window name
style, // the window style
- 0, 0, 0, 0, // the window position and size
+ pos.x, pos.y, // the window position
+ size.x, size.y, // and size
GetHwndOf(GetParent()), // parent
(HMENU)GetId(), // child id
wxGetInstance(), // app instance
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
-
-BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
- EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
-END_EVENT_TABLE()
-
+ IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
#endif
// ============================================================================
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE;
- if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX) )
+ if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX, pos, size, label, 0) )
return FALSE;
- SetSize(pos.x, pos.y, size.x, size.y);
-
return TRUE;
}
return (WXHBRUSH)brush->GetResourceHandle();
}
-void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
-{
- // do nothing - the aim of having this function is to prevent
- // wxControl::OnEraseBackground() to paint over the control inside the
- // static box
-}
-
long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
- if ( nMsg == WM_NCHITTEST)
+ switch ( nMsg )
{
- int xPos = LOWORD(lParam); // horizontal position of cursor
- int yPos = HIWORD(lParam); // vertical position of cursor
-
- ScreenToClient(&xPos, &yPos);
-
- // Make sure you can drag by the top of the groupbox, but let
- // other (enclosed) controls get mouse events also
- if (yPos < 10)
- return (long)HTCLIENT;
+ case WM_NCHITTEST:
+ // FIXME: this hack is specific to dialog ed, shouldn't it be
+ // somehow disabled during normal operation?
+ {
+ int xPos = LOWORD(lParam); // horizontal position of cursor
+ int yPos = HIWORD(lParam); // vertical position of cursor
+
+ ScreenToClient(&xPos, &yPos);
+
+ // Make sure you can drag by the top of the groupbox, but let
+ // other (enclosed) controls get mouse events also
+ if ( yPos < 10 )
+ return (long)HTCLIENT;
+ }
+ break;
+
+ // VZ: I will remove (or change) this soon... (15.11.99)
+#if 0
+ case WM_ERASEBKGND:
+ // prevent wxControl from processing this message because it will
+ // erase the background incorrectly and there is no way for us to
+ // override this at wxWin event level (if we do process the event,
+ // we don't know how to do it properly - paint the background
+ // without painting over other controls - and if we don't,
+ // wxControl still gets it)
+ return MSWDefWindowProc(nMsg, wParam, lParam);
+#endif
}
return wxControl::MSWWindowProc(nMsg, wParam, lParam);