nux-0.9.46

nux::LayeredLayout Class Reference

An layered layout. More...

#include <Nux/LayeredLayout.h>

Inheritance diagram for nux::LayeredLayout:
nux::Layout nux::Area nux::InitiallyUnownedObject nux::Focusable nux::Object nux::Trackable

Public Types

enum  InputMode { INPUT_MODE_ACTIVE = 0, INPUT_MODE_COMPOSITE }

Public Member Functions

 LayeredLayout (NUX_FILE_LINE_PROTO)
 ~LayeredLayout ()
void AddLayer (Area *area, bool expand=true, int x=0, int y=0, int width=0, int height=0)
 Add a layer to the layout.
void UpdateLayer (Area *area, bool expand=true, int x=0, int y=0, int width=0, int height=0)
 Update properties of a layer in the layout.
void RemoveLayer (Area *area)
 Remove a layer.
void SetActiveLayerN (int index_)
 Set the active layer of the layout.
int GetActiveLayerN ()
 Get the active layer of the layout.
void SetActiveLayer (Area *area)
 Set the active layer of the layout.
AreaGetActiveLayer ()
 Get the active layer of the layout.
void SetPaintAll (bool paint_all)
 Set whether the layout will paint all the layers it contains. Default is false.
bool GetPaintAll ()
 Get whether the layout is drawing all the layers it contains.
void SetInputMode (LayeredLayout::InputMode input_mode)
 Sets the input mode of the layout.
void Raise (Area *area, Area *above)
 Raise the paint and input depth of an area.
void Lower (Area *area, Area *below)
 Lower the paint and input depth of an area.
void RaiseTop (Area *area)
 Raises the paint and input depth of area to the top of the layout.
void LowerBottom (Area *area)
 Lowers the paint and input depth of area to the bottom of the layout.
LayeredLayout::InputMode GetInputMode ()
 Get which input mode is set on the layout.
long ComputeLayout2 ()
void GetCompositeList (std::list< Area * > *ViewList)
void ProcessDraw (GraphicsEngine &gfx_context, bool force_draw)
 Draw Element.
long ProcessEvent (IEvent &ievent, long traverse_info, long process_event_info)
 Process Event.
void AddLayout (Layout *layouy, unsigned int stretch_factor=1, MinorDimensionPosition position=eAbove, MinorDimensionSize extend=eFull, float percentage=100.0f)
void AddView (Area *view, unsigned int stretch_factor=1, MinorDimensionPosition positioning=eAbove, MinorDimensionSize extend=eFull, float percentage=100.0f)
 Add an object to the layout.
void RemoveChildObject (Area *area)
void Clear ()

Protected Member Functions

virtual long DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
virtual long DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
virtual bool FocusFirstChild ()
virtual bool FocusLastChild ()

Detailed Description

An layered layout.

LayeredLayout works either as a bin layout, showing only one layer at a time, or it works as a composite layout, drawing all children in order (and you are able to modify the order).

The layout also allows two modes of input. In INPUT_MODE_ACTIVE, the layout will only send events to the active layer, even if in composite drawing mode. In INPUT_MODE_COMPOSITE, the layout will send events to all the layers, in the stacking order from top to bottom. This allows creation of complex widgets more easily than implementing the drawing and input modes manually.


Member Enumeration Documentation

Enumerator:
INPUT_MODE_ACTIVE 
INPUT_MODE_COMPOSITE 

Constructor & Destructor Documentation

nux::LayeredLayout::LayeredLayout ( NUX_FILE_LINE_PROTO  )
nux::LayeredLayout::~LayeredLayout ( )

Member Function Documentation

void nux::LayeredLayout::AddLayer ( Area area,
bool  expand = true,
int  x = 0,
int  y = 0,
int  width = 0,
int  height = 0 
)

Add a layer to the layout.

This method will add the layer with layout specific options

