#endif
#ifdef __WXDEBUG__
- static const char *GetMessageName(int message);
+const char *wxGetMessageName(int message);
#endif //WXDEBUG
#define WINDOW_MARGIN 3 // This defines sensitivity of Leave events
m_lastMsg = 0;
m_lastWParam = 0;
m_lastLParam = 0;
- m_acceleratorTable = 0;
+// m_acceleratorTable = 0;
m_hMenu = 0;
m_xThumbSize = 0;
m_lastMsg = 0;
m_lastWParam = 0;
m_lastLParam = 0;
- m_acceleratorTable = 0;
+// m_acceleratorTable = 0;
m_hMenu = 0;
m_xThumbSize = 0;
{
::ScreenToClient(hParentWnd, &point);
}
+
+ // We may be faking the client origin.
+ // So a window that's really at (0, 30) may appear
+ // (to wxWin apps) to be at (0, 0).
+ if (GetParent())
+ {
+ wxPoint pt(GetParent()->GetClientAreaOrigin());
+ point.x -= pt.x;
+ point.y -= pt.y;
+ }
*x = point.x;
*y = point.y;
}
pt.y = *y;
::ScreenToClient(hWnd, &pt);
+/*
+ // We may be faking the client origin.
+ // So a window that's really at (0, 30) may appear
+ // (to wxWin apps) to be at (0, 0).
+ if (GetParent())
+ {
+ wxPoint pt1(GetParent()->GetClientAreaOrigin());
+ pt.x -= pt1.x;
+ pt.y -= pt1.y;
+ }
+*/
+
*x = pt.x;
*y = pt.y;
}
POINT pt;
pt.x = *x;
pt.y = *y;
+
+/*
+ // We may be faking the client origin.
+ // So a window that's really at (0, 30) may appear
+ // (to wxWin apps) to be at (0, 0).
+ if (GetParent())
+ {
+ wxPoint pt1(GetParent()->GetClientAreaOrigin());
+ pt.x += pt1.x;
+ pt.y += pt1.y;
+ }
+*/
+
::ClientToScreen(hWnd, &pt);
*x = pt.x;
// Get size *available for subwindows* i.e. excluding menu bar etc.
-// For XView, this is the same as GetSize
void wxWindow::GetClientSize(int *x, int *y) const
{
HWND hWnd = (HWND) GetHWND();
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
actualY = currentY;
+ AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
+
int currentW,currentH;
GetSize(¤tW, ¤tH);
if (width == -1)
GetEventHandler()->ProcessEvent(event);
}
+// For implementation purposes - sometimes decorations make the client area
+// smaller
+wxPoint wxWindow::GetClientAreaOrigin() const
+{
+ return wxPoint(0, 0);
+}
+
+// Makes an adjustment to the window position (for example, a frame that has
+// a toolbar that it manages itself).
+void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
+{
+ if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
+ {
+ wxPoint pt(GetParent()->GetClientAreaOrigin());
+ x += pt.x; y += pt.y;
+ }
+}
+
bool wxWindow::Show(bool show)
{
HWND hWnd = (HWND) GetHWND();
long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
#ifdef __WXDEBUG__
- wxLogTrace(wxTraceMessages, "Processing %s", GetMessageName(message));
+ wxLogTrace(wxTraceMessages, "Processing %s", wxGetMessageName(message));
#endif // WXDEBUG
HWND hWnd = (HWND)m_hWnd;
return MSWDefWindowProc(message, wParam, lParam );
break;
}
+ case WM_PALETTECHANGED:
+ {
+ return MSWOnPaletteChanged((WXHWND) (HWND) wParam);
+ break;
+ }
+ case WM_QUERYNEWPALETTE:
+ {
+ return MSWOnQueryNewPalette();
+ break;
+ }
case WM_ERASEBKGND:
{
// Prevents flicker when dragging
bool wxWindow::MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
wxSysColourChangedEvent event;
- event.m_eventObject = this;
+ event.SetEventObject(this);
// Check if app handles this.
if (GetEventHandler()->ProcessEvent(event))
return 1;
}
+long wxWindow::MSWOnPaletteChanged(WXHWND hWndPalChange)
+{
+ wxPaletteChangedEvent event(GetId());
+ event.SetEventObject(this);
+ event.SetChangedWindow(wxFindWinFromHandle(hWndPalChange));
+ GetEventHandler()->ProcessEvent(event);
+ return 0;
+}
+
+long wxWindow::MSWOnQueryNewPalette()
+{
+ wxQueryNewPaletteEvent event(GetId());
+ event.SetEventObject(this);
+ if (!GetEventHandler()->ProcessEvent(event) || !event.GetPaletteRealized())
+ {
+ return (long) FALSE;
+ }
+ else
+ return (long) TRUE;
+}
+
// Responds to colour changes: passes event on to children.
void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
{
#ifdef __WXDEBUG__
wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.",
- GetMessageName(m_lastMsg));
+ wxGetMessageName(m_lastMsg));
#endif // WXDEBUG
return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
return FALSE;
}
+bool wxWindow::MSWTranslateMessage(WXMSG* WXUNUSED(pMsg))
+{
+ return FALSE;
+}
+
long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate), WXHWND WXUNUSED(deactivate))
{
#if WXDEBUG > 1
bool wxWindow::MSWOnPaint(void)
{
+#ifdef __WIN32__
+ HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
+ ::GetUpdateRgn((HWND) GetHWND(), hRegion, FALSE);
+
+ m_updateRegion = wxRegion((WXHRGN) hRegion);
+#else
+ RECT updateRect;
+ ::GetUpdateRect((HWND) GetHWND(), & updateRect, FALSE);
+
+ m_updateRegion = wxRegion(updateRect.left, updateRect.top,
+ updateRect.right - updateRect.left, updateRect.bottom - updateRect.top);
+#endif
+
wxPaintEvent event(m_windowId);
event.SetEventObject(this);
if (!GetEventHandler()->ProcessEvent(event))
*y = point.y;
}
+// OBSOLETE: use GetUpdateRegion instead.
+
+#if 0
/*
* Update iterator. Use from within OnPaint.
*/
{
return ((RECT *)rp)[current].bottom-GetY();
}
+#endif
wxWindow *wxGetActiveWindow(void)
{
return IsShown() && IsEnabled();
}
+// Update region access
+wxRegion wxWindow::GetUpdateRegion() const
+{
+ return m_updateRegion;
+}
+
+bool wxWindow::IsExposed(int x, int y, int w, int h) const
+{
+ return (m_updateRegion.Contains(x, y, w, h) != wxOutRegion);
+}
+
+bool wxWindow::IsExposed(const wxPoint& pt) const
+{
+ return (m_updateRegion.Contains(pt) != wxOutRegion);
+}
+
+bool wxWindow::IsExposed(const wxRect& rect) const
+{
+ return (m_updateRegion.Contains(rect) != wxOutRegion);
+}
+
#ifdef __WXDEBUG__
-static const char *GetMessageName(int message)
+const char *wxGetMessageName(int message)
{
switch ( message ) {
case 0x0000: return "WM_NULL";