Fixed incorrect clipping region on wxGTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-09-03 18:59:14 +00:00
parent 4d08943ee4
commit ee8bee6c8c
2 changed files with 32 additions and 12 deletions

View File

@@ -73,14 +73,15 @@ class wxSTCCallTip : public wxSTCCallTipBase {
public: public:
wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
: wxSTCCallTipBase(parent, param2), : wxSTCCallTipBase(parent, param2),
m_ct(ct), m_swx(swx) m_ct(ct), m_swx(swx), m_cx(-1), m_cy(-1)
{ {
} }
~wxSTCCallTip() { ~wxSTCCallTip() {
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP && defined(__WXGTK__) #if wxUSE_POPUPWIN && wxSTC_USE_POPUP && defined(__WXGTK__)
wxRect rect = GetRect(); wxRect rect = GetRect();
GetParent()->ScreenToClient(&rect.x, &rect.y); rect.x = m_cx;
rect.y = m_cy;
GetParent()->Refresh(false, &rect); GetParent()->Refresh(false, &rect);
#endif #endif
} }
@@ -112,17 +113,26 @@ public:
virtual void DoSetSize(int x, int y, virtual void DoSetSize(int x, int y,
int width, int height, int width, int height,
int sizeFlags = wxSIZE_AUTO) { int sizeFlags = wxSIZE_AUTO) {
if (x != -1) if (x != -1) {
m_cx = x;
GetParent()->ClientToScreen(&x, NULL); GetParent()->ClientToScreen(&x, NULL);
if (y != -1) }
if (y != -1) {
m_cy = y;
GetParent()->ClientToScreen(NULL, &y); GetParent()->ClientToScreen(NULL, &y);
}
wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags); wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
} }
#endif #endif
wxPoint GetMyPosition() {
return wxPoint(m_cx, m_cy);
}
private: private:
CallTip* m_ct; CallTip* m_ct;
ScintillaWX* m_swx; ScintillaWX* m_swx;
int m_cx, m_cy;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -926,10 +936,10 @@ void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
rgn.Subtract(childRect); rgn.Subtract(childRect);
} }
if (ct.inCallTipMode) { if (ct.inCallTipMode) {
wxWindow* tip = (wxWindow*)ct.wCallTip.GetID(); wxSTCCallTip* tip = (wxSTCCallTip*)ct.wCallTip.GetID();
wxRect childRect = tip->GetRect(); wxRect childRect = tip->GetRect();
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP #if wxUSE_POPUPWIN && wxSTC_USE_POPUP
tip->GetParent()->ScreenToClient(&childRect.x, &childRect.y); childRect.SetPosition(tip->GetMyPosition());
#endif #endif
rgn.Subtract(childRect); rgn.Subtract(childRect);
} }

View File

@@ -73,14 +73,15 @@ class wxSTCCallTip : public wxSTCCallTipBase {
public: public:
wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx)
: wxSTCCallTipBase(parent, param2), : wxSTCCallTipBase(parent, param2),
m_ct(ct), m_swx(swx) m_ct(ct), m_swx(swx), m_cx(-1), m_cy(-1)
{ {
} }
~wxSTCCallTip() { ~wxSTCCallTip() {
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP && defined(__WXGTK__) #if wxUSE_POPUPWIN && wxSTC_USE_POPUP && defined(__WXGTK__)
wxRect rect = GetRect(); wxRect rect = GetRect();
GetParent()->ScreenToClient(&rect.x, &rect.y); rect.x = m_cx;
rect.y = m_cy;
GetParent()->Refresh(false, &rect); GetParent()->Refresh(false, &rect);
#endif #endif
} }
@@ -112,17 +113,26 @@ public:
virtual void DoSetSize(int x, int y, virtual void DoSetSize(int x, int y,
int width, int height, int width, int height,
int sizeFlags = wxSIZE_AUTO) { int sizeFlags = wxSIZE_AUTO) {
if (x != -1) if (x != -1) {
m_cx = x;
GetParent()->ClientToScreen(&x, NULL); GetParent()->ClientToScreen(&x, NULL);
if (y != -1) }
if (y != -1) {
m_cy = y;
GetParent()->ClientToScreen(NULL, &y); GetParent()->ClientToScreen(NULL, &y);
}
wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags); wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
} }
#endif #endif
wxPoint GetMyPosition() {
return wxPoint(m_cx, m_cy);
}
private: private:
CallTip* m_ct; CallTip* m_ct;
ScintillaWX* m_swx; ScintillaWX* m_swx;
int m_cx, m_cy;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -926,10 +936,10 @@ void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
rgn.Subtract(childRect); rgn.Subtract(childRect);
} }
if (ct.inCallTipMode) { if (ct.inCallTipMode) {
wxWindow* tip = (wxWindow*)ct.wCallTip.GetID(); wxSTCCallTip* tip = (wxSTCCallTip*)ct.wCallTip.GetID();
wxRect childRect = tip->GetRect(); wxRect childRect = tip->GetRect();
#if wxUSE_POPUPWIN && wxSTC_USE_POPUP #if wxUSE_POPUPWIN && wxSTC_USE_POPUP
tip->GetParent()->ScreenToClient(&childRect.x, &childRect.y); childRect.SetPosition(tip->GetMyPosition());
#endif #endif
rgn.Subtract(childRect); rgn.Subtract(childRect);
} }