File: applications.rst

package info (click to toggle)
libgtkada 21.0.0.785f3cf4-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 41,160 kB
  • sloc: ada: 203,114; xml: 8,403; python: 4,501; perl: 3,838; ansic: 2,949; sh: 2,851; makefile: 351; objc: 160; javascript: 100
file content (52 lines) | stat: -rw-r--r-- 1,206 bytes parent folder | download | duplicates (3)
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
51
52
.. _Starting_an_application_with_GtkAda:

***********************************
Starting an application with GtkAda
***********************************

You need to perform some initializations to start a GtkAda application::

  --  predefined units of the library
  with Gtk.Main;
  with Gtk.Enums;
  with Gtk.Window;
  ...
  --  My units
  with Callbacks;
  ...
  procedure Application is
     procedure Create_Window is ...

  begin
     --  Set the locale specific datas (e.g time and date format)
     Gtk.Main.Set_Locale;

     --  Initializes GtkAda
     Gtk.Main.Init;

     --  Create the main window
     Create_Window;

     --  Signal handling loop
     Gtk.Main.Main;
  end Application;


the `Create_Window` procedure looks like::

     procedure Create_Window is
        Main_Window : Gtk.Window.Gtk_Window;
        ...
     begin
        Gtk.Window.Gtk_New
          (Window   => Main_Window,
           The_Type => Gtk.Enums.Window_Toplevel);

        --  From Gtk.Widget:
        Gtk.Window.Set_Title (Window => Main_Window, Title  => "Editor");

        --  Construct the window and connect various callbacks

        ...
        Gtk.Window.Show_All (Main_Window);
     end Create_Window;