示例#1
0
static void fm_cell_renderer_text_class_init(FmCellRendererTextClass *klass)
{
    GObjectClass *g_object_class = G_OBJECT_CLASS(klass);
    GtkCellRendererClass* render_class = GTK_CELL_RENDERER_CLASS(klass);

    g_object_class->get_property = fm_cell_renderer_text_get_property;
    g_object_class->set_property = fm_cell_renderer_text_set_property;

    render_class->render = fm_cell_renderer_text_render;
    render_class->get_size = fm_cell_renderer_text_get_size;
#if GTK_CHECK_VERSION(3, 0, 0)
    render_class->get_preferred_width = fm_cell_renderer_text_get_preferred_width;
    render_class->get_preferred_height = fm_cell_renderer_text_get_preferred_height;
    render_class->get_preferred_height_for_width = fm_cell_renderer_text_get_preferred_height_for_width;
#endif

    /**
     * FmCellRendererText:max-height:
     *
     * The #FmCellRendererText:max-height property is the maximum height
     * of text that will be rendered. If text doesn't fit in that height
     * then text will be ellipsized. The value of -1 means unlimited
     * height.
     *
     * Since: 1.0.2
     */
    g_object_class_install_property(g_object_class,
                                    PROP_HEIGHT,
                                    g_param_spec_int("max-height",
                                                     "Maximum_height",
                                                     "Maximum height",
                                                     -1, 2048, -1,
                                                     G_PARAM_READWRITE));
}
示例#2
0
static void
egg_cell_renderer_keys_get_size (GtkCellRenderer       *cell,
				 GtkWidget             *widget,
				 const GdkRectangle    *cell_area,
				 gint                  *x_offset,
				 gint                  *y_offset,
				 gint                  *width,
				 gint                  *height)

