ui_node_tab.c File Reference

#include "../ui_main.h"
#include "../ui_parse.h"
#include "../ui_actions.h"
#include "../ui_font.h"
#include "../ui_input.h"
#include "../ui_icon.h"
#include "../ui_render.h"
#include "../ui_tooltip.h"
#include "ui_node_tab.h"
#include "ui_node_abstractnode.h"
#include "ui_node_abstractoption.h"
#include "../../client.h"
#include "../../input/cl_input.h"
Include dependency graph for ui_node_tab.c:

Go to the source code of this file.

Defines

#define EXTRADATA_TYPE   abstractOptionExtraData_t
#define EXTRADATA(node)   UI_EXTRADATA(node, EXTRADATA_TYPE)
#define EXTRADATACONST(node)   UI_EXTRADATACONST(node, EXTRADATA_TYPE)

Enumerations

enum  mn_tab_type_t {
  UI_TAB_NOTHING = 0, UI_TAB_NORMAL = 1, UI_TAB_SELECTED = 2, UI_TAB_HIGHLIGHTED = 3,
  UI_TAB_DISABLED = 4
}

Functions

static uiNode_tUI_TabNodeTabAtPosition (const uiNode_t *node, int x, int y)
 Return a tab located at a screen position.
static void UI_TabNodeClick (uiNode_t *node, int x, int y)
 Handles tab clicks.
static void UI_TabNodeDrawPlain (const char *image, int x, int y, int width, mn_tab_type_t type)
 Normalized access to the texture structure of tab to display the plain part of a tab.
static void UI_TabNodeDrawJunction (const char *image, int x, int y, mn_tab_type_t leftType, mn_tab_type_t rightType)
 Normalized access to the texture structure of tab to display a junction between each tabs.
static void UI_TabNodeDraw (uiNode_t *node)
static void UI_TabNodeDrawTooltip (uiNode_t *node, int x, int y)
 Custom tooltip of tab node.
static void UI_TabNodeInit (uiNode_t *node)
void UI_RegisterTabNode (uiBehaviour_t *behaviour)

Variables

static const int TILE_WIDTH = 33
static const int TILE_HEIGHT = 36
static const int TILE_SIZE = 40

Detailed Description

Todo:
auto tooltip for chopped options

Definition in file ui_node_tab.c.


Define Documentation

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

Definition at line 42 of file ui_node_tab.c.

#define EXTRADATA_TYPE   abstractOptionExtraData_t

Definition at line 41 of file ui_node_tab.c.

#define EXTRADATACONST ( node   )     UI_EXTRADATACONST(node, EXTRADATA_TYPE)

Definition at line 43 of file ui_node_tab.c.


Enumeration Type Documentation

Enumerator:
UI_TAB_NOTHING 
UI_TAB_NORMAL 
UI_TAB_SELECTED 
UI_TAB_HIGHLIGHTED 
UI_TAB_DISABLED 

Definition at line 45 of file ui_node_tab.c.


Function Documentation

void UI_RegisterTabNode ( uiBehaviour_t behaviour  ) 
static void UI_TabNodeClick ( uiNode_t node,
int  x,
int  y 
) [static]
static void UI_TabNodeDraw ( uiNode_t node  )  [static]
static void UI_TabNodeDrawJunction ( const char *  image,
int  x,
int  y,
mn_tab_type_t  leftType,
mn_tab_type_t  rightType 
) [inline, static]

Normalized access to the texture structure of tab to display a junction between each tabs.

Parameters:
[in] image The normalized tab texture to use
[in] x The upper-left position of the screen to draw the texture
[in] y The upper-left position of the screen to draw the texture
[in] leftType The status of the left tab of the junction we display
[in] rightType The status of the right tab of the junction we display

Definition at line 169 of file ui_node_tab.c.

References TILE_HEIGHT, TILE_SIZE, TILE_WIDTH, and UI_DrawNormImageByName().

Referenced by UI_TabNodeDraw().

static void UI_TabNodeDrawPlain ( const char *  image,
int  x,
int  y,
int  width,
mn_tab_type_t  type 
) [inline, static]

Normalized access to the texture structure of tab to display the plain part of a tab.

Parameters:
[in] image The normalized tab texture to use
[in] x The upper-left position of the screen to draw the texture
[in] y The upper-left position of the screen to draw the texture
[in] width The width size of the screen to use (stretch)
[in] type The status of the tab we display

Definition at line 154 of file ui_node_tab.c.

References TILE_HEIGHT, TILE_SIZE, TILE_WIDTH, and UI_DrawNormImageByName().

Referenced by UI_TabNodeDraw().

static void UI_TabNodeDrawTooltip ( uiNode_t node,
int  x,
int  y 
) [static]

Custom tooltip of tab node.

Parameters:
[in] node Node we request to draw tooltip
[in] x Position x of the mouse
[in] y Position y of the mouse

Definition at line 292 of file ui_node_tab.c.

References _, OPTIONEXTRADATA, UI_DrawTooltip(), and UI_TabNodeTabAtPosition().

Referenced by UI_RegisterTabNode().

static void UI_TabNodeInit ( uiNode_t node  )  [static]

called when the window is pushed check cvar then, reduce runtime check

Todo:
move cvar check to AbstractOption

Definition at line 316 of file ui_node_tab.c.

References uiNode_s::behaviour, Com_Printf(), Cvar_FindVar(), Cvar_ForceSet(), EXTRADATA, uiNode_s::firstChild, OPTIONEXTRADATA, UI_GetPath(), and ui_optionBehaviour.

Referenced by UI_RegisterTabNode().

static uiNode_t* UI_TabNodeTabAtPosition ( const uiNode_t node,
int  x,
int  y 
) [static]

Return a tab located at a screen position.

Parameters:
[in] node A tab node
[in] x The x position of the screen to test
[in] y The x position of the screen to test
Returns:
A uiNode_t, or NULL if nothing.
Todo:

improve test when we are on a junction

improve test when we are on a chopped tab

Todo:
this dont work when an option is hidden

Definition at line 66 of file ui_node_tab.c.

References _, uiNode_s::behaviour, EXTRADATACONST, uiNode_s::firstChild, uiNode_s::invis, LONGLINES_PRETTYCHOP, uiNode_s::next, OPTIONEXTRADATA, R_FontTextSize(), uiNode_s::size, TILE_WIDTH, UI_GetFontFromNode(), UI_NodeAbsoluteToRelativePos(), and ui_optionBehaviour.

Referenced by UI_TabNodeClick(), UI_TabNodeDraw(), and UI_TabNodeDrawTooltip().


Variable Documentation

const int TILE_HEIGHT = 36 [static]

Definition at line 54 of file ui_node_tab.c.

const int TILE_SIZE = 40 [static]

Definition at line 55 of file ui_node_tab.c.

const int TILE_WIDTH = 33 [static]

Generated by  doxygen 1.6.2