当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_COLOR_SELECTION_DIALOG函数代码示例

本文整理汇总了C++中GTK_COLOR_SELECTION_DIALOG函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_COLOR_SELECTION_DIALOG函数的具体用法?C++ GTK_COLOR_SELECTION_DIALOG怎么用?C++ GTK_COLOR_SELECTION_DIALOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_COLOR_SELECTION_DIALOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: purplerc_set_color

static void
purplerc_set_color(GtkWidget *widget, gpointer data)
{
	GdkColor color;
	gchar title[128];
	const gchar *pref = NULL;
	GtkWidget *color_dialog = NULL;
	gint subscript = GPOINTER_TO_INT(data);

	g_snprintf(title, sizeof(title), _("Select Color for %s"),
	           _(color_names[GPOINTER_TO_INT(data)]));
	color_dialog = gtk_color_selection_dialog_new(_("Select Color"));
	g_signal_connect(G_OBJECT(color_dialog), "response",
	                 G_CALLBACK(purplerc_color_response), data);

	pref = purple_prefs_get_string(color_prefs[subscript]);

	if (pref != NULL && strcmp(pref, "")) {
		if (gdk_color_parse(pref, &color)) {
#if GTK_CHECK_VERSION(2,14,0)
			gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(
				gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))),
				&color);
#else
			gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color);
#endif
		}
	}

	gtk_window_present(GTK_WINDOW(color_dialog));
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:31,代码来源:pidginrc.c

示例2: dialog_colour_new

void dialog_colour_new(GtkWidget *w, gdouble *colour)
{
GtkWidget *csd;

/* create colour selection dialog */
csd = gtk_color_selection_dialog_new("Edit colour");

/* set the initial colour */
gtk_color_selection_set_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(csd)->colorsel), colour);

/* value colour update */
g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(csd)->colorsel), "color_changed",
                 GTK_SIGNAL_FUNC(set_colour_value), (gpointer) colour);
/* widget colour update */
if (w)
  g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(csd)->colorsel), "color_changed",
                   GTK_SIGNAL_FUNC(set_colour_widget), (gpointer) w);

g_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(csd)->ok_button), "clicked",
                 GTK_SIGNAL_FUNC(destroy_widget), (gpointer) csd);

gtk_widget_hide(GTK_COLOR_SELECTION_DIALOG(csd)->cancel_button);

gtk_widget_show(csd);

/*
g_signal_connect(GTK_OBJECT(w), "destroy", GTK_SIGNAL_FUNC(destroy_widget), csd);
*/
}
开发者ID:Bhattiasif,项目名称:gdis,代码行数:29,代码来源:gui_dialog.c

示例3: XOJ_CHECK_TYPE

void ColorToolItem::activated(GdkEvent *event, GtkMenuItem *menuitem, GtkToolButton *toolbutton) {
	XOJ_CHECK_TYPE(ColorToolItem);

	if (inUpdate) {
		return;
	}
	inUpdate = true;

	if (isSelector()) {
		this->colorDlg = gtk_color_selection_dialog_new(_("Select color"));
		g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(this->colorDlg)->ok_button), "clicked", G_CALLBACK(&customColorSelected), this);

		GdkColor color = Util::intToGdkColor(this->color);

		GtkWidget* cw = gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(this->colorDlg));
		gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(cw), &color);

		gtk_window_set_transient_for(GTK_WINDOW (this->colorDlg), GTK_WINDOW (this->parent));
		gtk_dialog_run(GTK_DIALOG(this->colorDlg));

		gtk_widget_destroy(this->colorDlg);
		this->colorDlg = NULL;
	}

	toolHandler->setColor(this->color);

	inUpdate = false;
}
开发者ID:wbrenna,项目名称:xournalpp,代码行数:28,代码来源:ColorToolItem.cpp

示例4: gtk_color_button_clicked