{
  EggCellRendererKeys *keys = (EggCellRendererKeys *) cell;
  GtkRequisition requisition;

  if (keys->sizing_label == NULL)
    keys->sizing_label = gtk_label_new (TOOLTIP_TEXT);

#if GTK_CHECK_VERSION (3,0,0)
  gtk_widget_get_preferred_size (keys->sizing_label, NULL, &requisition);
#else
  gtk_widget_size_request (keys->sizing_label, &requisition);
#endif
  (* GTK_CELL_RENDERER_CLASS (parent_class)->get_size) (cell, widget, cell_area, x_offset, y_offset, width, height);
  /* FIXME: need to take the cell_area et al. into account */
  if (width)
    *width = MAX (*width, requisition.width);
  if (height)
    *height = MAX (*height, requisition.height);
}
static void
parasite_property_cell_renderer_class_init(
    ParasitePropertyCellRendererClass *klass)
{
    GObjectClass *object_class = G_OBJECT_CLASS(klass);
    GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass);

    object_class->get_property = parasite_property_cell_renderer_get_property;
    object_class->set_property = parasite_property_cell_renderer_set_property;

    cell_class->start_editing = parasite_property_cell_renderer_start_editing;

    g_object_class_install_property(object_class,
                                    PROP_OBJECT,
                                    g_param_spec_object("object",
                                            "Object",
                                            "The object owning the property",
                                            G_TYPE_OBJECT,
                                            G_PARAM_READWRITE));

    g_object_class_install_property(object_class,
                                    PROP_NAME,
                                    g_param_spec_string("name",
                                            "Name",
                                            "The property name",
                                            NULL,
                                            G_PARAM_READWRITE));

    g_type_class_add_private(object_class,
                             sizeof(ParasitePropertyCellRendererPrivate));
}
static void
empathy_cell_renderer_activatable_class_init (
    EmpathyCellRendererActivatableClass *klass)
{
    GtkCellRendererClass *cell_class;
    GObjectClass *oclass;

    oclass = G_OBJECT_CLASS (klass);
    oclass->get_property = cell_renderer_activatable_get_property;
    oclass->set_property = cell_renderer_activatable_set_property;

    cell_class = GTK_CELL_RENDERER_CLASS (klass);
    cell_class->activate = cell_renderer_activatable_activate;
    cell_class->render = cell_renderer_activatable_render;

    signals[PATH_ACTIVATED] =
        g_signal_new ("path-activated",
                      G_TYPE_FROM_CLASS (klass),
                      G_SIGNAL_RUN_LAST,
                      0,
                      NULL, NULL,
                      g_cclosure_marshal_VOID__STRING,
                      G_TYPE_NONE,
                      1, G_TYPE_STRING);

    g_object_class_install_property (oclass, PROP_SHOW_ON_SELECT,
                                     g_param_spec_boolean ("show-on-select",
                                             "Show on select",
                                             "Whether the cell renderer should be shown only when it's selected",
                                             FALSE,
                                             G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));

    g_type_class_add_private (klass,
                              sizeof (EmpathyCellRendererActivatablePriv));
}
示例#5
0
static void
gimp_cell_renderer_button_class_init (GimpCellRendererButtonClass *klass)
{
  GObjectClass         *object_class = G_OBJECT_CLASS (klass);
  GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS (klass);

  /**
   * GimpCellRendererButton::clicked:
   * @cell:
   * @path:
   * @state:
   *
   * Called on a button cell when it is clicked.
   **/
  button_cell_signals[CLICKED] =
    g_signal_new ("clicked",
                  G_OBJECT_CLASS_TYPE (object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GimpCellRendererButtonClass, clicked),
                  NULL, NULL,
                  gimp_marshal_VOID__STRING_FLAGS,
                  G_TYPE_NONE, 2,
                  G_TYPE_STRING,
                  GDK_TYPE_MODIFIER_TYPE);

  cell_class->activate = gimp_cell_renderer_button_activate;

  klass->clicked       = NULL;
}
示例#6
0
static void
gm_cell_renderer_bitext_class_init (GmCellRendererBitextClass* klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkCellRendererClass* cell_class = GTK_CELL_RENDERER_CLASS (klass);
  GParamSpec *spec = NULL;

  g_type_class_add_private (klass, sizeof (GmCellRendererBitextPrivate));

  cell_class->get_preferred_height_for_width = gm_cell_renderer_bitext_get_preferred_height_for_width;
  cell_class->render = gm_cell_renderer_bitext_render;

  gobject_class->finalize = gm_cell_renderer_bitext_finalize;
  gobject_class->get_property = gm_cell_renderer_bitext_get_property;
  gobject_class->set_property = gm_cell_renderer_bitext_set_property;

  spec = g_param_spec_string ("primary-text",
			      "Primary text",
			      "Primary text",
			      NULL, (GParamFlags) G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class,
				   GM_CELL_RENDERER_BITEXT_PROP_PRIMARY_TEXT,
				   spec);

  spec = g_param_spec_string ("secondary-text",
			      "Secondary text",
			      "Secondary text",
			      NULL, (GParamFlags) G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class,
				   GM_CELL_RENDERER_BITEXT_PROP_SECONDARY_TEXT,
				   spec);
}
static void
hippo_person_renderer_class_init(HippoPersonRendererClass  *klass)
{
    GObjectClass *object_class = G_OBJECT_CLASS(klass);
    GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass);

    object_class->finalize = hippo_person_renderer_finalize;
    
    object_class->get_property = hippo_person_renderer_get_property;
    object_class->set_property = hippo_person_renderer_set_property;

    cell_class->get_size = hippo_person_renderer_get_size;
    cell_class->render = hippo_person_renderer_render;

    g_object_class_install_property(object_class,
                				    PROP_PERSON,
                                    g_param_spec_object("person",
                             							_("Person Object"),
                            							_("The person to render"),
                            							HIPPO_TYPE_PERSON,
                            							G_PARAM_READWRITE));
                            							
    g_object_class_install_property(object_class,
                				    PROP_PHOTO,
                                    g_param_spec_object("photo",
                             							_("Photo pixbuf"),
                            							_("The pixbuf to render for this person"),
                                                        GDK_TYPE_PIXBUF,
                            							G_PARAM_READWRITE));                            							
}
示例#8
0
static void
gcrd_class_init (GncCellRendererDateClass *klass)
{
	GncCellRendererPopupClass     *popup_class;
	GtkCellRendererClass          *cell_class;
	GObjectClass                  *gobject_class;

	popup_class = GNC_CELL_RENDERER_POPUP_CLASS (klass);
	cell_class = GTK_CELL_RENDERER_CLASS (klass);	
	parent_class = GNC_CELL_RENDERER_POPUP_CLASS (g_type_class_peek_parent (klass));
	gobject_class = G_OBJECT_CLASS (klass);

	gobject_class->set_property = gcrd_set_property;
	gobject_class->get_property = gcrd_get_property;

	cell_class->start_editing = gcrd_start_editing;
		
	popup_class->show_popup = gcrd_show;
	popup_class->hide_popup = gcrd_hide;

	g_object_class_install_property (
		gobject_class,
                 PROP_USE_BUTTONS,
                 g_param_spec_boolean ("use-buttons",
				       NULL,
				       NULL,
				       TRUE,
				       G_PARAM_READWRITE));

}
示例#9
0
static void
gd_two_lines_renderer_class_init (GdTwoLinesRendererClass *klass)
{
  GtkCellRendererClass *cclass = GTK_CELL_RENDERER_CLASS (klass);
  GObjectClass *oclass = G_OBJECT_CLASS (klass);

  cclass->render = gd_two_lines_renderer_render;
  cclass->get_preferred_width = gd_two_lines_renderer_get_preferred_width;
  cclass->get_preferred_height = gd_two_lines_renderer_get_preferred_height;
  cclass->get_preferred_height_for_width = gd_two_lines_renderer_get_preferred_height_for_width;
  cclass->get_aligned_area = gd_two_lines_renderer_get_aligned_area;

  oclass->set_property = gd_two_lines_renderer_set_property;
  oclass->get_property = gd_two_lines_renderer_get_property;
  oclass->finalize = gd_two_lines_renderer_finalize;
  
  properties[PROP_TEXT_LINES] =
    g_param_spec_int ("text-lines",
                      "Lines of text",
                      "The total number of lines to be displayed",
                      2, G_MAXINT, 2,
                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

  properties[PROP_LINE_TWO] =
    g_param_spec_string ("line-two",
                         "Second line",
                         "Second line",
                         NULL,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

  g_type_class_add_private (klass, sizeof (GdTwoLinesRendererPrivate));
  g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
static void
nemo_cell_renderer_disk_class_init (NemoCellRendererDiskClass *klass)
{
	GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
    GObjectClass         *object_class = G_OBJECT_CLASS(klass);
    parent_class           = g_type_class_peek_parent (klass);
    object_class->finalize = nemo_cell_renderer_disk_finalize;

    object_class->get_property = nemo_cell_renderer_disk_get_property;
    object_class->set_property = nemo_cell_renderer_disk_set_property;
    cell_class->render = nemo_cell_renderer_disk_render;

    g_object_class_install_property (object_class,
                                     PROP_DISK_FULL_PERCENTAGE,
                                     g_param_spec_int ("disk-full-percent",
                                                       "Percentage",
                                                       "The fractional bar to display",
                                                       0, 100, 0,
                                                       G_PARAM_READWRITE));

    g_object_class_install_property (object_class,
                                     PROP_SHOW_DISK_FULL_PERCENTAGE,
                                     g_param_spec_boolean ("show-disk-full-percent",
                                                         "Show Percentage Graph",
                                                         "Whether to show the bar",
                                                         FALSE,
                                                         G_PARAM_READWRITE));
}
示例#11
0
static void
gimp_cell_renderer_color_class_init (GimpCellRendererColorClass *klass)
{
  GObjectClass         *object_class = G_OBJECT_CLASS (klass);
  GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS (klass);

  object_class->get_property = gimp_cell_renderer_color_get_property;
  object_class->set_property = gimp_cell_renderer_color_set_property;

  cell_class->get_size       = gimp_cell_renderer_color_get_size;
  cell_class->render         = gimp_cell_renderer_color_render;

  g_object_class_install_property (object_class,
                                   PROP_COLOR,
                                   g_param_spec_boxed ("color", NULL, NULL,
                                                       GIMP_TYPE_RGB,
                                                       GIMP_PARAM_READWRITE));
  g_object_class_install_property (object_class,
                                   PROP_OPAQUE,
                                   g_param_spec_boolean ("opaque", NULL, NULL,
                                                         TRUE,
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT));
  g_object_class_install_property (object_class,
                                   PROP_SIZE,
                                   g_param_spec_int ("icon-size", NULL, NULL,
                                                     0, G_MAXINT,
                                                     DEFAULT_ICON_SIZE,
                                                     GIMP_PARAM_READWRITE |
                                                     G_PARAM_CONSTRUCT));
}
static void
ephy_removable_pixbuf_renderer_class_init (EphyRemovablePixbufRendererClass *klass)
{
  GObjectClass *oclass = G_OBJECT_CLASS (klass);
  GtkCellRendererClass *crclass = GTK_CELL_RENDERER_CLASS (klass);

  crclass->render = ephy_removable_pixbuf_renderer_render;
  crclass->activate = ephy_removable_pixbuf_renderer_activate;
  oclass->get_property = ephy_removable_pixbuf_renderer_get_property;
  oclass->set_property = ephy_removable_pixbuf_renderer_set_property;
  oclass->dispose = ephy_removable_pixbuf_renderer_dispose;

  g_object_class_install_property (oclass,
				   PROP_RENDER_POLICY,
				   g_param_spec_enum ("render-policy",
						      "Render policy",
						      "The rendering policy for the close icon in the renderer",
						      EPHY_TYPE_REMOVABLE_PIXBUF_RENDER_POLICY,
						      EPHY_REMOVABLE_PIXBUF_RENDER_PRELIT,
						      G_PARAM_CONSTRUCT |
						      G_PARAM_READWRITE |
						      G_PARAM_STATIC_STRINGS));

  signals[DELETE_CLICKED] =
    g_signal_new ("delete-clicked",
		  G_OBJECT_CLASS_TYPE (oclass),
		  G_SIGNAL_RUN_LAST,
		  0, NULL, NULL, NULL,
		  G_TYPE_NONE, 1,
		  G_TYPE_STRING);

  g_type_class_add_private (klass, sizeof (EphyRemovablePixbufRendererPrivate));
}
示例#13
0
static void cell_renderer_bifurcation_class_init(CellRendererBifurcationClass *klass) {
    GObjectClass *object_class = G_OBJECT_CLASS (klass);
    GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);

    object_class->finalize = cell_renderer_bifurcation_finalize;

    object_class->get_property = cell_renderer_bifurcation_get_property;
    object_class->set_property = cell_renderer_bifurcation_set_property;

    cell_class->get_size = cell_renderer_bifurcation_get_size;
    cell_class->render = cell_renderer_bifurcation_render;

    g_object_class_install_property(object_class,
				    PROP_ROW_ID,
				    g_param_spec_ulong("row-id",
						       "Row Id",
						       "A row ID pointing to the keyframe this diagram starts at",
						       0, (gulong)-1, 1,
						       G_PARAM_READWRITE));

    g_object_class_install_property(object_class,
				    PROP_ANIMATION,
				    g_param_spec_object("animation",
							"Animation",
							"The animation this bifurcation diagram gets its keyframes from",
							G_TYPE_OBJECT,
							G_PARAM_READWRITE));
}
示例#14
0
static void
custom_cell_renderer_progress_class_init (CustomCellRendererProgressClass *klass)
{
  GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS(klass);
  GObjectClass         *object_class = G_OBJECT_CLASS(klass);

  parent_class           = g_type_class_peek_parent (klass);
  object_class->finalize = custom_cell_renderer_progress_finalize;

  /* Hook up functions to set and get our
   *   custom cell renderer properties */
  object_class->get_property = custom_cell_renderer_progress_get_property;
  object_class->set_property = custom_cell_renderer_progress_set_property;

  /* Override the two crucial functions that are the heart
   *   of a cell renderer in the parent class */
  cell_class->get_size = custom_cell_renderer_progress_get_size;
  cell_class->render   = custom_cell_renderer_progress_render;

  /* Install our very own properties */
  g_object_class_install_property (object_class,
                                   PROP_PERCENTAGE,
                                   g_param_spec_double ("percentage",
                                                        "Percentage",
                                                         "The fractional progress to display",
                                                         0, 1, 0,
                                                         G_PARAM_READWRITE));
}
示例#15
0
static void
gtk_cell_renderer_accel_get_size (GtkCellRenderer *cell,
                                  GtkWidget       *widget,
                                  GdkRectangle    *cell_area,
                                  gint            *x_offset,
                                  gint            *y_offset,
                                  gint            *width,
                                  gint            *height)

{
  GtkCellRendererAccel *accel = (GtkCellRendererAccel *) cell;
  GtkRequisition requisition;

  if (accel->sizing_label == NULL)
    accel->sizing_label = gtk_label_new (_("New accelerator..."));

  gtk_widget_size_request (accel->sizing_label, &requisition);

  GTK_CELL_RENDERER_CLASS (gtk_cell_renderer_accel_parent_class)->get_size (cell, widget, cell_area,
                                                                            x_offset, y_offset, width, height);

  /* FIXME: need to take the cell_area et al. into account */
  if (width)
    *width = MAX (*width, requisition.width);
  if (height)
    *height = MAX (*height, requisition.height);
}
static void
athena_cell_renderer_text_ellipsized_class_init (AthenaCellRendererTextEllipsizedClass *klass)
{
	GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);

	cell_class->get_preferred_width = athena_cell_renderer_text_ellipsized_get_preferred_width;
}
示例#17
0
static void class_init (QCADCellRendererTextClass *klass)
  {
  GObjectClass *object_klass = G_OBJECT_CLASS (klass) ;
  GtkCellRendererClass *cr_klass = GTK_CELL_RENDERER_CLASS (klass) ;

  object_klass->set_property = set_property ;
  object_klass->get_property = get_property ;

  cr_klass->render        = render ;
  cr_klass->start_editing = start_editing ;

  g_object_class_install_property (G_OBJECT_CLASS (klass), QCAD_CELL_RENDERER_TEXT_PROPERTY_SENSITIVE,
    g_param_spec_boolean ("sensitive", "Sensitive", "Whether this text cell renderer is sensitive",
      TRUE, G_PARAM_READABLE | G_PARAM_WRITABLE)) ;

  cell_renderer_text_signals[QCAD_CELL_RENDERER_TEXT_EDITING_STARTED_SIGNAL] =
    g_signal_new (
#ifdef GTK_DOC
      "workaround-editing-started",
#else
      "editing-started",
#endif /* def GTK_DOC */
      G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
      G_STRUCT_OFFSET (QCADCellRendererTextClass, editing_started), NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING,
        G_TYPE_NONE, 2, GTK_TYPE_CELL_EDITABLE, G_TYPE_STRING) ;
  }
示例#18
0
static gboolean
gimp_cell_renderer_toggle_activate (GtkCellRenderer      *cell,
                                    GdkEvent             *event,
                                    GtkWidget            *widget,
                                    const gchar          *path,
                                    const GdkRectangle   *background_area,
                                    const GdkRectangle   *cell_area,
                                    GtkCellRendererState  flags)
{
  GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell);

  if (gtk_cell_renderer_toggle_get_activatable (toggle))
    {
      GdkModifierType state = 0;

      GTK_CELL_RENDERER_CLASS (parent_class)->activate (cell, event, widget,
							path, background_area,
							cell_area, flags);

      if (event && ((GdkEventAny *) event)->type == GDK_BUTTON_PRESS)
        state = ((GdkEventButton *) event)->state;

      gimp_cell_renderer_toggle_clicked (GIMP_CELL_RENDERER_TOGGLE (cell),
                                         path, state);

      return TRUE;
    }

  return FALSE;
}
示例#19
0
/***************************************************************************
 *
 *  custom_cell_renderer_button_class_init:
 *
 *  set up our own get_property and set_property functions, and
 *  override the parent's functions that we need to implement.
 *  If you want cells that can be activated on their own (ie. not
 *  just the whole row selected) or cells that are editable, you
 *  will need to override 'activate' and 'start_editing' as well.
 *
 ***************************************************************************/
