From 8c2654ce3d3db6e87cc0a33f3f38eb2f5bf95134 Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@bullseye.com>
Date: Tue, 20 Jan 2009 17:50:51 +0000
Subject: [PATCH] build fixes and cleanup

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/dataview.h         | 25 +++++----
 include/wx/gtk/dataview.h     |  1 +
 samples/dataview/dataview.cpp | 53 +++++++++----------
 src/common/datavcmn.cpp       | 97 +++++++++++++++++------------------
 src/gtk/dataview.cpp          | 72 ++++++++++++--------------
 5 files changed, 119 insertions(+), 129 deletions(-)

diff --git a/include/wx/dataview.h b/include/wx/dataview.h
index 2437dac427..a4213bd6d1 100644
--- a/include/wx/dataview.h
+++ b/include/wx/dataview.h
@@ -16,23 +16,22 @@
 
 #if wxUSE_DATAVIEWCTRL
 
-#include "wx/control.h"
 #include "wx/textctrl.h"
 #include "wx/headercol.h"
 #include "wx/variant.h"
 #include "wx/dynarray.h"
 #include "wx/icon.h"
-#include "wx/imaglist.h"
 #include "wx/weakref.h"
 #include "wx/vector.h"
+#include "wx/dataobj.h"
+
+class WXDLLIMPEXP_FWD_CORE wxImageList;
 
 #if !(defined(__WXGTK20__) || defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
 // #if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
     #define wxHAS_GENERIC_DATAVIEWCTRL
 #endif
 
-class WXDLLIMPEXP_FWD_CORE wxDataFormat;
-
 // ----------------------------------------------------------------------------
 // wxDataViewCtrl flags
 // ----------------------------------------------------------------------------
@@ -713,7 +712,7 @@ public:
                                 const wxDataViewColumn *column = NULL ) = 0;
     virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
     virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
-    
+
     virtual bool EnableDragSource( const wxDataFormat &format );
     virtual bool EnableDropTarget( const wxDataFormat &format );
 
@@ -787,7 +786,7 @@ public:
     // For drag operations
     void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; }
     wxDataObject *GetDataObject() const { return m_dataObject; }
-    
+
     // For drop operations
     void SetDataFormat( const wxDataFormat &format ) { m_dataFormat = format; }
     wxDataFormat GetDataFormat() const { return m_dataFormat; }
@@ -805,9 +804,9 @@ protected:
     wxVariant           m_value;
     wxDataViewColumn   *m_column;
     wxPoint             m_pos;
-    
+
     wxDataObject       *m_dataObject;
-    
+
     wxDataFormat        m_dataFormat;
     void*               m_dataBuffer;
     size_t              m_dataSize;
@@ -954,9 +953,9 @@ public:
         { if (m_data) delete m_data; m_data = data; }
     wxClientData *GetData() const
         { return m_data; }
-        
+
     wxVector<wxVariant>  m_values;
-    
+
 private:
     wxClientData    *m_data;
 };
@@ -971,7 +970,7 @@ public:
     void PrependColumn( const wxString &varianttype );
     void InsertColumn( unsigned int pos, const wxString &varianttype );
     void AppendColumn( const wxString &varianttype );
-    
+
     void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
     void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
     void InsertItem(  unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL );
@@ -990,7 +989,7 @@ public:
     virtual bool SetValueByRow( const wxVariant &value,
                            unsigned int row, unsigned int col );
 
-    
+
 public:
     wxVector<wxDataViewListStoreLine*> m_data;
     wxArrayString                      m_cols;
@@ -1021,7 +1020,7 @@ public:
     bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
     bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
     bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype );
-                    
+
     // overridden from base class
     virtual bool PrependColumn( wxDataViewColumn *col );
     virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
diff --git a/include/wx/gtk/dataview.h b/include/wx/gtk/dataview.h
index 1418915ef3..f08f50f26d 100644
--- a/include/wx/gtk/dataview.h
+++ b/include/wx/gtk/dataview.h
@@ -431,6 +431,7 @@ public:
     virtual bool IsExpanded( const wxDataViewItem & item ) const;
 
     virtual bool EnableDragSource( const wxDataFormat &format );
