]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dataview.cpp
[ 1508778 ] Fix for wxOwnerDrawnComboBox list selection rendering.
[wxWidgets.git] / src / gtk / dataview.cpp
index 8b02377e0ef2e1c89ce8964713de5a63804b5675..9ff06f25be678ce8829f5fa6565ce5d0162452f8 100644 (file)
 
 #ifndef wxUSE_GENERICDATAVIEWCTRL
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/dcclient.h"
+    #include "wx/sizer.h"
+#endif
+
 #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/gtk/private.h"
 #include "wx/gtk/win_gtk.h"
@@ -1340,8 +1343,8 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *column,
 
 IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
 
-wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell,
-    size_t model_column, int flags ) :
+wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column,
+    int fixed_width, wxDataViewColumnSizing sizing, int flags ) :
     wxDataViewColumnBase( title, cell, model_column, flags )
 {
     GtkCellRenderer *renderer = (GtkCellRenderer *) cell->GetGtkHandle();
@@ -1350,6 +1353,16 @@ wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell,
 
     gtk_tree_view_column_set_title( column, wxGTK_CONV(title) );
 
+    if (sizing == wxDATAVIEW_COL_WIDTH_FIXED)
+        gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_FIXED );
+    else if (sizing == wxDATAVIEW_COL_WIDTH_GROW)
+        gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_GROW_ONLY );
+    else
+        gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_AUTOSIZE );
+
+    if (fixed_width > 0)
+        gtk_tree_view_column_set_fixed_width( column, fixed_width );
+
     gtk_tree_view_column_pack_start( column, renderer, TRUE );
 
     gtk_tree_view_column_set_cell_data_func( column, renderer,
@@ -1370,6 +1383,21 @@ void wxDataViewColumn::SetTitle( const wxString &title )
     gtk_tree_view_column_set_title( column, wxGTK_CONV(title) );
 }
 
+int wxDataViewColumn::GetWidth()
+{
+    return gtk_tree_view_column_get_width( (GtkTreeViewColumn *)m_column );
+}
+
+void wxDataViewColumn::SetFixedWidth( int width )
+{
+    gtk_tree_view_column_set_fixed_width( (GtkTreeViewColumn *)m_column, width );
+}
+
+int wxDataViewColumn::GetFixedWidth()
+{
+    return gtk_tree_view_column_get_fixed_width( (GtkTreeViewColumn *)m_column );
+}
+
 //-----------------------------------------------------------------------------
 // wxDataViewCtrl
 //-----------------------------------------------------------------------------
@@ -1410,6 +1438,12 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
     m_treeview = gtk_tree_view_new();
     gtk_container_add (GTK_CONTAINER (m_widget), m_treeview);
 
+    if (style & wxDV_MULTIPLE)
+    {
+        GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
+        gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
+    }
+
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
         GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
     gtk_widget_show (m_treeview);