fixes to client area origin handling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-09-19 22:45:14 +00:00
parent 0cecad314c
commit b9f2926155
4 changed files with 42 additions and 10 deletions

View File

@@ -73,6 +73,8 @@ public:
const wxString& name = wxToolBarNameStr); const wxString& name = wxToolBarNameStr);
void SetToolBar(wxToolBar *toolbar); void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
wxPoint GetClientAreaOrigin() const { return wxPoint(0, 0); }
// implementation from now on // implementation from now on
// -------------------------- // --------------------------

View File

@@ -73,6 +73,8 @@ public:
const wxString& name = wxToolBarNameStr); const wxString& name = wxToolBarNameStr);
void SetToolBar(wxToolBar *toolbar); void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
wxPoint GetClientAreaOrigin() const { return wxPoint(0, 0); }
// implementation from now on // implementation from now on
// -------------------------- // --------------------------

View File

@@ -2690,10 +2690,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
if (m_resizing) return; /* I don't like recursions */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = TRUE;
if (x == -1) int currentX, currentY;
x = m_x; GetPosition(&currentX, &currentY);
if (x == -1)
x = currentX;
if (y == -1) if (y == -1)
y = m_y; y = currentY;
AdjustForParentClientOrigin(x, y, sizeFlags); AdjustForParentClientOrigin(x, y, sizeFlags);
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
@@ -2986,9 +2988,21 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const
dx = pizza->xoffset; dx = pizza->xoffset;
dy = pizza->yoffset; dy = pizza->yoffset;
} }
int nx = m_x - dx;
int ny = m_y - dy;
if ( !IsTopLevel() && m_parent )
{
// 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).
wxPoint pt(m_parent->GetClientAreaOrigin());
nx -= pt.x;
ny -= pt.y;
}
if (x) (*x) = m_x - dx; if (x) (*x) = nx;
if (y) (*y) = m_y - dy; if (y) (*y) = ny;
} }
void wxWindowGTK::DoClientToScreen( int *x, int *y ) const void wxWindowGTK::DoClientToScreen( int *x, int *y ) const

View File

@@ -2690,10 +2690,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
if (m_resizing) return; /* I don't like recursions */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = TRUE;
if (x == -1) int currentX, currentY;
x = m_x; GetPosition(&currentX, &currentY);
if (x == -1)
x = currentX;
if (y == -1) if (y == -1)
y = m_y; y = currentY;
AdjustForParentClientOrigin(x, y, sizeFlags); AdjustForParentClientOrigin(x, y, sizeFlags);
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
@@ -2986,9 +2988,21 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const
dx = pizza->xoffset; dx = pizza->xoffset;
dy = pizza->yoffset; dy = pizza->yoffset;
} }
int nx = m_x - dx;
int ny = m_y - dy;
if ( !IsTopLevel() && m_parent )
{
// 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).
wxPoint pt(m_parent->GetClientAreaOrigin());
nx -= pt.x;
ny -= pt.y;
}
if (x) (*x) = m_x - dx; if (x) (*x) = nx;
if (y) (*y) = m_y - dy; if (y) (*y) = ny;
} }
void wxWindowGTK::DoClientToScreen( int *x, int *y ) const void wxWindowGTK::DoClientToScreen( int *x, int *y ) const