#include "wx/listimpl.cpp"
#include "wx/gtk/private.h"
+#include "wx/gtk/dc.h"
+#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, dv->GetId() );
event.SetDataViewColumn( gs_lastLeftClickHeader );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
}
gs_lastLeftClickHeader = NULL;
}
-void wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable,
- gint sort_column_id,
- GtkTreeIterCompareFunc func,
- gpointer data,
- GtkDestroyNotify destroy)
+void wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable,
+ gint WXUNUSED(sort_column_id),
+ GtkTreeIterCompareFunc func,
+ gpointer WXUNUSED(data),
+ GtkDestroyNotify WXUNUSED(destroy) )
{
g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
g_return_if_fail (func != NULL);
}
-void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable,
- GtkTreeIterCompareFunc func,
- gpointer data,
- GtkDestroyNotify destroy)
+void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable,
+ GtkTreeIterCompareFunc func,
+ gpointer WXUNUSED(data),
+ GtkDestroyNotify WXUNUSED(destroy) )
{
g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
g_return_if_fail (func != NULL);
gboolean wxgtk_tree_model_has_default_sort_func (GtkTreeSortable *sortable)
{
+ g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (sortable), FALSE );
+
return FALSE;
}
static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
GtkCellRenderer *renderer,
- GdkEvent *event,
+ GdkEvent *WXUNUSED(event),
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
+ GdkRectangle *WXUNUSED(background_area),
GdkRectangle *cell_area,
- GtkCellRendererState flags )
+ GtkCellRendererState WXUNUSED(flags) )
{
GtkWxCellRenderer *wxrenderer = (GtkWxCellRenderer *) renderer;
wxDataViewCustomRenderer *cell = wxrenderer->cell;
static void
gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer,
- GtkWidget *widget,
+ GtkWidget *WXUNUSED(widget),
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
{
wxRect renderrect( rect.x, rect.y, rect.width, rect.height );
wxWindowDC* dc = (wxWindowDC*) cell->GetDC();
-#if wxUSE_NEW_DC
- wxGTKWindowDCImpl *impldc = (wxGTKWindowDCImpl *) dc->GetImpl();
- if (impldc->m_window == NULL)
- {
- impldc->m_window = window;
- impldc->SetUpDC();
- }
-#else
- if (dc->m_window == NULL)
+ wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl();
+ if (impl->m_gdkwindow == NULL)
{
- dc->m_window = window;
- dc->SetUpDC();
+ impl->m_gdkwindow = window;
+ impl->SetUpDC();
}
-#endif
int state = 0;
if (flags & GTK_CELL_RENDERER_SELECTED)
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
+ GdkRectangle *WXUNUSED(background_area),
GdkRectangle *cell_area,
- GtkCellRendererState flags )
+ GtkCellRendererState WXUNUSED(flags) )
{
GtkWxCellRenderer *wxrenderer = (GtkWxCellRenderer *) renderer;
wxDataViewCustomRenderer *cell = wxrenderer->cell;
static gpointer s_user_data = NULL;
static void
-wxgtk_cell_editable_editing_done( GtkCellEditable *editable,
+wxgtk_cell_editable_editing_done( GtkCellEditable *WXUNUSED(editable),
wxDataViewRenderer *wxrenderer )
{
wxDataViewColumn *column = wxrenderer->GetOwner();
event.SetModel( dv->GetModel() );
wxDataViewItem item( s_user_data );
event.SetItem( item );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
}
static void
-wxgtk_renderer_editing_started( GtkCellRenderer *cell, GtkCellEditable *editable,
+wxgtk_renderer_editing_started( GtkCellRenderer *WXUNUSED(cell), GtkCellEditable *editable,
gchar *path, wxDataViewRenderer *wxrenderer )
{
wxDataViewColumn *column = wxrenderer->GetOwner();
gtk_tree_path_free( tree_path );
wxDataViewItem item( iter.user_data );
event.SetItem( item );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
if (GTK_IS_CELL_EDITABLE(editable))
{
gchar *arg1, gchar *arg2, gpointer user_data );
}
-static void wxGtkTextRendererEditedCallback( GtkCellRendererText *renderer,
+static void wxGtkTextRendererEditedCallback( GtkCellRendererText *WXUNUSED(renderer),
gchar *arg1, gchar *arg2, gpointer user_data )
{
wxDataViewTextRenderer *cell = (wxDataViewTextRenderer*) user_data;
return false;
}
-bool wxDataViewBitmapRenderer::GetValue( wxVariant &value ) const
+bool wxDataViewBitmapRenderer::GetValue( wxVariant &WXUNUSED(value) ) const
{
return false;
}
// wxDataViewCustomRenderer
// ---------------------------------------------------------
-class wxDataViewCtrlDC: public wxWindowDC
+class wxDataViewCtrlDCImpl: public wxWindowDCImpl
{
public:
- wxDataViewCtrlDC( wxDataViewCtrl *window )
- {
-#if wxUSE_NEW_DC
- wxGTKWindowDCImpl *impl = (wxGTKWindowDCImpl*) GetImpl();
-
+ wxDataViewCtrlDCImpl( wxDC *owner, wxDataViewCtrl *window ) :
+ wxWindowDCImpl( owner )
+ {
GtkWidget *widget = window->m_treeview;
// Set later
- impl->m_window = NULL;
-
- impl->m_context = window->GtkGetPangoDefaultContext();
- impl->m_layout = pango_layout_new( impl->m_context );
- impl->m_fontdesc = pango_font_description_copy( widget->style->font_desc );
-
- impl->m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
-
-#else
- GtkWidget *widget = window->m_treeview;
- // Set later
- m_window = NULL;
+ m_gdkwindow = NULL;
+
+ m_window = window;
m_context = window->GtkGetPangoDefaultContext();
m_layout = pango_layout_new( m_context );
m_fontdesc = pango_font_description_copy( widget->style->font_desc );
m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
-#endif
- // Set m_window later
+
+ // Set m_gdkwindow later
// SetUpDC();
- // m_owner = window;
}
};
+class wxDataViewCtrlDC: public wxWindowDC
+{
+public:
+ wxDataViewCtrlDC( wxDataViewCtrl *window ) :
+ wxWindowDC( new wxDataViewCtrlDCImpl( this, window ) )
+ { }
+};
+
+
// ---------------------------------------------------------
// wxDataViewCustomRenderer
// ---------------------------------------------------------
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, dv->GetId() );
event.SetDataViewColumn( column );
event.SetModel( dv->GetModel() );
- if (dv->GetEventHandler()->ProcessEvent( event ))
+ if (dv->HandleWindowEvent( event ))
return FALSE;
}
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, dv->GetId() );
event.SetDataViewColumn( column );
event.SetModel( dv->GetModel() );
- if (dv->GetEventHandler()->ProcessEvent( event ))
+ if (dv->HandleWindowEvent( event ))
return FALSE;
}
event.SetEventObject( m_owner );
event.SetModel( m_owner->GetModel() );
event.SetItem( item );
- m_owner->GetEventHandler()->ProcessEvent( event );
+ m_owner->HandleWindowEvent( event );
return true;
}
event.SetColumn( col );
event.SetDataViewColumn( GetOwner()->GetColumn(col) );
event.SetItem( item );
- m_owner->GetEventHandler()->ProcessEvent( event );
+ m_owner->HandleWindowEvent( event );
return true;
}
unsigned int i = (unsigned int)gtk_tree_path_get_indices (path)[0];
- if (i >= wx_model->GetLastIndex())
+ if (i >= wx_model->GetLastIndex() + 1)
return FALSE;
iter->stamp = m_gtk_model->stamp;
if (n == -1)
return FALSE;
- if (n >= (int) wx_model->GetLastIndex()-2)
+ if (n >= (int) wx_model->GetLastIndex())
return FALSE;
iter->user_data = (gpointer) ++n;
wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
if (iter == NULL)
- return (gint) wx_model->GetLastIndex()-1;
+ return (gint) wx_model->GetLastIndex() + 1;
return 0;
}
if (n < 0)
return FALSE;
- if (n >= (gint) wx_model->GetLastIndex()-1)
+ if (n >= (gint) wx_model->GetLastIndex() + 1)
return FALSE;
iter->stamp = m_gtk_model->stamp;
wxDataViewEvent event( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, dv->GetId() );
event.SetItem( dv->GetSelection() );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
}
static void
wxDataViewItem item( (void*) iter.user_data );;
event.SetItem( item );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
}
static gboolean
wxDataViewItem item( (void*) iter->user_data );;
event.SetItem( item );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
return !event.IsAllowed();
}
wxDataViewItem item( (void*) iter->user_data );;
event.SetItem( item );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
}
static gboolean
wxDataViewItem item( (void*) iter->user_data );;
event.SetItem( item );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
return !event.IsAllowed();
}
wxDataViewItem item( (void*) iter->user_data );;
event.SetItem( item );
event.SetModel( dv->GetModel() );
- dv->GetEventHandler()->ProcessEvent( event );
+ dv->HandleWindowEvent( event );
}
//-----------------------------------------------------------------------------
else if (style & wxDV_HORIZ_RULES)
grid = GTK_TREE_VIEW_GRID_LINES_HORIZONTAL;
- gtk_tree_view_set_grid_lines( GTK_TREE_VIEW(m_treeview), grid );
+ if (grid != GTK_TREE_VIEW_GRID_LINES_NONE)
+ gtk_tree_view_set_grid_lines( GTK_TREE_VIEW(m_treeview), grid );
}
- else
#endif
- {
- gtk_tree_view_set_rules_hint( GTK_TREE_VIEW(m_treeview), (style & wxDV_HORIZ_RULES) != 0 );
- }
+
+ gtk_tree_view_set_rules_hint( GTK_TREE_VIEW(m_treeview), (style & wxDV_ROW_LINES) != 0 );
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);