fixes for handling WM_SYSCOLORCHANGE - now seems to work
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -200,11 +200,6 @@ public:
|
|||||||
// we refresh the window when it is dis/enabled
|
// we refresh the window when it is dis/enabled
|
||||||
virtual bool Enable(bool enable = TRUE);
|
virtual bool Enable(bool enable = TRUE);
|
||||||
|
|
||||||
// remember that the font/colour was changed
|
|
||||||
virtual bool SetBackgroundColour(const wxColour& colour);
|
|
||||||
virtual bool SetForegroundColour(const wxColour& colour);
|
|
||||||
virtual bool SetFont(const wxFont& font);
|
|
||||||
|
|
||||||
// our Capture/ReleaseMouse() maintains the stack of windows which had
|
// our Capture/ReleaseMouse() maintains the stack of windows which had
|
||||||
// captured the mouse and when ReleaseMouse() is called, the mouse freed
|
// captured the mouse and when ReleaseMouse() is called, the mouse freed
|
||||||
// only if the stack is empty, otherwise it is captured back by the window
|
// only if the stack is empty, otherwise it is captured back by the window
|
||||||
@@ -272,11 +267,8 @@ protected:
|
|||||||
int m_alignBgBitmap;
|
int m_alignBgBitmap;
|
||||||
wxStretch m_stretchBgBitmap;
|
wxStretch m_stretchBgBitmap;
|
||||||
|
|
||||||
// more flags
|
// is the mouse currently inside the window?
|
||||||
bool m_isCurrent:1; // is the mouse currently inside the window?
|
bool m_isCurrent:1;
|
||||||
bool m_hasBgCol:1; // was the bg colour explicitly changed by user?
|
|
||||||
bool m_hasFgCol:1; // fg
|
|
||||||
bool m_hasFont:1; // font
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the window scrollbars
|
// the window scrollbars
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: window.h
|
// Name: wx/window.h
|
||||||
// Purpose: wxWindowBase class - the interface of wxWindow
|
// Purpose: wxWindowBase class - the interface of wxWindow
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -823,6 +823,11 @@ protected:
|
|||||||
bool m_isEnabled:1;
|
bool m_isEnabled:1;
|
||||||
bool m_isBeingDeleted:1;
|
bool m_isBeingDeleted:1;
|
||||||
|
|
||||||
|
// was the window colours/font explicitly changed by user?
|
||||||
|
bool m_hasBgCol:1;
|
||||||
|
bool m_hasFgCol:1;
|
||||||
|
bool m_hasFont:1;
|
||||||
|
|
||||||
// window attributes
|
// window attributes
|
||||||
long m_windowStyle,
|
long m_windowStyle,
|
||||||
m_exStyle;
|
m_exStyle;
|
||||||
|
@@ -637,6 +637,8 @@ bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
m_backgroundColour = colour;
|
m_backgroundColour = colour;
|
||||||
|
|
||||||
|
m_hasBgCol = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,6 +649,8 @@ bool wxWindowBase::SetForegroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
m_foregroundColour = colour;
|
m_foregroundColour = colour;
|
||||||
|
|
||||||
|
m_hasFgCol = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,6 +682,8 @@ bool wxWindowBase::SetFont(const wxFont& font)
|
|||||||
|
|
||||||
m_font = fontOk;
|
m_font = fontOk;
|
||||||
|
|
||||||
|
m_hasFont = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,9 +46,6 @@ END_EVENT_TABLE()
|
|||||||
// Item members
|
// Item members
|
||||||
wxControl::wxControl()
|
wxControl::wxControl()
|
||||||
{
|
{
|
||||||
m_backgroundColour = *wxWHITE;
|
|
||||||
m_foregroundColour = *wxBLACK;
|
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
m_callback = 0;
|
m_callback = 0;
|
||||||
#endif // WXWIN_COMPATIBILITY
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
@@ -3257,7 +3257,11 @@ bool wxWindowMSW::HandleSysColorChange()
|
|||||||
wxSysColourChangedEvent event;
|
wxSysColourChangedEvent event;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
return GetEventHandler()->ProcessEvent(event);
|
(void)GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
|
// always let the system carry on the default processing to allow the
|
||||||
|
// native controls to react to the colours update
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush,
|
bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush,
|
||||||
@@ -3324,19 +3328,35 @@ bool wxWindowMSW::HandleQueryNewPalette()
|
|||||||
// Responds to colour changes: passes event on to children.
|
// Responds to colour changes: passes event on to children.
|
||||||
void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
wxNode *node = GetChildren().First();
|
wxWindowList::Node *node = GetChildren().GetFirst();
|
||||||
while ( node )
|
while ( node )
|
||||||
{
|
{
|
||||||
// Only propagate to non-top-level windows
|
// Only propagate to non-top-level windows because Windows already
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
// sends this event to all top-level ones
|
||||||
if ( win->GetParent() )
|
wxWindow *win = node->GetData();
|
||||||
|
if ( !win->IsTopLevel() )
|
||||||
{
|
{
|
||||||
wxSysColourChangedEvent event2;
|
// we need to send the real WM_SYSCOLORCHANGE and not just trigger
|
||||||
event.m_eventObject = win;
|
// EVT_SYS_COLOUR_CHANGED call because the latter wouldn't work for
|
||||||
win->GetEventHandler()->ProcessEvent(event2);
|
// the standard controls
|
||||||
|
::SendMessage(GetHwndOf(win), WM_SYSCOLORCHANGE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the colours we use if they were not set explicitly by the user:
|
||||||
|
// this must be done or OnCtlColor() would continue to use the old colours
|
||||||
|
if ( !m_hasFgCol )
|
||||||
|
{
|
||||||
|
m_foregroundColour = wxSystemSettings::
|
||||||
|
GetSystemColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !m_hasBgCol )
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxSystemSettings::
|
||||||
|
GetSystemColour(wxSYS_COLOUR_BTNFACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -938,40 +938,6 @@ wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// colours/fonts
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxWindow::SetBackgroundColour(const wxColour& colour)
|
|
||||||
{
|
|
||||||
if ( !wxWindowNative::SetBackgroundColour(colour) )
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
m_hasBgCol = TRUE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxWindow::SetForegroundColour(const wxColour& colour)
|
|
||||||
{
|
|
||||||
if ( !wxWindowNative::SetForegroundColour(colour) )
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
m_hasFgCol = TRUE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxWindow::SetFont(const wxFont& font)
|
|
||||||
{
|
|
||||||
if ( !wxWindowNative::SetFont(font) )
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
m_hasFont = TRUE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// mouse capture
|
// mouse capture
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user