Implement rest of MSW's wxDataViewCtrl's native column reordering
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a5b4330420
commit
fc8c1a15b2
@ -469,6 +469,9 @@ public: // utility functions not part of the API
|
|||||||
return GetClientSize().GetWidth() / GetColumnCount();
|
return GetClientSize().GetWidth() / GetColumnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// called by header window after reorder
|
||||||
|
void ColumnMoved( wxDataViewColumn* col, unsigned int new_pos );
|
||||||
|
|
||||||
// updates the header window after a change in a column setting
|
// updates the header window after a change in a column setting
|
||||||
void OnColumnChange();
|
void OnColumnChange();
|
||||||
|
|
||||||
|
@ -138,6 +138,8 @@ public:
|
|||||||
// the column count
|
// the column count
|
||||||
virtual void UpdateDisplay();
|
virtual void UpdateDisplay();
|
||||||
|
|
||||||
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
// called Refresh afterwards
|
// called Refresh afterwards
|
||||||
virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
|
virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
|
||||||
|
|
||||||
@ -157,6 +159,7 @@ protected:
|
|||||||
|
|
||||||
int m_scrollOffsetX;
|
int m_scrollOffsetX;
|
||||||
int m_buttonHeight;
|
int m_buttonHeight;
|
||||||
|
bool m_delayedUpdate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindowMSW)
|
DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindowMSW)
|
||||||
@ -1281,6 +1284,7 @@ bool wxDataViewHeaderWindowMSW::Create( wxDataViewCtrl *parent, wxWindowID id,
|
|||||||
m_owner = parent;
|
m_owner = parent;
|
||||||
|
|
||||||
m_scrollOffsetX = 0;
|
m_scrollOffsetX = 0;
|
||||||
|
m_delayedUpdate = false;
|
||||||
m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this );
|
m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this );
|
||||||
|
|
||||||
int x = pos.x == wxDefaultCoord ? 0 : pos.x,
|
int x = pos.x == wxDefaultCoord ? 0 : pos.x,
|
||||||
@ -1333,7 +1337,16 @@ wxDataViewHeaderWindowMSW::~wxDataViewHeaderWindow()
|
|||||||
|
|
||||||
wxSize wxDataViewHeaderWindowMSW::DoGetBestSize() const
|
wxSize wxDataViewHeaderWindowMSW::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
return wxSize(80, m_buttonHeight );
|
return wxSize( 80, m_buttonHeight+2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDataViewHeaderWindowMSW::OnInternalIdle()
|
||||||
|
{
|
||||||
|
if (m_delayedUpdate)
|
||||||
|
{
|
||||||
|
m_delayedUpdate = false;
|
||||||
|
UpdateDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewHeaderWindowMSW::UpdateDisplay()
|
void wxDataViewHeaderWindowMSW::UpdateDisplay()
|
||||||
@ -1456,7 +1469,10 @@ bool wxDataViewHeaderWindowMSW::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARA
|
|||||||
|
|
||||||
case HDN_ENDDRAG: // user has finished reordering a column
|
case HDN_ENDDRAG: // user has finished reordering a column
|
||||||
{
|
{
|
||||||
// TODO: How to query the new position here?
|
wxDataViewColumn *col = GetColumn(nmHDR->iItem);
|
||||||
|
unsigned int new_pos = nmHDR->pitem->iOrder;
|
||||||
|
m_owner->ColumnMoved( col, new_pos );
|
||||||
|
m_delayedUpdate = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3965,6 +3981,15 @@ wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDataViewCtrl::ColumnMoved( wxDataViewColumn* col, unsigned int new_pos )
|
||||||
|
{
|
||||||
|
if (new_pos > m_cols.GetCount()) return;
|
||||||
|
m_cols.DeleteObject( col );
|
||||||
|
m_cols.Insert( new_pos, col );
|
||||||
|
|
||||||
|
m_clientArea->UpdateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
|
bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
|
||||||
{
|
{
|
||||||
wxDataViewColumnList::compatibility_iterator ret = m_cols.Find( column );
|
wxDataViewColumnList::compatibility_iterator ret = m_cols.Find( column );
|
||||||
|
Loading…
Reference in New Issue
Block a user