本文整理汇总了C++中GTK_COLOR_BUTTON函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_COLOR_BUTTON函数的具体用法?C++ GTK_COLOR_BUTTON怎么用?C++ GTK_COLOR_BUTTON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_COLOR_BUTTON函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configure
void
configure(void)
{
ENTER;
DBG("dialog %p\n", dialog);
if (!dialog)
dialog = mk_dialog();
gtk_widget_show(dialog);
update_opt_menu(edge_opt, p->edge - 1);
update_opt_menu(allign_opt, p->allign - 1);
//gtk_adjustment_set_value(margin_adj, p->margin);
//gtk_adjustment_value_changed(margin_adj);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(margin_spinb), p->margin);
update_opt_menu(width_opt, p->widthtype - 1);
gtk_adjustment_set_value(width_adj, p->width);
update_opt_menu(height_opt, HEIGHT_PIXEL - 1);
gtk_adjustment_set_value(height_adj, p->height);
update_toggle_button(tr_checkb, p->transparent);
gtk_color_button_set_color(GTK_COLOR_BUTTON(tr_colorb), &p->gtintcolor);
gtk_color_button_set_alpha (GTK_COLOR_BUTTON(tr_colorb), 256*p->alpha);
gtk_widget_show(dialog);
update_toggle_button(prop_dt_checkb, p->setdocktype);
update_toggle_button(prop_st_checkb, p->setstrut);
RET();
}
示例2: change_color_check
static void
change_color_check (GtkToggleButton *button, XpadPreferences *pref)
{
g_signal_handler_block (xpad_settings (), pref->priv->notify_back_handler);
g_signal_handler_block (xpad_settings (), pref->priv->notify_text_handler);
if (!gtk_toggle_button_get_active (button))
{
xpad_settings_set_text_color (xpad_settings (), NULL);
xpad_settings_set_back_color (xpad_settings (), NULL);
}
else
{
GdkColor color;
gtk_color_button_get_color (GTK_COLOR_BUTTON (pref->priv->textbutton), &color);
xpad_settings_set_text_color (xpad_settings (), &color);
gtk_color_button_get_color (GTK_COLOR_BUTTON (pref->priv->backbutton), &color);
xpad_settings_set_back_color (xpad_settings (), &color);
}
gtk_widget_set_sensitive (pref->priv->colorbox, gtk_toggle_button_get_active (button));
g_signal_handler_unblock (xpad_settings (), pref->priv->notify_back_handler);
g_signal_handler_unblock (xpad_settings (), pref->priv->notify_text_handler);
}
示例3: global_config_save
void
global_config_save(FILE *fp)
{
GdkColor c;
fprintf(fp, "# fbpanel <profile> config file\n");
fprintf(fp, "# see http://fbpanel.sf.net/docs.html for complete configuration guide\n");
fprintf(fp, "\n\n");
fprintf(fp, "Global {\n");
fprintf(fp, " edge = %s\n",
num2str(edge_pair, gtk_combo_box_get_active(GTK_COMBO_BOX(edge_opt)) + 1, "none"));
fprintf(fp, " allign = %s\n",
num2str(allign_pair, gtk_combo_box_get_active(GTK_COMBO_BOX(allign_opt)) + 1, "none"));
fprintf(fp, " margin = %d\n", (int) margin_adj->value);
fprintf(fp, " widthtype = %s\n",
num2str(width_pair, gtk_combo_box_get_active(GTK_COMBO_BOX(width_opt)) + 1, "none"));
fprintf(fp, " width = %d\n", (int) width_adj->value);
fprintf(fp, " height = %d\n", (int) height_adj->value);
fprintf(fp, " transparent = %s\n",
num2str(bool_pair, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tr_checkb)), "false"));
gtk_color_button_get_color(GTK_COLOR_BUTTON(tr_colorb), &c);
fprintf(fp, " tintcolor = #%06x\n", gcolor2rgb24(&c));
fprintf(fp, " alpha = %d\n", gtk_color_button_get_alpha(GTK_COLOR_BUTTON(tr_colorb)) * 0xff / 0xffff);
fprintf(fp, " setdocktype = %s\n",
num2str(bool_pair, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prop_dt_checkb)), "true"));
fprintf(fp, " setpartialstrut = %s\n",
num2str(bool_pair, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prop_st_checkb)), "true"));
fprintf(fp, "}\n\n");
}
示例4: propgen
PRIVATE void propgen(Component *c, Generator *g) {
Data *data = g->data;
GtkWidget *dialog, *vbox2, *color1; //, *color2; //*type;
dialog = gtk_dialog_new_with_buttons( "GL Cube Properties", gui_get_mesh_window(), GTK_DIALOG_DESTROY_WITH_PARENT,
"Oki", GTK_RESPONSE_OK, "Not Now", GTK_RESPONSE_CANCEL, NULL );
vbox2 = gtk_vbox_new( FALSE, 10 );
color1 = g_object_new( GTK_TYPE_COLOR_BUTTON, "color", &(data->cube_color), "title", "cube_color", "use-alpha", TRUE, "alpha", data->cube_alpha, NULL );
gtk_container_add( GTK_CONTAINER( vbox2 ), color1 );
gtk_container_add( GTK_CONTAINER( GTK_DIALOG( dialog )->vbox ), vbox2 );
gtk_widget_show_all( dialog );
gint response = gtk_dialog_run( GTK_DIALOG(dialog) );
if( response != GTK_RESPONSE_CANCEL ) {
gtk_color_button_get_color( GTK_COLOR_BUTTON(color1), &(data->cube_color) );
data->cube_alpha = gtk_color_button_get_alpha( GTK_COLOR_BUTTON(color1) );
}
gtk_widget_destroy( dialog );
}
示例5: init_text_attributes
EXPORT gboolean init_text_attributes(GladeXML *xml)
{
extern GdkColor white;
extern GdkColor black;
GtkWidget *notebook = NULL;
GtkWidget *child = NULL;
notebook = glade_xml_get_widget(xml,"value_notebook");
child = glade_xml_get_widget(xml,"value_text_table");
gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(notebook),child,TRUE,TRUE,GTK_PACK_START);
child = glade_xml_get_widget(xml,"value_font_table");
gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(notebook),child,TRUE,TRUE,GTK_PACK_START);
child = glade_xml_get_widget(xml,"value_location_table");
gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(notebook),child,TRUE,TRUE,GTK_PACK_START);
OBJ_SET((glade_xml_get_widget(xml,"precision_spin")),"handler",GINT_TO_POINTER(PRECISION));
OBJ_SET((glade_xml_get_widget(xml,"value_xpos_spin")),"handler",GINT_TO_POINTER(VALUE_XPOS));
OBJ_SET((glade_xml_get_widget(xml,"value_ypos_spin")),"handler",GINT_TO_POINTER(VALUE_YPOS));
OBJ_SET((glade_xml_get_widget(xml,"value_grab_button")),"x_spin",glade_xml_get_widget(xml,"value_xpos_spin"));
OBJ_SET((glade_xml_get_widget(xml,"value_grab_button")),"y_spin",glade_xml_get_widget(xml,"value_ypos_spin"));
OBJ_SET((glade_xml_get_widget(xml,"value_font_scale_spin")),"handler",GINT_TO_POINTER(VALUE_FONTSCALE));
OBJ_SET((glade_xml_get_widget(xml,"value_color_day_button")),"handler",GINT_TO_POINTER(GAUGE_COL_VALUE_FONT_DAY));
OBJ_SET((glade_xml_get_widget(xml,"value_color_nite_button")),"handler",GINT_TO_POINTER(GAUGE_COL_VALUE_FONT_NITE));
OBJ_SET((glade_xml_get_widget(xml,"show_value_check")),"handler",GINT_TO_POINTER(SHOW_VALUE));
gtk_color_button_set_color(GTK_COLOR_BUTTON(glade_xml_get_widget(xml,"value_color_day_button")),&white);
gtk_color_button_set_color(GTK_COLOR_BUTTON(glade_xml_get_widget(xml,"value_color_nite_button")),&black);
update_text_controls();
update_onscreen_tblocks();
return TRUE;
}
示例6: abrir_preferencias
gboolean abrir_preferencias(respuesta_t * respuesta) {
dialogo_preferencias_filtro_t * dialogo = dialogo_preferencias_filtro_crear();
if(!dialogo) {
return FALSE;
}
if(respuesta) {
gtk_color_button_set_color (GTK_COLOR_BUTTON(dialogo->bot_color_ordenes), &respuesta->orden.color);
gtk_color_button_set_color (GTK_COLOR_BUTTON(dialogo->bot_color_argumentos), &respuesta->argumento.color);
gtk_range_set_value(GTK_RANGE(dialogo->sld_tolerancia_ordenes), respuesta->orden.tolerancia);
gtk_range_set_value(GTK_RANGE(dialogo->sld_tolerancia_argumentos), respuesta->argumento.tolerancia);
}
gboolean devolver;
if (gtk_dialog_run(GTK_DIALOG(dialogo->dlg_preferencias_filtro)) == GTK_RESPONSE_OK) {
gtk_color_button_get_color(GTK_COLOR_BUTTON(dialogo->bot_color_ordenes), &respuesta->orden.color);
gtk_color_button_get_color(GTK_COLOR_BUTTON(dialogo->bot_color_argumentos), &respuesta->argumento.color);
respuesta->orden.tolerancia = gtk_range_get_value(GTK_RANGE(dialogo->sld_tolerancia_ordenes));
respuesta->argumento.tolerancia = gtk_range_get_value(GTK_RANGE(dialogo->sld_tolerancia_argumentos));
devolver = TRUE;
}
else {
devolver = FALSE;
}
dialogo_preferencias_filtro_cerrar(dialogo);
return devolver;
}
示例7: wp_color_changed
static void
wp_color_changed (AppearanceData *data,
gboolean update)
{
MateWPItem *item;
item = get_selected_item (data, NULL);
if (item == NULL)
return;
gtk_color_button_get_color (GTK_COLOR_BUTTON (data->wp_pcpicker), item->pcolor);
gtk_color_button_get_color (GTK_COLOR_BUTTON (data->wp_scpicker), item->scolor);
if (update)
{
gchar *pcolor, *scolor;
pcolor = gdk_color_to_string (item->pcolor);
scolor = gdk_color_to_string (item->scolor);
g_settings_set_string (data->wp_settings, WP_PCOLOR_KEY, pcolor);
g_settings_set_string (data->wp_settings, WP_SCOLOR_KEY, scolor);
g_free (pcolor);
g_free (scolor);
}
wp_shade_type_changed (NULL, data);
}
示例8: wp_props_wp_selected
static void
wp_props_wp_selected (GtkTreeSelection *selection,
AppearanceData *data)
{
MateWPItem *item;
item = get_selected_item (data, NULL);
if (item != NULL)
{
wp_set_sensitivities (data);
if (strcmp (item->filename, "(none)") != 0)
wp_option_menu_set (data, item->options, FALSE);
wp_option_menu_set (data, item->shade_type, TRUE);
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_pcpicker),
item->pcolor);
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_scpicker),
item->scolor);
if (data->wp_update_settings)
wp_props_wp_set (data, item);
}
else
{
gtk_widget_set_sensitive (data->wp_rem_button, FALSE);
}
}
示例9: UpdateColourPreview
static void
UpdateColourPreview(void)
{
TextureInfo *tempTexture;
double ambient[4], diffuse[4], specular[4];
if (!bUpdate)
return;
if (useOpacity)
opacityValue = (float) gtk_adjustment_get_value(padjOpacity) / 100.0f;
gtk_color_button_get_array(GTK_COLOR_BUTTON(pcpAmbient), ambient);
gtk_color_button_get_array(GTK_COLOR_BUTTON(pcpDiffuse), diffuse);
gtk_color_button_get_array(GTK_COLOR_BUTTON(pcpSpecular), specular);
tempTexture = col3d.textureInfo; /* Remeber texture, as setupmat resets it */
SetupMat(&col3d, (float) ambient[0], (float) ambient[1], (float) ambient[2],
(float) diffuse[0], (float) diffuse[1], (float) diffuse[2],
(float) specular[0], (float) specular[1], (float) specular[2],
(int) gtk_adjustment_get_value(padjShine), opacityValue);
col3d.textureInfo = tempTexture;
gtk_widget_queue_draw(pwPreview);
}
示例10: profile_palette_notify_colorpickers_cb
static void
profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
GParamSpec *pspec,
GtkWidget *editor)
{
GtkWidget *w;
GdkColor colors[TERMINAL_PALETTE_SIZE];
guint n_colors, i;
n_colors = G_N_ELEMENTS (colors);
terminal_profile_get_palette (profile, colors, &n_colors);
n_colors = MIN (n_colors, TERMINAL_PALETTE_SIZE);
for (i = 0; i < n_colors; i++)
{
char name[32];
GdkColor old_color;
g_snprintf (name, sizeof (name), "palette-colorpicker-%d", i + 1);
w = profile_editor_get_widget (editor, name);
gtk_color_button_get_color (GTK_COLOR_BUTTON (w), &old_color);
if (!gdk_color_equal (&old_color, &colors[i]))
{
g_signal_handlers_block_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
gtk_color_button_set_color (GTK_COLOR_BUTTON (w), &colors[i]);
g_signal_handlers_unblock_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
}
}
}
示例11: preferences_color_cb
/* Preferences Callback : Change color. */
void
preferences_color_cb (GtkWidget *button, gpointer data)
{
GdkColor color, font_color;
char *color_str, *font_color_str;
gtk_color_button_get_color (
GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color);
gtk_color_button_get_color (
GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color),
&font_color);
color_str = g_strdup_printf ("#%.2x%.2x%.2x",
color.red / 256,
color.green / 256,
color.blue / 256);
font_color_str = g_strdup_printf ("#%.2x%.2x%.2x",
font_color.red / 256,
font_color.green / 256,
font_color.blue / 256);
g_settings_set_string (stickynotes->settings, "default-color", color_str);
g_settings_set_string (stickynotes->settings, "default-font-color", font_color_str);
g_free (color_str);
g_free (font_color_str);
}
示例12: colour_changed
void colour_changed(GtkWidget *w, gpointer data)
{
rgba_t *col = (rgba_t*)data;
GdkColor gdk_col;
gtk_color_button_get_color(GTK_COLOR_BUTTON(w), &gdk_col);
int alpha = (gtk_color_button_get_alpha(GTK_COLOR_BUTTON(w)) / 255);
if (alpha > 255)
alpha = 255;
int red = (gdk_col.red / 255);
if (red > 255)
red = 255;
int green = (gdk_col.green / 255);
if (green > 255)
green = 255;
int blue = (gdk_col.blue / 255);
if (blue > 255)
blue = 255;
//col->set((BYTE)red, (BYTE)green, (BYTE)blue, (BYTE)alpha);
col->r = (BYTE)red;
col->g = (BYTE)green;
col->b = (BYTE)blue;
col->a = (BYTE)alpha;
force_map_redraw(true, true);
}
示例13: properties_color_cb
/* Properties Dialog Callback : Color */
void
properties_color_cb (GtkWidget *button, StickyNote *note)
{
char *color_str = NULL;
char *font_color_str = NULL;
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(note->w_def_color)))
{
GdkColor color;
GdkColor font_color;
gtk_color_button_get_color (
GTK_COLOR_BUTTON (note->w_color),
&color);
gtk_color_button_get_color (
GTK_COLOR_BUTTON (note->w_font_color),
&font_color);
color_str = g_strdup_printf ("#%.2x%.2x%.2x",
color.red / 256,
color.green / 256,
color.blue / 256);
font_color_str = g_strdup_printf ("#%.2x%.2x%.2x",
font_color.red / 256,
font_color.green / 256,
font_color.blue / 256);
}
stickynote_set_color (note, color_str, font_color_str, TRUE);
g_free (color_str);
g_free (font_color_str);
}
示例14: create_text_block_event
EXPORT gboolean create_text_block_event(GtkWidget * widget, gpointer data)
{
GtkWidget *dialog = NULL;
MtxTextBlock *tblock = NULL;
GladeXML *xml = NULL;
gchar * filename = NULL;
gint result = 0;
if (!GTK_IS_WIDGET(gauge))
return FALSE;
filename = get_file(g_build_filename(GAUGEDESIGNER_GLADE_DIR,"gaugedesigner.glade",NULL),NULL);
if (filename)
{
xml = glade_xml_new(filename, "tblock_dialog", NULL);
g_free(filename);
}
else
{
printf("Can't locate primary glade file!!!!\n");
exit(-1);
}
glade_xml_signal_autoconnect(xml);
dialog = glade_xml_get_widget(xml,"tblock_dialog");
gtk_color_button_set_color(GTK_COLOR_BUTTON(glade_xml_get_widget(xml,"tblock_day_colorbutton")),&white);
gtk_color_button_set_color(GTK_COLOR_BUTTON(glade_xml_get_widget(xml,"tblock_nite_colorbutton")),&black);
if (!GTK_IS_WIDGET(dialog))
{
return FALSE;
}
result = gtk_dialog_run(GTK_DIALOG(dialog));
switch (result)
{
case GTK_RESPONSE_APPLY:
tblock = g_new0(MtxTextBlock, 1);
tblock->font_scale = gtk_spin_button_get_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml,"tblock_font_scale_spin")));
tblock->x_pos = gtk_spin_button_get_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml,"tblock_xpos_spin")));
tblock->y_pos = gtk_spin_button_get_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml,"tblock_ypos_spin")));
tblock->text = gtk_editable_get_chars(GTK_EDITABLE(glade_xml_get_widget(xml,"tblock_text_entry")),0,-1);
gtk_color_button_get_color(GTK_COLOR_BUTTON(glade_xml_get_widget(xml,"tblock_day_colorbutton")),&tblock->color[MTX_DAY]);
gtk_color_button_get_color(GTK_COLOR_BUTTON(glade_xml_get_widget(xml,"tblock_nite_colorbutton")),&tblock->color[MTX_NITE]);
tblock->font = (gchar *)gtk_font_button_get_font_name (GTK_FONT_BUTTON(glade_xml_get_widget(xml,"tblock_fontbutton")));
tblock->font = g_strchomp(g_strdelimit(tblock->font,"0123456789",' '));
changed = TRUE;
mtx_gauge_face_set_text_block_struct(MTX_GAUGE_FACE(gauge),tblock);
g_free(tblock->text);
g_free(tblock);
update_onscreen_tblocks();
break;
default:
break;
}
if (GTK_IS_WIDGET(dialog))
gtk_widget_destroy(dialog);
return (FALSE);
}
示例15: preferences_color_cb
/* Preferences Callback : Change color. */
void
preferences_color_cb (GtkWidget *button, gpointer data)
{
GdkColor color, font_color;
char *color_str, *font_color_str;
gtk_color_button_get_color (
GTK_COLOR_BUTTON (stickynotes->w_prefs_color), &color);
gtk_color_button_get_color (
GTK_COLOR_BUTTON (stickynotes->w_prefs_font_color),
&font_color);
color_str = g_strdup_printf ("#%.2x%.2x%.2x",
color.red / 256,
color.green / 256,
color.blue / 256);
font_color_str = g_strdup_printf ("#%.2x%.2x%.2x",
font_color.red / 256,
font_color.green / 256,
font_color.blue / 256);
gconf_client_set_string (stickynotes->gconf,
GCONF_PATH "/defaults/color", color_str, NULL);
gconf_client_set_string (stickynotes->gconf,
GCONF_PATH "/defaults/font_color", font_color_str,
NULL);
g_free (color_str);
g_free (font_color_str);
}