moved AdjustToClientAreaOrigin to wxWindowBase, needed worldwide for wxUniv

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-09-18 22:36:18 +00:00
parent 45eb404791
commit a200c35efa
9 changed files with 38 additions and 54 deletions

View File

@@ -198,10 +198,6 @@ public:
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// Windows subclassing
void SubclassWin(WXHWND hWnd);
void UnsubclassWin();

View File

@@ -215,13 +215,6 @@ public:
// smaller
virtual wxPoint GetClientAreaOrigin(void) const;
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin( int& rX
,int& rY
,int nSizeFlags
);
// Windows subclassing
void SubclassWin(WXHWND hWnd);
void UnsubclassWin(void);

View File

@@ -976,6 +976,10 @@ protected:
virtual void DoSetClientData( void *data );
virtual void *DoGetClientData() const;
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// what kind of data do we have?
wxClientDataType m_clientDataType;

View File

@@ -1355,6 +1355,23 @@ void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const
GetClientSize(w, h);
}
void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
{
// don't do it for the dialogs/frames - they float independently of their
// parent
if ( !IsTopLevel() )
{
wxWindow *parent = GetParent();
if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent )
{
wxPoint pt(parent->GetClientAreaOrigin());
x += pt.x;
y += pt.y;
}
}
}
void wxWindowBase::GetPositionConstraint(int *x, int *y) const
{
wxLayoutConstraints *constr = GetConstraints();

View File

@@ -2690,6 +2690,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
if (x == -1)
x = m_x;
if (y == -1)
y = m_y;
AdjustForParentClientOrigin(x, y, sizeFlags);
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */

View File

@@ -2690,6 +2690,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
if (x == -1)
x = m_x;
if (y == -1)
y = m_y;
AdjustForParentClientOrigin(x, y, sizeFlags);
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */

View File

@@ -180,6 +180,8 @@ static ibool wxWindowMouseHandler(window_t *wnd, event_t *e)
wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd);
wxPoint where = win->ScreenToClient(wxPoint(e->where_x, e->where_y));
if ( !win->IsEnabled() ) return FALSE;
wxEventType type = wxEVT_NULL;
wxMouseEvent event;
event.SetEventObject(win);
@@ -387,6 +389,9 @@ static ibool wxWindowKeybHandler(window_t *wnd, event_t *e)
{
wxEventType type = wxEVT_NULL;
wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd);
if ( !win->IsEnabled() ) return FALSE;
wxPoint where = win->ScreenToClient(wxPoint(e->where_x, e->where_y));
wxKeyEvent event;
@@ -847,9 +852,7 @@ void wxWindowMGL::DoSetSize(int x, int y, int width, int height, int sizeFlags)
if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
y = currentY;
#if 0 // FIXME_MGL -- what's this good for?
AdjustForParentClientOrigin(x, y, sizeFlags);
#endif
wxSize size(-1, -1);
if ( width == -1 )

View File

@@ -1554,24 +1554,6 @@ wxPoint wxWindowMSW::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 wxWindowMSW::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
{
// don't do it for the dialogs/frames - they float independently of their
// parent
if ( !IsTopLevel() )
{
wxWindow *parent = GetParent();
if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent )
{
wxPoint pt(parent->GetClientAreaOrigin());
x += pt.x;
y += pt.y;
}
}
}
// ---------------------------------------------------------------------------
// text metrics
// ---------------------------------------------------------------------------

View File

@@ -1639,29 +1639,6 @@ wxPoint wxWindowOS2::GetClientAreaOrigin() const
return wxPoint(0, 0);
} // end of wxWindowOS2::GetClientAreaOrigin
void wxWindowOS2::AdjustForParentClientOrigin(
int& rX
, int& rY
, int nSizeFlags
)
{
//
// Don't do it for the dialogs/frames - they float independently of their
// parent
//
if (!IsTopLevel())
{
wxWindow* pParent = GetParent();
if (!(nSizeFlags & wxSIZE_NO_ADJUSTMENTS) && pParent)
{
wxPoint vPoint(pParent->GetClientAreaOrigin());
rX += vPoint.x;
rY += vPoint.y;
}
}
} // end of wxWindowOS2::AdjustForParentClientOrigin
// ---------------------------------------------------------------------------
// text metrics
// ---------------------------------------------------------------------------