+    virtual bool EnableDropTarget( const wxDataFormat &format );
 
     static wxVisualAttributes
     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp
index 726bfb0745..d59ca05770 100644
--- a/samples/dataview/dataview.cpp
+++ b/samples/dataview/dataview.cpp
@@ -20,14 +20,14 @@
     #include "wx/wx.h"
 #endif
 
+#include "wx/dataview.h"
 #include "wx/datetime.h"
 #include "wx/splitter.h"
 #include "wx/aboutdlg.h"
 #include "wx/choicdlg.h"
 #include "wx/numdlg.h"
-#include "wx/dataview.h"
 #include "wx/spinctrl.h"
-#include "wx/menu.h"
+#include "wx/imaglist.h"
 
 #ifndef __WXMSW__
     #include "../sample.xpm"
@@ -65,9 +65,6 @@ static const char *small1_xpm[] = {
 };
 
 
-#define DEFAULT_ALIGN                   wxALIGN_LEFT
-#define DATAVIEW_DEFAULT_STYLE          (wxDV_MULTIPLE|wxDV_HORIZ_RULES|wxDV_VERT_RULES)
-
 // -------------------------------------
 // MyMusicModel
 // -------------------------------------
@@ -668,7 +665,7 @@ public:
     void OnRightClick( wxMouseEvent &event );
     void OnGoto( wxCommandEvent &event);
     void OnAddMany( wxCommandEvent &event);
-    
+
     void OnBeginDrag( wxDataViewEvent &event );
     void OnDropPossible( wxDataViewEvent &event );
     void OnDrop( wxDataViewEvent &event );
@@ -767,7 +764,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL, MyFrame::OnSorted)
 
     EVT_DATAVIEW_ITEM_CONTEXT_MENU(ID_MUSIC_CTRL, MyFrame::OnContextMenu)
-    
+
     EVT_DATAVIEW_ITEM_BEGIN_DRAG( ID_MUSIC_CTRL, MyFrame::OnBeginDrag )
     EVT_DATAVIEW_ITEM_DROP_POSSIBLE( ID_MUSIC_CTRL, MyFrame::OnDropPossible )
     EVT_DATAVIEW_ITEM_DROP( ID_MUSIC_CTRL, MyFrame::OnDrop )
@@ -795,7 +792,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
 
     SetMenuBar(menu_bar);
     CreateStatusBar();
-    
+
     wxPanel *panel = new wxPanel( this, -1 );
 
     wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
@@ -809,7 +806,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
 
     m_music_model = new MyMusicModel;
     m_musicCtrl->AssociateModel( m_music_model.get() );
-    
+
     m_musicCtrl->EnableDragSource( wxDF_TEXT );
     m_musicCtrl->EnableDropTarget( wxDF_TEXT );
 
@@ -901,25 +898,25 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
     bottom_sizer->Add( m_log, 1, wxGROW );
 
     // wxDataViewListCtrl
-    
+
     wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( panel, -1,
         wxDefaultPosition, wxSize(100,200) );
-        
+
     listctrl->AppendToggleColumn( wxT("Toggle") );
     listctrl->AppendTextColumn( wxT("Text") );
-    
+
     wxVector<wxVariant> data;
     data.push_back( true );
     data.push_back( "row 1" );
     listctrl->AppendItem( data );
-    
+
     data.clear();
     data.push_back( false );
     data.push_back( "row 3" );
     listctrl->AppendItem( data );
-    
+
     bottom_sizer->Add( listctrl, 1 );
-    
+
 
     // wxDataViewTreeCtrl
 
@@ -930,9 +927,9 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
     treectrl2->SetImageList( ilist );
 
     wxDataViewItem parent2 = treectrl2->AppendContainer( wxDataViewItem(0),wxT("Root 1"), 0 );
