Index

Package: Windows

Description

package Widgets.Containers.Windows is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Window

type Window is new Container and Event_Listener with private;

Ancestors:

Primitive operations:

Construct
Delete (overriding Widgets.Containers.Delete)
Draw (overriding Widgets.Containers.Draw)
Events.Listeners.To_String (Inherited)
Find_Widget_At (overriding Widgets.Containers.Find_Widget_At)
Get_Window (overriding Widgets.Get_Window)
Handle_Event (overriding Events.Listeners.Handle_Event)
Is_Rooted (overriding Widgets.Is_Rooted)
Is_Showing (overriding Widgets.Is_Showing)
Objects.Construct (Inherited)
On_Descendant_Shown (overriding Widgets.On_Descendant_Shown)
On_Key_Press (overriding Widgets.On_Key_Press)
Pack (overriding Widgets.Containers.Pack)
Remove_Widget
Translate_To_Content (overriding Widgets.Translate_To_Content)
Translate_To_Window (overriding Widgets.Translate_To_Window)
Widgets.Activate_Popup (Inherited)
Widgets.Bring_To_Front (Inherited)
Widgets.Construct (Inherited)
Widgets.Containers.Add_Child (Inherited)
Widgets.Containers.Apply_Container_Layout (Inherited)
Widgets.Containers.Bring_To_Front (Inherited)
Widgets.Containers.Delete_Child (Inherited)
Widgets.Containers.Delete_Children (Inherited)
Widgets.Containers.Draw_Children (Inherited)
Widgets.Containers.Draw_Content (Inherited)
Widgets.Containers.Draw_Content_Foreground (Inherited)
Widgets.Containers.Handle_Rooted (Inherited)
Widgets.Containers.Handle_Shown (Inherited)
Widgets.Containers.Remove_Child (Inherited)
Widgets.Get_Color (Inherited)
Widgets.Get_Min_Height (Inherited)
Widgets.Get_Min_Width (Inherited)
Widgets.Get_Process_Name (Inherited)
Widgets.Get_View (Inherited)
Widgets.On_Blur (Inherited)
Widgets.On_Click (Inherited)
Widgets.On_Disabled (Inherited)
Widgets.On_Enabled (Inherited)
Widgets.On_Enter (Inherited)
Widgets.On_Exit (Inherited)
Widgets.On_Focus (Inherited)
Widgets.On_Key_Release (Inherited)
Widgets.On_Key_Typed (Inherited)
Widgets.On_Mouse_Held (Inherited)
Widgets.On_Mouse_Move (Inherited)
Widgets.On_Mouse_Press (Inherited)
Widgets.On_Mouse_Release (Inherited)
Widgets.On_Mouse_Scroll (Inherited)
Widgets.On_Resize (Inherited)
Widgets.On_Rooted (Inherited)
Widgets.On_Shown (Inherited)
Widgets.Set_Border (Inherited)
Widgets.Set_Color (Inherited)
Widgets.Set_Parent (Inherited)
Widgets.Set_Zoom (Inherited)
Widgets.To_String (Inherited)
A Window is the root of the widget tree within the application window. All interface input events are delivered to the Window and then dispatched by the Window to its descendent widgets. Widget events are handled in a bottom-up approach, being delivered to the focused widget first and then dispatching up the tree, toward the Window, until the event is captured and handled. Input focus, or just "focus", is tracked by the Window. Exactly one widget in the Window tree will have focus at all times. If no other widget is focused, the Window will be focused by default. The focused widget will receive all keyboard events.

Types

A_Window

type A_Window is access all Window'Class;

Subprograms & Entries

Create_Window

function Create_Window
( view: access Game_Views.Game_View'Class;
id: String;
width, height: Natural;
filter: Filter_Type := Filter_Nearest ) return A_Window;
Creates a new Window within 'view'. 'width' and 'height' are the size of the widget. The window will automatically be upscaled to a higher resolution if the bitmap it draws onto is a multiple or more of the window size. 'filter' determines the upscaling filter algorithm to use.

