GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Oct 26, 2014 3:00 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: gtk CSS style for a widget which does not have a gdkwindow
PostPosted: Wed Jan 30, 2013 9:38 pm 
Offline
Familiar Face

Joined: Wed Jan 30, 2013 8:28 pm
Posts: 20
Hello,
There are many good tutos here for css style on gtk...but nothing about constraints. I want to know if it is possible to style a widget which does not have a gdkwindow ( gtk_widget_set_has_window(wid, FALSE) ). what is the effect of styling a widget when it is not yet realized like:

// very very simple example

int main( int argc, char *argv[] )
{
gtk_init( &argc, &argv );
GtkWigdet *window = gtk_window_new(TOPLEVEL_WINDOW);
GtWidget *label = gtk_label_new( "My question" );
gtk_container_add( GTK_CONTAINER(window), label);
GtkStyleContext *style_context = gtk_widget_get_style_context(label);
GtkCssProvider *css_provider = gtk_css_provider_new();

// style applied to label which is not yet realized

gtk_css_provider_load_from_data(css_provider, " GtkLabel {background-color: red} ", -1, NULL );
gtk_style_context_add_provider( style_context, css_provider );

// widget will be realize after showing the toplevel window

gtk_widget_show_all(window);
return 0;
}

Another question is about the GtkWidgetPath element which is not very clear for me

Thanks for the time to give some answers to my questions...

NB: I'm french I try myself so be indulgent with me :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group