static void
gtk_color_button_clicked (GtkButton *button)
{
  GtkColorButton *color_button = GTK_COLOR_BUTTON (button);
  GtkColorSelectionDialog *color_dialog;

  /* if dialog already exists, make sure it's shown and raised */
  if (!color_button->priv->cs_dialog) 
    {
      /* Create the dialog and connects its buttons */
      GtkWidget *parent;
      
      parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));
      
      color_button->priv->cs_dialog = gtk_color_selection_dialog_new (color_button->priv->title);
      
      color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

      if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
        {
          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
 	    gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent));
	       
	  gtk_window_set_modal (GTK_WINDOW (color_dialog),
				gtk_window_get_modal (GTK_WINDOW (parent)));
	}
      
      g_signal_connect (color_dialog->ok_button, "clicked",
                        G_CALLBACK (dialog_ok_clicked), color_button);
      g_signal_connect (color_dialog->cancel_button, "clicked",
			G_CALLBACK (dialog_cancel_clicked), color_button);
      g_signal_connect (color_dialog, "destroy",
                        G_CALLBACK (dialog_destroy), color_button);
    }

  color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

  gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (color_dialog->colorsel),
                                               color_button->priv->use_alpha);
  
  gtk_color_selection_set_previous_color (GTK_COLOR_SELECTION (color_dialog->colorsel), 
					  &color_button->priv->color);
  gtk_color_selection_set_previous_alpha (GTK_COLOR_SELECTION (color_dialog->colorsel), 
					  color_button->priv->alpha);

  gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (color_dialog->colorsel), 
					 &color_button->priv->color);
  gtk_color_selection_set_current_alpha (GTK_COLOR_SELECTION (color_dialog->colorsel), 
					 color_button->priv->alpha);

  gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
}
开发者ID:Krlos0208,项目名称:Sintetizador_Voz,代码行数:52,代码来源:gtkcolorbutton.c

示例5: gsm_color_button_clicked

static gint
gsm_color_button_clicked (GtkWidget * widget, GdkEventButton * event)
{
  GSMColorButton *color_button = GSM_COLOR_BUTTON (widget);
  GtkColorSelectionDialog *color_dialog;

  /* if dialog already exists, make sure it's shown and raised */
  if (!color_button->priv->cs_dialog)
    {
      /* Create the dialog and connects its buttons */
      GtkWidget *parent;

      parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));

      color_button->priv->cs_dialog =
	gtk_color_selection_dialog_new (color_button->priv->title);

      color_dialog =
	GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

      if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
	{
	  if (GTK_WINDOW (parent) !=
	      gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
	    gtk_window_set_transient_for (GTK_WINDOW (color_dialog),
					  GTK_WINDOW (parent));

	  gtk_window_set_modal (GTK_WINDOW (color_dialog),
				gtk_window_get_modal (GTK_WINDOW (parent)));
	}

      g_signal_connect (color_dialog, "response",
                        G_CALLBACK (dialog_response), color_button);

      g_signal_connect (color_dialog, "destroy",
			G_CALLBACK (dialog_destroy), color_button);
    }

  color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

  gtk_color_selection_set_previous_color (GTK_COLOR_SELECTION
                                          (gtk_color_selection_dialog_get_color_selection (color_dialog)),
					  &color_button->priv->color);

  gtk_color_selection_set_current_color (GTK_COLOR_SELECTION
                                         (gtk_color_selection_dialog_get_color_selection (color_dialog)),
					 &color_button->priv->color);

  gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
  return 0;
}
开发者ID:brion,项目名称:gnome-system-monitor,代码行数:51,代码来源:gsm_color_button.c

示例6: clip_GTK_COLORSELECTIONDIALOGNEW