static void
custom_cell_renderer_button_class_init (CustomCellRendererButtonClass *klass)
{
	GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS(klass);
	GObjectClass         *object_class = G_OBJECT_CLASS(klass);

	parent_class           = g_type_class_peek_parent (klass);
	object_class->finalize = custom_cell_renderer_button_finalize;

	/* Hook up functions to set and get our
	 *   custom cell renderer properties */
	object_class->get_property = custom_cell_renderer_button_get_property;
	object_class->set_property = custom_cell_renderer_button_set_property;

	// Override activate
	cell_class->activate = custom_cell_renderer_button_activate;

	button_cell_signals[CLICKED] =
		g_signal_new (g_intern_static_string ("clicked"),
			  G_OBJECT_CLASS_TYPE (object_class),
			  G_SIGNAL_RUN_LAST,
			  G_STRUCT_OFFSET (CustomCellRendererButtonClass, clicked),
			  NULL, NULL,
			  gtk_marshal_VOID__STRING,
			  G_TYPE_NONE, 1,
			  G_TYPE_STRING);
}
示例#20
0
static void
cell_renderer_key_class_init (CellRendererKeyClass *cell_key_class)
{
  GObjectClass *object_class;
  GtkCellRendererClass *cell_renderer_class;

  object_class = G_OBJECT_CLASS (cell_key_class);
  cell_renderer_class = GTK_CELL_RENDERER_CLASS (cell_key_class);
  parent_class = g_type_class_peek_parent (object_class);
  
  GTK_CELL_RENDERER_CLASS(cell_key_class)->start_editing = cell_renderer_key_start_editing;

  object_class->set_property = cell_renderer_key_set_property;
  object_class->get_property = cell_renderer_key_get_property;
  cell_renderer_class->get_size = cell_renderer_key_get_size;

  object_class->finalize = cell_renderer_key_finalize;
   
  g_object_class_install_property (object_class,
                                   PROP_SCANCODE,
                                   g_param_spec_int ("scancode",
                                                     "Scancode",
                                                     "Scancode",
                                                      -1,
                                                      G_MAXINT,
                                                      -1,
                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
  
  g_signal_new ("accel_edited",
                TYPE_CELL_RENDERER_KEY,
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET(CellRendererKeyClass, accel_edited),
                NULL, NULL,
                marshal_VOID__STRING_UINT,
                G_TYPE_NONE,
                2,G_TYPE_STRING,G_TYPE_UINT);

  g_signal_new ("accel_cleared",
                TYPE_CELL_RENDERER_KEY,
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET(CellRendererKeyClass, accel_cleared),
                NULL, NULL,
                gtk_marshal_VOID__STRING,
                G_TYPE_NONE,
                1,G_TYPE_STRING);
}
static void
cell_renderer_caption_render (GtkCellRenderer *cell,
                                GdkWindow *window,
                                GtkWidget *widget,
                                GdkRectangle *background_area,
                                GdkRectangle *cell_area,
                                GdkRectangle *expose_area,
                                GtkCellRendererState flags)
{
  (* GTK_CELL_RENDERER_CLASS (cell_renderer_caption_parent_class)->render)
      (cell, window, widget, background_area, cell_area, expose_area, flags);

  if ((flags & (GTK_CELL_RENDERER_SELECTED|GTK_CELL_RENDERER_PRELIT)) != 0)
  {
    cairo_t *cr;
    int radius = 5;
    int x, y, w, h;
    GtkStateType state;
    x = background_area->x;
    y = background_area->y;
    w = background_area->width;
    h = background_area->height;

    /* sometimes width is -1 - not sure what to do here */
    if (w == -1)
      return;

    if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
    {
      if (GTK_WIDGET_HAS_FOCUS (widget))
        state = GTK_STATE_SELECTED;
      else
        state = GTK_STATE_ACTIVE;
    }
    else
      state = GTK_STATE_PRELIGHT;

    /* add rounded corners to the selection indicator */
    cr = gdk_cairo_create (GDK_DRAWABLE (window));

    gdk_cairo_set_source_color (cr, &widget->style->base[GTK_STATE_NORMAL]);

    cairo_rectangle (cr, x, y, w, h);

    cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
    cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, 0);
    cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, M_PI * 0.5);
    cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.5, M_PI);
    cairo_close_path (cr);

    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);

    cairo_fill (cr);
    cairo_destroy (cr);
  }
}
static void
xfce_cell_renderer_pixbuf_on_demand_class_init(XfceCellRendererPixbufOnDemandClass *klass)
{
	GObjectClass *object_class = G_OBJECT_CLASS(klass);
	GtkCellRendererClass *cr_class;
	static GType iter_boxed = 0;

	parent_class = g_type_class_peek_parent(klass);
	
	object_class->finalize = xfce_cell_renderer_pixbuf_on_demand_finalize;
	object_class->dispose = xfce_cell_renderer_pixbuf_on_demand_dispose;
	object_class->get_property = xfce_cell_renderer_pixbuf_on_demand_get_property;
	object_class->set_property = xfce_cell_renderer_pixbuf_on_demand_set_property;
	
	cr_class = GTK_CELL_RENDERER_CLASS(klass);
	
	cr_class->get_size = xfce_cell_renderer_pixbuf_on_demand_get_size;
	cr_class->render = xfce_cell_renderer_pixbuf_on_demand_render;

	g_object_class_install_property (object_class, PATH_PROP, 
		g_param_spec_string ("path", "Filesystem path to image", 
			"The path to the image to be loaded on demand",
			NULL,
			G_PARAM_READABLE|G_PARAM_WRITABLE
		)	
	);

	g_object_class_install_property (object_class, LOADED_PROP, 
		g_param_spec_boolean ("loaded", "Flag if loaded",
			"Flag if the pixbuf has been loaded or not",
			FALSE,
			G_PARAM_READABLE|G_PARAM_WRITABLE
		)	
	);

	
	if (!iter_boxed) {
		iter_boxed = g_boxed_type_register_static ("pboditer", pboditer_copy_cb, pboditer_free_cb);
	}

	g_object_class_install_property (object_class, ITER_PROP, 
		g_param_spec_boxed ("iter", "row iter",
			"The iter of the row to fill loaded and pixbuf in", 
			iter_boxed,
			G_PARAM_READABLE|G_PARAM_WRITABLE
		)	
	);

	g_object_class_install_property (object_class, PIXBUF_PROP, 
		g_param_spec_object ("pixbuf", "pixbuf to show",
			"The loaded pixbuf, if any",
			GDK_TYPE_PIXBUF,
			G_PARAM_READABLE|G_PARAM_WRITABLE
		)	
	);
}
示例#23
0
void activate_cell_renderer_toggle_tree_mode(void)
{
	GtkCellRendererClass *cell_class;
	GtkCellRendererToggle *toggle_renderer;

	toggle_renderer = GTK_CELL_RENDERER_TOGGLE(gtk_cell_renderer_toggle_new());
	cell_class = GTK_CELL_RENDERER_CLASS(GTK_WIDGET_GET_CLASS(toggle_renderer));
	cell_class->activate = gtk_cell_renderer_toggle_activate;
	gtk_object_destroy(GTK_OBJECT(toggle_renderer));
}
示例#24
0
static void remmina_cell_renderer_pixbuf_class_init(RemminaCellRendererPixbufClass *klass)
{
	GtkCellRendererClass *renderer_class = GTK_CELL_RENDERER_CLASS(klass);

	renderer_class->activate = remmina_cell_renderer_pixbuf_activate;

	remmina_cell_renderer_pixbuf_signals[0] = g_signal_new("activate", G_TYPE_FROM_CLASS(klass),
			G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaCellRendererPixbufClass, activate), NULL,
			NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}
