TABLE OF CONTENTS


TkAda/TtkStyle [ Packages ]

[ Top ] [ TkAda ] [ Packages ]

FUNCTION

 Provides code for manipulate Tk command ttk::style

SOURCE

package Tcl.Tk.Ada.TtkStyle with
   SPARK_Mode
is

TtkStyle/TtkStyle.Element_Create [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Creates a new element in the current theme of the selected type

SOURCE

   procedure Element_Create
     (Name, Element_Type: in String; Options: in String := "") with
      Pre => Name /= "" and Element_Type /= "";

PARAMETERS

 Name         - Name of the element to create
 Element_Type - Type of the element to create
 Options      - Additional options for the created element

EXAMPLE

   -- Create a new element with name My_Image and type of image from image named someimage
   Element_Create("My_Image", "image", "someimage");

COMMANDS

 ttk::style element create name element_type ?options?

HISTORY

 8.6.3 - Added

TtkStyle/TtkStyle.Element_Names [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Return list of elements in the current theme

SOURCE

   function Element_Names return String;

EXAMPLE

      -- Get the list of available elements
      Names: constant String := Element_Names;
      COMMAND
      ttk::style element names

HISTORY

 8.6.3 - Added

TtkStyle/TtkStyle.Element_Options [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Get options set for the selected element in current theme

SOURCE

   function Element_Options(Element: in String) return String with
      Pre => Element /= "";

PARAMETERS

 Element - Name of the element to query

RESULT

 List of element options

EXAMPLE

   -- Get the options for the element named Entry
   Options: constant String := Element_Options("Entry");

COMMANDS

 ttk::style element options element

HISTORY

 8.6.3 - Added

TtkStyle/TtkStyle.Style_Configure [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Configure selected or create new Ttk style

SOURCE

   procedure Style_Configure(Name, Options: in String) with
      Pre => Name /= "" and Options /= "";

PARAMETERS

 Name    - Name of style to configure or create
 Options - Options for the style

EXAMPLE

      -- Set padding for TButton to 4px in each direction
      Style_Configure("TButton", "-padding {4 4 4 4}");

COMMANDS

 ttk::style configure name options

HISTORY

 8.6.1 - Added

TtkStyle/TtkStyle.Style_Layout_(function) [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Get widget layout for the selected style

SOURCE

   function Style_Layout(Name: in String) return String with
      Pre => Name /= "";

PARAMETERS

 Name - Name of the style to query

RESULT

 String with layout setting for the selected style

EXAMPLE

      -- Get the layout for the Toolbutton in the current theme
      Layout: constant String := Style_Layout("Toolbutton");

SEE ALSO

 TtkStyle.Style_Layout_(procedure)

COMMANDS

 ttk::style layout name

HISTORY

 8.6.2 - Added

TtkStyle/TtkStyle.Style_Layout_(procedure) [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Define widget layout style for the selected style

SOURCE

   procedure Style_Layout(Name, Options: in String) with
      Pre => Name /= "" and Options /= "";

PARAMETERS

 Name    - Name of the style to modify
 Options - Options for the layout

EXAMPLE

      -- Define layout for the TButton in the current theme
      Style_Layout("TButton", "{Button.button -children { Button.padding -children { Button.label -side left -expand true } } }");

SEE ALSO

 TtkStyle.Style_Layout_(function)

COMMANDS

 ttk::style layout name options

HISTORY

 8.6.2 - Added

TtkStyle/TtkStyle.Style_Lookup [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Get value of the selected option in the selected style

SOURCE

   function Style_Lookup
     (Name, Option: in String; State: in String := "";
      Default: in String := "") return String with
      Pre => Name /= "" and Option /= "";

PARAMETERS

 Name    - Name of the style to query
 Option  - Name of the option to query
 State   - List of the states names. If empty, mean "normal" state.
           Default value is empty
 Default - Default value to return when option was not found

RESULT

 Value of the selected option in the selected style. If option was not
 found, return value of Default parameter.

EXAMPLE

      -- Get the font (Tcl name) used by the main window
      Font_Name: constant String := Style_Lookup(".", "-font");

COMMANDS

 ttk::style lookup name option ?state? ?default?

HISTORY

 8.6.3 - Added

TtkStyle/TtkStyle.Style_Map [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Define widget style dynamic map for the selected style

SOURCE

   procedure Style_Map(Name, Options: in String) with
      Pre => Name /= "" and Options /= "";

PARAMETERS

 Name    - Name of the style to modify
 Options - Options for the widget

EXAMPLE

      -- Set the background of the TPanedwindow when mouse is hovering about to black
      Style_Map("TPanedwindow", "-background [list hover black]");

COMMANDS

 ttk::style map name options

HISTORY

 8.6.2 - Added

TtkStyle/TtkStyle.Theme_Names [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Get list of all available Ttk themes

SOURCE

   function Theme_Names return String;

RESULT

 String with list of all available Ttk themes

EXAMPLE

      -- Get the list of available themes
      Themes: constant String := Theme_Names;

COMMANDS

 ttk::style theme names

HISTORY

 8.6.1 - Added

TtkStyle/TtkStyle.Theme_Use_(function) [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Get currently used Ttk theme

SOURCE

   function Theme_Use return String;

RESULT

 Name of currently used Ttk theme

EXAMPLE

      -- Get the name of the current theme
      Current_Theme: constant String := Theme_Use;

SEE ALSO

 TtkStyle.Theme_Use_(procedure)

COMMANDS

 ttk::style theme use

HISTORY

 8.6.1 - Added

TtkStyle/TtkStyle.Theme_Use_(procedure) [ Subprograms ]

[ Top ] [ TtkStyle ] [ Subprograms ]

FUNCTION

 Set new Ttk theme and redraw all widgets

SOURCE

   procedure Theme_Use(ThemeName: in String) with
      Pre => ThemeName /= "";

PARAMETERS

 Name of Ttk theme to set

EXAMPLE

   -- Use theme clam as the current theme
   Theme_Use("clam");

SEE ALSO

 TtkStyle.Theme_Use_(function)

COMMANDS

 ttk::style theme use ThemeName

HISTORY

 8.6.1 - Added