/****  Color selection dialog constructor ****/
int
clip_GTK_COLORSELECTIONDIALOGNEW(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   char     *title = _clip_parc(ClipMachineMemory, 2);

   GtkWidget *wid = NULL;

   C_widget *cwid, *ccolorsel, *cokbtn, *ccancelbtn, *chlpbtn;

   CHECKOPT(1, MAP_type_of_ClipVarType);
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);

   if (_clip_parinfo(ClipMachineMemory, 2) == UNDEF_type_of_ClipVarType)
      title = "\0";
   LOCALE_TO_UTF(title);
   wid = gtk_color_selection_dialog_new(title);
   FREE_TEXT(title);
   cwid = _register_widget(ClipMachineMemory, wid, cv);

   ccolorsel = _register_widget(ClipMachineMemory, GTK_COLOR_SELECTION_DIALOG(wid)->colorsel, NULL);
   cokbtn = _register_widget(ClipMachineMemory, GTK_COLOR_SELECTION_DIALOG(wid)->ok_button, NULL);
   ccancelbtn = _register_widget(ClipMachineMemory, GTK_COLOR_SELECTION_DIALOG(wid)->cancel_button, NULL);
   chlpbtn = _register_widget(ClipMachineMemory, GTK_COLOR_SELECTION_DIALOG(wid)->help_button, NULL);

   if (ccolorsel)
      _clip_madd(ClipMachineMemory, &cwid->obj, HASH_COLORSEL, &ccolorsel->obj);
   if (cokbtn)
      _clip_madd(ClipMachineMemory, &cwid->obj, HASH_OKBUTTON, &cokbtn->obj);
   if (ccancelbtn)
      _clip_madd(ClipMachineMemory, &cwid->obj, HASH_CANCELBUTTON, &ccancelbtn->obj);
   if (chlpbtn)
      _clip_madd(ClipMachineMemory, &cwid->obj, HASH_HELPBUTTON, &chlpbtn->obj);

   if (ccolorsel)
      _clip_destroy(ClipMachineMemory, &ccolorsel->obj);
   if (cokbtn)
      _clip_destroy(ClipMachineMemory, &cokbtn->obj);
   if (ccancelbtn)
      _clip_destroy(ClipMachineMemory, &ccancelbtn->obj);
   if (chlpbtn)
      _clip_destroy(ClipMachineMemory, &chlpbtn->obj);

   _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);
   return 0;
 err:
   return 1;
}
开发者ID:amery,项目名称:clip-angelo,代码行数:50,代码来源:colorsel.c

示例7: GetParentForModalDialog

bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
{
    if (data)
        m_data = *data;

    m_parent = GetParentForModalDialog(parent, 0);
    GtkWindow * const parentGTK = m_parent ? GTK_WINDOW(m_parent->m_widget)
                                           : NULL;

    wxString title(_("Choose colour"));
    m_widget = gtk_color_selection_dialog_new(wxGTK_CONV(title));

    g_object_ref(m_widget);

    if ( parentGTK )
    {
        gtk_window_set_transient_for(GTK_WINDOW(m_widget), parentGTK);
    }

    GtkColorSelection* sel = GTK_COLOR_SELECTION(
        gtk_color_selection_dialog_get_color_selection(
        GTK_COLOR_SELECTION_DIALOG(m_widget)));
    gtk_color_selection_set_has_palette(sel, true);

    return true;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:26,代码来源:colordlg.cpp

示例8: change_color_callback

static void
change_color_callback (GtkWidget *button,
                       gpointer   data)
{
  GtkWidget *dialog;
  GtkColorSelection *colorsel;
  GtkColorSelectionDialog *selection_dialog;
  gint response;

  dialog = gtk_color_selection_dialog_new ("Changing color");

  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));

  selection_dialog = GTK_COLOR_SELECTION_DIALOG (dialog);
  colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));

  gtk_color_selection_set_previous_rgba (colorsel, &color);
  gtk_color_selection_set_current_rgba (colorsel, &color);
  gtk_color_selection_set_has_palette (colorsel, TRUE);

  response = gtk_dialog_run (GTK_DIALOG (dialog));

  if (response == GTK_RESPONSE_OK)
    {
      gtk_color_selection_get_current_rgba (colorsel, &color);

      gtk_widget_override_background_color (da, 0, &color);
    }

  gtk_widget_destroy (dialog);
}
开发者ID:BYC,项目名称:gtk,代码行数:31,代码来源:colorsel.c

示例9: gtk_color_selection_dialog_get_property

