Re: ToolTip Color Extraction

I worte this query to gtk-app-devel a few days ago. Unfortunately, nobody has responded as yet. However, I could get the solution myself by debugging through the Gtk Sources. I am documenting that here so that it will be useful for others too.
The GtkTooltips widget has a field called tip_window which contains a pointer to GtkStyle. This style contains all the color information necessary for the tooltip. However, if we just do  "sampleToolTip->tip_window", we would get a NULL. What we need to do is to set the tip_window properly (before we retrieve it) iand for that we need to call the function "gtk_tooltips_force_window".
Thus we would write :
GtkTooltips *sampleToolTip;
GtkStyle * tooltipStyle;
sampleToolTip = gtk_tooltips_new();
// Here we would write a code to associate the tooltip with window etc.
 tooltipStyle = gtk_rc_get_style(sampleToolTip->tip_window);
On doing this we would get the color and other information in the tooltipStyle.
This helped me and hope this helps to other too.
On 10/5/05, Neelesh Bodas <neelesh bodas gmail com> wrote:
I see this query posted on this mailing list a multiple times, but non of them have been answered. (One of the post is mine itself.)
The issue is as follows :
1) The Background and Foreground Color of  "Gtk Tooltip" is configurable through the "GTKRC file".
2) What this means is that the Gtk-library/ Gtk-code parses the GtkRC file and "fills" some of its internal data structures.
3) In this process, it must be reading the color of tooltip from the GtkRC file and must be storing somewhere in its internal data structure.
Which is that Data structure?
In other words, how can a developer, at runtime, get the color of the GtkTooltip, using Gtk Data structures?
It would be fine even if I get simply the API...but what I am looking  for is the precise Data structure inside Gtk Sources.
My primary guess is that it should be GtkStyle or GtkRcStyle or something related to that.
Some Gtk-Guru, please, I would be grateful if you could answer this. I have been looking at Gtk Sources for a while but donot seem to get anything related to this.
Thanks in Advance,

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