TABLE OF CONTENTS


Dialogs/Dialogs [ Packages ]

[ Top ] [ Packages ]

FUNCTION

 Provide code to show various in game dialogs (messages, questins, etc)

SOURCE

package Dialogs is

Dialogs/Dialogs.Button_Settings [ Records ]

[ Top ] [ Dialogs ] [ Records ]

FUNCTION

 Data structure for setting various options for a dialog's buttons

SOURCE

   type Button_Settings is record
      Text: Unbounded_String := Null_Unbounded_String;
      Command: Unbounded_String := Null_Unbounded_String;
      Icon: Unbounded_String := Null_Unbounded_String;
      Tooltip: Unbounded_String := Null_Unbounded_String;
      Color: Unbounded_String := Null_Unbounded_String;
   end record;

PARAMETERS

 Text    - The text to display on the button. If empty, the button will
           not be displayed. Default value is empty
 Command - The Tcl command to execute when the button pressed. Default
           value is empty
 Icon    - The Tcl icon to display on the button. Default value is empty
 Tooltip - The button's tooltip text. Default value is empty

HISTORY

 7.7 - Added

Dialogs/Dialogs.Empty_Button_Settings [ Constants ]

[ Top ] [ Dialogs ] [ Constants ]

FUNCTION

 Default value of Button_Settings

SOURCE

   Empty_Button_Settings: constant Button_Settings :=
     (Text => Null_Unbounded_String, Command => Null_Unbounded_String,
      Icon => Null_Unbounded_String, Tooltip => Null_Unbounded_String,
      Color => Null_Unbounded_String);

