------------------------------------------------------------------------------ -- -- -- Copyright (C) 2019 L. Dries -- -- -- -- 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. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- 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 -- -- . -- -- -- ------------------------------------------------------------------------------ -- Version 1.00 dd. 19-07-2016 created by L. Dries -- ------------------------------------------------------------------------------ -- Created from Template V1.00 by L. Dries on 23- 10- 2018 -- ------------------------------------------------------------------------------ pragma License(Unrestricted); with Gtk.Enums; use Gtk.Enums; with Gtk.Handlers; use Gtk.Handlers; with Gtk.Combo_Box_Text; use Gtk.Combo_Box_Text; with Glib.Gslist; use Glib.Gslist; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with CPP2Ada_Dialog_Type_CB; use CPP2Ada_Dialog_Type_CB; with CPP2Ada_General; use CPP2Ada_General; with CPP2Ada_Main_Init; use CPP2Ada_Main_Init; with CPP2Ada_Languages; use CPP2Ada_Languages; package body CPP2Ada_Dialog_Type_Init is package Dialog_CBR is new Gtk.Handlers.Return_Callback (Gtk_Dialog_Record, Boolean); package Button is new Gtk.Handlers.Callback (Gtk_Button_Record); procedure Type_New(TypeDialog : out Type_Dialog_Access) is begin TypeDialog := new Type_Dialog_Record; CPP2Ada_Dialog_Type_Init.Type_Init (TypeDialog); end Type_New; procedure Type_Init(TypeDialog : access Type_Dialog_Record'Class) is pragma Suppress (All_Checks); Pixmaps_Dir : constant String := "pixmaps/"; Items : String_List.Glist; begin Gtk.Dialog.Initialize (TypeDialog); TypeDialog.Set_Title (To_String(Type_Dialog_Title(Lan))); Set_Position (TypeDialog, Win_Pos_Center); Set_Modal (TypeDialog, true); Set_Resizable (TypeDialog, false); Set_Default_Size (TypeDialog, Dialogsize_H, Dialogsize_V); if Set_Icon_From_File(TypeDialog, Icon_Name) then On_Type_End(null); end if; Type_Dialog_Open := true; TypeDialog.Dialog_Box := Get_Content_Area(TypeDialog); Gtk_New(TypeDialog.Button_Box, Orientation_Horizontal, 0); Gtk_New(TypeDialog.Frame_Box, Orientation_Vertical, 0); Gtk_New(TypeDialog.Frame, To_String(Type_Frame_Title(lan))); Gtk_New (TypeDialog.Radio_Header); Gtk_New (TypeDialog.Radio_CPP); Pack_Start (TypeDialog.Frame_Box, TypeDialog.Frame, Expand => True, Fill => True, Padding => 0); Set_Label(TypeDialog.Radio_Header, To_String(Type_Header_Title(lan))); Pack_Start (TypeDialog.Frame_Box, TypeDialog.Radio_Header, Expand => True, Fill => True, Padding => 0); Set_Label(TypeDialog.Radio_CPP, To_String(Type_CPP_Title(lan))); Pack_Start (TypeDialog.Frame_Box, TypeDialog.Radio_CPP, Expand => True, Fill => True, Padding => 1); Gtk_New (TypeDialog.Wrong_File, To_String(Lan_Wrong_File(Lan))); Pack_Start (TypeDialog.Button_Box, TypeDialog.Wrong_File, Expand => True, Fill => True, Padding => 0); Gtk_New (TypeDialog.OK, To_String(Lan_OK(Lan))); Pack_Start (TypeDialog.Button_Box, TypeDialog.OK, Expand => True, Fill => True, Padding => 0); Pack_Start (TypeDialog.Dialog_Box, TypeDialog.Frame_Box, Expand => True, Fill => True, Padding => 0); Pack_Start (TypeDialog.Dialog_Box, TypeDialog.Button_Box, Expand => True, Fill => True, Padding => 0); TypeDialog.Radio_Frame := Get_Group(TypeDialog.Radio_Header'record); Set_Group(TypeDialog.Radio_CPP, TypeDialog.Radio_Frame); Set_Size_Request(TypeDialog, Dialogsize_H, Dialogsize_V); Dialog_CBR.Connect(TypeDialog, "delete_event", Dialog_CBR.To_Marshaller(On_Type_Delete_Event'Access)); Button.Connect(TypeDialog.OK, "clicked", Button.To_Marshaller(On_Type_OK'Access)); Button.Connect(TypeDialog.Wrong_File, "clicked", Button.To_Marshaller(On_Type_End'Access)); end Type_Init; end CPP2Ada_Dialog_Type_Init;