ui_node_panel.c File Reference

#include "../ui_main.h"
#include "../ui_parse.h"
#include "../ui_render.h"
#include "../ui_actions.h"
#include "ui_node_abstractnode.h"
#include "ui_node_panel.h"
#include "../../../common/scripts.h"
Include dependency graph for ui_node_panel.c:

Go to the source code of this file.

Defines

#define EXTRADATA_TYPE   panelExtraData_t
#define EXTRADATA(node)   UI_EXTRADATA(node, EXTRADATA_TYPE)
#define CORNER_SIZE   25
#define MID_SIZE   1
#define MARGE   3

Functions

static void UI_PanelNodeDraw (uiNode_t *node)
 Handles Button draw.
static void UI_TopDownFlowLayout (uiNode_t *node, int margin)
 Create a top-down flow layout with child of the node. Child position is automatically set, child height don't change and child width is set according to node width and padding.
static void UI_BorderLayout (uiNode_t *node, int margin)
 Create a border layout with child of the node. Child with BORDERLAYOUT_TOP and BORDERLAYOUT_BOTTOM num are first positioned, there height do not change but the width fill the parent node. Then child with BORDERLAYOUT_LEFT and BORDERLAYOUT_RIGHT are positioned between positioned nodes. Finally BORDERLAYOUT_MIDDLE is filled into available free space.
static void UI_PackLayout (uiNode_t *node, int margin)
 Create a pack layout with child of the node. Set position and size of nodes one by one. It is a usefull layout manager because it can create nice layout without sub panel.
void UI_StarLayout (uiNode_t *node)
 Do a star layout with child according to there num.
static void UI_ClientLayout (uiNode_t *node)
static void UI_ColumnLayout (uiNode_t *node)
 Do column layout. A grid layout according to a fixed number of column. Check to first row to see the needed size of columns, and the height. All rows will use the same row.
static void UI_PanelNodeDoLayout (uiNode_t *node)
static void UI_PanelNodeLoaded (uiNode_t *node)
 Handled after the end of the load of the node from script (all data and/or child are set).
static void UI_PanelNodeGetClientPosition (uiNode_t *node, vec2_t position)
static void UI_PanelPropertyChanged (uiNode_t *node, const value_t *property)
void UI_RegisterPanelNode (uiBehaviour_t *behaviour)

Variables

static const value_tpropertyLayoutMargin
static const value_tpropertyLayoutColumns
static const value_tpropertyPadding
static const uiBehaviour_t const * localBehaviour
static const value_t properties []
 Valid properties for a panel node.

Detailed Description

Todo:
clean up all properties

Definition in file ui_node_panel.c.


Define Documentation

#define CORNER_SIZE   25

Definition at line 36 of file ui_node_panel.c.

#define EXTRADATA ( node   )     UI_EXTRADATA(node, EXTRADATA_TYPE)

Definition at line 34 of file ui_node_panel.c.

#define EXTRADATA_TYPE   panelExtraData_t

Definition at line 33 of file ui_node_panel.c.

#define MARGE   3

Definition at line 38 of file ui_node_panel.c.

#define MID_SIZE   1

Definition at line 37 of file ui_node_panel.c.


Function Documentation

static void UI_BorderLayout ( uiNode_t node,
int  margin 
) [static]

Create a border layout with child of the node. Child with BORDERLAYOUT_TOP and BORDERLAYOUT_BOTTOM num are first positioned, there height do not change but the width fill the parent node. Then child with BORDERLAYOUT_LEFT and BORDERLAYOUT_RIGHT are positioned between positioned nodes. Finally BORDERLAYOUT_MIDDLE is filled into available free space.

Parameters:
[in,out] node The panel node to render the children for
[in] margin The margin between all children nodes in their y-position of the panel
Note:
test only

Definition at line 102 of file ui_node_panel.c.

References uiNode_s::align, uiNode_s::firstChild, uiNode_s::invis, LAYOUTALIGN_BOTTOM, LAYOUTALIGN_LEFT, LAYOUTALIGN_MIDDLE, LAYOUTALIGN_RIGHT, LAYOUTALIGN_TOP, uiNode_s::next, uiNode_s::padding, uiNode_s::pos, uiNode_s::size, and UI_NodeSetSize().

Referenced by UI_PanelNodeDoLayout().

static void UI_ClientLayout ( uiNode_t node  )  [static]
static void UI_ColumnLayout ( uiNode_t node  )  [static]

Do column layout. A grid layout according to a fixed number of column. Check to first row to see the needed size of columns, and the height. All rows will use the same row.

Todo:
Use child to align each nodes inside respective cell.

Definition at line 319 of file ui_node_panel.c.

References uiNode_s::behaviour, Com_Printf(), uiBehaviour_s::doLayout, EXTRADATA, uiNode_s::firstChild, i, uiNode_s::next, uiNode_s::padding, uiNode_s::pos, uiNode_s::size, UI_ExecuteEventActions(), UI_GetPath(), and UI_SetScroll().

