------------------------------------------------------------------------------ -- -- -- XVIEW ADA LIBRARY COMPONENTS -- -- -- -- XV_PANEL_PACKAGE -- -- -- -- S p e c -- -- -- -- Copyright (c) 1995 Andreas Almroth, All Rights Reserved -- -- -- -- The XVIEW ADA library is free software; you can redistribute it and/or -- -- modify it under terms of the GNU Library General Public License as -- -- published by the Free Software Foundation; either version 2, or (at your -- -- option) any later version. The XVIEW ADA library is distributed in the -- -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the -- -- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public -- -- License along with the XVIEW ADA library; see the file COPYING.LIB. If -- -- not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, -- -- MA 02139, USA. -- -- -- ------------------------------------------------------------------------------ with Ada.Finalization,Xv_Base_Package,Xv_Frame_Package,Xv_Font_Package; use Ada.Finalization,Xv_Base_Package,Xv_Frame_Package,Xv_Font_Package; with Xv_Server_Image_Package; use Xv_Server_Image_Package; with Interfaces.C,Interfaces.C.Strings; package Xv_Panel_Package is type Panel is new Xv_Opaque; type Panel_cmd is new Xv_Opaque; type Scroll_Panel is new Xv_Opaque; type Panel_item is new Xv_Opaque; type Panel_abbrev_menu_button_item is new Panel_Item; type Panel_button_item is new Panel_Item; type Panel_choice_item is new Panel_Item; type Panel_toggle_item is new Panel_Item; type Panel_checkbox_item is new Panel_Item; type Panel_drop_target_item is new Panel_Item; type Panel_gauge_item is new Panel_Item; type Panel_list_item is new Panel_Item; type Panel_message_item is new Panel_Item; type Panel_slider_item is new Panel_Item; type Panel_text_item is new Panel_Item; type Panel_numeric_text_item is new Panel_Item; type Panel_multi_text_item is new Panel_Item; -- Return one of these from a callback function for text and numeric PANEL_NONE : constant := 2; PANEL_NEXT : constant := 13; PANEL_PREVIOUS : constant := 14; PANEL_INSERT : constant := 12; type callback_button_ptr is access procedure (item : Panel_item; event : Integer); type callback_text_ptr is access function (item : Panel_item; event : Integer) return Integer; type Callback_Multi_text_ptr is access function (item : Panel_item; event : Integer) return Integer; type callback_numeric_ptr is access function (item : Panel_item; event : Integer) return Integer; type callback_choice_ptr is access procedure (item : Panel_item; choice : Integer; event : Integer); type callback_list_ptr is access procedure (item : Panel_item; txt : Interfaces.C.char_array; client_data : Integer; op : Integer; event : Integer); type callback_slider_ptr is access procedure (item : Panel_item; choice : Integer; event : Integer); type callback_gauge_ptr is access procedure (item : Panel_item; choice : Integer; event : Integer); -------------- -- Xv_Panel -- -------------- type xv_panel (Owner : Frame; A_Border : Boolean) is new Controlled with private; -- type xv_panel (Owner : Frame := 0; A_Border : Boolean := False) -- is new Controlled with private; type Xv_Panel_Ptr is access all xv_panel; procedure Initialize (V : in out Xv_Panel); procedure Finalize (V : in out Xv_Panel); procedure Set_Size (V : in Xv_Panel ; W, H : Integer); procedure Set_Pos (V : in Xv_Panel ; X, Y : Integer); function Get_Panel (V : in Xv_Panel) return Panel; --------------------- -- Xv_Panel_Button -- --------------------- type Xv_Panel_Button (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Button (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Button_Ptr is access all Xv_Panel_Button; procedure Initialize (V : in out Xv_Panel_Button); procedure Finalize (V : in out Xv_Panel_Button); procedure Set_Pos (V : in Xv_Panel_Button; X,Y : Integer); procedure Set_Text (V : in Xv_Panel_Button; Txt : String); procedure Set_Image (V : in Xv_Panel_Button; image:Server_Image); procedure Set_Callback (V : in Xv_Panel_Button; func : Callback_Button_Ptr); procedure Set_Menu (V : in Xv_Panel_Button; menu : Xv_opaque); function Get_Button (V : in Xv_Panel_Button) return Panel_Button_item; ------------------- -- Xv_Panel_Text -- ------------------- type Xv_Panel_Text (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Text (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Text_Ptr is access all Xv_Panel_Text; procedure Initialize (V : in out Xv_Panel_Text); procedure Finalize (V : in out Xv_Panel_Text); procedure Set_Pos (V : in Xv_Panel_Text; X,Y : Integer); procedure Set_Text (V : in Xv_Panel_Text; Txt : String); procedure Set_Disp_Width (V : in Xv_Panel_Text; Txt : Integer); procedure Set_Value (V : in Xv_Panel_Text; Txt : String); procedure Set_Label_Font (V : in Xv_Panel_Text; Fnt : Font); procedure Set_Entry_Font (V : in Xv_Panel_Text; Fnt : Font); function Get_Value (V : in Xv_Panel_Text) return String; procedure Set_Callback (V : in Xv_Panel_Text; Func : Callback_Text_Ptr); ------------------- -- Xv_Panel_Multi_Text -- ------------------- type Xv_Panel_Multi_Text (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Multi_Text (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Multi_Text_Ptr is access all Xv_Panel_Multi_Text; procedure Initialize (V : in out Xv_Panel_Multi_Text); procedure Finalize (V : in out Xv_Panel_Multi_Text); procedure Set_Pos (V : in Xv_Panel_Multi_Text; X,Y : Integer); procedure Set_Text (V : in Xv_Panel_Multi_Text; Txt : String); procedure Set_Disp_Width (V : in Xv_Panel_Multi_Text; Txt : Integer); procedure Set_Value (V : in Xv_Panel_Multi_Text; Txt : String); procedure Set_Label_Font (V : in Xv_Panel_Multi_Text; Fnt : Font); procedure Set_Entry_Font (V : in Xv_Panel_Multi_Text; Fnt : Font); procedure Set_Display_Length (V : in Xv_Panel_Multi_Text; W : Integer); procedure Set_Stored_Length (V : in Xv_Panel_Multi_Text; W : Integer); procedure Set_Display_Width (V : in Xv_Panel_Multi_Text; W : Integer); procedure Set_Display_Rows (V : in Xv_Panel_Multi_Text; W : Integer); procedure Set_Wrap_On_Char (V : in Xv_Panel_Multi_Text); procedure Set_Wrap_On_Word (V : in Xv_Panel_Multi_Text); function Get_Value (V : in Xv_Panel_Multi_Text) return String; procedure Set_Callback (V : in Xv_Panel_Multi_Text; Func : Callback_Multi_Text_Ptr); ---------------------- -- Xv_Panel_Numeric -- ---------------------- type Xv_Panel_Numeric (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Numeric (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Numeric_Ptr is access all Xv_Panel_Numeric; procedure Initialize (V : in out Xv_Panel_Numeric); procedure Finalize (V : in out Xv_Panel_Numeric); procedure Set_Pos (V : in Xv_Panel_Numeric; X,Y : Integer); procedure Set_Text (V : in Xv_Panel_Numeric; Txt : String); procedure Set_Disp_Width (V : in Xv_Panel_Numeric; Txt : Integer); procedure Set_Value (V : in Xv_Panel_Numeric; Txt : Integer); procedure Set_Min_Value (V : in Xv_Panel_Numeric; Txt : Integer); procedure Set_Max_Value (V : in Xv_Panel_Numeric; Txt : Integer); procedure Set_Label_Font (V : in Xv_Panel_Numeric; Fnt : Font); procedure Set_Entry_Font (V : in Xv_Panel_Numeric; Fnt : Font); function Get_Value (V : in Xv_Panel_Numeric) return Integer; procedure Set_Callback (V : in Xv_Panel_Numeric; Func : Callback_Numeric_Ptr); --------------------- -- Xv_Panel_Choice -- --------------------- type Xv_Panel_Choice (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Choice (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Choice_Ptr is access all Xv_Panel_Choice; procedure Initialize (V : in out Xv_Panel_Choice); procedure Finalize (V : in out Xv_Panel_Choice); procedure Set_Pos (V : in Xv_Panel_Choice; X,Y : Integer); procedure Set_Text (V : in Xv_Panel_Choice; Txt : String); procedure Set_Layout (V : in Xv_Panel_Choice; Data : Boolean); procedure Set_Value (V : in Xv_Panel_Choice; Txt : Integer); function Get_Value (V : in Xv_Panel_Choice) return Integer; procedure Set_Callback (V : in Xv_Panel_Choice; Func : Callback_Choice_Ptr); procedure Set_Choices (V : in Xv_Panel_Choice; Choices : Strings); --------------------- -- Xv_Panel_Toggle -- --------------------- type Xv_Panel_Toggle (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Toggle (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Toggle_Ptr is access all Xv_Panel_Toggle; procedure Initialize (V : in out Xv_Panel_Toggle); procedure Finalize (V : in out Xv_Panel_Toggle); procedure Set_Pos (V : in Xv_Panel_Toggle; X, Y : Integer); procedure Set_Text (V : in Xv_Panel_Toggle; Txt : String); procedure Set_Layout (V : in Xv_Panel_Toggle; Data : Boolean); procedure Set_Value (V : in Xv_Panel_Toggle; Txt : Integer); function Get_Value (V : in Xv_Panel_Toggle) return Integer; procedure Set_Callback (V : in Xv_Panel_Toggle; Func : Callback_Choice_Ptr); procedure Set_Choices (V : in Xv_Panel_Toggle; Choices : Strings); ----------------------- -- Xv_Panel_Checkbox -- ----------------------- type Xv_Panel_Checkbox (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Checkbox (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Checkbox_Ptr is access all Xv_Panel_Checkbox; procedure Initialize (V : in out Xv_Panel_Checkbox); procedure Finalize (V : in out Xv_Panel_Checkbox); procedure Set_Pos (V : in Xv_Panel_Checkbox; X, Y : Integer); procedure Set_Text (V : in Xv_Panel_Checkbox; Txt : String); procedure Set_Layout (V : in Xv_Panel_Checkbox; Data : Boolean); procedure Set_Value (V : in Xv_Panel_Checkbox; Txt : Integer); function Get_Value (V : in Xv_Panel_Checkbox) return Integer; procedure Set_Callback (V : in Xv_Panel_Checkbox; Func : Callback_Choice_Ptr); procedure Set_Choices (V : in Xv_Panel_Checkbox; Choices : Strings); ------------------- -- Xv_Panel_List -- ------------------- type Xv_Panel_List (Owner : Panel; Read_State : Boolean) -- type Xv_Panel_List (Owner : Panel := 0; Read_State : Boolean := False) is new Controlled with private; type Xv_Panel_List_Ptr is access all Xv_Panel_List; procedure Initialize (V : in out Xv_Panel_List); procedure Finalize (V : in out Xv_Panel_List); procedure Remove_Row (V : in Xv_Panel_List; Row : Integer); procedure Insert_Row (V : in Xv_Panel_List; Row : Integer; Choice : String); procedure Set_Choices (V : in Xv_Panel_List; Choices : Strings); procedure Set_Pos (V : in Xv_Panel_List; X, Y : Integer); procedure Set_Disp_Rows (V : in Xv_Panel_List; Rows : Integer); procedure Set_Width (V : in Xv_Panel_List; Width : Integer); procedure Set_Title (V : in Xv_Panel_List; Txt : String); procedure Set_Font (V : in Xv_Panel_List; Row : Integer; Fnt : Font); procedure Set_Value (V : in Xv_Panel_List; Txt : Integer; State : Boolean); function Get_Value (V : in Xv_Panel_List) return Integer; function Get_Choice (V : in Xv_Panel_List) return String; function Get_Rows (V : in Xv_Panel_List) return Integer; procedure Set_Callback (V : in Xv_Panel_List; Func : Callback_List_Ptr); ---------------------- -- Xv_Panel_Message -- ---------------------- type Xv_Panel_Message (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Message (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Message_Ptr is access all Xv_Panel_Message; procedure Initialize (V : in out Xv_Panel_Message); procedure Finalize (V : in out Xv_Panel_Message); procedure Set_Pos (V : in Xv_Panel_Message; X,Y : Integer); procedure Set_Text (V : in Xv_Panel_Message; Txt : String); procedure Set_Font (V : in Xv_Panel_Message; Fnt : Font); --------------------- -- Xv_Panel_Slider -- --------------------- type Xv_Panel_Slider (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Slider (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Slider_Ptr is access all Xv_Panel_Slider; procedure Initialize (V : in out Xv_Panel_Slider); procedure Finalize (V : in out Xv_Panel_Slider); procedure Set_Pos (V : in Xv_Panel_Slider; X,Y : Integer); procedure Set_Width (V : in Xv_Panel_Slider; W : Integer); procedure Set_Text (V : in Xv_Panel_Slider; Txt : String); procedure Set_Value (V : in Xv_Panel_Slider; Txt : Integer); procedure Set_Layout (V : in Xv_Panel_Slider; Data : Boolean); procedure Set_Min_Value (V : in Xv_Panel_Slider; Txt : Integer); procedure Set_Max_Value (V : in Xv_Panel_Slider; Txt : Integer); procedure Set_Ticks (V : in Xv_Panel_Slider; Txt : Integer); function Get_Value (V : in Xv_Panel_Slider) return Integer; procedure Set_Callback (V : in Xv_Panel_Slider; Func : Callback_Slider_Ptr); procedure Set_Font (V : in Xv_Panel_Slider; Fnt : Font); --------------------- -- Xv_Panel_Gauge -- --------------------- type Xv_Panel_Gauge (Owner : Panel) is new Controlled with private; -- type Xv_Panel_Gauge (Owner : Panel := 0) is new Controlled with private; type Xv_Panel_Gauge_Ptr is access all Xv_Panel_Gauge; procedure Initialize (V : in out Xv_Panel_Gauge); procedure Finalize (V : in out Xv_Panel_Gauge); procedure Set_Pos (V : in Xv_Panel_Gauge; X,Y : Integer); procedure Set_Width (V : in Xv_Panel_Gauge; W : Integer); procedure Set_Text (V : in Xv_Panel_Gauge; Txt : String); procedure Set_Value (V : in Xv_Panel_Gauge; Txt : Integer); procedure Set_Layout (V : in Xv_Panel_Gauge; Data : Boolean); procedure Set_Min_Value (V : in Xv_Panel_Gauge; Txt : Integer); procedure Set_Max_Value (V : in Xv_Panel_Gauge; Txt : Integer); procedure Set_Ticks (V : in Xv_Panel_Gauge; Txt : Integer); function Get_Value (V : in Xv_Panel_Gauge) return Integer; -- procedure Set_Callback (V : in Xv_Panel_Gauge; -- Func : Callback_Gauge_Ptr); procedure Set_Font (V : in Xv_Panel_Gauge; Fnt : Font); ------------------------------------------------------------------------------- private type Xv_Panel (Owner : Frame; A_Border : Boolean) -- type Xv_Panel (Owner : Frame := 0; A_Border : Boolean := False) is new Controlled with record parent : Frame := Owner; base : Panel; Border : Boolean := A_Border; end record; type Xv_Panel_Button (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_button_item; end record; type Xv_Panel_Text (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_text_item; end record; type Xv_Panel_Multi_Text (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_Multi_Text_Item; end record; type Xv_Panel_Numeric (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_numeric_text_item; end record; type Xv_Panel_Choice (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_choice_item; end record; type Xv_Panel_Toggle (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_toggle_item; end record; type Xv_Panel_Checkbox (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_checkbox_item; end record; type Xv_Panel_List (Owner : Panel; Read_State : Boolean) is new Controlled with record parent : Panel := Owner; base : Panel_list_item; State : Boolean := Read_State; end record; type Xv_Panel_Message (Owner : Panel) is new Controlled with record parent : Panel := Owner; base : Panel_message_item; end record; type Xv_Panel_Slider (Owner : Panel) is new Controlled with record Parent : Panel := Owner; Base : Panel_Slider_Item; end record; type Xv_Panel_Gauge (Owner : Panel) is new Controlled with record Parent : Panel := Owner; Base : Panel_Gauge_Item; end record; end Xv_Panel_Package;