File: dial_test.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 (50 lines) | stat: -rw-r--r-- 1,227 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
with Glib; use Glib;
with Gtk_Dial, Dial_Handlers; use Gtk_Dial, Dial_Handlers;
with Gtk.Main, Gtk.Enums; use Gtk.Enums;
with Gtk.Window, Gtk.Adjustment, Gtk.Frame, Gtk.Box, Gtk.Label;
use Gtk.Window, Gtk.Adjustment, Gtk.Frame, Gtk.Box, Gtk.Label;

procedure Dial_Test is
   Window     : Gtk_Window;
   Adjustment : Gtk_Adjustment;
   Dial       : Gtk_Dial.Gtk_Dial;
   Frame      : Gtk_Frame;
   Vbox       : Gtk_Vbox;
   Label      : Gtk_Label;

begin
   Gtk.Main.Init;

   Gtk_New (Window);
   Set_Title (Window, "Dial");

   Window_Cb.Connect
     (Window, "destroy", Window_Cb.To_Marshaller (Destroy'Access));

   Set_Border_Width (Window, 10);

   Gtk_New_Vbox (Vbox, False, 5);
   Add (Window, Vbox);

   Gtk_New (Frame);
   Set_Shadow_Type (Frame, Shadow_In);
   Pack_Start (Vbox, Frame, True, True, 0);

   Gtk_New (Adjustment, 0.0, -1.0, 1.0, 0.01, 0.1, 0.0);

   Gtk_New (Dial, Adjustment);
   Set_Update_Policy (Dial, Update_Delayed);

   Add (Frame, Dial);

   Gtk_New (Label, "0.00");
   Pack_Start (Vbox, Label, True, True, 0);

   Adjustment_Cb.Connect
     (Adjustment, "value_changed",
      Adjustment_Cb.To_Marshaller (Value_Changed'Access), Label);

   Show_All (Window);

   Gtk.Main.Main;
end Dial_Test;