本文整理汇总了C++中GTK_CELL_RENDERER函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_CELL_RENDERER函数的具体用法?C++ GTK_CELL_RENDERER怎么用?C++ GTK_CELL_RENDERER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_CELL_RENDERER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: custom_cell_renderer_progress_init
static void
custom_cell_renderer_progress_init (CustomCellRendererProgress *cellrendererprogress)
{
GTK_CELL_RENDERER(cellrendererprogress)->mode = GTK_CELL_RENDERER_MODE_INERT;
GTK_CELL_RENDERER(cellrendererprogress)->xpad = 2;
GTK_CELL_RENDERER(cellrendererprogress)->ypad = 2;
}
示例2: x_fstylecb_new
/*! \brief Create a ComboBox with the gschem fill styles.
*
* \return GtkWidget
*/
GtkWidget*
x_fstylecb_new ()
{
GtkComboBox *combo;
GtkCellLayout *layout;
GtkCellRenderer *swatch_cell;
GtkCellRenderer *text_cell;
if (fstyle_list_store == NULL) {
fstyle_list_store = create_fstyle_list_store ();
}
combo = GTK_COMBO_BOX (gtk_combo_box_new_with_model (GTK_TREE_MODEL (fstyle_list_store)));
layout = GTK_CELL_LAYOUT (combo); /* For convenience */
/* Renders the fill swatch. Since this won't contain text, set a
* minimum width. */
swatch_cell = GTK_CELL_RENDERER (gschem_fill_swatch_cell_renderer_new ());
g_object_set (swatch_cell, "width", 25, NULL);
gtk_cell_layout_pack_start (layout, swatch_cell, FALSE);
gtk_cell_layout_add_attribute (layout, swatch_cell, "fill-type", COLUMN_INDEX);
/* Renders the name of the fill style */
text_cell = GTK_CELL_RENDERER (gtk_cell_renderer_text_new());
g_object_set (text_cell, "xpad", 5, NULL);
gtk_cell_layout_pack_start (layout, text_cell, TRUE);
gtk_cell_layout_add_attribute (layout, text_cell, "text", COLUMN_NAME);
return GTK_WIDGET (combo);
}
示例3: book_tree_add_columns
static void
book_tree_add_columns (DhBookTree *tree)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
column = gtk_tree_view_column_new ();
renderer = GTK_CELL_RENDERER (gtk_cell_renderer_pixbuf_new ());
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes
(column, renderer,
"pixbuf", COL_OPEN_PIXBUF,
"pixbuf-expander-open", COL_OPEN_PIXBUF,
"pixbuf-expander-closed", COL_CLOSED_PIXBUF,
NULL);
renderer = GTK_CELL_RENDERER (gtk_cell_renderer_text_new ());
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer,
"text", COL_TITLE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
}
示例4: gqv_cell_renderer_icon_init
static void
gqv_cell_renderer_icon_init(GQvCellRendererIcon *cellicon)
{
GTK_CELL_RENDERER(cellicon)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
GTK_CELL_RENDERER(cellicon)->xpad = 2;
GTK_CELL_RENDERER(cellicon)->ypad = 2;
}
示例5: thunar_icon_renderer_init
static void
thunar_icon_renderer_init (ThunarIconRenderer *icon_renderer)
{
/* use 1px padding */
GTK_CELL_RENDERER (icon_renderer)->xpad = 1;
GTK_CELL_RENDERER (icon_renderer)->ypad = 1;
}
示例6: custom_cell_renderer_button_init
/***************************************************************************
*
* custom_cell_renderer_button_init: set some default properties of the
* parent (GtkCellRendererPixbuf).
*
***************************************************************************/
static void
custom_cell_renderer_button_init (CustomCellRendererButton *cellbutton)
{
GTK_CELL_RENDERER(cellbutton)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
GTK_CELL_RENDERER(cellbutton)->xpad = 2;
GTK_CELL_RENDERER(cellbutton)->ypad = 2;
}
示例7: git_stash_pane_init
static void
git_stash_pane_init (GitStashPane *self)
{
gchar *objects[] = {"stash_pane",
"stash_model",
NULL};
GError *error = NULL;
GtkTreeView *stash_view;
GtkTreeViewColumn *stash_number_column;
GtkCellRenderer *stash_number_renderer;
GtkTreeViewColumn *stash_message_column;
GtkCellRenderer *stash_message_renderer;
GtkCellRenderer *diff_renderer;
GtkTreeSelection *selection;
self->priv = g_new0 (GitStashPanePriv, 1);
self->priv->builder = gtk_builder_new ();
if (!gtk_builder_add_objects_from_file (self->priv->builder, BUILDER_FILE,
objects,
&error))
{
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
}
stash_view = GTK_TREE_VIEW (gtk_builder_get_object (self->priv->builder,
"stash_view"));
stash_number_column = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (self->priv->builder,
"stash_number_column"));
stash_number_renderer = GTK_CELL_RENDERER (gtk_builder_get_object (self->priv->builder,
"stash_number_renderer"));
stash_message_column = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (self->priv->builder,
"stash_message_column"));
stash_message_renderer = GTK_CELL_RENDERER (gtk_builder_get_object (self->priv->builder,
"stash_message_renderer"));
diff_renderer = anjuta_cell_renderer_diff_new ();
selection = gtk_tree_view_get_selection (stash_view);
gtk_tree_view_column_set_cell_data_func (stash_number_column, stash_number_renderer,
stash_number_renderer_data_func,
NULL, NULL);
gtk_tree_view_column_set_cell_data_func (stash_message_column, stash_message_renderer,
stash_message_renderer_data_func,
NULL, NULL);
gtk_tree_view_column_pack_start (stash_message_column, diff_renderer, TRUE);
gtk_tree_view_column_add_attribute (stash_message_column, diff_renderer,
"diff", COL_DIFF);
/* Don't allow diffs to be selected */
gtk_tree_selection_set_select_function (selection, on_stash_view_row_selected,
NULL, NULL);
g_signal_connect (G_OBJECT (stash_view), "button-press-event",
G_CALLBACK (on_stash_view_button_press_event),
self);
}
示例8: gtk_cell_renderer_text_init
static void
gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
{
GTK_CELL_RENDERER (celltext)->xalign = 0.0;
GTK_CELL_RENDERER (celltext)->yalign = 0.5;
GTK_CELL_RENDERER (celltext)->xpad = 2;
GTK_CELL_RENDERER (celltext)->ypad = 2;
celltext->fixed_height_rows = -1;
celltext->font = pango_font_description_new ();
}
示例9: freetuxtv_cellrenderer_channelslist_init
static void
freetuxtv_cellrenderer_channelslist_init (FreetuxTVCellRendererChannelsList *self)
{
#if GTK_API_VERSION == 3
gtk_cell_renderer_set_padding (GTK_CELL_RENDERER(self), 2, 2);
#else
GTK_CELL_RENDERER(self)->mode = GTK_CELL_RENDERER_MODE_INERT;
GTK_CELL_RENDERER(self)->xpad = 2;
GTK_CELL_RENDERER(self)->ypad = 2;
#endif
}
示例10: uploads_get_dialog
/**
* uploads_get_dialog:
*
* Returns the a #GtkWindow representing the Uploads window. If it
* has not already been created, it creates it. The Uploads window is
* set to be hidden instead of destroyed when closed, to avoid having
* to recreate it and re-parse the UI file, etc.
**/
static GtkWindow *
uploads_get_dialog (XviewerPostasaPlugin *plugin)
{
GtkBuilder *builder;
GError *error = NULL;
GtkButton *cancel_button;
GtkButton *cancel_all_button;
if (plugin->priv->uploads_window == NULL) {
builder = gtk_builder_new ();
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
gtk_builder_add_from_resource (builder, GTKBUILDER_UPLOAD_FILE,
&error);
if (error != NULL) {
g_warning ("Couldn't load Postasa uploads UI file:%d:%s", error->code, error->message);
g_error_free (error);
return NULL;
}
/* note: do not unref gtk_builder_get_object() returns */
plugin->priv->uploads_window = GTK_WINDOW (gtk_builder_get_object (builder, "uploads_window"));
plugin->priv->uploads_view = GTK_TREE_VIEW (gtk_builder_get_object (builder, "uploads_view"));
plugin->priv->uploads_store = GTK_LIST_STORE (gtk_builder_get_object (builder, "uploads_store"));
cancel_button = GTK_BUTTON (gtk_builder_get_object (builder, "cancel_button"));
cancel_all_button = GTK_BUTTON (gtk_builder_get_object (builder, "cancel_all_button"));
/* TODO: can't set expand = TRUE when packing cells into columns via glade-3/GtkBuilder apparently?
bgo #602152 So for now, we take them, clear them out, and remap them. Ugh. Better solutions welcome. */
GtkTreeViewColumn *file_col = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (builder, "file_col"));
GtkCellRenderer *thumbnail_cell = GTK_CELL_RENDERER (gtk_builder_get_object (builder, "thumbnail_cell"));
GtkCellRenderer *filepath_cell = GTK_CELL_RENDERER (gtk_builder_get_object (builder, "filepath_cell"));
gtk_tree_view_column_clear (file_col);
gtk_tree_view_column_pack_start (file_col, thumbnail_cell, FALSE);
gtk_tree_view_column_pack_end (file_col, filepath_cell, TRUE);
gtk_tree_view_column_add_attribute (file_col, thumbnail_cell, "pixbuf", 0);
gtk_tree_view_column_add_attribute (file_col, filepath_cell, "text", 1);
GtkTreeViewColumn *progress_col = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (builder, "progress_col"));
GtkCellRenderer *progress_cell = GTK_CELL_RENDERER (gtk_builder_get_object (builder, "progress_cell"));
gtk_tree_view_column_clear (progress_col);
gtk_tree_view_column_pack_end (progress_col, progress_cell, TRUE);
gtk_tree_view_column_add_attribute (progress_col, progress_cell, "pulse", 3);
gtk_tree_view_column_add_attribute (progress_col, progress_cell, "text", 5);
g_object_unref (builder);
g_signal_connect (G_OBJECT (cancel_button), "clicked", G_CALLBACK (uploads_cancel_cb), plugin);
g_signal_connect (G_OBJECT (cancel_all_button), "clicked", G_CALLBACK (uploads_cancel_all_cb), plugin);
g_signal_connect (G_OBJECT (plugin->priv->uploads_window), "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), plugin);
}
return plugin->priv->uploads_window;
}
示例11: empathy_cell_renderer_expander_init
static void
empathy_cell_renderer_expander_init (EmpathyCellRendererExpander *expander)
{
EmpathyCellRendererExpanderPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (expander,
EMPATHY_TYPE_CELL_RENDERER_EXPANDER, EmpathyCellRendererExpanderPriv);
expander->priv = priv;
priv->expander_style = GTK_EXPANDER_COLLAPSED;
priv->expander_size = 12;
priv->activatable = TRUE;
priv->animation_node = NULL;
GTK_CELL_RENDERER (expander)->xpad = 2;
GTK_CELL_RENDERER (expander)->ypad = 2;
GTK_CELL_RENDERER (expander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
}
示例12: gtk_cell_renderer_text_new
static GtkTreeViewColumn *divelist_column(struct DiveList *dl, int index, const char *title,
data_func_t data_func, PangoAlignment align)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *col;
double xalign = 0.0; /* left as default */
renderer = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, title);
gtk_tree_view_column_set_sort_column_id(col, index);
gtk_tree_view_column_set_resizable(col, TRUE);
gtk_tree_view_column_pack_start(col, renderer, TRUE);
if (data_func)
gtk_tree_view_column_set_cell_data_func(col, renderer, data_func, NULL, NULL);
else
gtk_tree_view_column_add_attribute(col, renderer, "text", index);
gtk_object_set(GTK_OBJECT(renderer), "alignment", align, NULL);
switch (align) {
case PANGO_ALIGN_LEFT:
xalign = 0.0;
break;
case PANGO_ALIGN_CENTER:
xalign = 0.5;
break;
case PANGO_ALIGN_RIGHT:
xalign = 1.0;
break;
}
gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), xalign, 0.5);
gtk_tree_view_append_column(GTK_TREE_VIEW(dl->tree_view), col);
return col;
}
示例13: set_pixbuf
static void
set_pixbuf (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
{
GdkPixbuf *pixbuf = NULL;
CongServiceDocumentFactory *factory;
gtk_tree_model_get (model, iter,
NEWDOCTYPELIST_FACTORY_COLUMN, &factory,
-1);
if (NULL==factory) {
return;
}
pixbuf = cong_document_factory_get_icon(factory);
g_object_set (GTK_CELL_RENDERER (cell), "pixbuf", pixbuf, NULL);
if (pixbuf) {
g_object_unref (pixbuf);
}
}
示例14: gossip_cell_renderer_expander_init
static void
gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander)
{
GossipCellRendererExpanderPriv *priv;
priv = GET_PRIV (expander);
priv->expander_style = GTK_EXPANDER_COLLAPSED;
priv->expander_size = 12;
priv->activatable = TRUE;
priv->animation_node = NULL;
GTK_CELL_RENDERER (expander)->xpad = 2;
GTK_CELL_RENDERER (expander)->ypad = 2;
GTK_CELL_RENDERER (expander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
}
示例15: attachment_button_update_pixbufs
static void
attachment_button_update_pixbufs (EAttachmentButton *button)
{
GtkCellLayout *cell_layout;
GtkCellRenderer *renderer;
GdkPixbuf *pixbuf_expander_open;
GdkPixbuf *pixbuf_expander_closed;
GList *list;
/* Grab the first cell renderer. */
cell_layout = GTK_CELL_LAYOUT (button->priv->cell_view);
list = gtk_cell_layout_get_cells (cell_layout);
renderer = GTK_CELL_RENDERER (list->data);
g_list_free (list);
pixbuf_expander_open = gtk_widget_render_icon (
GTK_WIDGET (button), GTK_STOCK_GO_DOWN,
GTK_ICON_SIZE_BUTTON, NULL);
pixbuf_expander_closed = gtk_widget_render_icon (
GTK_WIDGET (button), GTK_STOCK_GO_FORWARD,
GTK_ICON_SIZE_BUTTON, NULL);
g_object_set (
renderer,
"pixbuf-expander-open", pixbuf_expander_open,
"pixbuf-expander-closed", pixbuf_expander_closed,
NULL);
g_object_unref (pixbuf_expander_open);
g_object_unref (pixbuf_expander_closed);
}