-    wxDataViewItem child2 = treectrl2->AppendItem( parent2, wxT("Child 1"), 0 );
-    child2 = treectrl2->AppendItem( parent2, wxT("Child 2"), 0 );
-    child2 = treectrl2->AppendItem( parent2, wxT("Child 3, very long, long, long, long"), 0 );
+    treectrl2->AppendItem( parent2, wxT("Child 1"), 0 );
+    treectrl2->AppendItem( parent2, wxT("Child 2"), 0 );
+    treectrl2->AppendItem( parent2, wxT("Child 3, very long, long, long, long"), 0 );
 
     bottom_sizer->Add( treectrl2, 1 );
 
@@ -1006,9 +1003,9 @@ void MyFrame::OnActivated( wxDataViewEvent &event )
 
     wxString title = m_music_model->GetTitle( event.GetItem() );
     wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item: %s"), title );
-    
+
     if (m_musicCtrl->IsExpanded( event.GetItem() ))
-    wxLogMessage(wxT("Item: %s is expanded"), title );
+        wxLogMessage(wxT("Item: %s is expanded"), title );
 }
 
 void MyFrame::OnSelectionChanged( wxDataViewEvent &event )
@@ -1163,14 +1160,14 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
 void MyFrame::OnBeginDrag( wxDataViewEvent &event )
 {
     wxDataViewItem item( event.GetItem() );
-        
+
     // only allow drags for item, not containers
     if (m_music_model->IsContainer( item ) )
     {
         event.Veto();
         return;
     }
-    
+
     MyMusicModelNode *node = (MyMusicModelNode*) item.GetID();
     wxTextDataObject *obj = new wxTextDataObject;
     obj->SetText( node->m_title );
@@ -1180,11 +1177,11 @@ void MyFrame::OnBeginDrag( wxDataViewEvent &event )
 void MyFrame::OnDropPossible( wxDataViewEvent &event )
 {
     wxDataViewItem item( event.GetItem() );
-        
+
     // only allow drags for item, not containers
     if (m_music_model->IsContainer( item ) )
         event.Veto();
-    
+
     if (event.GetDataFormat() != wxDF_TEXT)
         event.Veto();
 }
@@ -1192,23 +1189,23 @@ void MyFrame::OnDropPossible( wxDataViewEvent &event )
 void MyFrame::OnDrop( wxDataViewEvent &event )
 {
     wxDataViewItem item( event.GetItem() );
-        
+
     // only allow drops for item, not containers
     if (m_music_model->IsContainer( item ) )
     {
         event.Veto();
         return;
     }
-    
+
     if (event.GetDataFormat() != wxDF_TEXT)
     {
         event.Veto();
         return;
     }
-        
+
     wxTextDataObject obj;
     obj.SetData( wxDF_TEXT, event.GetDataSize(), event.GetDataBuffer() );
-    
+
     wxLogMessage(wxT("Text dropped: %s"), obj.GetText() );
 }
 
diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp
index 39d6ba8b8e..386f529720 100644
--- a/src/common/datavcmn.cpp
+++ b/src/common/datavcmn.cpp
@@ -18,20 +18,17 @@
 #if wxUSE_DATAVIEWCTRL
 
 #include "wx/dataview.h"
-#include "wx/spinctrl.h"
-#include "wx/choice.h"
-
-#include "wx/weakref.h"
-#include "wx/vector.h"
 
 #ifndef WX_PRECOMP
     #include "wx/dc.h"
     #include "wx/settings.h"
     #include "wx/log.h"
-    #include "wx/icon.h"
     #include "wx/crt.h"
 #endif
 
+#include "wx/spinctrl.h"
+#include "wx/imaglist.h"
+
 const char wxDataViewCtrlNameStr[] = "dataviewCtrl";
 
 
@@ -909,11 +906,11 @@ bool wxDataViewCtrlBase::EnableDropTarget( const wxDataFormat &WXUNUSED(format)
 void wxDataViewCtrlBase::ExpandAncestors( const wxDataViewItem & item )
 {
     if (!m_model) return;
-    
+
     if (!item.IsOk()) return;
 
     wxVector<wxDataViewItem> parentChain;
-    
+
     // at first we get all the parents of the selected item
     wxDataViewItem parent = m_model->GetParent(item);
     while (parent.IsOk())
@@ -921,7 +918,7 @@ void wxDataViewCtrlBase::ExpandAncestors( const wxDataViewItem & item )
         parentChain.push_back(parent);
         parent = m_model->GetParent(parent);
     }
-    
+
     // then we expand the parents, starting at the root
     while (!parentChain.empty())
     {
@@ -1408,13 +1405,13 @@ wxString wxDataViewListStore::GetColumnType( unsigned int pos ) const
 {
     return m_cols[pos];
 }
-    
+
 void wxDataViewListStore::AppendItem( const wxVector<wxVariant> &values, wxClientData *data )
 {
     wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
     line->m_values = values;
     m_data.push_back( line );
-    
+
     RowAppended();
 }
 
@@ -1423,7 +1420,7 @@ void wxDataViewListStore::PrependItem( const wxVector<wxVariant> &values, wxClie
     wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
     line->m_values = values;
     m_data.insert( m_data.begin(), line );
-    
+
     RowPrepended();
 }
 
@@ -1432,7 +1429,7 @@ void wxDataViewListStore::InsertItem(  unsigned int row, const wxVector<wxVarian
     wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
     line->m_values = values;
     m_data.insert( m_data.begin()+row, line );
-    
+
     RowInserted( row );
 }
 
@@ -1440,7 +1437,7 @@ void wxDataViewListStore::DeleteItem( unsigned row )
 {
     wxVector<wxDataViewListStoreLine*>::iterator it = m_data.begin() + row;
     m_data.erase( it );
-    
+
     RowDeleted( row );
 }
 
@@ -1452,7 +1449,7 @@ void wxDataViewListStore::DeleteAllItems()
         wxDataViewListStoreLine* line = *it;
         delete line;
     }
-    
+
     Reset( 0 );
 }
 
@@ -1466,7 +1463,7 @@ bool wxDataViewListStore::SetValueByRow( const wxVariant &value, unsigned int ro
 {
     wxDataViewListStoreLine *line = m_data[row];
     line->m_values[col] = value;
-    
+
     return true;
 }
 
@@ -1539,18 +1536,18 @@ bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *col )
 {
     return AppendColumn( col, "string" );
 }
-                    
+
 wxDataViewColumn *wxDataViewListCtrl::AppendTextColumn( const wxString &label, 
           wxDataViewCellMode mode, int width, wxAlignment align, int flags )
 {
     GetStore()->AppendColumn( wxT("string") );
-    
+
     wxDataViewColumn *ret = new wxDataViewColumn( label,
         new wxDataViewTextRenderer( wxT("string"), mode ),
         GetStore()->GetColumnCount()-1, width, align, flags );
-        
+
     wxDataViewCtrl::AppendColumn( ret );
-    
+
     return ret;
 }
 
@@ -1558,13 +1555,13 @@ wxDataViewColumn *wxDataViewListCtrl::AppendToggleColumn( const wxString &label,
           wxDataViewCellMode mode, int width, wxAlignment align, int flags )
 {
     GetStore()->AppendColumn( wxT("bool") );
-    
+
     wxDataViewColumn *ret = new wxDataViewColumn( label,
         new wxDataViewToggleRenderer( wxT("bool"), mode ),
         GetStore()->GetColumnCount()-1, width, align, flags );
-        
+
     wxDataViewCtrl::AppendColumn( ret );
-    
+
     return ret;
 }
 
@@ -1572,13 +1569,13 @@ wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &labe
           wxDataViewCellMode mode, int width, wxAlignment align, int flags )
 {
     GetStore()->AppendColumn( wxT("long") );
-    
+
     wxDataViewColumn *ret = new wxDataViewColumn( label,
         new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ),
         GetStore()->GetColumnCount()-1, width, align, flags );