static void
freetuxtv_cellrenderer_channelslist_class_init (FreetuxTVCellRendererChannelsListClass *klass)
{

	GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS(klass);
	GObjectClass         *object_class = G_OBJECT_CLASS(klass);

	object_class->finalize = freetuxtv_cellrenderer_channelslist_finalize;

	object_class->get_property = freetuxtv_cellrenderer_channelslist_get_property;
	object_class->set_property = freetuxtv_cellrenderer_channelslist_set_property;

#if GTK_API_VERSION == 3
	cell_class->get_request_mode = freetuxtv_cellrenderer_channelslist_get_request_mode;
	cell_class->get_preferred_width = freetuxtv_cellrenderer_channelslist_get_preferred_width;
	cell_class->get_preferred_height_for_width = freetuxtv_cellrenderer_channelslist_get_preferred_height_for_width;
#else
	cell_class->get_size = freetuxtv_cellrenderer_channelslist_get_size;
#endif
	cell_class->render   = freetuxtv_cellrenderer_channelslist_render;

	g_object_class_install_property (object_class,
	    PROP_TYPE,
	    g_param_spec_enum ("type",
		    "Type",
		    "The type of data in the cell",
		    FREETUXTV_TYPE_CELLRENDERER_CHANNELSLIST_TYPE,
		    CELLRENDERER_TYPE_CHANNELS_GROUP,
		    G_PARAM_READWRITE));

	g_object_class_install_property (object_class,
	    PROP_NAME,
	    g_param_spec_string ("name",
		    "Name",
		    "The name to display in the cell",
		    NULL,
		    G_PARAM_READWRITE));

	g_object_class_install_property (object_class,
	    PROP_LOGO,
	    g_param_spec_string ("logo",
		    "Logo",
		    "Logo to display in the cell",
		    NULL,
		    G_PARAM_READWRITE));

	g_object_class_install_property (object_class,
	    PROP_ISPLAYING,
	    g_param_spec_boolean ("isplaying",
		    "Channel is playing",
		    "Say if the channel is playing",
		    FALSE,
		    G_PARAM_READWRITE));
}
示例#26
0
static GtkCellEditable *start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
  {
  GtkCellEditable *ce = NULL ;

  if (!QCAD_CELL_RENDERER_TEXT (cell)->sensitive) return NULL ;

  if (NULL != (ce = (GTK_CELL_RENDERER_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_CELL_RENDERER_TEXT))))->start_editing (cell, event, widget, path, background_area, cell_area, flags)))
    g_signal_emit (G_OBJECT (cell), cell_renderer_text_signals[QCAD_CELL_RENDERER_TEXT_EDITING_STARTED_SIGNAL], 0, ce, path) ;

  return ce ;
  }
