本文整理汇总了C++中GTK_COLOR_BUTTON函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_COLOR_BUTTON函数的具体用法?C++ GTK_COLOR_BUTTON怎么用?C++ GTK_COLOR_BUTTON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_COLOR_BUTTON函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:BackupTheBerlios,项目名称:fbpanel-svn,代码行数:29,代码来源:configurator.c
示例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);
}
开发者ID:abhinandh,项目名称:xpad,代码行数:25,代码来源:xpad-preferences.c
示例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");
}
开发者ID:BackupTheBerlios,项目名称:fbpanel-svn,代码行数:30,代码来源:configurator.c
示例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 );
}
开发者ID:BackupTheBerlios,项目名称:galan,代码行数:27,代码来源:cube.c
示例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;
}
开发者ID:Torture,项目名称:MegaTunix,代码行数:30,代码来源:gd_init.c
示例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;
}
开发者ID:BackupTheBerlios,项目名称:visionrobot,代码行数:32,代码来源:preferencias.c
示例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);
}
开发者ID:kottroll,项目名称:mate-control-center,代码行数:28,代码来源:appearance-desktop.c
示例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);
}
}
开发者ID:kottroll,项目名称:mate-control-center,代码行数:30,代码来源:appearance-desktop.c
示例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);
}
开发者ID:iagolucchese,项目名称:python_backgammon,代码行数:25,代码来源:gtkcolour3d.c
示例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);
}
}
}
开发者ID:jsgh,项目名称:mate-terminal,代码行数:30,代码来源:profile-editor.c
示例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);
}
开发者ID:alexandervdm,项目名称:mate-applets,代码行数:28,代码来源:stickynotes_applet_callbacks.c
示例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);
}
开发者ID:BackupTheBerlios,项目名称:gtkslade-svn,代码行数:31,代码来源:prefs_colours.cpp
示例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);
}
开发者ID:MotoHoss,项目名称:mate-applets,代码行数:33,代码来源:stickynotes_callbacks.c
示例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);
}
开发者ID:Torture,项目名称:MegaTunix,代码行数:60,代码来源:tblocks.c
示例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);
}
开发者ID:lanoxx,项目名称:gnome-panel,代码行数:31,代码来源:stickynotes_applet_callbacks.c
示例16: swap_colors_clicked
static void
swap_colors_clicked (GtkButton *button,
CcBackgroundPanel *panel)
{
CcBackgroundPanelPrivate *priv = panel->priv;
GdkColor pcolor, scolor;
char *new_pcolor, *new_scolor;
gtk_color_button_get_color (GTK_COLOR_BUTTON (WID ("style-pcolor")), &pcolor);
gtk_color_button_get_color (GTK_COLOR_BUTTON (WID ("style-scolor")), &scolor);
gtk_color_button_set_color (GTK_COLOR_BUTTON (WID ("style-scolor")), &pcolor);
gtk_color_button_set_color (GTK_COLOR_BUTTON (WID ("style-pcolor")), &scolor);
new_pcolor = gdk_color_to_string (&scolor);
new_scolor = gdk_color_to_string (&pcolor);
g_object_set (priv->current_background,
"primary-color", new_pcolor,
"secondary-color", new_scolor,
NULL);
g_settings_set_string (priv->settings, WP_PCOLOR_KEY, new_pcolor);
g_settings_set_string (priv->settings, WP_SCOLOR_KEY, new_scolor);
g_free (new_pcolor);
g_free (new_scolor);
g_settings_apply (priv->settings);
update_preview (priv, NULL);
}
开发者ID:dawati,项目名称:gnome-control-center,代码行数:32,代码来源:cc-background-panel.c
示例17: gtk_color_button_set_rgba
void wxColourButton::UpdateColour()
{
#ifdef __WXGTK3__
gtk_color_button_set_rgba(GTK_COLOR_BUTTON(m_widget), m_colour);
#else
gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
#endif
}
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:8,代码来源:clrpicker.cpp
示例18: settings
void settings(){
GtkWidget *window_settings;
GtkWidget *box_buttons;
GtkWidget *box_cbuttons1;
GtkWidget *box_cbuttons2;
GtkWidget * label_bg;
GtkWidget * label_fg;
GtkWidget* button_save;
GtkWidget* button_close;
window_settings = gtk_window_new(GTK_WINDOW_TOPLEVEL);
box_main = gtk_vbox_new(FALSE, 0);
box_buttons = gtk_hbox_new(FALSE, 0);
box_cbuttons1 = gtk_hbox_new(FALSE, 0);
box_cbuttons2 = gtk_hbox_new(FALSE, 0);
label_bg = gtk_label_new("Background : ");
gtk_box_pack_start (GTK_BOX(box_cbuttons1), label_bg, TRUE, FALSE, 5);
button_bcolor = gtk_color_button_new();
gtk_box_pack_start (GTK_BOX(box_cbuttons1), button_bcolor, TRUE, FALSE, 5);
gtk_box_pack_start (GTK_BOX(box_main), box_cbuttons1, TRUE, FALSE, 5);
label_fg = gtk_label_new("Foreground : ");
gtk_box_pack_start (GTK_BOX(box_cbuttons2), label_fg, TRUE, FALSE, 5);
button_fcolor = gtk_color_button_new();
gtk_box_pack_start (GTK_BOX(box_cbuttons2), button_fcolor, TRUE, FALSE, 5);
gtk_box_pack_start (GTK_BOX(box_main), box_cbuttons2, TRUE, FALSE, 5);
button_save = gtk_button_new_with_label("Save");
button_close = gtk_button_new_with_label("Close");
gtk_signal_connect (GTK_OBJECT (button_save), "clicked",
GTK_SIGNAL_FUNC (save), NULL);
gtk_box_pack_start (GTK_BOX (box_buttons), button_save, TRUE, FALSE, 5);
gtk_signal_connect (GTK_OBJECT (button_close), "clicked",
GTK_SIGNAL_FUNC (remove_vte), NULL);
gtk_box_pack_start (GTK_BOX (box_buttons), button_close, TRUE, FALSE, 5);
gtk_box_pack_start (GTK_BOX (box_main), box_buttons, TRUE, FALSE, 5);
gtk_container_add (GTK_CONTAINER (window_settings), box_main);
gtk_widget_show (label_fg);
gtk_widget_show (label_bg);
gtk_widget_show (box_cbuttons1);
gtk_widget_show (box_cbuttons2);
gtk_widget_show (button_bcolor);
gtk_widget_show (button_fcolor);
gtk_widget_show (button_save);
gtk_widget_show (button_close);
gtk_widget_show (box_buttons);
gtk_widget_show (box_main);
gtk_widget_show (window_settings);
gtk_color_button_set_color(GTK_COLOR_BUTTON(button_bcolor), &bcolor);
gtk_color_button_set_color(GTK_COLOR_BUTTON(button_fcolor), &fcolor);
}
开发者ID:inf0-warri0r,项目名称:multi_terminal,代码行数:58,代码来源:multi_terminal.c
示例19: reset_general_controls
void reset_general_controls()
{
GtkWidget * widget = NULL;
if ((!toplevel) || (!gauge))
return;
hold_handlers = TRUE;
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"cw_button"));
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget),TRUE);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"ccw_button"));
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget),TRUE);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"antialiased_check"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),TRUE);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"tattletale_check"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),TRUE);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"tattletale_alpha_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_width_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_tail_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"start_angle_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"sweep_angle_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"lbound_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"ubound_spin"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),0);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"background_color_button"));
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget),&black);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"needle_color_button"));
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget),&white);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"gradient_begin_color_button"));
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget),&white);
widget = GTK_WIDGET (gtk_builder_get_object(toplevel,"gradient_end_color_button"));
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget),&black);
hold_handlers = FALSE;
}
开发者ID:toxicgumbo,项目名称:MegaTunix,代码行数:57,代码来源:handlers.c
示例20: widget_colorbutton_input_by_file
static void widget_colorbutton_input_by_file(variable *var, char *filename)
{
FILE *infile;
GdkColor color;
list_t *values = NULL;
gchar line[512];
gint count;
guint alpha;
#ifdef DEBUG_TRANSITS
fprintf(stderr, "%s(): Entering.\n", __func__);
#endif
if (infile = fopen(filename, "r")) {
/* Just one line */
if (fgets(line, 512, infile)) {
/* Enforce end of string in case of max chars read */
line[512 - 1] = 0;
/* Remove the trailing [CR]LFs */
for (count = strlen(line) - 1; count >= 0; count--)
if (line[count] == 13 || line[count] == 10) line[count] = 0;
values = linecutter(g_strdup(line), '|');
if (values->n_lines > 0) {
/* Parse the RGB value to create the necessary GdkColor.
* This function doesn't like trailing whitespace so it
* needs to be stripped first with g_strstrip() */
if (gdk_color_parse(g_strstrip(values->line[0]), &color)) {
#ifdef DEBUG_CONTENT
fprintf(stderr, "%s:() valid colour found\n", __func__);
#endif
gtk_color_button_set_color(GTK_COLOR_BUTTON(var->Widget), &color);
}
}
if (values->n_lines > 1) {
/* Read alpha as an unsigned decimal integer */
if (sscanf(values->line[1], "%u", &alpha) == 1) {
#ifdef DEBUG_CONTENT
fprintf(stderr, "%s:() valid alpha=%u found\n", __func__, alpha);
#endif
/* This requires use-alpha="true" */
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(var->Widget), alpha);
}
}
/* Free linecutter memory */
if (values) list_t_free(values);
}
/* Close the file */
fclose(infile);
} else {
fprintf(stderr, "%s(): Couldn't open '%s' for reading.\n", __func__,
filename);
}
#ifdef DEBUG_TRANSITS
fprintf(stderr, "%s(): Exiting.\n", __func__);
#endif
}
开发者ID:ElAdnan,项目名称:gtkdialog,代码行数:57,代码来源:widget_colorbutton.c
注:本文中的GTK_COLOR_BUTTON函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论