-        
+
     wxDataViewCtrl::AppendColumn( ret );
-    
+
     return ret;
 }
 
@@ -1586,13 +1583,13 @@ wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &labe
           wxDataViewCellMode mode, int width, wxAlignment align, int flags )
 {
     GetStore()->AppendColumn( wxT("wxDataViewIconText") );
-    
+
     wxDataViewColumn *ret = new wxDataViewColumn( label,
         new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ),
         GetStore()->GetColumnCount()-1, width, align, flags );
-        
+
     wxDataViewCtrl::AppendColumn( ret );
-    
+
     return ret;
 }
 
@@ -1738,11 +1735,11 @@ wxDataViewTreeStore::InsertContainer(const wxDataViewItem& parent,
 {
     wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent );
     if (!parent_node) return wxDataViewItem(0);
-    
+
     wxDataViewTreeStoreNode *previous_node = FindNode( previous );
     int pos = parent_node->GetChildren().IndexOf( previous_node );
     if (pos == wxNOT_FOUND) return wxDataViewItem(0);
-    
+
     wxDataViewTreeStoreContainerNode *node =
         new wxDataViewTreeStoreContainerNode( parent_node, text, icon, expanded, data );
     parent_node->GetChildren().Insert( (size_t) pos, node );
@@ -2054,9 +2051,9 @@ wxDataViewItem wxDataViewTreeCtrl::AppendItem( const wxDataViewItem& parent,
         icon = m_imageList->GetIcon( iconIndex );
 
     wxDataViewItem res = GetStore()->AppendItem( parent, text, icon, data );
-    
+
     GetStore()->ItemAdded( parent, res );
-    
+
     return res;
 }
 
@@ -2068,9 +2065,9 @@ wxDataViewItem wxDataViewTreeCtrl::PrependItem( const wxDataViewItem& parent,
         icon = m_imageList->GetIcon( iconIndex );
 
     wxDataViewItem res = GetStore()->PrependItem( parent, text, icon, data );
-    
+
     GetStore()->ItemAdded( parent, res );
-    
+
     return res;
 }
 
@@ -2082,9 +2079,9 @@ wxDataViewItem wxDataViewTreeCtrl::InsertItem( const wxDataViewItem& parent, con
         icon = m_imageList->GetIcon( iconIndex );
 
     wxDataViewItem res = GetStore()->InsertItem( parent, previous, text, icon, data );
-    
+
     GetStore()->ItemAdded( parent, res );
-    
+
     return res;
 }
 
@@ -2100,9 +2097,9 @@ wxDataViewItem wxDataViewTreeCtrl::PrependContainer( const wxDataViewItem& paren
         expanded = m_imageList->GetIcon( expandedIndex );
 
     wxDataViewItem res = GetStore()->PrependContainer( parent, text, icon, expanded, data );
-    
+
     GetStore()->ItemAdded( parent, res );
-    
+
     return res;
 }
 
@@ -2118,9 +2115,9 @@ wxDataViewItem wxDataViewTreeCtrl::AppendContainer( const wxDataViewItem& parent
         expanded = m_imageList->GetIcon( expandedIndex );
 
     wxDataViewItem res = GetStore()->AppendContainer( parent, text, icon, expanded, data );
-    
+
     GetStore()->ItemAdded( parent, res );
-    
+
     return res;
 }
 
@@ -2136,16 +2133,16 @@ wxDataViewItem wxDataViewTreeCtrl::InsertContainer( const wxDataViewItem& parent
         expanded = m_imageList->GetIcon( expandedIndex );
 
     wxDataViewItem res = GetStore()->InsertContainer( parent, previous, text, icon, expanded, data );
-    
+
     GetStore()->ItemAdded( parent, res );
-    
+
     return res;
 }
 
 void wxDataViewTreeCtrl::SetItemText( const wxDataViewItem& item, const wxString &text )
 { 
     GetStore()->SetItemText(item,text);
-    
+
     // notify control
     GetStore()->ValueChanged( item, 0 );
 }
@@ -2153,7 +2150,7 @@ void wxDataViewTreeCtrl::SetItemText( const wxDataViewItem& item, const wxString
 void wxDataViewTreeCtrl::SetItemIcon( const wxDataViewItem& item, const wxIcon &icon )
 { 
     GetStore()->SetItemIcon(item,icon);
-    
+
     // notify control
     GetStore()->ValueChanged( item, 0 );
 }
@@ -2161,7 +2158,7 @@ void wxDataViewTreeCtrl::SetItemIcon( const wxDataViewItem& item, const wxIcon &
 void wxDataViewTreeCtrl::SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon )
 { 
     GetStore()->SetItemExpandedIcon(item,icon);
-    
+
     // notify control
     GetStore()->ValueChanged( item, 0 );
 }
@@ -2171,7 +2168,7 @@ void wxDataViewTreeCtrl::DeleteItem( const wxDataViewItem& item )
     wxDataViewItem parent_item = GetStore()->GetParent( item );
 
     GetStore()->DeleteItem(item);
-    
+
     // notify control
     GetStore()->ItemDeleted( parent_item, item );
 }
@@ -2198,7 +2195,7 @@ void wxDataViewTreeCtrl::DeleteChildren( const wxDataViewItem& item )
 void  wxDataViewTreeCtrl::DeleteAllItems()
 { 
     GetStore()->DeleteAllItems();
-    
+
     GetStore()->Cleared();
 }
 
@@ -2210,7 +2207,7 @@ void wxDataViewTreeCtrl::OnExpanded( wxDataViewEvent &event )
     if (!container) return;
 
     container->SetExpanded( true );
-    
+
     GetStore()->ItemChanged( event.GetItem() );
 }
 
