File: tooltips.adb

package info (click to toggle)
libgtkada 2.24.4dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 12,208 kB
  • ctags: 1,676
  • sloc: ada: 119,686; ansic: 4,719; sh: 3,003; makefile: 690; xml: 338; perl: 70
file content (36 lines) | stat: -rw-r--r-- 1,105 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--  This example demonstrates how you can change the color scheme used
--  for tooltips.
--  This is of course done through styles. However, you can not directly
--  associate a Gtk_Tooltips with a style, so you have to do the following.

--  Note also that this choice should probably left to the user, who can
--  modify it through a RC file that contains the following:
--      style "postie"
--      {
--         bg[NORMAL]={1.0, 0.93, 0.22}
--      }
--      widget "gtk-tooltips*" style "postie"

with Gtk.Tooltips, Gtk.Style, Gtk.Enums, Gtk.Widget, Gdk.Color;
use Gtk.Tooltips, Gtk.Style, Gtk.Enums, Gtk.Widget, Gdk.Color;

procedure Tooltips is
   Style : Gtk_Style;
   Tips  : Gtk_Tooltips;
   Color : Gdk_Color;
begin
   Gtk_New (Style);

   --  blue foreground
   Set_Rgb (Color, 255, 255, 65535);
   Alloc (Get_Default_Colormap, Color);
   Set_Foreground (Style, State_Normal, Color);

   --  green background
   Set_Rgb (Color, 255, 65535, 255);
   Alloc (Get_Default_Colormap, Color);
   Set_Background (Style, State_Normal, Color);

   Gtk_New (Tips);
   Force_Window (Tips);
end Tooltips;