Implement hint cursor for resizable columns
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -578,6 +578,7 @@ protected:
|
|||||||
|
|
||||||
// event handling:
|
// event handling:
|
||||||
void OnSize(wxSizeEvent &event);
|
void OnSize(wxSizeEvent &event);
|
||||||
|
void OnMouse(wxMouseEvent &event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// type definitions:
|
// type definitions:
|
||||||
|
@@ -1460,6 +1460,56 @@ void wxDataViewCtrl::DoSetIndent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// event handling:
|
// event handling:
|
||||||
|
void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
|
||||||
|
if (GetModel() == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(m_peer));
|
||||||
|
|
||||||
|
int NoOfChildren;
|
||||||
|
wxDataViewItemArray items;
|
||||||
|
NoOfChildren = GetModel()->GetChildren( wxDataViewItem(), items);
|
||||||
|
if (NoOfChildren == 0)
|
||||||
|
return;
|
||||||
|
wxDataViewItem firstChild = items[0];
|
||||||
|
|
||||||
|
UInt16 headerHeight = 0;
|
||||||
|
MacDataViewListCtrlPtr->GetHeaderButtonHeight(&headerHeight);
|
||||||
|
|
||||||
|
|
||||||
|
if (event.GetY() < headerHeight)
|
||||||
|
{
|
||||||
|
unsigned int col_count = GetColumnCount();
|
||||||
|
unsigned int col;
|
||||||
|
for (col = 0; col < col_count; col++)
|
||||||
|
{
|
||||||
|
wxDataViewColumn *column = GetColumn( col );
|
||||||
|
if (column->IsHidden())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Rect itemrect;
|
||||||
|
::GetDataBrowserItemPartBounds( MacDataViewListCtrlPtr->GetControlRef(),
|
||||||
|
reinterpret_cast<DataBrowserItemID>(firstChild.GetID()), column->GetPropertyID(),
|
||||||
|
kDataBrowserPropertyEnclosingPart, &itemrect );
|
||||||
|
|
||||||
|
if (abs( event.GetX() - itemrect.right) < 3)
|
||||||
|
{
|
||||||
|
if (column->GetFlags() & wxDATAVIEW_COL_RESIZABLE)
|
||||||
|
SetCursor( wxCursor( wxCURSOR_SIZEWE ) );
|
||||||
|
else
|
||||||
|
SetCursor( *wxSTANDARD_CURSOR );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCursor( *wxSTANDARD_CURSOR );
|
||||||
|
}
|
||||||
|
|
||||||
void wxDataViewCtrl::OnSize(wxSizeEvent& event)
|
void wxDataViewCtrl::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
unsigned int const NoOfColumns = this->GetColumnCount();
|
unsigned int const NoOfColumns = this->GetColumnCount();
|
||||||
@@ -1497,6 +1547,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase)
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase)
|
BEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase)
|
||||||
EVT_SIZE(wxDataViewCtrl::OnSize)
|
EVT_SIZE(wxDataViewCtrl::OnSize)
|
||||||
|
EVT_MOTION(wxDataViewCtrl::OnMouse)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#endif // !wxUSE_GENERICDATAVIEWCTRL
|
#endif // !wxUSE_GENERICDATAVIEWCTRL
|
||||||
|
Reference in New Issue
Block a user