@@ -2222,7 +2219,7 @@ void wxDataViewTreeCtrl::OnCollapsed( wxDataViewEvent &event )
     if (!container) return;
 
     container->SetExpanded( false );
-    
+
     GetStore()->ItemChanged( event.GetItem() );
 }
 
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 5c9c64c115..53944136d0 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -20,10 +20,7 @@
     #include "wx/log.h"
     #include "wx/dcclient.h"
     #include "wx/sizer.h"
-    #include "wx/icon.h"
-    #include "wx/list.h"
     #include "wx/settings.h"
-    #include "wx/dataobj.h"
     #include "wx/crt.h"
 #endif
 
@@ -39,9 +36,7 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
-class wxDataViewCtrlInternal;
-
-wxDataViewCtrlInternal *g_internal = NULL;
+static wxDataViewCtrlInternal *gs_internal = NULL;
 
 class wxGtkTreeModelNode;
 
@@ -56,7 +51,7 @@ typedef struct _GtkWxTreeModel       GtkWxTreeModel;
 WX_DECLARE_LIST(wxDataViewItem, ItemList);
 WX_DEFINE_LIST(ItemList)
 
-class wxDataViewCtrlInternal
+class WXDLLIMPEXP_ADV wxDataViewCtrlInternal
 {
 public:
     wxDataViewCtrlInternal( wxDataViewCtrl *owner, wxDataViewModel *wx_model, GtkWxTreeModel *gtk_model );
@@ -74,10 +69,10 @@ public:
     gboolean iter_parent( GtkTreeIter *iter, GtkTreeIter *child );
 
     // dnd iface
-   
+
     bool EnableDragSource( const wxDataFormat &format );
     bool EnableDropTarget( const wxDataFormat &format );
-    
+
     gboolean row_draggable( GtkTreeDragSource *drag_source, GtkTreePath *path );
     gboolean drag_data_delete( GtkTreeDragSource *drag_source, GtkTreePath* path );
     gboolean drag_data_get( GtkTreeDragSource *drag_source, GtkTreePath *path,
@@ -128,11 +123,11 @@ private:
     GtkSortType           m_sort_order;
     wxDataViewColumn     *m_dataview_sort_column;
     int                   m_sort_column;
-    
+
     GtkTargetEntry        m_dragSourceTargetEntry;
     wxCharBuffer          m_dragSourceTargetEntryTarget;
     wxDataObject         *m_dragDataObject;
-    
+
     GtkTargetEntry        m_dropTargetTargetEntry;
     wxCharBuffer          m_dropTargetTargetEntryTarget;
     wxDataObject         *m_dropDataObject;
@@ -143,10 +138,11 @@ private:
 // wxGtkTreeModelNode
 //-----------------------------------------------------------------------------
 
+static
 int LINKAGEMODE wxGtkTreeModelChildCmp( void** id1, void** id2 )
 {
-    int ret = g_internal->GetDataViewModel()->Compare( *id1, *id2,
-        g_internal->GetSortColumn(), (g_internal->GetSortOrder() == GTK_SORT_ASCENDING) );
+    int ret = gs_internal->GetDataViewModel()->Compare( *id1, *id2,
+        gs_internal->GetSortColumn(), (gs_internal->GetSortOrder() == GTK_SORT_ASCENDING) );
 
     return ret;
 }
@@ -186,7 +182,7 @@ public:
 
             if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare())
             {
-                g_internal = m_internal;
+                gs_internal = m_internal;
                 m_children.Sort( &wxGtkTreeModelChildCmp );
                 return m_children.Index( id );
             }
@@ -200,7 +196,7 @@ public:
 
             if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare())
             {
-                g_internal = m_internal;
+                gs_internal = m_internal;
                 m_children.Sort( &wxGtkTreeModelChildCmp );
                 return m_children.Index( id );
             }