Referenced by UI_PanelNodeDoLayout().

static void UI_PackLayout ( uiNode_t node,
int  margin 
) [static]

Create a pack layout with child of the node. Set position and size of nodes one by one. It is a usefull layout manager because it can create nice layout without sub panel.

Parameters:
[in,out] node The panel node to render the children for
[in] margin The margin between all children nodes
Note:
test only

Definition at line 191 of file ui_node_panel.c.

References uiNode_s::align, uiNode_s::firstChild, uiNode_s::invis, LAYOUTALIGN_BOTTOM, LAYOUTALIGN_FILL, LAYOUTALIGN_LEFT, LAYOUTALIGN_RIGHT, LAYOUTALIGN_TOP, uiNode_s::next, uiNode_s::padding, uiNode_s::pos, uiNode_s::size, and UI_NodeSetSize().

Referenced by UI_PanelNodeDoLayout().

static void UI_PanelNodeDoLayout ( uiNode_t node  )  [static]
static void UI_PanelNodeDraw ( uiNode_t node  )  [static]
static void UI_PanelNodeGetClientPosition ( uiNode_t node,
vec2_t  position 
) [static]

Definition at line 430 of file ui_node_panel.c.

References EXTRADATA.

Referenced by UI_RegisterPanelNode().

static void UI_PanelNodeLoaded ( uiNode_t node  )  [static]

Handled after the end of the load of the node from script (all data and/or child are set).

Definition at line 420 of file ui_node_panel.c.

References Com_DPrintf(), CORNER_SIZE, DEBUG_CLIENT, EXTRADATA, LAYOUT_NONE, MID_SIZE, uiNode_s::size, UI_GetPath(), and UI_Invalidate().

Referenced by UI_RegisterPanelNode().

static void UI_PanelPropertyChanged ( uiNode_t node,
const value_t property 
) [static]
void UI_RegisterPanelNode ( uiBehaviour_t behaviour  ) 
void UI_StarLayout ( uiNode_t node  ) 

Do a star layout with child according to there num.

Note:
1=top-left 2=top-middle 3=top-right 4=middle-left 5=middle-middle 6=middle-right 7=bottom-left 8=bottom-middle 9=bottom-right 10=fill
Todo:
Tag it static when it is possible

Definition at line 258 of file ui_node_panel.c.

References uiNode_s::align, uiNode_s::behaviour, uiBehaviour_s::doLayout, uiNode_s::firstChild, LAYOUTALIGN_FILL, LAYOUTALIGN_NONE, LAYOUTALIGN_SPECIAL, uiNode_s::next, uiNode_s::pos, uiNode_s::size, UI_NodeGetPoint(), UI_NodeRelativeToAbsolutePoint(), and UI_NodeSetSize().

Referenced by UI_PanelNodeDoLayout(), and UI_WindowNodeDoLayout().

static void UI_TopDownFlowLayout ( uiNode_t node,
int  margin 
) [static]

Create a top-down flow layout with child of the node. Child position is automatically set, child height don't change and child width is set according to node width and padding.

Parameters:
[in,out] node The panel node to render the children for
[in] margin The margin between all children nodes in their y-position of the panel
Note:
test only

Definition at line 74 of file ui_node_panel.c.

References uiNode_s::firstChild, uiNode_s::next, uiNode_s::padding, uiNode_s::pos, uiNode_s::size, and UI_NodeSetSize().

Referenced by UI_PanelNodeDoLayout().


Variable Documentation

const uiBehaviour_t const* localBehaviour [static]

Definition at line 44 of file ui_node_panel.c.

const value_t properties[] [static]
Initial value:
 {
    
    {"layout", V_INT, UI_EXTRADATA_OFFSETOF(panelExtraData_t, layout), MEMBER_SIZEOF(panelExtraData_t, layout)},
    
    {"layoutMargin", V_INT, UI_EXTRADATA_OFFSETOF(panelExtraData_t, layoutMargin), MEMBER_SIZEOF(panelExtraData_t, layoutMargin)},
    
    {"layoutColumns", V_INT, UI_EXTRADATA_OFFSETOF(panelExtraData_t, layoutColumns), MEMBER_SIZEOF(panelExtraData_t, layoutColumns)},

    {NULL, V_NULL, 0, 0}
}

Valid properties for a panel node.

Definition at line 452 of file ui_node_panel.c.

const value_t* propertyLayoutColumns [static]

Definition at line 41 of file ui_node_panel.c.

const value_t* propertyLayoutMargin [static]

Definition at line 40 of file ui_node_panel.c.

const value_t* propertyPadding [static]

Definition at line 42 of file ui_node_panel.c.


Generated by  doxygen 1.6.2