Example #1
0
/**
@brief set label and tip for existing button @a button
This does not affect the button's "default" label
@param button the button widget to be updated
@param type 0-based index into labels array

@return
*/
void e2_button_set_indexed_text (GtkWidget *button, E2_ButtonText type)
{
	if (type >= 0 && type < (sizeof(defined_button_labels)/sizeof(defined_button_labels[0])))
	{
		e2_button_set_label (button, defined_button_labels[type]);
		if (defined_button_tips[type] != NULL)
		{
			e2_widget_set_safetip (button, defined_button_tips[type]);
		}
		else
		{
#ifdef USE_GTK2_12TIPS
			gtk_widget_set_has_tooltip (button, FALSE);
#else
			GtkTooltipsData *tdata = gtk_tooltips_data_get (button);
			if (tdata != NULL)
			{
				g_free (tdata->tip_text);
				tdata->tip_text = NULL;
				g_free (tdata->tip_private);
				tdata->tip_private = NULL;
			}
#endif
		}
	}
}
Example #2
0
static VALUE
rg_s_get_data(G_GNUC_UNUSED VALUE self, VALUE widget)
{
    GtkTooltipsData* data = gtk_tooltips_data_get(GTK_WIDGET(RVAL2GOBJ(widget)));

    return rb_ary_new3(3, GOBJ2RVAL(data->widget), CSTR2RVAL(data->tip_text),
                       CSTR2RVAL(data->tip_private));
}
GtkTextBuffer *ctk_display_device_tv_create_help(GtkTextTagTable *table,
                                                 CtkDisplayDeviceTv
                                                 *ctk_display_device_tv)
{
    GtkTextIter i;
    GtkTextBuffer *b;
    GtkTooltipsData *td;

    b = gtk_text_buffer_new(table);
    
    gtk_text_buffer_get_iter_at_offset(b, &i, 0);

    ctk_help_title(b, &i, "%s Help", ctk_display_device_tv->name);

    ctk_help_heading(b, &i, "TV Overscan");
    ctk_help_para(b, &i, __tv_overscan_help);
    
    ctk_help_heading(b, &i, "TV Flicker Filter");
    ctk_help_para(b, &i, __tv_flicker_filter_help);
    
    ctk_help_heading(b, &i, "TV Brightness");
    ctk_help_para(b, &i, __tv_brightness_help);
    
    ctk_help_heading(b, &i, "TV Hue");
    ctk_help_para(b, &i, __tv_hue_help);
    
    ctk_help_heading(b, &i, "TV Contrast");
    ctk_help_para(b, &i, __tv_contrast_help);
    
    ctk_help_heading(b, &i, "TV Saturation");
    ctk_help_para(b, &i, __tv_saturation_help);
    
    ctk_help_heading(b, &i, "TV Encoder name");
    ctk_help_para(b, &i, __tv_encoder_name_help);
    
    ctk_help_heading(b, &i, "TV Refresh rate");
    ctk_help_para(b, &i, __tv_refresh_rate_help);
    
    add_image_sliders_help
        (CTK_IMAGE_SLIDERS(ctk_display_device_tv->image_sliders), b, &i);

    add_acquire_edid_help(b, &i);

    td = gtk_tooltips_data_get(GTK_WIDGET(ctk_display_device_tv->reset_button));
    ctk_help_reset_hardware_defaults (b, &i, td->tip_text);

    ctk_help_finish(b);

    return b;
    
} /* ctk_display_device_tv_create_help() */
GtkTextBuffer *ctk_display_device_create_help(GtkTextTagTable *table,
                                              CtkDisplayDevice *ctk_object)
{
    GtkTextIter i;
    GtkTextBuffer *b;
    GtkTooltipsData *td;
    int j;

    b = gtk_text_buffer_new(table);

    gtk_text_buffer_get_iter_at_offset(b, &i, 0);

    ctk_help_title(b, &i, "%s Help", ctk_object->name);

    ctk_help_heading(b, &i, "Device Information");
    ctk_help_para(b, &i, "%s", __info_help);

    for (j = 0; j < ARRAY_LEN(__info_entry_data); j++) {
        InfoEntryData *entryData = __info_entry_data+j;
        InfoEntry *entry = ctk_object->info_entries+j;

        if (entry->present) {
            ctk_help_term(b, &i, "%s", entryData->str);
            ctk_help_para(b, &i, "%s", *entryData->tooltip);
        }
    }

    add_acquire_edid_help(b, &i);

    add_color_controls_help
        (CTK_COLOR_CONTROLS(ctk_object->color_controls), b, &i);

    add_dithering_controls_help
        (CTK_DITHERING_CONTROLS(ctk_object->dithering_controls), b, &i);

    add_image_sliders_help
        (CTK_IMAGE_SLIDERS(ctk_object->image_sliders), b, &i);

    if (ctk_object->color_correction_available) {
        ctk_color_correction_tab_help(b, &i, "X Server Color Correction", TRUE);
    }

    td = gtk_tooltips_data_get(GTK_WIDGET(ctk_object->reset_button));
    ctk_help_reset_hardware_defaults(b, &i, td->tip_text);

    ctk_help_finish(b);

    return b;

} /* ctk_display_device_create_help() */
Example #5
0
/* Retrieves any GtkTooltipsData previously associated with the given widget. */
int
clip_GTK_TOOLTIPSDATAGET(ClipMachine * ClipMachineMemory)
{
   C_widget *cwid = _fetch_cw_arg(ClipMachineMemory);

   GtkTooltipsData *data;

   CHECKCWID(cwid, GTK_IS_WIDGET);
   data = gtk_tooltips_data_get(cwid->widget);
   if (data)
    {
       C_widget *ctt = _list_get_cwidget(ClipMachineMemory, data->tooltips);

       C_object *cfont = _list_get_cobject(ClipMachineMemory, data->font);

       ClipVar  *ret = RETPTR(ClipMachineMemory);

       char     *tip_text = data->tip_text ? data->tip_text : "";

       char     *tip_private = data->tip_private ? data->tip_private : "";

       memset(ret, 0, sizeof(*ret));
       _clip_map(ClipMachineMemory, ret);
       if (!ctt)
	  ctt = _register_widget(ClipMachineMemory, (GtkWidget *) (data->tooltips), NULL);
       if (ctt)
	  _clip_madd(ClipMachineMemory, ret, HASH_TOOLTIPS, &ctt->obj);
       if (!cfont)
	  cfont =
	   _register_object(ClipMachineMemory, data->font, GDK_OBJECT_FONT, NULL, (coDestructor) gdk_object_font_destructor);
       if (cfont)
	{
	   cfont->ref_count = 1;
	   _clip_madd(ClipMachineMemory, ret, HASH_FONT, &cfont->obj);
	}
       _clip_madd(ClipMachineMemory, ret, HASH_WIDGET, &cwid->obj);
       LOCALE_FROM_UTF(tip_text);
       LOCALE_FROM_UTF(tip_private);
       _clip_mputc(ClipMachineMemory, ret, HASH_TIPTEXT, tip_text, strlen(tip_text));
       _clip_mputc(ClipMachineMemory, ret, HASH_TIPPRIVATE, tip_private, strlen(tip_private));
       _clip_mputn(ClipMachineMemory, ret, HASH_WIDTH, data->width);
       FREE_TEXT(tip_text);
       FREE_TEXT(tip_private);
    }
   return 0;
 err:
   return 1;
}
Example #6
0
static const gchar *
gimp_help_get_help_data (GtkWidget  *widget,
                         GtkWidget **help_widget,
                         gpointer   *ret_data)
{
  GtkTooltipsData *tooltips_data;
  gchar           *help_id   = NULL;
  gpointer         help_data = NULL;

  for (; widget; widget = widget->parent)
    {
      tooltips_data = gtk_tooltips_data_get (widget);

      if (tooltips_data && tooltips_data->tip_private)
        help_id = tooltips_data->tip_private;
      else
        help_id = g_object_get_qdata (G_OBJECT (widget), GIMP_HELP_ID);

      help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");

      if (help_id)
        {
          if (help_widget)
            *help_widget = widget;

          if (ret_data)
            *ret_data = help_data;

          return (const gchar *) help_id;
        }
    }

  if (help_widget)
    *help_widget = NULL;

  if (ret_data)
    *ret_data = NULL;

  return NULL;
}
Example #7
0
static gboolean
gimp_help_callback (GtkWidget          *widget,
                    GimpWidgetHelpType  help_type,
                    GimpHelpFunc        help_func)
{
  switch (help_type)
    {
    case GIMP_WIDGET_HELP_TYPE_HELP:
      if (help_func)
        {
          GtkTooltipsData *tooltips_data;
          gchar           *help_id   = NULL;
          gpointer         help_data = NULL;

          tooltips_data = gtk_tooltips_data_get (widget);

          if (tooltips_data && tooltips_data->tip_private)
            help_id = tooltips_data->tip_private;
          else
            help_id = g_object_get_qdata (G_OBJECT (widget), GIMP_HELP_ID);

          help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");

          (* help_func) (help_id, help_data);
        }
      return TRUE;

    case GTK_WIDGET_HELP_WHATS_THIS:
      g_idle_add (gimp_context_help_idle_start, widget);
      return TRUE;

    default:
      break;
    }

  return FALSE;
}