rect.y += cell_area->y;
rect.width -= renderer->xpad * 2;
rect.height -= renderer->ypad * 2;
-
+
GdkRectangle dummy;
if (gdk_rectangle_intersect (expose_area, &rect, &dummy))
{
return ret;
}
-void wxDataViewRenderer::SetAlignment( int align )
+void wxDataViewRenderer::GtkUpdateAlignment()
{
+ int align = m_alignment;
+
+ // query alignment from column ?
+ if (align == -1)
+ {
+ // None there yet
+ if (GetOwner() == NULL)
+ return;
+
+ align = GetOwner()->GetAlignment();
+ align |= wxALIGN_CENTRE_VERTICAL;
+ }
+
// horizontal alignment:
gfloat xalign = 0.0;
g_value_unset( &gvalue2 );
}
-int wxDataViewRenderer::GetAlignment() const
+void wxDataViewRenderer::SetAlignment( int align )
{
- int ret = 0;
- GValue gvalue;
-
- // horizontal alignment:
-
- g_object_get( G_OBJECT(m_renderer), "xalign", &gvalue, NULL );
- float xalign = g_value_get_float( &gvalue );
- if (xalign < 0.5)
- ret |= wxALIGN_LEFT;
- else if (xalign == 0.5)
- ret |= wxALIGN_CENTER_HORIZONTAL;
- else
- ret |= wxALIGN_RIGHT;
- g_value_unset( &gvalue );
-
-
- // vertical alignment:
-
- g_object_get( G_OBJECT(m_renderer), "yalign", &gvalue, NULL );
- float yalign = g_value_get_float( &gvalue );
- if (yalign < 0.5)
- ret |= wxALIGN_TOP;
- else if (yalign == 0.5)
- ret |= wxALIGN_CENTER_VERTICAL;
- else
- ret |= wxALIGN_BOTTOM;
- g_value_unset( &gvalue );
-
- return ret;
+ m_alignment = align;
+ GtkUpdateAlignment();
}
-
+int wxDataViewRenderer::GetAlignment() const
+{
+ return m_alignment;
+}
// ---------------------------------------------------------
// wxDataViewTextRenderer
wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel();
- if (!wx_model->IsIndexListModel())
+ if (!wx_model->IsVirtualListModel())
{
if (wx_model->IsContainer( item ))
xalign = 0.5;
gtk_tree_view_column_set_alignment( column, xalign );
+
+ if (m_renderer && m_renderer->GetAlignment() == -1)
+ m_renderer->GtkUpdateAlignment();
}
wxAlignment wxDataViewColumn::GetAlignment() const
gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_FIXED );
// TODO find a better calculation
- gtk_tree_view_column_set_fixed_width( GTK_TREE_VIEW_COLUMN(m_column), 80 );
+ gtk_tree_view_column_set_fixed_width( GTK_TREE_VIEW_COLUMN(m_column), wxDVC_DEFAULT_WIDTH );
#else
// this is unpractical for large numbers of items and disables
// user resizing, which is totally unexpected
m_sort_column = -1;
m_dataview_sort_column = NULL;
- if (!m_wx_model->IsIndexListModel())
+ if (!m_wx_model->IsVirtualListModel())
InitTree();
}
void wxDataViewCtrlInternal::Resort()
{
- if (!m_wx_model->IsIndexListModel())
+ if (!m_wx_model->IsVirtualListModel())
m_root->Resort();
}
bool wxDataViewCtrlInternal::ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item )
{
- if (!m_wx_model->IsIndexListModel())
+ if (!m_wx_model->IsVirtualListModel())
{
wxGtkTreeModelNode *parent_node = FindNode( parent );
if (m_wx_model->IsContainer( item ))
bool wxDataViewCtrlInternal::ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item )
{
- if (!m_wx_model->IsIndexListModel())
+ if (!m_wx_model->IsVirtualListModel())
{
wxGtkTreeModelNode *parent_node = FindNode( parent );
parent_node->DeleteChild( item.GetID() );
GtkTreeModelFlags wxDataViewCtrlInternal::get_flags()
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
return GTK_TREE_MODEL_LIST_ONLY;
else
return GTK_TREE_MODEL_ITERS_PERSIST;
gboolean wxDataViewCtrlInternal::get_iter( GtkTreeIter *iter, GtkTreePath *path )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
{
GtkTreePath *retval = gtk_tree_path_new ();
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
// user_data is just the index
int i = (wxUIntPtr) iter->user_data;
gboolean wxDataViewCtrlInternal::iter_next( GtkTreeIter *iter )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
gboolean wxDataViewCtrlInternal::iter_children( GtkTreeIter *iter, GtkTreeIter *parent )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
// this is a list, nodes have no children
if (parent)
gboolean wxDataViewCtrlInternal::iter_has_child( GtkTreeIter *iter )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
// this is a list, nodes have no children
return FALSE;
gint wxDataViewCtrlInternal::iter_n_children( GtkTreeIter *iter )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
gboolean wxDataViewCtrlInternal::iter_nth_child( GtkTreeIter *iter, GtkTreeIter *parent, gint n )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
wxDataViewIndexListModel *wx_model = (wxDataViewIndexListModel*) m_wx_model;
gboolean wxDataViewCtrlInternal::iter_parent( GtkTreeIter *iter, GtkTreeIter *child )
{
- if (m_wx_model->IsIndexListModel())
+ if (m_wx_model->IsVirtualListModel())
{
return FALSE;
}