Parameters:
areathe Area, Layout or View
expandarea should be expanded to all the available space of the layout. If this is set to false, all the following parameters must be set
xthe horizontal position of the layer, expand must be false
ythe vertical position of the layer, expand must be false
widththe width of the layer inside the layout, expand must be false
heightthe height of the layer inside the layout, expand must be false
void nux::LayeredLayout::AddLayout ( Layout layouy,
unsigned int  stretch_factor = 1,
MinorDimensionPosition  position = eAbove,
MinorDimensionSize  extend = eFull,
float  percentage = 100.0f 
) [virtual]

Reimplemented from nux::Layout.

void nux::LayeredLayout::AddView ( Area baseobject,
unsigned int  stretchFactor = 1,
MinorDimensionPosition  positioning = eAbove,
MinorDimensionSize  extend = eFull,
float  percentage = 100.0f 
) [virtual]

Add an object to the layout.

Add an object to the layout. A baseobject minor dimension with respect to a layout object is the dimension opposite to the layout flow. A baseobject major dimension with respect to a layout object is the dimension aligned with the layout flow. A layout object minor dimension is the dimension opposite to the layout flow. A layout object major dimension is the dimension aligned with the layout flow.

Add an object to the layout. The added object get its size and position managed by the layout. When a baseobject is added with a stretches factor equal to 0, its major dimension assumes its minimum value. For instance, if the layout is a vertical layout and the added object has a stretch factor equal 0, then during the layout, the added object height will be set to its minimum value using ApplyMinHeight().

The positioning parameter controls how the layout will place the object within itself. A vertical layout object controls the horizontal positioning of its children baseobject, While an horizontal layout object controls the vertical positioning of its children baseobject.

The extend parameter controls how much size the baseobject minor dimension gets from the layout minor dimension. See MinorDimensionSize.

/param baseobject The object that is being added. /param stretchFactor This value controls how the layout object share space between its children baseobject. /param positioning Controls how the layout position the object. /param extend Controls the object minor dimension size. /param percentage Controls the object minor dimension size in percentage of the layout minor dimension size.

Reimplemented from nux::Layout.

void nux::LayeredLayout::Clear ( ) [virtual]

Reimplemented from nux::Layout.

long nux::LayeredLayout::ComputeLayout2 ( ) [virtual]

Reimplemented from nux::Area.

virtual long nux::LayeredLayout::DoFocusNext ( IEvent ievent,
long  TraverseInfo,
long  ProcessEventInfo 
) [protected, virtual]

Reimplemented from nux::Layout.

virtual long nux::LayeredLayout::DoFocusPrev ( IEvent ievent,
long  TraverseInfo,
long  ProcessEventInfo 
) [protected, virtual]

Reimplemented from nux::Layout.

virtual bool nux::LayeredLayout::FocusFirstChild ( ) [protected, virtual]

Reimplemented from nux::Layout.

virtual bool nux::LayeredLayout::FocusLastChild ( ) [protected, virtual]

Reimplemented from nux::Layout.

Area* nux::LayeredLayout::GetActiveLayer ( )

Get the active layer of the layout.

Returns the the active layer of the layout. This is only useful if input mode is INPUT_MODE_ACTIVE.

Returns:
the active layer
int nux::LayeredLayout::GetActiveLayerN ( )

Get the active layer of the layout.

Returns the index of the active layer of the layout. This is only useful if input mode is INPUT_MODE_ACTIVE.

Returns:
the index of the active layer
void nux::LayeredLayout::GetCompositeList ( std::list< Area * > *  ViewList) [virtual]

Reimplemented from nux::Layout.

LayeredLayout::InputMode nux::LayeredLayout::GetInputMode ( )

Get which input mode is set on the layout.

Returns the current input mode on the layout.

Returns:
the current input mode on the layout
bool nux::LayeredLayout::GetPaintAll ( )

Get whether the layout is drawing all the layers it contains.

Returns whether the layout is drawing all the layers it contains. See SetPaintAll.

Returns:
whether the layout is drawing all the layers
void nux::LayeredLayout::Lower ( Area area,
Area below 
)

Lower the paint and input depth of an area.