Add_Widget

procedure Add_Widget
( this: access Window;
child: in out A_Widget;
consume: Boolean := True );
Adds a child widget to the Window. 'child' will be consumed if 'consume' is set to True. In either case, however, the Container will own 'child' after this is called, and will delete it if it's still a child at the time of deletion.

Draw

procedure Draw
( this: access Window );
Draws the whole Window, all its children, and then the popup widget stack in back-to-front order. The modal widget, if set, will be the front-most child. The popup widgets, if any are active, will still be drawn in front of the modal widget tree and menu bar. This procedure is used by the renderer to draw the whole OS window.

Get_Outer_Border

function Get_Outer_Border
( this: not null access Window'Class ) return Allegro_Color;
Returns the color of the outer border that surrounds the window. See Set_Border_Color().

Get_Scale

function Get_Scale
( this: not null access Window'Class ) return Positive;
Returns the scaling factor used when drawing the Window to the screen. A return value of 1 means it is drawn at actual size.

Give_Focus

procedure Give_Focus
( this: access Window;
target: not null A_Widget );
Requests input focus be given to 'target'. If 'target' doesn't accept focus, then focus will be given to its "next focus" widget (what happens when you press the Tab key). If no "next focus" widget exists or accepts focus, then focus will be given to the widget's nearest ancestor that accepts it. Changing the input focus will prevent any potential key held and key release events from being sent to the old focused widget that received the key press.

Is_Showing

function Is_Showing
( this: access Window ) return Boolean;
Returns True if the Window is showing on the screen. It is showing if it is visible and has been added to the Game_View.

Pop_Popup

procedure Pop_Popup
( this: access Window );
Pops the top-most widget off the popup stack. If there are no active popup widgets, nothing will happen.

Pop_Popup

procedure Pop_Popup
( this: access Window;
popup: not null A_Widget );
Pops all widgets from the popups stack until the given popup widget has been popped. If the widget isn't an active popup menu, nothing will happen.

Push_Popup

procedure Push_Popup
( this: access Window;
popup: not null A_Widget );
Pushes a popup widget onto the top of the popup stack, making it visible. Popups are the highest in the Z-order, so they will be displayed in front of any modal widget, most recent on top. The widget will temporarily become a child of the window while its on the popup stack.

Remove_Widget

procedure Remove_Widget
( this: access Window;
child: not null A_Widget );
Removes the widget from the window.

Set_Filter

procedure Set_Filter
( this: not null access Window'Class;
filter: Filter_Type );
Sets the pixel scaling filter for the entire window. If the window is scaled to a larger resolution on the screen, everything in the window will be scaled up to that resolution with this filter.

Set_Menubar

procedure Set_Menubar
( this: access Window;
menu: in out A_Menubar );
Sets the Window's menu bar widget. The menu bar is optional and there can be only one per Window. 'menu' will be consumed. If a menu bar has already been set, the old one will be deleted.

Set_Modal

procedure Set_Modal
( this: access Window;
modal: A_Widget );
Sets the modal widget drawn on top of all others in the Window. This widget and its descendents will receive all input events or prevent them from being sent to any others, while it is visible. Set 'modal' to null to clear the modal widget. 'modal' will be set visible when it's set and invisible when another modal widget is set or it's unset. The modal modal widget tree will be drawn in front of all other Window children and behind any active popup widgets.

Set_Offset

procedure Set_Offset
( this: access Window;
x, y: Integer );
Sets the offset of the top left corner of the window from the top left corner of the screen.

Set_Outer_Border

procedure Set_Outer_Border
( this: not null access Window'Class;
color: Allegro_Color );
Sets the color of the outer border that surrounds the window, if the window widget doesn't fill the entire display. For applications that use a fixed window size that scales to fill the display, the display resolutions in between exact multiples of the window size will show this border color between the edges of the window widget and the display.

Set_Title

procedure Set_Title
( this: not null access Window'Class;
title: String );
Sets the title at the top of the application window.

Delete

procedure Delete
( this: in out A_Window );
Deletes the Window.