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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
------------------------------------------------------------------------------
-- G P S --
-- --
-- Copyright (C) 2003-2015, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
with Common; use Common;
with GNATCOLL.Scripts; use GNATCOLL.Scripts;
with Gtk.Box; use Gtk.Box;
with Gtk.Label; use Gtk.Label;
with Gtk.Main; use Gtk.Main;
with Gtk.Enums; use Gtk.Enums;
with Gtk.Scrolled_Window; use Gtk.Scrolled_Window;
with Gtk.Text_View; use Gtk.Text_View;
with Gtk.Window; use Gtk.Window;
with GtkConsole; use GtkConsole;
with Common_Gtk; use Common_Gtk;
procedure NewClassGtk is
Repo : constant Scripts_Repository := Register_Scripts_And_Functions;
Console : Gtk_Console;
Win : Gtk_Window;
Scrolled : Gtk_Scrolled_Window;
View : Gtk_Text_View;
Box : Gtk_Box;
Label : Gtk_Label;
begin
Add_GUI_Subprograms (Repo);
Gtk.Main.Init;
Gtk_New (Win, Window_Toplevel);
Set_Default_Size (Win, 800, 600);
Gtk_New_Vbox (Box, Homogeneous => False);
Add (Win, Box);
-- For each known language, create a console
declare
Langs : constant Scripting_Language_Array :=
Get_Scripting_Languages (Repo);
begin
for L in Langs'Range loop
Gtk_New (Label, Get_Name (Langs (L)));
Pack_Start (Box, Label, Expand => False, Fill => False);
Gtk_New (Scrolled);
Set_Policy (Scrolled, Policy_Automatic, Policy_Automatic);
Pack_Start (Box, Scrolled, Expand => True, Fill => True);
Gtk_New (View);
Add (Scrolled, View);
Set_Wrap_Mode (View, Wrap_Word);
Console := GtkConsole.Create (View);
Set_Default_Console (Langs (L), Virtual_Console (Console));
end loop;
end;
Show_All (Win);
Gtk.Main.Main;
end NewClassGtk;
|