static void
gtk_color_selection_dialog_get_property (GObject         *object,
					 guint            prop_id,
					 GValue          *value,
					 GParamSpec      *pspec)
{
  GtkColorSelectionDialog *colorsel;

  colorsel = GTK_COLOR_SELECTION_DIALOG (object);

  switch (prop_id)
    {
    case PROP_COLOR_SELECTION:
      g_value_set_object (value, colorsel->colorsel);
      break;
    case PROP_OK_BUTTON:
      g_value_set_object (value, colorsel->ok_button);
      break;
    case PROP_CANCEL_BUTTON:
      g_value_set_object (value, colorsel->cancel_button);
      break;
    case PROP_HELP_BUTTON:
      g_value_set_object (value, colorsel->help_button);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
开发者ID:Krlos0208,项目名称:Sintetizador_Voz,代码行数:29,代码来源:gtkcolorseldialog.c

示例10: gtk_color_selection_dialog_buildable_get_internal_child

static GObject *
gtk_color_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
							 GtkBuilder   *builder,
							 const gchar  *childname)
{
    if (strcmp(childname, "ok_button") == 0)
	return G_OBJECT (GTK_COLOR_SELECTION_DIALOG (buildable)->ok_button);
    else if (strcmp(childname, "cancel_button") == 0)
	return G_OBJECT (GTK_COLOR_SELECTION_DIALOG (buildable)->cancel_button);
    else if (strcmp(childname, "help_button") == 0)
	return G_OBJECT (GTK_COLOR_SELECTION_DIALOG(buildable)->help_button);
    else if (strcmp(childname, "color_selection") == 0)
	return G_OBJECT (GTK_COLOR_SELECTION_DIALOG(buildable)->colorsel);

    return parent_buildable_iface->get_internal_child (buildable, builder, childname);
}
开发者ID:Krlos0208,项目名称:Sintetizador_Voz,代码行数:16,代码来源:gtkcolorseldialog.c

示例11: change_color

static void change_color(GtkWidget *button, t_global_monitor *global, gint type)
{
    GtkWidget *dialog;
    GtkColorSelection *colorsel;
    gint response;

    dialog = gtk_color_selection_dialog_new(_("Select color"));
    gtk_window_set_transient_for(GTK_WINDOW(dialog),
                                 GTK_WINDOW(global->opt_dialog));
    colorsel =
        GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel);
    gtk_color_selection_set_previous_color(colorsel,
                                           &global->monitor->options.color[type]);
    gtk_color_selection_set_current_color(colorsel,
                                          &global->monitor->options.color[type]);
    gtk_color_selection_set_has_palette(colorsel, TRUE);

    response = gtk_dialog_run(GTK_DIALOG(dialog));
    if (response == GTK_RESPONSE_OK)
    {
        gtk_color_selection_get_current_color(colorsel,
                                              &global->monitor->options.color[type]);
        gtk_widget_modify_bg(global->monitor->opt_da[type],
                             GTK_STATE_NORMAL,
                             &global->monitor->options.color[type]);
        setup_monitor(global);
    }

    gtk_widget_destroy(dialog);
}
开发者ID:BackupTheBerlios,项目名称:xfce-goodies-svn,代码行数:30,代码来源:netload.c

示例12: GTK_COLOR_SELECTION

void wxColourDialog::ColourDataToDialog()
{
    GtkColorSelection* sel = GTK_COLOR_SELECTION(
        gtk_color_selection_dialog_get_color_selection(
        GTK_COLOR_SELECTION_DIALOG(m_widget)));

    const wxColour& color = m_data.GetColour();
    if (color.IsOk())
    {
#ifdef __WXGTK3__
        gtk_color_selection_set_current_rgba(sel, color);
#else
        gtk_color_selection_set_current_color(sel, color.GetColor());
#endif
    }

    // setup the palette:

    GdkColor colors[wxColourData::NUM_CUSTOM];
    gint n_colors = 0;
    for (unsigned i = 0; i < WXSIZEOF(colors); i++)
    {
        wxColour c = m_data.GetCustomColour(i);
        if (c.IsOk())
        {
            colors[n_colors] = *c.GetColor();
            n_colors++;
        }
    }

    wxGtkString pal(gtk_color_selection_palette_to_string(colors, n_colors));

    GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel));
    g_object_set(settings, "gtk-color-palette", pal.c_str(), NULL);
}
开发者ID:hwiesmann,项目名称:wxWidgets,代码行数:35,代码来源:colordlg.cpp

