Index

Package: Buttons

Description

package Widgets.Buttons is

Classes

Button_Action

type Button_Action is new Action with private;

Ancestors:

Primitive operations:

Actions.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
Objects.To_String (Inherited)
Represents a widget action involving a Button, like a press or release.

Button (abstract)

type Button is abstract new Widget with private;

Ancestors:

Immediate Children:

Primitive operations:

Add_Listener
Add_Listener
Construct
Dispatch_Action
Draw_Content (overriding Widgets.Draw_Content)
Get_Min_Height (overriding Widgets.Get_Min_Height)
Get_Min_Width (overriding Widgets.Get_Min_Width)
Objects.Construct (Inherited)
Remove_Listener
Set_Color (overriding Widgets.Set_Color)
To_String (overriding Widgets.To_String)
Toggle_State
Widgets.Activate_Popup (Inherited)
Widgets.Bring_To_Front (Inherited)
Widgets.Construct (Inherited)
Widgets.Delete (Inherited)
Widgets.Draw (Inherited)
Widgets.Find_Widget (Inherited)
Widgets.Get_Color (Inherited)
Widgets.Get_Process_Name (Inherited)
Widgets.Get_View (Inherited)
Widgets.Get_Window (Inherited)
Widgets.Handle_Ancestor_Hidden (Inherited)
Widgets.Handle_Ancestor_Unhidden (Inherited)
Widgets.Handle_Blur (Inherited)
Widgets.Handle_Click (Inherited)
Widgets.Handle_Descendant_Hidden (Inherited)
Widgets.Handle_Descendant_Unhidden (Inherited)
Widgets.Handle_Disabled (Inherited)
Widgets.Handle_Enabled (Inherited)
Widgets.Handle_Enter (Inherited)
Widgets.Handle_Exit (Inherited)
Widgets.Handle_Focus (Inherited)
Widgets.Handle_Hidden (Inherited)
Widgets.Handle_Key_Held (Inherited)
Widgets.Handle_Key_Press (Inherited)
Widgets.Handle_Key_Release (Inherited)
Widgets.Handle_Mouse_Held (Inherited)
Widgets.Handle_Mouse_Move (Inherited)
Widgets.Handle_Mouse_Press (Inherited)
Widgets.Handle_Mouse_Release (Inherited)
Widgets.Handle_Mouse_Scroll (Inherited)
Widgets.Handle_Resize (Inherited)
Widgets.Handle_Unhidden (Inherited)
Widgets.Pack (Inherited)
Widgets.Set_Dirty (Inherited)
Widgets.Set_Parent (Inherited)
Widgets.Set_Zoom (Inherited)
Widgets.Translate_To_Content (Inherited)
Widgets.Translate_To_Window (Inherited)
A Button is a simple control widget with two states: on and off. A button notifies listeners of each event, so that a listener can know when a button is pressed by the user, release, held down for a period of time, or clicked. This abstract class is intended to be extended by a subclass that implements a specific behavior, like toggling, or a button that goes back to Off as soon as the mouse is released.

Types

A_Button_Action

type A_Button_Action is access all Button_Action'Class;

Button_Listener (abstract)

type Button_Listener is limited interface and Action_Listener;
This is the interface to implement in order to listen to button actions. When a button action occurs, the listener will be notified of the type of action performed and the button that performed the action.

A_Button_Listener

type A_Button_Listener is access all Button_Listener'Class;

A_Button_Handler

type A_Button_Handler is
        access procedure( action : A_Button_Action );
A simple procedure to handle a button action, used by Simple_Button_Listener.

A_Button

type A_Button is access all Button'Class;

Constants & Global variables

Held (Actions.Action_Id)

Held    : constant Action_Id;
button is pressed down

Release (Actions.Action_Id)

Release : constant Action_Id;
button is held down for the repeat delay

Click (Actions.Action_Id)

Click   : constant Action_Id;
button is released

Subprograms & Entries

Handle_Action (abstract)

procedure Handle_Action
( this: access Button_Listener;
action: A_Button_Action ) is abstract;
Handles the button action 'action'.

Add_Listener

procedure Add_Listener
( this: access Button;
listener: not null A_Button_Listener );
Registers 'listener' as an Button_Action listener.

Add_Listener

procedure Add_Listener
( this: access Button;
handler: not null A_Button_Handler );
Registers 'handler' to be invoked when a Button_Action occurs. 'handler' can be added multiple times and can't be removed.

Contrast_Text

procedure Contrast_Text
( this: not null access Button'Class;
enabled: Boolean );
If contasting text is enabled, the text of the button will be displayed as either white or black, whichever contrasts most with the button's foreground color.

Get_State

function Get_State
( this: not null access Button'Class ) return Boolean;
Returns the state of the button: True if it's on and False if it's off.

Get_Text

function Get_Text
( this: not null access Button'Class ) return String;
Returns the button's text.

Remove_Listener

procedure Remove_Listener
( this: access Button;
listener: not null A_Button_Listener );
Unregisters 'listener' as an Button_Action listener.

Set_Align

procedure Set_Align
( this: not null access Button'Class;
align: Align_Type );
Sets the horizontal alignment for the button's icon and text.

Set_Color

procedure Set_Color
( this: access Button;
purpose: Color_Purpose;
color: Color_Type );
Sets the color to be used for a specific purpose. Setting the Foreground color to Transparent will cause the button to become transparent.

Set_Icon

procedure Set_Icon
( this: access Button;
icon: String );
Sets the button's icon by filename.

Set_Shade_Disabled

procedure Set_Shade_Disabled
( this: not null access Button'Class;
shade: Float );
Sets the shade applied to the button's foreground color when it is disabled. Use 1.0 for no shading, < 1.0 to darken and > 1.0 to lighten.

Set_Shade_On

procedure Set_Shade_On
(this: not null access Button'Class;
shade: Float );
Sets the shade applied to the button's foreground color when its state is On / Pressed down. Use 1.0 for no shading, < 1.0 to darken and > 1.0 to lighten.

Set_Shade_Hover

procedure Set_Shade_Hover
( this: not null access Button'Class;
shade: Float );
Sets the shade applied to the button's foreground color when the mouse hovers over it. Use 1.0 for no shading, < 1.0 to darken and > 1.0 to lighten.

Set_State

procedure Set_State
( this: access Button;
on: Boolean );
Sets the state of the button. If the state changes, a Press or Release action will occur as appopriate.

Set_Text

procedure Set_Text
( this: access Button;
text: String );
Sets the button's text.

Toggle_State

procedure Toggle_State
( this: access Button );
Toggles the state of the button to the opposite of the current state. A Press or Release action will occur as appopriate.