Index

Package: Themes

Description

package Themes is

Classes

Theme (abstract)

type Theme is abstract new Limited_Object with private;

Ancestors:

Immediate Children:

Themes.Ked.Ked_Theme

Primitive operations:

Border_Width
Construct (overriding Objects.Construct)
Delete (overriding Objects.Delete)
Label_Height
Objects.To_String (Inherited)

Types

Align_Type

type Align_Type is ( Align_Left, Align_Center, Align_Right );

Border_Type

type Border_Type is ( Border_None, Border_Raised, Border_Sunk, Border_Line );

Color_Purpose

type Color_Purpose is ( Background,
                            Foreground,
                            Selected,
                            Selected_Text,
                            Text );

Colors_Array

type Colors_Array is array (Color_Purpose) of Color_Type;

A_Theme

type A_Theme is access all Theme'Class;

Constants & Global variables

DEFAULT_FONT_NAME (String)

DEFAULT_FONT_NAME : constant String := "standard";

DEFAULT_FONT_SIZE (Positive)

DEFAULT_FONT_SIZE : constant Positive := 14;

Subprograms & Entries

Create_Theme

function Create_Theme return A_Theme;
Raises an exception on error, such as failure to load resources.

Border_Width

function Border_Width
( this: access Theme ) return Natural;

Color

function Color
( this: access Theme;
purpose: Color_Purpose ) return Color_Type;

Draw_Border

procedure Draw_Border
( this: access Theme;
dc: Drawing_Context;
border: Border_Type;
x1, y1, x2, y2: Integer;
color: Color_Type );

Draw_Box

procedure Draw_Box
( this: access Theme;
dc: Drawing_Context;
x1, y1, x2, y2: Integer;
color: Color_Type;
border: Border_Type := Border_None );

Draw_Label

procedure Draw_Label
( this: access Theme;
dc: Drawing_Context;
x1, y1, x2, y2: Integer;
icon: A_Bitmap;
text: String;
fontName: String;
fontSize: Positive;
color: Color_Type;
align: Align_Type;
smooth: Boolean := False );
Draws a label composed of the given icon, some horizontal spacing, and the given text. If the icon or the text is ommitted, the spacing that would separate the two will also be ommitted. The 'smooth' argument enables text anti-aliasing. The 'align' argument determines the alignment for the icon and text as a group within the width of the area given for the label by x1 and x2. The label will be centered vertically between y1 and y2.

Get_Bitmap (abstract)

function Get_Bitmap
( this: access Theme;
id: Natural ) return A_Bitmap is abstract;
Synchronously retrieves a bitmap by tile id.

Get_Font

function Get_Font
( this: not null access Theme'Class;
name: String;
size: Positive ) return Font_Type;
Returns a reference to a previously loaded font. If the font by this name and in this size has not been loaded previously, it will be reloaded in the new size 'size'. If the font 'name' is unknown or it can't be reloaded in the requested size, an exception will be raised.

Get_Text_Height

function Get_Text_Height
( this: not null access Theme'Class;
fontName: String;
fontSize: Positive ) return Natural;
Returns the height in pixels of any text drawn in the given font. Zero is returned if the font hasn't been loaded.

Get_ID (abstract)

function Get_ID
( this: access Theme;
name: String ) return Natural is abstract;
Returns the id number of a tile referenced by name in the theme's tile library.

Get_Scaling_Filter

function Get_Scaling_Filter
( this: not null access Theme'Class ) return Filter_Type;
Returns the theme's current scaling filter type.

Get_Text_Width

function Get_Text_Width
( this: not null access Theme'Class;
text: String;
fontName: String;
fontSize: Positive ) return Natural;
Returns the width in pixels of 'text' in the given font. Zero is returned if the font hasn't been loaded.

Label_Height

function Label_Height
( this: access Theme;
icon: A_Bitmap;
text: String;
fontName: String;
fontSize: Positive ) return Natural;
Returns the minimum height in pixels required to draw a label with the given icon and text. If Draw_Label is overridden, this function should also be appropriately overridden to return the correct height.

Label_Width

function Label_Width
( this: access Theme;
icon: A_Bitmap;
text: String;
fontName: String;
fontSize: Positive ) return Natural;
Returns the minimum width in pixels required to draw a label with the given icon and text. If Draw_Label is overridden, this function should also be appropriately overridden to return the correct width.

Register_Font

procedure Register_Font
( this: not null access Theme'Class;
path: String;
name: String );
Registers a font file with a font name. The font will be loaded first at size DEFAULT_FONT_SIZE. If the file at 'path' can't be loaded, a Resource_Error exception will be raised.

Set_Scaling_Filter

procedure Set_Scaling_Filter
( this: not null access Theme'Class;
filter: Filter_Type );
Sets the theme's current scaling filter type.

Delete

procedure Delete
( this: in out A_Theme );
Deletes the theme.