From b04fcede8f8f29cbade858ff81247ffbdc482d27 Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Fri, 31 Aug 2007 09:14:49 +0000
Subject: [PATCH] Added wxDataViewCtrl::AppendIconTextColumn

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dataviewctrl.tex | 10 ++++++++++
 include/wx/dataview.h          | 10 +++++++++-
 samples/dataview/dataview.cpp  |  7 ++-----
 src/common/datavcmn.cpp        | 22 ++++++++++++++++++++++
 4 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/docs/latex/wx/dataviewctrl.tex b/docs/latex/wx/dataviewctrl.tex
index 3ce51565c0..2aa0d92ec7 100644
--- a/docs/latex/wx/dataviewctrl.tex
+++ b/docs/latex/wx/dataviewctrl.tex
@@ -131,6 +131,16 @@ created in the function or NULL on failure.
 Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
 created in the function or NULL on failure.
 
+\membersection{wxDataViewCtrl::AppendIconTextColumn}\label{wxdataviewctrlappendicontextcolumn}
+
+\func{wxDataViewColumn*}{AppendIconTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
+
+\func{wxDataViewColumn*}{AppendIconTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
+
+Appends a column for rendering text with an icon. Returns the wxDataViewColumn
+created in the function or NULL on failure. This uses the 
+\helpref{wxDataViewIconTextRenderer}{wxdataviewicontextrenderer}.
+
 \membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}
 
 \func{wxDataViewColumn*}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
diff --git a/include/wx/dataview.h b/include/wx/dataview.h
index 5a1ee8b9d9..17544e7d53 100644
--- a/include/wx/dataview.h
+++ b/include/wx/dataview.h
@@ -26,7 +26,7 @@
 
 #if defined(__WXGTK20__)
     // for testing
-    #define wxUSE_GENERICDATAVIEWCTRL 1
+    // #define wxUSE_GENERICDATAVIEWCTRL 1
 #elif defined(__WXMAC__)
 #else
     #define wxUSE_GENERICDATAVIEWCTRL 1
@@ -449,6 +449,10 @@ public:
                     wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
                     wxAlignment align = wxALIGN_CENTER,
                     int flags = wxDATAVIEW_COL_RESIZABLE );
+    wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column, 
+                    wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+                    wxAlignment align = wxALIGN_CENTER,
+                    int flags = wxDATAVIEW_COL_RESIZABLE );
     wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column,
                     wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
                     wxAlignment align = wxALIGN_CENTER,
@@ -469,6 +473,10 @@ public:
                     wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
                     wxAlignment align = wxALIGN_CENTER,
                     int flags = wxDATAVIEW_COL_RESIZABLE );
+    wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column,
+                    wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
+                    wxAlignment align = wxALIGN_CENTER,
+                    int flags = wxDATAVIEW_COL_RESIZABLE );
     wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
                     wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
                     wxAlignment align = wxALIGN_CENTER,
diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp
index c55e399eb5..8b1e24f85f 100644
--- a/samples/dataview/dataview.cpp
+++ b/samples/dataview/dataview.cpp
@@ -676,11 +676,8 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
     m_listCtrl->AssociateModel( m_list_model.get() );
     
     m_listCtrl->AppendTextColumn( "editable string", 0, wxDATAVIEW_CELL_EDITABLE, 120 );
-    
-    m_col = new wxDataViewColumn( "icon", new wxDataViewIconTextRenderer, 1, 60 );
-    m_listCtrl->AppendColumn( m_col );
-    
-    m_col = m_listCtrl->AppendTextColumn( "index", 2, wxDATAVIEW_CELL_INERT, 120 );
+    m_listCtrl->AppendIconTextColumn( "icon", 1, wxDATAVIEW_CELL_INERT, 60 );
+    m_listCtrl->AppendTextColumn( "index", 2, wxDATAVIEW_CELL_INERT, 120 );
     
     data_sizer->Add( m_listCtrl, 2, wxGROW );
  
diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp
index b82a73f598..c8fc22960d 100644
--- a/src/common/datavcmn.cpp
+++ b/src/common/datavcmn.cpp
@@ -614,6 +614,17 @@ wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_
     return ret;
 }
 
+wxDataViewColumn *
+wxDataViewCtrlBase::AppendIconTextColumn( const wxString &label, unsigned int model_column,
+                            wxDataViewCellMode mode, int width, wxAlignment align, int flags )
+{
+    wxDataViewColumn *ret = new wxDataViewColumn( label,
+        new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode, (int)align ),
+        model_column, width, align, flags );
+    AppendColumn( ret );
+    return ret;
+}
+
 wxDataViewColumn *
 wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column,
                             wxDataViewCellMode mode, int width, wxAlignment align, int flags )
@@ -670,6 +681,17 @@ wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_
     return ret;
 }
 
+wxDataViewColumn *
+wxDataViewCtrlBase::AppendIconTextColumn( const wxBitmap &label, unsigned int model_column,
+                            wxDataViewCellMode mode, int width, wxAlignment align, int flags )
+{
+    wxDataViewColumn *ret = new wxDataViewColumn( label,
+        new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode, (int)align ),
+        model_column, width, align, flags );
+    AppendColumn( ret );
+    return ret;
+}
+
 wxDataViewColumn *
 wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
                             wxDataViewCellMode mode, int width, wxAlignment align, int flags )
-- 
2.50.0

