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:
Benjamin Williams
2006-11-10 15:17:11 +00:00
parent 65f4ce38c6
commit ce15b45fef
3 changed files with 54 additions and 15 deletions

View File

@@ -476,9 +476,14 @@ public:
public: public:
virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p); virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
wxRect CalculateHintRect(wxWindow* pane_window,
const wxPoint& pt,
const wxPoint& offset);
void DrawHintRect(wxWindow* pane_window, void DrawHintRect(wxWindow* pane_window,
const wxPoint& pt, const wxPoint& pt,
const wxPoint& offset); const wxPoint& offset);
virtual void ShowHint(const wxRect& rect); virtual void ShowHint(const wxRect& rect);
virtual void HideHint(); virtual void HideHint();

View File

@@ -3132,6 +3132,17 @@ void wxAuiNotebook::OnTabEndDrag(wxCommandEvent& command_evt)
} }
else 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 // If there is no tabframe at all, create one
wxTabFrame* new_tabs = new wxTabFrame; wxTabFrame* new_tabs = new wxTabFrame;
new_tabs->SetTabCtrlHeight(m_tab_ctrl_height); new_tabs->SetTabCtrlHeight(m_tab_ctrl_height);

View File

@@ -3035,13 +3035,17 @@ 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 // CalculateHintRect() calculates the drop hint rectangle. The method
// the pame would indeed become docked at the specified drop point, // first calls DoDrop() to determine the exact position the pane would
// DrawHintRect() then calls ShowHint() to indicate this drop rectangle. // be at were if dropped. If the pane would indeed become docked at the
// "pane_window" is the window pointer of the pane being dragged, pt is // specified drop point, the the rectangle hint will be returned in
// the mouse position, in client coordinates // screen coordinates. Otherwise, an empty rectangle is returned.
void wxAuiManager::DrawHintRect(wxWindow* pane_window, // |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& pt,
const wxPoint& offset) const wxPoint& offset)
{ {
@@ -3061,7 +3065,7 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window,
hint.Show(); hint.Show();
if (!hint.IsOk()) if (!hint.IsOk())
return; return rect;
CopyDocksAndPanes(docks, panes, m_docks, m_panes); 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 // find out where the new pane would be
if (!DoDrop(docks, panes, hint, pt, offset)) if (!DoDrop(docks, panes, hint, pt, offset))
{ {
HideHint(); return rect;
return;
} }
panes.Add(hint); panes.Add(hint);
@@ -3109,13 +3112,33 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window,
if (rect.IsEmpty()) if (rect.IsEmpty())
{ {
HideHint(); return rect;
return;
} }
// actually show the hint rectangle on the screen // actually show the hint rectangle on the screen
m_frame->ClientToScreen(&rect.x, &rect.y); m_frame->ClientToScreen(&rect.x, &rect.y);
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); ShowHint(rect);
}
} }
void wxAuiManager::OnFloatingPaneMoveStart(wxWindow* wnd) void wxAuiManager::OnFloatingPaneMoveStart(wxWindow* wnd)