1. fixed wxStaticBox background erasing (or, rather, restored the old bug)
2. fixed the mask code in wxBitmap(const wxIcon&) - now it really works (Win32) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -73,7 +73,18 @@ protected:
|
|||||||
|
|
||||||
// create the control of the given class with the given style, returns FALSE
|
// create the control of the given class with the given style, returns FALSE
|
||||||
// if creation failed
|
// 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
|
// determine the extended styles combination for this window (may slightly
|
||||||
// modify style parameter, this is why it's non const)
|
// modify style parameter, this is why it's non const)
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#define _WX_STATBOX_H_
|
#define _WX_STATBOX_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "statbox.h"
|
#pragma interface "statbox.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
@@ -48,8 +48,6 @@ public:
|
|||||||
// implementation from now on
|
// implementation from now on
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
|
||||||
|
|
||||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
@@ -60,9 +58,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize();
|
||||||
|
|
||||||
private:
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -140,10 +140,8 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon)
|
|||||||
|
|
||||||
HBITMAP hbitmap = iconInfo.hbmColor;
|
HBITMAP hbitmap = iconInfo.hbmColor;
|
||||||
|
|
||||||
wxBitmap bmpMask(width, height, 1);
|
wxMask *mask = new wxMask;
|
||||||
bmpMask.SetHBITMAP((WXHBITMAP)iconInfo.hbmMask);
|
mask->SetMaskBitmap((WXHBITMAP)iconInfo.hbmMask);
|
||||||
|
|
||||||
SetMask(new wxMask(bmpMask));
|
|
||||||
#endif // Win16/32
|
#endif // Win16/32
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
@@ -155,6 +153,10 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon)
|
|||||||
M_BITMAPDATA->m_hBitmap = (WXHBITMAP)hbitmap;
|
M_BITMAPDATA->m_hBitmap = (WXHBITMAP)hbitmap;
|
||||||
M_BITMAPDATA->m_ok = TRUE;
|
M_BITMAPDATA->m_ok = TRUE;
|
||||||
|
|
||||||
|
#ifndef __WIN16__
|
||||||
|
SetMask(mask);
|
||||||
|
#endif // !Win16
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +164,6 @@ wxBitmap::~wxBitmap()
|
|||||||
{
|
{
|
||||||
if (wxTheBitmapList)
|
if (wxTheBitmapList)
|
||||||
wxTheBitmapList->DeleteObject(this);
|
wxTheBitmapList->DeleteObject(this);
|
||||||
|
|
||||||
delete GetMask();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::FreeResource(bool WXUNUSED(force))
|
bool wxBitmap::FreeResource(bool WXUNUSED(force))
|
||||||
|
@@ -58,23 +58,35 @@ wxControl::~wxControl()
|
|||||||
m_isBeingDeleted = TRUE;
|
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
|
// VZ: if someone could put a comment here explaining what exactly this is
|
||||||
// needed for, it would be nice...
|
// needed for, it would be nice...
|
||||||
bool want3D;
|
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
|
// all controls have these childs (wxWindows creates all controls visible
|
||||||
// by default)
|
// by default)
|
||||||
style |= WS_CHILD | WS_VISIBLE;
|
style |= WS_CHILD | WS_VISIBLE;
|
||||||
|
|
||||||
m_hWnd = (WXHWND)::CreateWindowEx
|
m_hWnd = (WXHWND)::CreateWindowEx
|
||||||
(
|
(
|
||||||
GetExStyle(style, &want3D), // extended style
|
exstyle, // extended style
|
||||||
classname, // the kind of control to create
|
classname, // the kind of control to create
|
||||||
NULL, // the window name
|
label, // the window name
|
||||||
style, // the window style
|
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
|
GetHwndOf(GetParent()), // parent
|
||||||
(HMENU)GetId(), // child id
|
(HMENU)GetId(), // child id
|
||||||
wxGetInstance(), // app instance
|
wxGetInstance(), // app instance
|
||||||
|
@@ -42,12 +42,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
|
||||||
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -69,11 +64,9 @@ bool wxStaticBox::Create(wxWindow *parent,
|
|||||||
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
|
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX) )
|
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX, pos, size, label, 0) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
SetSize(pos.x, pos.y, size.x, size.y);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,16 +112,13 @@ WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|||||||
return (WXHBRUSH)brush->GetResourceHandle();
|
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)
|
long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
if ( nMsg == WM_NCHITTEST)
|
switch ( nMsg )
|
||||||
|
{
|
||||||
|
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 xPos = LOWORD(lParam); // horizontal position of cursor
|
||||||
int yPos = HIWORD(lParam); // vertical position of cursor
|
int yPos = HIWORD(lParam); // vertical position of cursor
|
||||||
@@ -137,9 +127,23 @@ long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
|
|
||||||
// Make sure you can drag by the top of the groupbox, but let
|
// Make sure you can drag by the top of the groupbox, but let
|
||||||
// other (enclosed) controls get mouse events also
|
// other (enclosed) controls get mouse events also
|
||||||
if (yPos < 10)
|
if ( yPos < 10 )
|
||||||
return (long)HTCLIENT;
|
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);
|
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user