Re: Apply diferent styles to diferent own classes..



El mar, 07-08-2007 a las 16:04 +0000, Benjamin Berg escribi� On Tue, 2007-07-08 at 10:44 +0200, Iker Perez de Albeniz wrote:
> > Hi, 
> > 
> > I'm developing a program wich has diferent windows classes, the main
> > window and toolbox windows.. 
> > 
> > so.. 
> > 
> > in mi gtkrc file i define: 
> > 
> > class "GtkWindow" style "Default" 
> > 
> > and this code makes all windows look similar so what i wan is define
> > diferent styles for my own classes.. 
> > 
> > for example: 
> > 
> > 
> > in my program i create a HelloWorld class that is a GtkWindow with a
> > button and a label and i want that this class have a diferent style
> > from the main windows... 
> > 
> > i have read the documentation and apears someething abaut adding a
> > code like this: 
> 
> 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..

> 
> > widget "myownclass" stye "othrestyle" 
> > 
> > so i tried to do: 
> > 
> > widget "HelloWorld" style "hello-style" 
> 
> Sounds like you want to style the widgets inside the "HelloWorld" class
> differently. So two points to note here:
>       * widget matches on the name of the widget (set with
>         gtk_widget_set_name) and not the name of the class.
>       * The match you would only modify the main window, nothing inside.
> 
> What you really want is something like:
> 
> widget_class "HelloWorld.*" style "helloworld-style"
> 
> This will match against any widget inside your HelloWorld GtkWindow
> subclass.
> 
> 
> Benjamin

I think i have try it but doesn work...

for example, this is the main.cpp:

-----------------------------------

#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);
...
-----------------

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..






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