示例13: dialog_response

static void
dialog_response (GtkWidget * widget, GtkResponseType response, gpointer data)
{
  GSMColorButton *color_button = GSM_COLOR_BUTTON (data);
  GtkColorSelection *color_selection;

  if (response == GTK_RESPONSE_OK) {
    color_selection =
      GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG
			   (color_button->priv->cs_dialog)));

    gtk_color_selection_get_current_color (color_selection,
					   &color_button->priv->color);

    gtk_widget_hide (color_button->priv->cs_dialog);

    gtk_widget_queue_draw (GTK_WIDGET (&color_button->widget));

    g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);

    g_object_freeze_notify (G_OBJECT (color_button));
    g_object_notify (G_OBJECT (color_button), "color");
    g_object_thaw_notify (G_OBJECT (color_button));
  }
  else  /* (response == GTK_RESPONSE_CANCEL) */
    gtk_widget_hide (color_button->priv->cs_dialog);
}
开发者ID:brion,项目名称:gnome-system-monitor,代码行数:27,代码来源:gsm_color_button.c

示例14: change_color_callback

static void
change_color_callback (GtkWidget *button,
		       gpointer	  data)
{
  GtkWidget *dialog;
  GtkColorSelection *colorsel;
  gint response;
  
  dialog = gtk_color_selection_dialog_new ("Changing color");

  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
  
  colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel);

  gtk_color_selection_set_previous_color (colorsel, &color);
  gtk_color_selection_set_current_color (colorsel, &color);
  gtk_color_selection_set_has_palette (colorsel, TRUE);
  
  response = gtk_dialog_run (GTK_DIALOG (dialog));

  if (response == GTK_RESPONSE_OK)
    {
      gtk_color_selection_get_current_color (colorsel,
					     &color);
      
      gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
    }
  
  gtk_widget_destroy (dialog);
}
开发者ID:ErwinJanssen,项目名称:gtk2-win32-development-libraries,代码行数:30,代码来源:colorsel.c

示例15: uber_label_block_button_press_event

/**
 * uber_label_block_button_press_event:
 * @widget: A #GtkWidget.
 * @event: A #GdkEventButton.
 * @label: An #UberLabel.
 *
 * Callback to handle a button press event within the colored block.
 *
 * Returns: %FALSE always to allow further signal emission.
 * Side effects: None.
 */
static gboolean
uber_label_block_button_press_event (GtkWidget      *widget, /* IN */
                                     GdkEventButton *event,  /* IN */
                                     UberLabel      *label)  /* IN */
{
	UberLabelPrivate *priv;
	GtkWidget *dialog;
	GtkWidget *selection;

	g_return_val_if_fail(UBER_IS_LABEL(label), FALSE);

	priv = label->priv;
	dialog = gtk_color_selection_dialog_new("");
	selection = gtk_color_selection_dialog_get_color_selection(
			GTK_COLOR_SELECTION_DIALOG(dialog));
	gtk_color_selection_set_current_color(
			GTK_COLOR_SELECTION(selection),
			&priv->color);
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
		gtk_color_selection_get_current_color(
				GTK_COLOR_SELECTION(selection),
				&priv->color);
		gtk_widget_queue_draw(widget);
		g_signal_emit(label, signals[COLOR_CHANGED],
		              0, &priv->color);
	}
	gtk_widget_destroy(dialog);
	return FALSE;
}
开发者ID:jjardon,项目名称:perfkit,代码行数:40,代码来源:uber-label.c


注:本文中的GTK_COLOR_SELECTION_DIALOG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。