Re: Apply diferent styles to diferent own classes..



On Wed, 2007-08-08 at 09:45 +0200, Iker Perez de Albeniz wrote:
> El mar, 07-08-2007 a las 16:04 +0000, Benjamin Berg escribió:
> > Have you seen http://live.gnome.org/GnomeArt/Tutorials/GtkThemes ?
> > 
> 
> yes i have read it but (maybe becouse my bad english) it was a bit
> confused for me..

Hm, OK. It could probably be improved. (Though don't know how ...)

> [snip]
> #include <gtkmm.h>
> #include "mainWindow.h"
> 
> int main (int argc, char *argv[])
> {
> 
> 	Gtk::Main kit(argc, argv);
> 	
> 	Gtk::RC rc_style("./skin/gtkrc");
> 	Gtk::RC::reparse_all(); 
> 	
> 	mainWindow window;
> 	
> 	window.set_name("Principal");
> 	
> 	Gtk::Main::run(window);
> 	
> 	return 0;
> }
> ------------------------------------
> 
> then in mainWindow.cpp i define the name of a GtkHBox:
> 
> ------------------
> ...
> m_Box_Window.set_name("WindowBorder");
> m_Box_Window.set_size_request(700, 32);
> m_Box_Top.pack_start(m_Box_Window, Gtk::PACK_SHRINK);
> ...
> -----------------

Ah, so you are setting the name. And you don't have a custom subclass as
I first thought.

> and finaly in the gtkrc file y put the lines:
> 
> --------------------------------------------
> style "Aero-WindowBorder"
> {
> 
>   bg_pixmap[NORMAL] = "bg_menu.png"
> 
> }
> 
> widget_class "Principal.WindowBorder" 		style "Aero-WindowBorder"
> -----------------------------------------------
> 
> to set the backgroun of the HBox.. but deosn't work..

OK. As you are setting names on the widget, then the "widget" match is
what you want. Also, a box cannot have a background image set on it. You
will need to use a GtkEventBox or similar.

widget "*.WindowBorder" style "..."

But as said earlier, this will not change anything because the box does
not draw any background image.


Benjamin

PS: I guess you are trying to set a background image on some widgets. I
have no idea how people usually achieve this. But I see different
alternatives to parsing a gtkrc or modifying RC styles.
First setting the backing pixmap directly on an event box
(gdk_window_set_back_pixmap). Or even creating subclasses and overriding
the expose event of the container widget.

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]