@@ -2836,7 +2832,7 @@ void wxGtkTreeModelNode::Resort()
     wxGtkTreeModelChildren temp;
     WX_APPEND_ARRAY( temp, m_children );
 
-    g_internal = m_internal;
+    gs_internal = m_internal;
     m_children.Sort( &wxGtkTreeModelChildCmp );
 
     gint *new_order = new gint[child_count];
@@ -2884,7 +2880,7 @@ wxDataViewCtrlInternal::wxDataViewCtrlInternal( wxDataViewCtrl *owner,
     m_sort_order = GTK_SORT_ASCENDING;
     m_sort_column = -1;
     m_dataview_sort_column = NULL;
-    
+
     m_dragDataObject = NULL;
     m_dropDataObject = NULL;
 
@@ -2895,7 +2891,7 @@ wxDataViewCtrlInternal::wxDataViewCtrlInternal( wxDataViewCtrl *owner,
 wxDataViewCtrlInternal::~wxDataViewCtrlInternal()
 {
     g_object_unref( m_gtk_model );
-    
+
     delete m_dragDataObject;
     delete m_dropDataObject;
 }
@@ -2935,14 +2931,14 @@ bool wxDataViewCtrlInternal::EnableDragSource( const wxDataFormat &format )
 {
     wxGtkString atom_str( gdk_atom_name( format  ) );
     m_dragSourceTargetEntryTarget = wxCharBuffer( atom_str );
-    
+
     m_dragSourceTargetEntry.target =  m_dragSourceTargetEntryTarget.data();
     m_dragSourceTargetEntry.flags = 0;
     m_dragSourceTargetEntry.info = static_cast<guint>(-1);
-    
+
     gtk_tree_view_enable_model_drag_source( GTK_TREE_VIEW(m_owner->GtkGetTreeView() ),
        GDK_BUTTON1_MASK, &m_dragSourceTargetEntry, 1, (GdkDragAction) GDK_ACTION_COPY );
-       
+
     return true;
 }
 
@@ -2950,14 +2946,14 @@ bool wxDataViewCtrlInternal::EnableDropTarget( const wxDataFormat &format )
 {
     wxGtkString atom_str( gdk_atom_name( format  ) );
     m_dropTargetTargetEntryTarget = wxCharBuffer( atom_str );
-    
+
     m_dropTargetTargetEntry.target =  m_dragSourceTargetEntryTarget.data();
     m_dropTargetTargetEntry.flags = 0;
     m_dropTargetTargetEntry.info = static_cast<guint>(-1);
-    
+
     gtk_tree_view_enable_model_drag_dest( GTK_TREE_VIEW(m_owner->GtkGetTreeView() ),
        &m_dropTargetTargetEntry, 1, (GdkDragAction) GDK_ACTION_COPY );
-       
+
     return true;
 }
 
@@ -2965,7 +2961,7 @@ gboolean wxDataViewCtrlInternal::row_draggable( GtkTreeDragSource *WXUNUSED(drag
     GtkTreePath *path )
 {
     delete m_dragDataObject;
-    
+
     GtkTreeIter iter;
     if (!get_iter( &iter, path )) return FALSE;
     wxDataViewItem item( (void*) iter.user_data );
@@ -2976,16 +2972,16 @@ gboolean wxDataViewCtrlInternal::row_draggable( GtkTreeDragSource *WXUNUSED(drag
     event.SetModel( m_wx_model );
     if (!m_owner->HandleWindowEvent( event ))
         return FALSE;
-        
+
     if (!event.IsAllowed())
         return FALSE;
-        
+
     wxDataObject *obj = event.GetDataObject();
     if (!obj)
         return FALSE;
-    
+
     m_dragDataObject = obj;
-    
+
     return TRUE;
 }
 
@@ -3009,14 +3005,14 @@ gboolean wxDataViewCtrlInternal::drag_data_get( GtkTreeDragSource *WXUNUSED(drag
     size_t size = m_dragDataObject->GetDataSize( selection_data->target );
     if (size == 0)
         return FALSE;
-       
+
     void *buf = malloc( size );
-    
+
     gboolean res = FALSE;
     if (m_dragDataObject->GetDataHere( selection_data->target, buf ))
     {
         res = TRUE;
-    
+
         gtk_selection_data_set( selection_data, selection_data->target,
             8, (const guchar*) buf, size );
     }
@@ -3034,7 +3030,7 @@ wxDataViewCtrlInternal::drag_data_received(GtkTreeDragDest *WXUNUSED(drag_dest),
     GtkTreeIter iter;
     if (!get_iter( &iter, path )) return FALSE;
     wxDataViewItem item( (void*) iter.user_data );
-    
+
     wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP, m_owner->GetId() );
     event.SetEventObject( m_owner );
     event.SetItem( item );
@@ -3044,7 +3040,7 @@ wxDataViewCtrlInternal::drag_data_received(GtkTreeDragDest *WXUNUSED(drag_dest),
     event.SetDataBuffer( selection_data->data );
     if (!m_owner->HandleWindowEvent( event ))
         return FALSE;
-        
+
     if (!event.IsAllowed())
         return FALSE;
 
@@ -3059,7 +3055,7 @@ wxDataViewCtrlInternal::row_drop_possible(GtkTreeDragDest *WXUNUSED(drag_dest),
     GtkTreeIter iter;
     if (!get_iter( &iter, path )) return FALSE;
     wxDataViewItem item( (void*) iter.user_data );
-    
+
     wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() );
     event.SetEventObject( m_owner );
     event.SetItem( item );
@@ -3067,10 +3063,10 @@ wxDataViewCtrlInternal::row_drop_possible(GtkTreeDragDest *WXUNUSED(drag_dest),
     event.SetDataFormat( selection_data->target );
     if (!m_owner->HandleWindowEvent( event ))
         return FALSE;
-        
+
     if (!event.IsAllowed())
         return FALSE;
-    
+
     return TRUE;
 }
 
@@ -4126,7 +4122,7 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
     GtkTreePath *path = m_internal->get_path( &iter );
     bool res = gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path );
     gtk_tree_path_free( path );
-    
+
     return res;
 }
 
-- 
2.45.2