示例#27
0
static void 
i7_cell_renderer_transcript_class_init(I7CellRendererTranscriptClass *klass) 
{
	GtkCellRendererClass *renderer_class = GTK_CELL_RENDERER_CLASS(klass);
	renderer_class->get_size = i7_cell_renderer_transcript_get_size;
	renderer_class->render = i7_cell_renderer_transcript_render;
	GObjectClass *object_class = G_OBJECT_CLASS(klass);
	object_class->get_property = i7_cell_renderer_transcript_get_property;
	object_class->set_property = i7_cell_renderer_transcript_set_property;
	object_class->finalize = i7_cell_renderer_transcript_finalize;
	
	/* Install properties */
	GParamFlags flags = G_PARAM_LAX_VALIDATION | G_PARAM_STATIC_STRINGS;
	g_object_class_install_property(object_class, PROP_DEFAULT_WIDTH, 
		g_param_spec_uint("default-width", "Default width",
			"The width to make the whole renderer",
			0, G_MAXUINT, 400, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_TEXT_PADDING, 
		g_param_spec_uint("text-padding", "Text padding",
			"Padding between the edges of the rectangles and the text",
			0, G_MAXUINT, 6, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_COMMAND, 
		g_param_spec_string("command", "Command",
			"Command from the Skein",
			NULL, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_TRANSCRIPT_TEXT, 
		g_param_spec_string("transcript-text", "Transcript text",
			"Transcript text from the Skein",
			NULL, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_EXPECTED_TEXT, 
		g_param_spec_string("expected-text", "Expected text",
			"Expected text from the Skein",
			NULL, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_MATCH_TYPE,
	    g_param_spec_int("match-type", "Match type",
		    "-1 = no comparison, 0 = no match, 1 = near match, 2 = exact match",
		    -1, 2, -1, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_CURRENT,
	    g_param_spec_boolean("current", "Current",
		    "Whether to render the node as the currently highlighted node",
		    FALSE, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_PLAYED,
	    g_param_spec_boolean("played", "Played",
		    "Whether to render the node as the latest played node",
		    FALSE, G_PARAM_READWRITE | flags));
	g_object_class_install_property(object_class, PROP_CHANGED,
	    g_param_spec_boolean("changed", "Changed",
		    "Whether to render the node as having been changed since it was last played",
		    FALSE, G_PARAM_READWRITE | flags));
	
	/* Add private data */
	g_type_class_add_private (klass, sizeof (I7CellRendererTranscriptPrivate));
}
示例#28
0
static void render (GtkCellRenderer *cr, GdkWindow *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
  {
  GtkStateType widget_state = GTK_WIDGET_STATE (widget) ;

// The things you have to do to make sensitive work in GTK+-2.4 ...

  if (!(QCAD_CELL_RENDERER_TEXT (cr)->sensitive))
    {
    flags = GTK_CELL_RENDERER_INSENSITIVE ;
    GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE ;
    }
  GTK_CELL_RENDERER_CLASS (g_type_class_peek (g_type_parent (QCAD_TYPE_CELL_RENDERER_TEXT)))->render (cr, window, widget, background_area, cell_area, expose_area, flags) ;
  GTK_WIDGET_STATE (widget) = widget_state ;
  }
示例#29
0
static void
spaning_renderer_render (GtkCellRenderer      *cell,
                         cairo_t              *cr,
			 GtkWidget            *widget,
			 const GdkRectangle   *background_area,
			 const GdkRectangle   *cell_area,
			 GtkCellRendererState  flags)
{
	GiggleSpaningRendererPriv *priv = GET_PRIV (cell);
	GtkTreeViewColumn         *first_column, *last_column;
	GdkRectangle               first_area, last_area;
	int                        first = priv->first;
	int                        last = priv->last;
	GdkRectangle               real_background_area;
	GdkRectangle               real_cell_area;
	GList                     *columns;

	columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (widget));

	if (last < 0)
		last = g_list_length (columns) - 1;

	first_column = g_list_nth_data (columns, first);
	last_column = g_list_nth_data (columns, last);

	g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (first_column));
	g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (last_column));

	gtk_tree_view_get_cell_area (GTK_TREE_VIEW (widget), NULL, first_column, &first_area);
	gtk_tree_view_get_cell_area (GTK_TREE_VIEW (widget), NULL, last_column, &last_area);

	real_cell_area.x      = first_area.x;
	real_cell_area.y      = cell_area->y;
	real_cell_area.width  = last_area.x + last_area.width - first_area.x;
	real_cell_area.height = cell_area->height;

	gtk_tree_view_get_background_area (GTK_TREE_VIEW (widget), NULL, first_column, &first_area);
	gtk_tree_view_get_background_area (GTK_TREE_VIEW (widget), NULL, last_column, &last_area);

	real_background_area.x      = first_area.x;
	real_background_area.y      = cell_area->y;
	real_background_area.width  = last_area.x + last_area.width - first_area.x;
	real_background_area.height = cell_area->height;

	GTK_CELL_RENDERER_CLASS (giggle_spaning_renderer_parent_class)->render
		(cell, cr, widget, &real_background_area, &real_cell_area, flags);

	g_list_free (columns);
}
示例#30
0
static void
gm_cell_renderer_bitext_get_preferred_height_for_width (GtkCellRenderer* cell,
							GtkWidget* widget,
							gint width,
							gint *minimum_size,
							gint* natural_size)
{
  GtkCellRendererClass* parent
    = GTK_CELL_RENDERER_CLASS (gm_cell_renderer_bitext_parent_class);

  gm_cell_renderer_bitext_update_style (GM_CELL_RENDERER_BITEXT (cell),
					widget);

  parent->get_preferred_height_for_width (cell, widget, width, minimum_size, natural_size);
}