class wxDataViewCtrl;
-// ---------------------------------------------------------
-// wxGenericDataViewListModelNotifier
-// ---------------------------------------------------------
+//-----------------------------------------------------------------------------
+// wxDataViewHeaderWindow
+//-----------------------------------------------------------------------------
-class wxGenericDataViewListModelNotifier: public wxDataViewListModelNotifier
+class wxDataViewHeaderWindow: public wxWindow
{
public:
- wxGenericDataViewListModelNotifier( wxDataViewListModel *wx_model );
-
- virtual bool RowAppended();
- virtual bool RowPrepended();
- virtual bool RowInserted( size_t before );
- virtual bool RowDeleted( size_t row );
- virtual bool RowChanged( size_t row );
- virtual bool ValueChanged( size_t col, size_t row );
- virtual bool RowsReordered( size_t *new_order );
- virtual bool Cleared();
-
- wxDataViewListModel *m_wx_model;
-};
+ wxDataViewHeaderWindow( wxDataViewCtrl *parent,
+ wxWindowID id,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ const wxString &name = wxT("wxdataviewctrlheaderwindow") );
+ ~wxDataViewHeaderWindow();
-// ---------------------------------------------------------
-// wxGenericDataViewListModelNotifier
-// ---------------------------------------------------------
+ void SetOwner( wxDataViewCtrl* owner ) { m_owner = owner; }
+ wxDataViewCtrl *GetOwner() { return m_owner; }
-wxGenericDataViewListModelNotifier::wxGenericDataViewListModelNotifier(
- wxDataViewListModel *wx_model )
-{
- m_wx_model = wx_model;
-}
+ void OnPaint( wxPaintEvent &event );
+ void OnMouse( wxMouseEvent &event );
+ void OnSetFocus( wxFocusEvent &event );
-bool wxGenericDataViewListModelNotifier::RowAppended()
-{
- size_t pos = m_wx_model->GetNumberOfRows()-1;
+private:
+ wxDataViewCtrl *m_owner;
+ wxCursor *m_resizeCursor;
- return false;
-}
-
-bool wxGenericDataViewListModelNotifier::RowPrepended()
-{
- return false;
-}
+private:
+ DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindow)
+ DECLARE_EVENT_TABLE()
+};
-bool wxGenericDataViewListModelNotifier::RowInserted( size_t before )
-{
- return false;
-}
+//-----------------------------------------------------------------------------
+// wxDataViewMainWindow
+//-----------------------------------------------------------------------------
-bool wxGenericDataViewListModelNotifier::RowDeleted( size_t row )
+class wxDataViewMainWindow: public wxWindow
{
- return false;
-}
+public:
+ wxDataViewMainWindow( wxDataViewCtrl *parent,
+ wxWindowID id,
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ const wxString &name = wxT("wxdataviewctrlmainwindow") );
+ ~wxDataViewMainWindow();
-bool wxGenericDataViewListModelNotifier::RowChanged( size_t row )
-{
- return true;
-}
+ // notifications from wxDataViewListModel
+ bool RowAppended();
+ bool RowPrepended();
+ bool RowInserted( size_t before );
+ bool RowDeleted( size_t row );
+ bool RowChanged( size_t row );
+ bool ValueChanged( size_t col, size_t row );
+ bool RowsReordered( size_t *new_order );
+ bool Cleared();
-bool wxGenericDataViewListModelNotifier::ValueChanged( size_t model_col, size_t model_row )
-{
- wxNode *node = GetOwner()->m_viewingColumns.GetFirst();
- while (node)
- {
- wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
- if (viewing_column->m_modelColumn == model_col)
- {
-
- }
+ void SetOwner( wxDataViewCtrl* owner ) { m_owner = owner; }
+ wxDataViewCtrl *GetOwner() { return m_owner; }
- node = node->GetNext();
- }
+ void OnPaint( wxPaintEvent &event );
+ void OnMouse( wxMouseEvent &event );
+ void OnSetFocus( wxFocusEvent &event );
- return false;
-}
-
-bool wxGenericDataViewListModelNotifier::RowsReordered( size_t *new_order )
-{
- wxNode *node = GetOwner()->m_viewingColumns.GetFirst();
- while (node)
- {
- wxDataViewViewingColumn* viewing_column = (wxDataViewViewingColumn*) node->GetData();
-
- node = node->GetNext();
- }
+ void UpdateDisplay();
+ void RecalculateDisplay();
+ void OnInternalIdle();
- return false;
-}
+ void ScrollWindow( int dx, int dy, const wxRect *rect );
+private:
+ wxDataViewCtrl *m_owner;
+ int m_lineHeight;
+ bool m_dirty;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow)
+ DECLARE_EVENT_TABLE()
+};
-bool wxGenericDataViewListModelNotifier::Cleared()
+// ---------------------------------------------------------
+// wxGenericDataViewListModelNotifier
+// ---------------------------------------------------------
+
+class wxGenericDataViewListModelNotifier: public wxDataViewListModelNotifier
{
- return false;
-}
+public:
+ wxGenericDataViewListModelNotifier( wxDataViewMainWindow *mainWindow )
+ { m_mainWindow = mainWindow; }
+
+ virtual bool RowAppended()
+ { return m_mainWindow->RowAppended(); }
+ virtual bool RowPrepended()
+ { return m_mainWindow->RowPrepended(); }
+ virtual bool RowInserted( size_t before )
+ { return m_mainWindow->RowInserted( before ); }
+ virtual bool RowDeleted( size_t row )
+ { return m_mainWindow->RowDeleted( row ); }
+ virtual bool RowChanged( size_t row )
+ { return m_mainWindow->RowChanged( row ); }
+ virtual bool ValueChanged( size_t col, size_t row )
+ { return m_mainWindow->ValueChanged( col, row ); }
+ virtual bool RowsReordered( size_t *new_order )
+ { return m_mainWindow->RowsReordered( new_order ); }
+ virtual bool Cleared()
+ { return m_mainWindow->Cleared(); }
+
+ wxDataViewMainWindow *m_mainWindow;
+};
// ---------------------------------------------------------
// wxDataViewCell
// wxDataViewHeaderWindow
//-----------------------------------------------------------------------------
-class wxDataViewHeaderWindow: public wxWindow
-{
-public:
- wxDataViewHeaderWindow( wxDataViewCtrl *parent,
- wxWindowID id,
- const wxPoint &pos = wxDefaultPosition,
- const wxSize &size = wxDefaultSize,
- const wxString &name = wxT("wxdataviewctrlheaderwindow") );
- ~wxDataViewHeaderWindow();
-
- void SetOwner( wxDataViewCtrl* owner ) { m_owner = owner; }
- wxDataViewCtrl *GetOwner() { return m_owner; }
-
- void OnPaint( wxPaintEvent &event );
- void OnMouse( wxMouseEvent &event );
- void OnSetFocus( wxFocusEvent &event );
-
-private:
- wxDataViewCtrl *m_owner;
- wxCursor *m_resizeCursor;
-
-private:
- DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindow)
- DECLARE_EVENT_TABLE()
-};
-
IMPLEMENT_ABSTRACT_CLASS(wxDataViewHeaderWindow, wxWindow)
BEGIN_EVENT_TABLE(wxDataViewHeaderWindow,wxWindow)
// wxDataViewMainWindow
//-----------------------------------------------------------------------------
-class wxDataViewMainWindow: public wxWindow
-{
-public:
- wxDataViewMainWindow( wxDataViewCtrl *parent,
- wxWindowID id,
- const wxPoint &pos = wxDefaultPosition,
- const wxSize &size = wxDefaultSize,
- const wxString &name = wxT("wxdataviewctrlmainwindow") );
- ~wxDataViewMainWindow();
-
- void SetOwner( wxDataViewCtrl* owner ) { m_owner = owner; }
- wxDataViewCtrl *GetOwner() { return m_owner; }
-
- void OnPaint( wxPaintEvent &event );
- void OnMouse( wxMouseEvent &event );
- void OnSetFocus( wxFocusEvent &event );
-
- void UpdateDisplay();
- void RecalculateDisplay();
- void OnInternalIdle();
-
- void ScrollWindow( int dx, int dy, const wxRect *rect );
-private:
- wxDataViewCtrl *m_owner;
- int m_lineHeight;
- bool m_dirty;
-
-private:
- DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow)
- DECLARE_EVENT_TABLE()
-};
-
IMPLEMENT_ABSTRACT_CLASS(wxDataViewMainWindow, wxWindow)
BEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow)
{
}
+bool wxDataViewMainWindow::RowAppended()
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::RowPrepended()
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::RowInserted( size_t before )
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::RowDeleted( size_t row )
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::RowChanged( size_t row )
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::ValueChanged( size_t col, size_t row )
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::RowsReordered( size_t *new_order )
+{
+ return false;
+}
+
+bool wxDataViewMainWindow::Cleared()
+{
+ return false;
+}
+
void wxDataViewMainWindow::UpdateDisplay()
{
m_dirty = true;
if (!wxDataViewCtrlBase::AssociateModel( model ))
return false;
- m_notifier = new wxGenericDataViewListModelNotifier( model );
+ m_notifier = new wxGenericDataViewListModelNotifier( m_clientArea );
model->AddNotifier( m_notifier );