]> git.saurik.com Git - wxWidgets.git/commitdiff
Added (yet unfunctional) skeleton files fir
authorRobert Roebling <robert@roebling.de>
Mon, 20 Mar 2006 16:37:24 +0000 (16:37 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 20 Mar 2006 16:37:24 +0000 (16:37 +0000)
    generic implementation of wxDataViewCtrl.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

Makefile.in
build/bakefiles/files.bkl
include/wx/dataview.h
include/wx/generic/dataview.h [new file with mode: 0644]
src/generic/datavgen.cpp [new file with mode: 0644]
src/gtk/dataview.cpp

index a55c9c288518aa00515e38d7cc5b9e34bad6d013..c13873a1b085fcefb44e7f52a7b35ecb7d7b486a 100644 (file)
@@ -1860,6 +1860,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_GUI_HDR =  \
        wx/gtk/frame.h \
        wx/gtk/gauge.h \
        wx/gtk/gnome/gprint.h \
+       wx/gtk/gnome/gvfs.h \
        wx/gtk/listbox.h \
        wx/gtk/mdi.h \
        wx/gtk/menu.h \
@@ -2468,6 +2469,7 @@ COND_WXUNIV_0_ADVANCED_HDR =  \
        wx/dcbuffer.h \
        wx/generic/calctrl.h \
        wx/generic/datectrl.h \
+       wx/generic/dataview.h \
        wx/generic/grid.h \
        wx/generic/gridctrl.h \
        wx/generic/gridsel.h \
@@ -2504,6 +2506,7 @@ COND_WXUNIV_1_ADVANCED_HDR =  \
        wx/dcbuffer.h \
        wx/generic/calctrl.h \
        wx/generic/datectrl.h \
+       wx/generic/dataview.h \
        wx/generic/grid.h \
        wx/generic/gridctrl.h \
        wx/generic/gridsel.h \
@@ -3790,6 +3793,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS =  \
        monodll_frame.o \
        monodll_gauge.o \
        monodll_gprint.o \
+       monodll_gvfs.o \
        monodll_listbox.o \
        monodll_mdi.o \
        monodll_menu.o \
@@ -4425,6 +4429,7 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_1 =  \
 COND_WXUNIV_0___ADVANCED_SRC_OBJECTS =  \
        monodll_datavcmn.o \
        monodll_calctrl.o \
+       monodll_datavgen.o \
        monodll_datectlg.o \
        monodll_grid.o \
        monodll_gridctrl.o \
@@ -4447,6 +4452,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS =  \
 COND_WXUNIV_1___ADVANCED_SRC_OBJECTS =  \
        monodll_datavcmn.o \
        monodll_calctrl.o \
+       monodll_datavgen.o \
        monodll_datectlg.o \
        monodll_grid.o \
        monodll_gridctrl.o \
@@ -5410,6 +5416,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_1 =  \
        monolib_frame.o \
        monolib_gauge.o \
        monolib_gprint.o \
+       monolib_gvfs.o \
        monolib_listbox.o \
        monolib_mdi.o \
        monolib_menu.o \
@@ -6046,6 +6053,7 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_3 =  \
 COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_1 =  \
        monolib_datavcmn.o \
        monolib_calctrl.o \
+       monolib_datavgen.o \
        monolib_datectlg.o \
        monolib_grid.o \
        monolib_gridctrl.o \
@@ -6068,6 +6076,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_1 =  \
 COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_1 =  \
        monolib_datavcmn.o \
        monolib_calctrl.o \
+       monolib_datavgen.o \
        monolib_datectlg.o \
        monolib_grid.o \
        monolib_gridctrl.o \
@@ -7263,6 +7272,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_2 =  \
        coredll_frame.o \
        coredll_gauge.o \
        coredll_gprint.o \
+       coredll_gvfs.o \
        coredll_listbox.o \
        coredll_mdi.o \
        coredll_menu.o \
@@ -8592,6 +8602,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_3 =  \
        corelib_frame.o \
        corelib_gauge.o \
        corelib_gprint.o \
+       corelib_gvfs.o \
        corelib_listbox.o \
        corelib_mdi.o \
        corelib_menu.o \
@@ -9274,6 +9285,7 @@ COND_USE_SOSYMLINKS_1___advdll___so_symlinks_inst_cmd = rm -f \
 COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_2 =  \
        advdll_datavcmn.o \
        advdll_calctrl.o \
+       advdll_datavgen.o \
        advdll_datectlg.o \
        advdll_grid.o \
        advdll_gridctrl.o \
@@ -9296,6 +9308,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_2 =  \
 COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_2 =  \
        advdll_datavcmn.o \
        advdll_calctrl.o \
+       advdll_datavgen.o \
        advdll_datectlg.o \
        advdll_grid.o \
        advdll_gridctrl.o \
@@ -9333,6 +9346,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___advlib___depname = \
 COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_3 =  \
        advlib_datavcmn.o \
        advlib_calctrl.o \
+       advlib_datavgen.o \
        advlib_datectlg.o \
        advlib_grid.o \
        advlib_gridctrl.o \
@@ -9355,6 +9369,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_3 =  \
 COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_3 =  \
        advlib_datavcmn.o \
        advlib_calctrl.o \
+       advlib_datavgen.o \
        advlib_datectlg.o \
        advlib_grid.o \
        advlib_gridctrl.o \
@@ -11388,6 +11403,9 @@ monodll_artgtk.o: $(srcdir)/src/gtk/artgtk.cpp $(MONODLL_ODEP)
 monodll_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/gnome/gprint.cpp
 
+monodll_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(MONODLL_ODEP)
+       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+
 monodll_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(MONODLL_ODEP)
        $(CCC) -c -o $@ $(MONODLL_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
 
@@ -14709,6 +14727,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@monodll_calctrl.o: $(srcdir)/src/generic/calctrl.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/calctrl.cpp
 
+@COND_USE_GUI_1@monodll_datavgen.o: $(srcdir)/src/generic/datavgen.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/datavgen.cpp
+
 @COND_USE_GUI_1@monodll_datectlg.o: $(srcdir)/src/generic/datectlg.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/datectlg.cpp
 
@@ -15165,6 +15186,9 @@ monolib_artgtk.o: $(srcdir)/src/gtk/artgtk.cpp $(MONOLIB_ODEP)
 monolib_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/gnome/gprint.cpp
 
+monolib_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(MONOLIB_ODEP)
+       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+
 monolib_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(MONOLIB_ODEP)
        $(CCC) -c -o $@ $(MONOLIB_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
 
@@ -18486,6 +18510,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@monolib_calctrl.o: $(srcdir)/src/generic/calctrl.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/calctrl.cpp
 
+@COND_USE_GUI_1@monolib_datavgen.o: $(srcdir)/src/generic/datavgen.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/datavgen.cpp
+
 @COND_USE_GUI_1@monolib_datectlg.o: $(srcdir)/src/generic/datectlg.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/datectlg.cpp
 
@@ -19902,6 +19929,9 @@ coredll_artgtk.o: $(srcdir)/src/gtk/artgtk.cpp $(COREDLL_ODEP)
 coredll_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/gnome/gprint.cpp
 
+coredll_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(COREDLL_ODEP)
+       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+
 coredll_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(COREDLL_ODEP)
        $(CCC) -c -o $@ $(COREDLL_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
 
@@ -22668,6 +22698,9 @@ corelib_artgtk.o: $(srcdir)/src/gtk/artgtk.cpp $(CORELIB_ODEP)
 corelib_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/gnome/gprint.cpp
 
+corelib_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(CORELIB_ODEP)
+       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+
 corelib_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(CORELIB_ODEP)
        $(CCC) -c -o $@ $(CORELIB_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
 
@@ -25419,6 +25452,9 @@ advdll_datavcmn.o: $(srcdir)/src/common/datavcmn.cpp $(ADVDLL_ODEP)
 advdll_calctrl.o: $(srcdir)/src/generic/calctrl.cpp $(ADVDLL_ODEP)
        $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/calctrl.cpp
 
+advdll_datavgen.o: $(srcdir)/src/generic/datavgen.cpp $(ADVDLL_ODEP)
+       $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/datavgen.cpp
+
 advdll_datectlg.o: $(srcdir)/src/generic/datectlg.cpp $(ADVDLL_ODEP)
        $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/datectlg.cpp
 
@@ -25590,6 +25626,9 @@ advlib_datavcmn.o: $(srcdir)/src/common/datavcmn.cpp $(ADVLIB_ODEP)
 advlib_calctrl.o: $(srcdir)/src/generic/calctrl.cpp $(ADVLIB_ODEP)
        $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/calctrl.cpp
 
+advlib_datavgen.o: $(srcdir)/src/generic/datavgen.cpp $(ADVLIB_ODEP)
+       $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/datavgen.cpp
+
 advlib_datectlg.o: $(srcdir)/src/generic/datectlg.cpp $(ADVLIB_ODEP)
        $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/datectlg.cpp
 
index 9fd05f7294bf082a9c3c4b636e7ab167e6c0db9d..0c01325b7ffe2c604aabad59d3837819f2a38317 100644 (file)
@@ -2514,6 +2514,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
 <set var="ADVANCED_CMN_SRC" hints="files">
     src/common/datavcmn.cpp
     src/generic/calctrl.cpp
+    src/generic/datavgen.cpp
     src/generic/datectlg.cpp
     src/generic/grid.cpp
     src/generic/gridctrl.cpp
@@ -2539,6 +2540,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/dcbuffer.h
     wx/generic/calctrl.h
     wx/generic/datectrl.h
+    wx/generic/dataview.h
     wx/generic/grid.h
     wx/generic/gridctrl.h
     wx/generic/gridsel.h
index 331c79259b449c50a7106ed8201811d6815e27d8..a7b4ea8e778841293ef1ee17de766cd7383bced7 100644 (file)
 #include "wx/bitmap.h"
 #include "wx/variant.h"
 
+
+#if defined(__WXGTK20__)
+    // for testing
+  //  #define wxUSE_GENERICDATAVIEWCTRL 1
+#elif defined(__WXMAC__)
+    #define wxUSE_GENERICDATAVIEWCTRL 1
+#else
+    #define wxUSE_GENERICDATAVIEWCTRL 1
+#endif
+
 // ----------------------------------------------------------------------------
 // wxDataViewCtrl flags 
 // ----------------------------------------------------------------------------
@@ -293,7 +303,9 @@ protected:
     DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase)
 };
 
-#if defined(__WXGTK20__)
+#if defined(wxUSE_GENERICDATAVIEWCTRL)
+    #include "wx/generic/dataview.h"
+#elif defined(__WXGTK20__)
     #include "wx/gtk/dataview.h"
 #elif defined(__WXMAC__)
     #include "wx/mac/dataview.h"
diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h
new file mode 100644 (file)
index 0000000..51390f6
--- /dev/null
@@ -0,0 +1,233 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/generic/dataview.h
+// Purpose:     wxDataViewCtrl generic implementation header
+// Author:      Robert Roebling
+// Id:          $Id$
+// Copyright:   (c) 1998 Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __GENERICDATAVIEWCTRLH__
+#define __GENERICDATAVIEWCTRLH__
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/control.h"
+
+// --------------------------------------------------------- 
+// classes
+// --------------------------------------------------------- 
+
+class WXDLLIMPEXP_CORE wxDataViewCtrl;
+
+// --------------------------------------------------------- 
+// wxDataViewCell
+// --------------------------------------------------------- 
+
+class wxDataViewCell: public wxDataViewCellBase
+{
+public:
+    wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
+
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
+};
+    
+// --------------------------------------------------------- 
+// wxDataViewTextCell
+// --------------------------------------------------------- 
+
+class wxDataViewTextCell: public wxDataViewCell
+{
+public:
+    wxDataViewTextCell( const wxString &varianttype = wxT("string"), 
+                        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
+
+    bool SetValue( const wxVariant &value );
+    bool GetValue( wxVariant &value );
+    
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
+};
+    
+// --------------------------------------------------------- 
+// wxDataViewToggleCell
+// --------------------------------------------------------- 
+
+class wxDataViewToggleCell: public wxDataViewCell
+{
+public:
+    wxDataViewToggleCell( const wxString &varianttype = wxT("bool"), 
+                        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
+
+    bool SetValue( const wxVariant &value );
+    bool GetValue( wxVariant &value );
+    
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
+};
+    
+// --------------------------------------------------------- 
+// wxDataViewCustomCell
+// --------------------------------------------------------- 
+
+class wxDataViewCustomCell: public wxDataViewCell
+{
+public:
+    wxDataViewCustomCell( const wxString &varianttype = wxT("string"), 
+                          wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT )
+    ~wxDataViewCustomCell();
+    bool Init();
+    
+    virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
+    virtual wxSize GetSize() = 0;
+    
+    virtual bool Activate( wxRect cell,
+                           wxDataViewListModel *model, size_t col, size_t row )   
+                           { return false; }
+    
+    virtual bool LeftClick( wxPoint cursor, wxRect cell, 
+                           wxDataViewListModel *model, size_t col, size_t row )   
+                           { return false; }
+    virtual bool RightClick( wxPoint cursor, wxRect cell,
+                           wxDataViewListModel *model, size_t col, size_t row )   
+                           { return false; }
+    virtual bool StartDrag( wxPoint cursor, wxRect cell, 
+                           wxDataViewListModel *model, size_t col, size_t row )   
+                           { return false; }
+    
+    // Create DC on request
+    virtual wxDC *GetDC();
+    
+private:
+    wxDC        *m_dc;
+    
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
+};
+    
+// --------------------------------------------------------- 
+// wxDataViewProgressCell
+// --------------------------------------------------------- 
+
+class wxDataViewProgressCell: public wxDataViewCustomCell
+{
+public:
+    wxDataViewProgressCell( const wxString &label = wxEmptyString, 
+                            const wxString &varianttype = wxT("long"), 
+                            wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
+    ~wxDataViewProgressCell();
+    
+    bool SetValue( const wxVariant &value );
+    
+    virtual bool Render( wxRect cell, wxDC *dc, int state );
+    virtual wxSize GetSize();
+    
+private:
+    wxString    m_label;
+    int         m_value;
+    
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
+};
+    
+// --------------------------------------------------------- 
+// wxDataViewDateCell
+// --------------------------------------------------------- 
+
+class wxDataViewDateCell: public wxDataViewCustomCell
+{
+public:
+    wxDataViewDateCell( const wxString &varianttype = wxT("datetime"), 
+                        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
+    
+    bool SetValue( const wxVariant &value );
+    
+    virtual bool Render( wxRect cell, wxDC *dc, int state );
+    virtual wxSize GetSize();
+    virtual bool Activate( wxRect cell,
+                           wxDataViewListModel *model, size_t col, size_t row );
+    
+private:
+    wxDateTime    m_date;
+    
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
+};
+    
+// --------------------------------------------------------- 
+// wxDataViewColumn
+// --------------------------------------------------------- 
+
+class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
+{
+public:
+    wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column, int flags = 0 );
+    virtual ~wxDataViewColumn();
+
+    virtual void SetTitle( const wxString &title );
+    
+private:
+
+protected:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
+};
+
+// --------------------------------------------------------- 
+// wxDataViewCtrl
+// --------------------------------------------------------- 
+
+class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase,
+                                       public wxScrollHelperNative
+{
+public:
+    wxDataViewCtrl() : wxScrollHelperNative(this)
+    {
+        Init();
+    }
+    
+    wxDataViewCtrl( wxWindow *parent, wxWindowID id,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize, long style = 0,
+           const wxValidator& validator = wxDefaultValidator ) :
+           wxScrollHelperNative(this)
+    {
+        Create(parent, id, pos, size, style, validator );
+    }
+
+    virtual ~wxDataViewCtrl();
+
+    void Init();
+
+    bool Create(wxWindow *parent, wxWindowID id,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize, long style = 0,
+           const wxValidator& validator = wxDefaultValidator );
+
+    virtual bool AssociateModel( wxDataViewListModel *model );
+    virtual bool AppendColumn( wxDataViewColumn *col );
+    
+private:
+    wxDataViewListModelNotifier *m_notifier;
+    wxWindow                    *m_clientArea;
+    wxWindow                    *m_headerArea;
+    
+private:
+    virtual void ScrollWindow( int dx, int dy, const wxRect *rect );
+
+    // we need to return a special WM_GETDLGCODE value to process just the
+    // arrows but let the other navigation characters through
+#ifdef __WXMSW__
+    virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+#endif // __WXMSW__
+
+    WX_FORWARD_TO_SCROLL_HELPER()
+    
+private:
+    DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
+    DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
+};
+
+
+#endif // __GENERICDATAVIEWCTRLH__
diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp
new file mode 100644 (file)
index 0000000..8ec82cf
--- /dev/null
@@ -0,0 +1,644 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        datavgen.cpp
+// Purpose:     wxDataViewCtrl generic implementation
+// Author:      Robert Roebling
+// Id:          $Id$
+// Copyright:   (c) 1998 Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#include "wx/defs.h"
+
+#if wxUSE_DATAVIEWCTRL
+
+#include "wx/dataview.h"
+
+#ifdef wxUSE_GENERICDATAVIEWCTRL
+
+#include "wx/stockitem.h"
+#include "wx/dcclient.h"
+#include "wx/calctrl.h"
+#include "wx/popupwin.h"
+#include "wx/sizer.h"
+#include "wx/log.h"
+#include "wx/renderer.h"
+
+#ifdef __WXMSW__
+    #include <windows.h> // for DLGC_WANTARROWS
+    #include "wx/msw/winundef.h"
+#endif
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxDataViewCtrl;
+
+// --------------------------------------------------------- 
+// wxGenericDataViewListModelNotifier
+// --------------------------------------------------------- 
+
+class wxGenericDataViewListModelNotifier: public wxDataViewListModelNotifier
+{
+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;
+};
+
+// --------------------------------------------------------- 
+// wxGenericDataViewListModelNotifier
+// --------------------------------------------------------- 
+
+wxGenericDataViewListModelNotifier::wxGenericDataViewListModelNotifier( 
+    wxDataViewListModel *wx_model )
+{
+    m_wx_model = wx_model;
+}
+    
+bool wxGenericDataViewListModelNotifier::RowAppended()
+{
+    size_t pos = m_wx_model->GetNumberOfRows()-1;
+    
+    return false;
+}
+
+bool wxGenericDataViewListModelNotifier::RowPrepended()
+{
+    return false;
+}
+
+bool wxGenericDataViewListModelNotifier::RowInserted( size_t before )
+{
+    return false;
+}
+
+bool wxGenericDataViewListModelNotifier::RowDeleted( size_t row )
+{
+    return false;
+}
+
+bool wxGenericDataViewListModelNotifier::RowChanged( size_t row )
+{
+    return true;
+}
+
+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)
+        {
+        
+        }
+
+        node = node->GetNext();
+    }
+    
+    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();
+    }
+    
+    return false;
+}
+
+bool wxGenericDataViewListModelNotifier::Cleared()
+{
+    return false;
+}
+
+// --------------------------------------------------------- 
+// wxDataViewCell
+// --------------------------------------------------------- 
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewCell, wxDataViewCellBase)
+
+wxDataViewCell::wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode ) :
+    wxDataViewCellBase( varianttype, mode )
+{
+}
+
+// --------------------------------------------------------- 
+// wxDataViewTextCell
+// --------------------------------------------------------- 
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewTextCell, wxDataViewCell)
+
+wxDataViewTextCell::wxDataViewTextCell( const wxString &varianttype, wxDataViewCellMode mode ) :
+    wxDataViewCell( varianttype, mode )
+{
+}
+
+bool wxDataViewTextCell::SetValue( const wxVariant &value )
+{
+    return false;
+}
+
+bool wxDataViewTextCell::GetValue( wxVariant &value )
+{
+    return false;
+}
+
+// --------------------------------------------------------- 
+// wxDataViewToggleCell
+// --------------------------------------------------------- 
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleCell, wxDataViewCell)
+
+wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype, 
+                        wxDataViewCellMode mode ) :
+    wxDataViewCell( varianttype, mode )
+{
+}
+
+bool wxDataViewToggleCell::SetValue( const wxVariant &value )
+{
+    return false;
+}
+
+bool wxDataViewToggleCell::GetValue( wxVariant &value )
+{
+    return false;
+}
+    
+// --------------------------------------------------------- 
+// wxDataViewCustomCell
+// --------------------------------------------------------- 
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomCell, wxDataViewCell)
+
+wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype, 
+                          wxDataViewCellMode mode ) :
+    wxDataViewCell( varianttype, mode )
+{
+    m_dc = NULL;
+    
+    Init();
+}
+
+bool wxDataViewCustomCell::Init()
+{
+    return false;
+}
+
+wxDataViewCustomCell::~wxDataViewCustomCell()
+{
+    if (m_dc)
+        delete m_dc;
+}
+
+wxDC *wxDataViewCustomCell::GetDC()
+{
+    if (m_dc == NULL)
+    {
+        if (GetOwner() == NULL)
+            return NULL;
+        if (GetOwner()->GetOwner() == NULL)
+            return NULL;
+        m_dc = new wxClientDC( GetOwner()->GetOwner() );
+    }
+        
+    return m_dc;
+}
+    
+// --------------------------------------------------------- 
+// wxDataViewProgressCell
+// --------------------------------------------------------- 
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressCell, wxDataViewCustomCell)
+
+wxDataViewProgressCell::wxDataViewProgressCell( const wxString &label, 
+    const wxString &varianttype, wxDataViewCellMode mode ) :
+    wxDataViewCustomCell( varianttype, mode )  
+{
+    m_label = label;
+    m_value = 0;
+}
+
+wxDataViewProgressCell::~wxDataViewProgressCell()
+{
+}
+
+bool wxDataViewProgressCell::SetValue( const wxVariant &value )
+{
+    m_value = (long) value;
+    
+    if (m_value < 0) m_value = 0;
+    if (m_value > 100) m_value = 100;
+    
+    return true;
+}
+    
+bool wxDataViewProgressCell::Render( wxRect cell, wxDC *dc, int state )
+{
+    double pct = (double)m_value / 100.0;
+    wxRect bar = cell;
+    bar.width = (int)(cell.width * pct);
+    dc->SetPen( *wxTRANSPARENT_PEN );
+    dc->SetBrush( *wxBLUE_BRUSH );
+    dc->DrawRectangle( bar );
+
+    dc->SetBrush( *wxTRANSPARENT_BRUSH );
+    dc->SetPen( *wxBLACK_PEN );
+    dc->DrawRectangle( cell );
+    
+    return true;
+}
+
+wxSize wxDataViewProgressCell::GetSize()
+{
+    return wxSize(40,12);
+}
+    
+// --------------------------------------------------------- 
+// wxDataViewDateCell
+// --------------------------------------------------------- 
+
+class wxDataViewDateCellPopupTransient: public wxPopupTransientWindow
+{
+public: 
+    wxDataViewDateCellPopupTransient( wxWindow* parent, wxDateTime *value,
+        wxDataViewListModel *model, size_t col, size_t row ) :
+        wxPopupTransientWindow( parent, wxBORDER_SIMPLE )
+    {
+        m_model = model;
+        m_col = col;
+        m_row = row;
+        m_cal = new wxCalendarCtrl( this, -1, *value );
+        wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
+        sizer->Add( m_cal, 1, wxGROW );
+        SetSizer( sizer );
+        sizer->Fit( this );
+    }
+    
+    virtual void OnDismiss()
+    {
+    }
+    
+    void OnCalendar( wxCalendarEvent &event );
+    
+    wxCalendarCtrl      *m_cal;
+    wxDataViewListModel *m_model; 
+    size_t               m_col;
+    size_t               m_row;
+    
+private:
+    DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(wxDataViewDateCellPopupTransient,wxPopupTransientWindow)
+    EVT_CALENDAR( -1, wxDataViewDateCellPopupTransient::OnCalendar )
+END_EVENT_TABLE()
+
+void wxDataViewDateCellPopupTransient::OnCalendar( wxCalendarEvent &event )
+{
+    wxDateTime date = event.GetDate();
+    wxVariant value = date;
+    m_model->SetValue( value, m_col, m_row );
+    m_model->ValueChanged( m_col, m_row );
+    DismissAndNotify();
+}
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateCell, wxDataViewCustomCell)
+
+wxDataViewDateCell::wxDataViewDateCell( const wxString &varianttype,
+                        wxDataViewCellMode mode ) :
+    wxDataViewCustomCell( varianttype, mode )
+{
+}
+    
+bool wxDataViewDateCell::SetValue( const wxVariant &value )
+{
+    m_date = value.GetDateTime();
+    
+    return true;
+}
+
+bool wxDataViewDateCell::Render( wxRect cell, wxDC *dc, int state )
+{
+    dc->SetFont( GetOwner()->GetOwner()->GetFont() );
+    wxString tmp = m_date.FormatDate();
+    dc->DrawText( tmp, cell.x, cell.y );
+
+    return true;
+}
+
+wxSize wxDataViewDateCell::GetSize()
+{
+    wxDataViewCtrl* view = GetOwner()->GetOwner();
+    wxString tmp = m_date.FormatDate();
+    wxCoord x,y,d;
+    view->GetTextExtent( tmp, &x, &y, &d );
+    return wxSize(x,y+d);
+}
+
+bool wxDataViewDateCell::Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row )
+{
+    wxVariant variant;
+    model->GetValue( variant, col, row );
+    wxDateTime value = variant.GetDateTime();
+
+    wxDataViewDateCellPopupTransient *popup = new wxDataViewDateCellPopupTransient( 
+        GetOwner()->GetOwner()->GetParent(), &value, model, col, row );
+    wxPoint pos = wxGetMousePosition();
+    popup->Move( pos );
+    popup->Layout();
+    popup->Popup( popup->m_cal );
+
+    return true;
+}
+
+// --------------------------------------------------------- 
+// wxDataViewColumn
+// --------------------------------------------------------- 
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
+
+wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell, 
+    size_t model_column, int flags ) :
+    wxDataViewColumnBase( title, cell, model_column, flags )
+{
+}
+
+wxDataViewColumn::~wxDataViewColumn()
+{
+}
+
+void wxDataViewColumn::SetTitle( const wxString &title )
+{
+    wxDataViewColumnBase::SetTitle( title );
+    
+}
+
+//-----------------------------------------------------------------------------
+// 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_DYNAMIC_CLASS(wxDataViewHeaderWindow, wxWindow)
+
+BEGIN_EVENT_TABLE(wxDataViewHeaderWindow,wxWindow)
+    EVT_PAINT         (wxDataViewHeaderWindow::OnPaint)
+    EVT_MOUSE_EVENTS  (wxDataViewHeaderWindow::OnMouse)
+    EVT_SET_FOCUS     (wxDataViewHeaderWindow::OnSetFocus)
+END_EVENT_TABLE()
+
+wxDataViewHeaderWindow::wxDataViewHeaderWindow( wxDataViewCtrl *parent, wxWindowID id,
+     const wxPoint &pos, const wxSize &size, const wxString &name ) :
+    wxWindow( parent, id, pos, size, 0, name )
+{
+    SetOwner( parent );
+    
+    m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
+    
+    wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
+    SetOwnForegroundColour( attr.colFg );
+    SetOwnBackgroundColour( attr.colBg );
+    if (!m_hasFont)
+        SetOwnFont( attr.font );
+}
+
+wxDataViewHeaderWindow::~wxDataViewHeaderWindow()
+{
+    delete m_resizeCursor;
+}
+
+void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
+{
+    wxPaintDC dc;
+    PrepareDC( dc );
+    
+    int xpix;
+    m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
+
+    int x;
+    m_owner->GetViewStart( &x, NULL );
+
+    // account for the horz scrollbar offset
+    dc.SetDeviceOrigin( -x * xpix, 0 );
+    
+    dc.SetFont( GetFont() );
+    
+    dc.DrawText( wxT("This is the header..", 5, 5 );
+}
+
+void wxDataViewHeaderWindow::OnMouse( wxMouseEvent &event )
+{
+}
+
+void wxDataViewHeaderWindow::OnSetFocus( wxFocusEvent &event )
+{
+    event.Skip();
+}
+
+//-----------------------------------------------------------------------------
+// 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 );
+    
+private:
+    wxDataViewCtrl      *m_owner;
+    
+private:
+    DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow)
+    DECLARE_EVENT_TABLE()
+}
+
+IMPLEMENT_DYNAMIC_CLASS(wxDataViewMainWindow, wxWindow)
+
+BEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow)
+    EVT_PAINT         (wxDataViewMainWindow::OnPaint)
+    EVT_MOUSE_EVENTS  (wxDataViewMainWindow::OnMouse)
+    EVT_SET_FOCUS     (wxDataViewMainWindow::OnSetFocus)
+END_EVENT_TABLE()
+
+wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID id,
+    const wxPoint &pos, const wxSize &size, const wxString &name ) :
+    wxWindow( parent, id, pos, size, 0, name )
+{
+    SetOwner( parent );
+}
+
+wxDataViewMainWindow::~wxDataViewMainWindow()
+{
+}
+
+void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
+{
+    wxPaintDC dc( this );
+
+    PrepareDC( dc );
+
+    int dev_x, dev_y;
+    CalcScrolledPosition( 0, 0, &dev_x, &dev_y );
+
+    dc.SetFont( GetFont() );
+    
+    dc.DrawText( wxT("main window"), 5, 5 );
+}
+
+void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
+{
+    event.Skip();
+}
+
+void wxDataViewMainWindow::OnSetFocus( wxFocusEvent &event )
+{
+    event.Skip();
+}
+
+//-----------------------------------------------------------------------------
+// wxDataViewCtrl
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase)
+
+wxDataViewCtrl::~wxDataViewCtrl()
+{
+    if (m_notifier)
+        GetModel()->RemoveNotifier( m_notifier );
+}
+
+void wxDataViewCtrl::Init()
+{
+    m_notifier = NULL;
+}
+
+bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
+           const wxPoint& pos, const wxSize& size, 
+           long style, const wxValidator& validator )
+{
+    Init();
+    
+#ifdef __WXMAC__
+    MacSetClipChildren( true ) ;
+#endif
+
+    m_clientArea = new wxDataViewMainWindow( this, -1 );
+    m_headerArea = new wxDataViewHeaderWindow( this, -1, wxDefaultPosition, wxSize(-1,25) );
+    
+    SetTargetWindow( m_clientArea );
+    
+    wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
+    sizer->Add( m_headerArea, 0, wxGROW );
+    sizer->Add( m_clientArea, 1, wxGROW );
+    SetSizer( sizer );
+
+    return true;
+}
+
+#ifdef __WXMSW__
+WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg,
+                                       WXWPARAM wParam,
+                                       WXLPARAM lParam)
+{
+    WXLRESULT rc = wxPanel::MSWWindowProc(nMsg, wParam, lParam);
+
+#ifndef __WXWINCE__
+    // we need to process arrows ourselves for scrolling
+    if ( nMsg == WM_GETDLGCODE )
+    {
+        rc |= DLGC_WANTARROWS;
+    }
+#endif
+
+    return rc;
+}
+#endif
+
+void wxDataViewCtrl::ScrollWindow( int dx, int dy, const wxRect *rect )
+{
+    wxDataViewCtrlBase::ScrollWindow( dx, dy, rect );
+    m_headerArea->ScrollWindow( dx, 0, rect );
+}
+
+bool wxDataViewCtrl::AssociateModel( wxDataViewListModel *model )
+{
+    if (!wxDataViewCtrlBase::AssociateModel( model ))
+        return false;
+
+    m_notifier = new wxGenericDataViewListModelNotifier( model );
+
+    model->AddNotifier( m_notifier );    
+
+    return true;
+}
+
+bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
+{
+    if (!wxDataViewCtrlBase::AppendColumn(col))
+        return false;
+        
+    return true;
+}
+
+#endif 
+    // !wxUSE_GENERICDATAVIEWCTRL
+
+#endif 
+    // wxUSE_DATAVIEWCTRL
+
index 5239bad72f7f582cf1504b348b1301f0ec632432..b11b02de6539beee663213984365a20703f329b3 100644 (file)
@@ -15,6 +15,9 @@
 #if wxUSE_DATAVIEWCTRL
 
 #include "wx/dataview.h"
+
+#ifndef wxUSE_GENERICDATAVIEWCTRL
+
 #include "wx/stockitem.h"
 #include "wx/dcclient.h"
 #include "wx/calctrl.h"
@@ -1450,6 +1453,9 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
     return true;
 }
 
+#endif 
+    // !wxUSE_GENERICDATAVIEWCTRL
 
-#endif // wxUSE_DATAVIEWCTRL
+#endif 
+    // wxUSE_DATAVIEWCTRL