factored out CalculateHintRect() from DrawHintRect(); hint fix in auibook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -476,9 +476,14 @@ public:
|
||||
public:
|
||||
virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
|
||||
|
||||
wxRect CalculateHintRect(wxWindow* pane_window,
|
||||
const wxPoint& pt,
|
||||
const wxPoint& offset);
|
||||
|
||||
void DrawHintRect(wxWindow* pane_window,
|
||||
const wxPoint& pt,
|
||||
const wxPoint& offset);
|
||||
|
||||
virtual void ShowHint(const wxRect& rect);
|
||||
virtual void HideHint();
|
||||
|
||||
|
@@ -3132,6 +3132,17 @@ void wxAuiNotebook::OnTabEndDrag(wxCommandEvent& command_evt)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPoint zero(0,0);
|
||||
wxRect rect = m_mgr.CalculateHintRect(m_dummy_wnd,
|
||||
mouse_client_pt,
|
||||
zero);
|
||||
if (rect.IsEmpty())
|
||||
{
|
||||
// there is no suitable drop location here, exit out
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If there is no tabframe at all, create one
|
||||
wxTabFrame* new_tabs = new wxTabFrame;
|
||||
new_tabs->SetTabCtrlHeight(m_tab_ctrl_height);
|
||||
|
@@ -3035,15 +3035,19 @@ void wxAuiManager::HideHint()
|
||||
|
||||
|
||||
|
||||
// DrawHintRect() draws a drop hint rectangle. First calls DoDrop() to
|
||||
// determine the exact position the pane would be at were if dropped. If
|
||||
// the pame would indeed become docked at the specified drop point,
|
||||
// DrawHintRect() then calls ShowHint() to indicate this drop rectangle.
|
||||
// "pane_window" is the window pointer of the pane being dragged, pt is
|
||||
// the mouse position, in client coordinates
|
||||
void wxAuiManager::DrawHintRect(wxWindow* pane_window,
|
||||
const wxPoint& pt,
|
||||
const wxPoint& offset)
|
||||
|
||||
// CalculateHintRect() calculates the drop hint rectangle. The method
|
||||
// first calls DoDrop() to determine the exact position the pane would
|
||||
// be at were if dropped. If the pane would indeed become docked at the
|
||||
// specified drop point, the the rectangle hint will be returned in
|
||||
// screen coordinates. Otherwise, an empty rectangle is returned.
|
||||
// |pane_window| is the window pointer of the pane being dragged, |pt| is
|
||||
// the mouse position, in client coordinates. |offset| describes the offset
|
||||
// that the mouse is from the upper-left corner of the item being dragged
|
||||
|
||||
wxRect wxAuiManager::CalculateHintRect(wxWindow* pane_window,
|
||||
const wxPoint& pt,
|
||||
const wxPoint& offset)
|
||||
{
|
||||
wxRect rect;
|
||||
|
||||
@@ -3061,7 +3065,7 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window,
|
||||
hint.Show();
|
||||
|
||||
if (!hint.IsOk())
|
||||
return;
|
||||
return rect;
|
||||
|
||||
CopyDocksAndPanes(docks, panes, m_docks, m_panes);
|
||||
|
||||
@@ -3080,8 +3084,7 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window,
|
||||
// find out where the new pane would be
|
||||
if (!DoDrop(docks, panes, hint, pt, offset))
|
||||
{
|
||||
HideHint();
|
||||
return;
|
||||
return rect;
|
||||
}
|
||||
|
||||
panes.Add(hint);
|
||||
@@ -3109,13 +3112,33 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window,
|
||||
|
||||
if (rect.IsEmpty())
|
||||
{
|
||||
HideHint();
|
||||
return;
|
||||
return rect;
|
||||
}
|
||||
|
||||
// actually show the hint rectangle on the screen
|
||||
m_frame->ClientToScreen(&rect.x, &rect.y);
|
||||
ShowHint(rect);
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
// DrawHintRect() calculates the hint rectangle by calling
|
||||
// CalculateHintRect(). If there is a rectangle, it shows it
|
||||
// by calling ShowHint(), otherwise it hides any hint
|
||||
// rectangle currently shown
|
||||
void wxAuiManager::DrawHintRect(wxWindow* pane_window,
|
||||
const wxPoint& pt,
|
||||
const wxPoint& offset)
|
||||
{
|
||||
wxRect rect = CalculateHintRect(pane_window, pt, offset);
|
||||
|
||||
if (rect.IsEmpty())
|
||||
{
|
||||
HideHint();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowHint(rect);
|
||||
}
|
||||
}
|
||||
|
||||
void wxAuiManager::OnFloatingPaneMoveStart(wxWindow* wnd)
|
||||
|
Reference in New Issue
Block a user