-//-----------------------------------------------------------------------------
-// wxDataViewRenameTimer
-//-----------------------------------------------------------------------------
-
-wxDataViewRenameTimer::wxDataViewRenameTimer( wxDataViewMainWindow *owner )
-{
- m_owner = owner;
-}
-
-void wxDataViewRenameTimer::Notify()
-{
- m_owner->OnRenameTimer();
-}
-
-//-----------------------------------------------------------------------------
-// wxDataViewMainWindow
-//-----------------------------------------------------------------------------
-
-//The tree building helper, declared firstly
-static void BuildTreeHelper( wxDataViewModel * model, wxDataViewItem & item, wxDataViewTreeNode * node);
-
-int LINKAGEMODE wxDataViewSelectionCmp( unsigned int row1, unsigned int row2 )
-{
- if (row1 > row2) return 1;
- if (row1 == row2) return 0;
- return -1;
-}
-
-
-IMPLEMENT_ABSTRACT_CLASS(wxDataViewMainWindow, wxWindow)
-
-BEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow)
- EVT_PAINT (wxDataViewMainWindow::OnPaint)
- EVT_MOUSE_EVENTS (wxDataViewMainWindow::OnMouse)
- EVT_SET_FOCUS (wxDataViewMainWindow::OnSetFocus)
- EVT_KILL_FOCUS (wxDataViewMainWindow::OnKillFocus)
- EVT_CHAR (wxDataViewMainWindow::OnChar)
-END_EVENT_TABLE()
-
-wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size, const wxString &name ) :
- wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name ),
- m_selection( wxDataViewSelectionCmp )
-
-{
- SetOwner( parent );
-
- m_lastOnSame = false;
- m_renameTimer = new wxDataViewRenameTimer( this );
-
- // TODO: user better initial values/nothing selected
- m_currentCol = NULL;
- m_currentRow = 0;
-
- m_lineHeight = wxMax( 17, GetCharHeight() + 2 ); // 17 = mini icon height + 1
-
- m_dragCount = 0;
- m_dragStart = wxPoint(0,0);
- m_lineLastClicked = (unsigned int) -1;
- m_lineBeforeLastClicked = (unsigned int) -1;
- m_lineSelectSingleOnUp = (unsigned int) -1;
-
- m_hasFocus = false;
-
- SetBackgroundColour( *wxWHITE );
-
- SetBackgroundStyle(wxBG_STYLE_CUSTOM);
-
- m_penRule = wxPen(GetRuleColour());
-
- //Here I compose a pen can draw black lines, maybe there are something system colour to use
- m_penExpander = wxPen(wxColour(0,0,0));
- //Some new added code to deal with the tree structure
- m_root = new wxDataViewTreeNode( NULL );
- m_root->SetHasChildren(true);
-
- //Make m_count = -1 will cause the class recaculate the real displaying number of rows.
- m_count = -1 ;
- m_underMouse = NULL;
- UpdateDisplay();
-}
-
-wxDataViewMainWindow::~wxDataViewMainWindow()
-{
- DestroyTree();
- delete m_renameTimer;
-}