tags:

views:

455

answers:

2
+1  A: 

If what you want is to duplicate the look, then there are two very inefficient solutions to the problem:

  1. Write your own GTK theme engine (see Murrine or Clearlooks).
  2. Replace your entire program by a GtkDrawingArea widget and use Cairo to draw exactly the look you want. You'll be on your own then, though, so you'll have to write all your widget placement algorithms, buttons, expanders, menus, and whatnot, from scratch.

GTK isn't really meant for this sort of thing. The whole point of GTK is that you design your user interface with the standard widgets, and they just work with whatever theme, language, or accessibility technologies your users need to use. If you design your own look and there's no way to change it, then someone with color blindness or poor eyesight won't be able to use it. Or the text will get all misaligned if someone uses your application in another language. Or at the very least, maybe someone just likes a black desktop with white lettering, and your application will stick out and look really ugly on that user's computer. If you really need to make it look exactly that way, then probably GTK isn't the right tool for you.

ptomato
Thank you very very very much for the explanation... Actually i am trying to create the look in the seance of working of widget... like when we use Expander we will get one Arrow in Left corner of Label and when we click on it, it will expand .... so i want to replace this Arrow, i don't want that arrow it will be just a plain strip (with any color that system provides)... and when user click on it it will expand... hope this explains!
PP
Maybe you can subclass GtkExpander and draw your color bar with Cairo.
ptomato
can you please provide example!
PP
Nope, sorry ... it's much too complicated to write down here. Also I've never used Cairo directly before, so I don't know how. Here is a link to the relevant section of the GTK tutorial, called "Writing Your Own Widgets": http://library.gnome.org/devel/gtk-tutorial/stable/c2182.html Pay attention to how they make the GtkDial widget, although this tutorial is too old to use Cairo.There is a very good section in the book "Foundations of GTK+ Development" (www.gtkbook.com) on drawing your own widgets. If I remember right, they use Cairo in that chapter. It's a very good book to read anyway.
ptomato
Actually, you would probably be better off just using a GtkExpander temporarily and writing your own widget to replace it later on.
ptomato
Thanks for the explanation... i will just use simple expander and then i will replace it with new custom widget.
PP
+2  A: 

Stripping the arrow is quite trivial. Just append the following code to you $HOME/.gtkrc-2.0 (or create it if not found):

style "pradeep" {
  GtkExpander::expander-size = 0
  GtkExpander::expander-spacing = 0
}
widget "*.GtkExpander" style "pradeep"

This is done by customizing the appearance using resource files. You can get the same result programmatically by changing the GtkExpander style properties.

Furthermore, you can connect your own callback to its "activate" signal and switch the background color of the widget whenever is active or not. And a lot more...

Just remember someone loves to have a consistent user interface.

ntd