How do I remove the focus border?
- From: Martin Wulffeld <tranquil mail dk>
- To: gtk-app-devel-list gnome org
- Subject: How do I remove the focus border?
- Date: 27 Nov 2001 16:21:27 +0100
Hi
I'm trying to remove the focus border but only for one widget (button_2
in the example below). However, the new_style is applied to both
buttons. How come?
==BEGIN==
#include <gtk/gtk.h>
void
_gtk_style_invisible_focus(GtkStyle *style, GdkWindow *window,
GdkRectangle *area, GtkWidget *widget, gchar *detail, gint x, gint y,
gint width, gint height)
{
;
}
int
main(int argc, char *argv[])
{
GtkWidget * window;
GtkWidget * button_1;
GtkWidget * button_2;
GtkWidget * vbox;
GtkStyle * old_style;
GtkStyle * new_style;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "NoFocus");
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(gtk_exit), NULL);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(gtk_exit), NULL);
gtk_container_set_border_width(GTK_CONTAINER(window), 10);
gtk_widget_realize(window);
vbox = gtk_vbox_new(0,20);
gtk_container_add(GTK_CONTAINER(window), vbox);
button_1 = gtk_button_new_with_label("Button 1");
gtk_box_pack_start(GTK_BOX(vbox), button_1, TRUE, TRUE, 0);
gtk_widget_realize(button_1);
old_style = gtk_widget_get_style(window);
gtk_widget_push_style(old_style);
new_style = gtk_style_copy(old_style);
new_style->klass->draw_focus = _gtk_style_invisible_focus;
button_2 = gtk_button_new_with_label("Button 2");
gtk_box_pack_start(GTK_BOX(vbox), button_2, TRUE, TRUE, 0);
gtk_widget_set_style(button_2,new_style);
gtk_widget_pop_style();
gtk_widget_show_all(window);
gtk_main();
return(0);
}
==END==
--
Martin Wulffeld
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]