Lowers the paint and input depth of the area in the layout

Parameters:
areaarea to raise
belowarea to lower below
void nux::LayeredLayout::LowerBottom ( Area area)

Lowers the paint and input depth of area to the bottom of the layout.

Area will be drawn below all other layers and will be the last receive events

Parameters:
areaarea to lower
void nux::LayeredLayout::ProcessDraw ( GraphicsEngine GfxContext,
bool  force_draw 
) [virtual]

Draw Element.

Draw all elements inside the layout. If force_draw is true then the system requests that all objects redraw themselves completely.

Parameters:
force_draw
TraverseInfo
ProcessEventInfo
Returns:
The state of the Process Event.

Reimplemented from nux::Layout.

long nux::LayeredLayout::ProcessEvent ( IEvent ievent,
long  TraverseInfo,
long  ProcessEventInfo 
) [virtual]

Process Event.

Propagate event to all element contained in the layout.

Parameters:
ievent
TraverseInfo
ProcessEventInfo
Returns:
The state of the Process Event.

Reimplemented from nux::Layout.

void nux::LayeredLayout::Raise ( Area area,
Area above 
)

Raise the paint and input depth of an area.

Raises the paint and input depth of the area in the layout

Parameters:
areaarea to raise
abovearea to raise above
void nux::LayeredLayout::RaiseTop ( Area area)

Raises the paint and input depth of area to the top of the layout.

Area will be drawn above all other layers and will be the first receive events

Parameters:
areaarea to raise
void nux::LayeredLayout::RemoveChildObject ( Area area) [virtual]

Reimplemented from nux::Layout.

void nux::LayeredLayout::RemoveLayer ( Area area)

Remove a layer.

This method will remove a layer from the layout. It is here for completeness.

Parameters:
areathe Area, Layout or View to remove
void nux::LayeredLayout::SetActiveLayer ( Area area)

Set the active layer of the layout.

The active layer will receives input in the input mode is INPUT_MODE_ACTIVE.

Parameters:
areaThe area of the layer to make active
void nux::LayeredLayout::SetActiveLayerN ( int  index_)

Set the active layer of the layout.

The active layer will receives input in the input mode is INPUT_MODE_ACTIVE.

Parameters:
index_The index of the layer to make active
void nux::LayeredLayout::SetInputMode ( LayeredLayout::InputMode  input_mode)

Sets the input mode of the layout.

The layout is able to operate in two modes. INPUT_MODE_ACTIVE means that the layout will send events only to the active layout. In INPUT_MODE_COMPOSITE, the layout sends events to all the layouts it contains, starting from the topmost down to the bottom. A layer can stop propagation by returning the appropriate value in ProcessEvent. This can be mixed and matched with SetPaintAll depending on what you want to achieve. For instance, having paint all set to true but input_mode set to INPUT_MODE_ACTIVE allows you to create a composite view with one or many backgrounds, but with only one active view.

Parameters:
input_modethe input mode
void nux::LayeredLayout::SetPaintAll ( bool  paint_all)

Set whether the layout will paint all the layers it contains. Default is false.

Normally, the layout will only paint the active layer. However, if you are using the layout in INPUT_COMPOSITE, or have just sized and positioned the layers that you'd like them to be drawn so that they they are composited inside the layout, this should be set to true.

Parameters:
paint_allwhether to paint all the layers in the layout
void nux::LayeredLayout::UpdateLayer ( Area area,
bool  expand = true,
int  x = 0,
int  y = 0,
int  width = 0,
int  height = 0 
)

Update properties of a layer in the layout.

Allows updating properties of a layer after it has been added to the layout

Parameters:
areathe Area, Layout or View to update
expandarea should be expanded to all the available space of the layout. If this is set to false, all the following parameters must be set
xthe horizontal position of the layer, expand must be false
ythe vertical position of the layer, expand must be false
widththe width of the layer inside the layout, expand must be false
heightthe height of the layer inside the layout, expand must be false

The documentation for this class was generated from the following file: