update the real window flags when extended flags change and not only the normal ones
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -84,7 +84,8 @@ public:
|
|||||||
virtual void Freeze();
|
virtual void Freeze();
|
||||||
virtual void Thaw();
|
virtual void Thaw();
|
||||||
|
|
||||||
virtual void SetWindowStyleFlag( long style );
|
virtual void SetWindowStyleFlag(long style);
|
||||||
|
virtual void SetExtraStyle(long exStyle);
|
||||||
virtual bool SetCursor( const wxCursor &cursor );
|
virtual bool SetCursor( const wxCursor &cursor );
|
||||||
virtual bool SetFont( const wxFont &font );
|
virtual bool SetFont( const wxFont &font );
|
||||||
|
|
||||||
@@ -206,6 +207,11 @@ public:
|
|||||||
WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const
|
WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const
|
||||||
{ return MSWGetStyle(GetWindowStyle(), exflags); }
|
{ return MSWGetStyle(GetWindowStyle(), exflags); }
|
||||||
|
|
||||||
|
// update the real underlying window style flags to correspond to the
|
||||||
|
// current wxWindow object style (safe to call even if window isn't fully
|
||||||
|
// created yet)
|
||||||
|
void MSWUpdateStyle(long flagsOld, long exflagsOld);
|
||||||
|
|
||||||
// translate wxWidgets coords into Windows ones suitable to be passed to
|
// translate wxWidgets coords into Windows ones suitable to be passed to
|
||||||
// ::CreateWindow()
|
// ::CreateWindow()
|
||||||
//
|
//
|
||||||
|
@@ -1147,6 +1147,25 @@ void wxWindowMSW::SetWindowStyleFlag(long flags)
|
|||||||
// update the internal variable
|
// update the internal variable
|
||||||
wxWindowBase::SetWindowStyleFlag(flags);
|
wxWindowBase::SetWindowStyleFlag(flags);
|
||||||
|
|
||||||
|
// and the real window flags
|
||||||
|
MSWUpdateStyle(flagsOld, GetExtraStyle());
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowMSW::SetExtraStyle(long exflags)
|
||||||
|
{
|
||||||
|
long exflagsOld = GetExtraStyle();
|
||||||
|
if ( exflags == exflagsOld )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// update the internal variable
|
||||||
|
wxWindowBase::SetExtraStyle(exflags);
|
||||||
|
|
||||||
|
// and the real window flags
|
||||||
|
MSWUpdateStyle(GetWindowStyleFlag(), exflagsOld);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowMSW::MSWUpdateStyle(long flagsOld, long exflagsOld)
|
||||||
|
{
|
||||||
// now update the Windows style as well if needed - and if the window had
|
// now update the Windows style as well if needed - and if the window had
|
||||||
// been already created
|
// been already created
|
||||||
if ( !GetHwnd() )
|
if ( !GetHwnd() )
|
||||||
@@ -1155,9 +1174,21 @@ void wxWindowMSW::SetWindowStyleFlag(long flags)
|
|||||||
// we may need to call SetWindowPos() when we change some styles
|
// we may need to call SetWindowPos() when we change some styles
|
||||||
bool callSWP = false;
|
bool callSWP = false;
|
||||||
|
|
||||||
WXDWORD exstyle, exstyleOld;
|
WXDWORD exstyle;
|
||||||
long style = MSWGetStyle(flags, &exstyle),
|
long style = MSWGetStyle(GetWindowStyleFlag(), &exstyle);
|
||||||
styleOld = MSWGetStyle(flagsOld, &exstyleOld);
|
|
||||||
|
// this is quite a horrible hack but we need it because MSWGetStyle()
|
||||||
|
// doesn't take exflags as parameter but uses GetExtraStyle() internally
|
||||||
|
// and so we have to modify the window exflags temporarily to get the
|
||||||
|
// correct exstyleOld
|
||||||
|
long exflagsNew = GetExtraStyle();
|
||||||
|
wxWindowBase::SetExtraStyle(exflagsOld);
|
||||||
|
|
||||||
|
WXDWORD exstyleOld;
|
||||||
|
long styleOld = MSWGetStyle(flagsOld, &exstyleOld);
|
||||||
|
|
||||||
|
wxWindowBase::SetExtraStyle(exflagsNew);
|
||||||
|
|
||||||
|
|
||||||
if ( style != styleOld )
|
if ( style != styleOld )
|
||||||
{
|
{
|
||||||
@@ -1171,14 +1202,8 @@ void wxWindowMSW::SetWindowStyleFlag(long flags)
|
|||||||
|
|
||||||
::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
|
::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
|
||||||
|
|
||||||
// If any of the style changes changed any of the frame styles:
|
// we need to call SetWindowPos() if any of the styles affecting the
|
||||||
// MSDN: SetWindowLong:
|
// frame appearance have changed
|
||||||
// Certain window data is cached, so changes you make using
|
|
||||||
// SetWindowLong will not take effect until you call the
|
|
||||||
// SetWindowPos function. Specifically, if you change any of
|
|
||||||
// the frame styles, you must call SetWindowPos with the
|
|
||||||
// SWP_FRAMECHANGED flag for the cache to be updated properly.
|
|
||||||
|
|
||||||
callSWP = ((styleOld ^ style ) & (WS_BORDER |
|
callSWP = ((styleOld ^ style ) & (WS_BORDER |
|
||||||
WS_THICKFRAME |
|
WS_THICKFRAME |
|
||||||
WS_CAPTION |
|
WS_CAPTION |
|
||||||
|
Reference in New Issue
Block a user