text
stringlengths 0
234
|
|---|
-- Procedure que se encarga de inicializar la interfaz gráfica
|
------------------------------------------------------------------------
|
procedure Inicializar_Interfaz_Grafica is
|
Win : Gtk_Window;
|
Buffer : Gtk_Double_Buffer;
|
Vbox, Hbox : Gtk_Box;
|
Id : G_Source_Id;--Timeout_Handler_Id;
|
Button : Gtk_Button;
|
inbuilt_font : Pango.Font.Pango_Font_Description;
|
--ventana : Gdk_Window;
|
--TAM_BUTTON_EXIT : constant GLib.Gint := 20;
|
alinea_button : Gtk.Alignment.Gtk_Alignment;
|
begin
|
-- ventana principal
|
Gtk.Window.Gtk_New (Win, Window_Toplevel);
|
Set_Title (Win, "PRACTICA STR: CONTROL DE TRAFICO");
|
Win.Set_Default_Size(CANVAS_WIDTH, CANVAS_HEIGHT);--+TAM_BUTTON_EXIT);
|
Void_Cb.Connect (Win, "destroy", Void_Cb.To_Marshaller (Quit'Access));
|
-- botón Exit
|
Gtk_New (Button, "EXIT");
|
Destroyed.Object_Connect (Button,
|
"clicked",
|
Destroyed.To_Marshaller (Quit'Access),
|
Slot_Object => Win);
|
Button.Set_Size_Request(100, 20);--TAM_BUTTON_EXIT);
|
Gtk.Alignment.Gtk_New(alinea_button, 0.5, 0.5, 0.0, 0.0);
|
alinea_button.Add(Button);
|
-- Double buffer
|
Double_Buffer.Gtk_New(Buffer);
|
Buffer.Set_Size_Request(CANVAS_WIDTH, CANVAS_HEIGHT);-- -TAM_BUTTON_EXIT);
|
-- Asociar widgets a la ventana principal y mostrarla
|
Gtk_New_Hbox (Hbox, Homogeneous => True, Spacing => 10);
|
Gtk_New_Vbox (Vbox, Homogeneous => False, Spacing => 0);
|
Pack_Start (Vbox, Buffer);
|
--Pack_Start (Vbox, Button, Expand => False, Fill => False);
|
Pack_Start (Vbox, alinea_button);--, Expand => False, Fill => False);
|
Pack_Start (Hbox, Vbox);
|
Win.Add(Hbox);
|
Show_All (Win);
|
--ventana := Get_Window(Gtk_Widget(Buffer));
|
--Gdk.Window.Move(ventana, 0, 0);
|
Id := Main_Context_Sources.Timeout_Add (PERIODICIDAD_REDIBUJAR_MILISEGUNDOS,
|
Draw_Complex_Buffer'Access,
|
Gtk_Drawing_Area (Buffer));
|
Gdk_New(pangoLayout, Get_Pango_Context(Buffer));
|
inbuilt_font := Pango.Font.From_String("Courier");
|
Pango.Layout.Set_Font_Description(pangoLayout, inbuilt_font);
|
-- INICIALIZACIÓN DEL ESTADO DE TODOS LOS OBJETOS VISUALIZADOS
|
Inicializar_Buffer_Coches;
|
end Inicializar_Interfaz_Grafica;
|
------------------
|
-- Draw_Complex --
|
------------------
|
procedure Draw_Complex (Pixmap : Cairo_Context) is
|
begin
|
Draw_Rectangle (Pixmap, Black_Gc, Filled => True,
|
X => 0, Y => 0,
|
Width => CANVAS_WIDTH, Height => CANVAS_HEIGHT);
|
-- DIBUJAR EN EL CANVAS EL ESTADO ACTUAL DE TODOS LOS OBJETOS
|
Dibujar_Canvas_Calle(Pixmap);
|
end Draw_Complex;
|
-------------------------
|
-- Draw_Complex_Buffer --
|
-------------------------
|
function Draw_Complex_Buffer (Area : Gtk_Drawing_Area) return Boolean is
|
Buffer : Gtk_Double_Buffer := Gtk_Double_Buffer (Area);
|
begin
|
Draw_Complex (Get_Pixmap (Buffer));
|
Double_Buffer.Thaw(Buffer);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.