Dialogs/Dialogs.Add_Close_Button [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Add button to close the selected dialog and set proper bindings for
 it.

SOURCE

   procedure Add_Close_Button
     (Name, Text, Command: String; Column_Span: Positive := 1;
      Row, Column: Natural := 0; Icon: String := "exiticon";
      Color: String := "");

PARAMETERS

 Name        - The Tk path name for the button
 Text        - The text to display on the button
 Command     - The Tcl command to run when the button was clicked
 Column_Span - The amount of columns to merge when placing the close
               button. Can be empty. Default value is 1 (no merging).
 Row         - The row in which the button will be placed. Can be empty.
               Default value is 0 (place button in the next row)
 Column      - The column in which the button will be placed. Can be empty.
               Default value is 0 (place button in the first column)
 Icon        - The Tcl image which will be displayed on the button instead
               of text
 Color       - The color of the text on the button. Can be empty. Default
               value is empty, which mean the default color used for buttons.
               Other options depends on the current game's theme.

Dialogs/Dialogs.Add_Commands [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Add Tcl commands related to dialogs

SOURCE

   procedure Add_Commands;

Dialogs/Dialogs.Change_Title [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Change the title of the selected dialog

SOURCE

   procedure Change_Title(Dialog: Ttk_Frame; New_Title: String);

PARAMETERS

 Dialog    - The dialog which title will be changed
 New_Title - The new title for the selected dialog

HISTORY

 6.8 - Added

Dialogs/Dialogs.Create_Dialog [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Create a new dialog with the selected title

SOURCE

   function Create_Dialog
     (Name, Title: String; Title_Width: Positive := 275;
      Columns: Positive := 1; Parent_Name: String := ".gameframe")
      return Ttk_Frame;

PARAMETERS

 Name        - The Tk path name of the new dialog
 Title       - The title of the new dialog
 Title_Width - The maximum width of the title. Used to set wrapping for
               it. Default value is 275 pixels. Can be empty.
 Columns     - The amount of columns which dialog will have. Used to set
               the title. Default value is 1 column. Can be empty.

RESULT

 The newly created Dialog as Ttk_Frame

Dialogs/Dialogs.Show_Dialog [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Show the selected dialog to the player

SOURCE

   procedure Show_Dialog
     (Dialog: Ttk_Frame; Parent_Frame: String := ".gameframe";
      With_Timer: Boolean := False;
      Relative_X, Relative_Y: Damage_Factor := 0.3);

PARAMETERS

 Dialog       - The dialog which will be shown
 Parent_Frame - The parent frame name for the dialog. Can be empty.
                Default value is .gameframe
 With_Timer   - If True, add timer to the dialog. Can be empty. Default
                value is False
 Relative_X   - Relative X coordinate inside of parent frame for the
                dialog. 0.0 is left border. Can be empty. Default value
                is 0.3
 Relative_Y   - Relative Y coordinate inside of parent frame for the
                dialog. 0.0 is top border. Can be empty. Default value is
                0.3

Dialogs/Dialogs.Show_Info [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Show the selected info to a player

SOURCE

   procedure Show_Info
     (Text: String; Parent_Name: String := ".gameframe"; Title: String;
      Button_1, Button_2: Button_Settings := Empty_Button_Settings) with
      Pre => Text'Length > 0 and Parent_Name'Length > 0;

PARAMETERS

 Text        - Text of info to show
 Parent_Name - Name of the parent widget. If empty, then the main game
               window will be used as parent for widget. Default value
               is .gameframe
 Title       - The text show in the dialog header.
 Button_1    - The settings for the first optional button. If empty, the
               button will not show. Default value is empty.
 Button_2    - The setting for the second optional button. If empty,
               the button will not show. Default value is empty.

HISTORY

 8.2 - Added parameter Wrap_Length

Dialogs/Dialogs.Show_Manipulate_Item [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Show the dialog for manipulate items amount in cargo (like selling,
 dropping, etc).

SOURCE

   procedure Show_Manipulate_Item
     (Title, Command, Action: String;
      Item_Index: Inventory_Container.Extended_Index;
      Max_Amount, Cost: Natural := 0) with
      Pre => Title'Length > 0 and Command'Length > 0;

PARAMETERS

 Title      - Title of the dialog
 Command    - Tcl command which will be executed when the player hit
              the button Ok
 Action     - The name of action which the player is doing (like drop,
              sell, ect)
 Item_Index - The index of the item which will be manipulated
 Max_Amount - Max amount of the items to manipualate. If zero, use max
              amount of items from player ship cargo. Default value is
              zero.
 Cost       - The cost (in buying) or gain (in selling) for one item in
              the game money. Can be zero. Default value is zero.

Dialogs/Dialogs.Show_Message [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Show the selected message to a player

SOURCE

   procedure Show_Message
     (Text: String; Parent_Frame: String := ".gameframe"; Title: String) with
      Pre => Text'Length > 0 and Parent_Frame'Length > 0;

PARAMETERS

 Text         - Text of message to show
 Parent_Frame - The parent frame of the message dialog. Default is
                the game frame. Can be empty
 Title        - The text show in the dialog header.

Dialogs/Dialogs.Show_Question [ Subprograms ]

[ Top ] [ Dialogs ] [ Subprograms ]

FUNCTION

 Show the dialog with question to the player

SOURCE

   procedure Show_Question
     (Question, Result: String; In_Game: Boolean := True) with
      Pre => Question'Length > 0;

PARAMETERS

 Question - The question which will be the player asked for
 Result   - The value set for Ok button
 In_Game  - The question in show during game

HISTORY

 5.9 - Added

Dialogs/Dialogs.Close_Dialog_Command [ Commands ]

[ Top ] [ Dialogs ] [ Commands ]

FUNCTION

 Close the selected dialog

SOURCE

   function Close_Dialog_Command
     (Client_Data: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int;
      Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with
      Convention => C;

PARAMETERS

 Client_Data - Custom data send to the command. Unused
 Interp      - Tcl interpreter in which command was executed.
 Argc        - Number of arguments passed to the command.
 Argv        - Values of arguments passed to the command.

RESULT

 This function always return TCL_OK

COMMANDS

 CloseDialog dialogname
 Dialogname is name of the dialog to close