ui_data.h File Reference

Data and interface to share data. More...

#include "../../shared/ufotypes.h"
#include "../../shared/shared.h"
#include "ui_nodes.h"
#include "node/ui_node_option.h"
Include dependency graph for ui_data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  uiSharedData_s
struct  uiOptionIterator_t

Defines

#define MAX_DEPTH_OPTIONITERATORCACHE   8

Typedefs

typedef struct uiSharedData_s uiSharedData_t

Enumerations

enum  uiTextIDs_t {
  TEXT_NULL, TEXT_STANDARD, TEXT_LIST, TEXT_LIST2,
  TEXT_UFOPEDIA, TEXT_UFOPEDIA_REQUIREMENT, TEXT_BUILDINGS, TEXT_BUILDING_INFO,
  TEXT_RESEARCH, TEXT_POPUP, TEXT_POPUP_INFO, TEXT_AIRCRAFT_LIST,
  TEXT_AIRCRAFT_INFO, TEXT_CAMPAIGN_LIST, TEXT_MULTISELECTION, TEXT_PRODUCTION_LIST,
  TEXT_PRODUCTION_AMOUNT, TEXT_PRODUCTION_INFO, TEXT_EMPLOYEE, TEXT_MOUSECURSOR_RIGHT,
  TEXT_PRODUCTION_QUEUED, TEXT_STATS_BASESUMMARY, TEXT_STATS_MISSION, TEXT_STATS_BASES,
  TEXT_STATS_NATIONS, TEXT_STATS_EMPLOYEES, TEXT_STATS_COSTS, TEXT_STATS_INSTALLATIONS,
  TEXT_STATS_7, TEXT_BASE_LIST, TEXT_BASE_INFO, TEXT_TRANSFER_LIST,
  TEXT_TRANSFER_LIST_AMOUNT, TEXT_TRANSFER_LIST_TRANSFERED, TEXT_MOUSECURSOR_PLAYERNAMES, TEXT_CARGO_LIST,
  TEXT_CARGO_LIST_AMOUNT, TEXT_UFOPEDIA_MAILHEADER, TEXT_UFOPEDIA_MAIL, TEXT_MARKET_NAMES,
  TEXT_MARKET_STORAGE, TEXT_MARKET_MARKET, TEXT_MARKET_PRICES, TEXT_CHAT_WINDOW,
  TEXT_AIREQUIP_1, TEXT_AIREQUIP_2, TEXT_BASEDEFENCE_LIST, TEXT_TIPOFTHEDAY,
  TEXT_GENERIC, TEXT_XVI, TEXT_MOUSECURSOR_TOP, TEXT_MOUSECURSOR_BOTTOM,
  TEXT_MOUSECURSOR_LEFT, TEXT_MESSAGEOPTIONS, TEXT_UFORECOVERY_NATIONS, TEXT_UFORECOVERY_UFOYARDS,
  TEXT_UFORECOVERY_CAPACITIES, TEXT_MATERIAL_STAGES, TEXT_IRCCONTENT, TEXT_IRCUSERS,
  TEXT_MULTIPLAYER_USERLIST, TEXT_MULTIPLAYER_USERTEAM, TEXT_ITEMDESCRIPTION, OPTION_LANGUAGES,
  OPTION_JOYSTICKS, OPTION_VIDEO_RESOLUTIONS, OPTION_SINGLEPLAYER_SKINS, OPTION_MULTIPLAYER_SKINS,
  OPTION_UFOPEDIA, OPTION_UFOS, OPTION_DROPSHIPS, OPTION_BASELIST,
  OPTION_TEAMDEFS, LINESTRIP_FUNDING, LINESTRIP_COLOR, UI_MAX_DATAID
}
 

linked into ui_global.sharedData - defined in UI scripts via dataID property

More...
enum  uiSharedType_t {
  UI_SHARED_NONE = 0, UI_SHARED_TEXT, UI_SHARED_LINKEDLISTTEXT, UI_SHARED_OPTION,
  UI_SHARED_LINESTRIP
}

Functions

int UI_GetDataVersion (int textId) __attribute__((warn_unused_result))
void UI_ResetData (int dataId)
 Reset a shared data. Type became NONE and value became NULL.
int UI_GetDataIDByName (const char *name) __attribute__((warn_unused_result))
 Return a dataId by name.
void UI_InitData (void)
 Initialize console command about UI shared data.
void UI_RegisterText (int textId, const char *text)
 share a text with a data id
const char * UI_GetText (int textId) __attribute__((warn_unused_result))
void UI_RegisterLinkedListText (int textId, struct linkedList_s *text)
 share a linked list of text with a data id
void UI_RegisterOption (int dataId, struct uiNode_s *option)
struct uiNode_sUI_GetOption (int dataId) __attribute__((warn_unused_result))
void UI_SortOptions (struct uiNode_s **option)
 Sort options by alphabet.
struct uiNode_sUI_InitOptionIteratorAtIndex (int index, struct uiNode_s *option, uiOptionIterator_t *iterator)
 Init an option iterator at an index.
struct uiNode_sUI_OptionIteratorNextOption (uiOptionIterator_t *iterator)
 Find the next element from the iterator Iterator skipCollapsed and skipInvisible attribute can control the option flow.
void UI_UpdateInvisOptions (struct uiNode_s *option, const struct linkedList_s *stringList)
struct uiNode_sUI_FindOptionByValue (uiOptionIterator_t *iterator, const char *value)
 Find an option (and all his parents) by is value.
int UI_FindOptionPosition (uiOptionIterator_t *iterator, const struct uiNode_s *option)
struct uiNode_sUI_AddOption (struct uiNode_s **tree, const char *name, const char *label, const char *value)
 Append an option to an option list.
void UI_RegisterLineStrip (int dataId, struct lineStrip_s *text)

Detailed Description

Data and interface to share data.

Todo:
clean up the interface

Definition in file ui_data.h.


Define Documentation

#define MAX_DEPTH_OPTIONITERATORCACHE   8

Definition at line 145 of file ui_data.h.

Referenced by UI_FindOptionAtIndex(), and UI_OptionIteratorNextOption().


Typedef Documentation


Enumeration Type Documentation

Enumerator:
UI_SHARED_NONE 
UI_SHARED_TEXT 
UI_SHARED_LINKEDLISTTEXT 
UI_SHARED_OPTION 
UI_SHARED_LINESTRIP 

Definition at line 122 of file ui_data.h.

linked into ui_global.sharedData - defined in UI scripts via dataID property

Enumerator:
TEXT_NULL 

default value, should not be used

TEXT_STANDARD 
TEXT_LIST 
TEXT_LIST2 
TEXT_UFOPEDIA 
TEXT_UFOPEDIA_REQUIREMENT 
TEXT_BUILDINGS 
TEXT_BUILDING_INFO 
TEXT_RESEARCH 
TEXT_POPUP 
TEXT_POPUP_INFO 
TEXT_AIRCRAFT_LIST 
TEXT_AIRCRAFT_INFO 
TEXT_CAMPAIGN_LIST 
TEXT_MULTISELECTION 
TEXT_PRODUCTION_LIST 
TEXT_PRODUCTION_AMOUNT 
TEXT_PRODUCTION_INFO 
TEXT_EMPLOYEE 
TEXT_MOUSECURSOR_RIGHT 
TEXT_PRODUCTION_QUEUED 
TEXT_STATS_BASESUMMARY 
TEXT_STATS_MISSION 
TEXT_STATS_BASES 
TEXT_STATS_NATIONS 
TEXT_STATS_EMPLOYEES 
TEXT_STATS_COSTS 
TEXT_STATS_INSTALLATIONS 
TEXT_STATS_7 
TEXT_BASE_LIST 
TEXT_BASE_INFO 
TEXT_TRANSFER_LIST 
TEXT_TRANSFER_LIST_AMOUNT 
TEXT_TRANSFER_LIST_TRANSFERED 
TEXT_MOUSECURSOR_PLAYERNAMES 
TEXT_CARGO_LIST 
TEXT_CARGO_LIST_AMOUNT 
TEXT_UFOPEDIA_MAILHEADER 
TEXT_UFOPEDIA_MAIL 
TEXT_MARKET_NAMES 
TEXT_MARKET_STORAGE 
TEXT_MARKET_MARKET 
TEXT_MARKET_PRICES 
TEXT_CHAT_WINDOW 
TEXT_AIREQUIP_1 
TEXT_AIREQUIP_2 
TEXT_BASEDEFENCE_LIST 
TEXT_TIPOFTHEDAY 
TEXT_GENERIC 
TEXT_XVI 
TEXT_MOUSECURSOR_TOP 
TEXT_MOUSECURSOR_BOTTOM 
TEXT_MOUSECURSOR_LEFT 
TEXT_MESSAGEOPTIONS 
TEXT_UFORECOVERY_NATIONS 
TEXT_UFORECOVERY_UFOYARDS 
TEXT_UFORECOVERY_CAPACITIES 
TEXT_MATERIAL_STAGES 
TEXT_IRCCONTENT 
TEXT_IRCUSERS 
TEXT_MULTIPLAYER_USERLIST 
TEXT_MULTIPLAYER_USERTEAM 
TEXT_ITEMDESCRIPTION 
OPTION_LANGUAGES 
OPTION_JOYSTICKS 
OPTION_VIDEO_RESOLUTIONS 
OPTION_SINGLEPLAYER_SKINS 
OPTION_MULTIPLAYER_SKINS 
OPTION_UFOPEDIA 
OPTION_UFOS 
OPTION_DROPSHIPS 
OPTION_BASELIST 
OPTION_TEAMDEFS 
LINESTRIP_FUNDING 
LINESTRIP_COLOR 
UI_MAX_DATAID 

Definition at line 40 of file ui_data.h.


Function Documentation

struct uiNode_s* UI_AddOption ( uiNode_t **  tree,
const char *  name,
const char *  label,
const char *  value 
) [read]

Append an option to an option list.

Parameters:
[in,out] tree first option of the list/tree of options
[in] name name of the option (should be unique in the option list)
[in] label label displayed
[in] value value used when this option is selected
Returns:
The new option

Definition at line 197 of file ui_data.c.

References uiNode_s::next, qtrue, UI_AllocNode(), and UI_InitOption().

Referenced by AIM_UpdateAircraftItemList(), CL_InitSkin_f(), CL_LanguageInit(), CL_TeamDefInitMenu(), CL_VideoInitMenu(), GAME_InitMenuOptions(), IN_JoystickInitMenu(), MSO_InitList(), TR_InitBaseList(), TR_TransferAliensFromMission_f(), UP_GenerateArticlesSummary(), and UP_GenerateSummary().

struct uiNode_s* UI_FindOptionByValue ( uiOptionIterator_t iterator,
const char *  value 
) [read]

Find an option (and all his parents) by is value.

Parameters:
[in,out] iterator If it found an option, the iterator contain all option parent
[in] value The value we search
Returns:
The right option, else NULL

Definition at line 486 of file ui_data.c.

References uiNode_s::behaviour, uiOptionIterator_t::option, OPTIONEXTRADATA, ui_optionBehaviour, and UI_OptionIteratorNextOption().

Referenced by UI_OptionTreeSetSelectedValue().

int UI_FindOptionPosition ( uiOptionIterator_t iterator,
const struct uiNode_s option 
)
int UI_GetDataIDByName ( const char *  name  ) 

Return a dataId by name.

Returns:
A dataId if data found, else -1

Definition at line 120 of file ui_data.c.

References uiNode_s::num, UI_MAX_DATAID, and ui_sharedDataIDNames.

Referenced by UI_ParseProperty(), and UI_ResetData_f().

int UI_GetDataVersion ( int  textId  ) 
struct uiNode_s* UI_GetOption ( int  dataId  )  [read]
const char* UI_GetText ( int  textId  ) 
void UI_InitData ( void   ) 

Initialize console command about UI shared data.

Note:
called by UI_Init

Definition at line 540 of file ui_data.c.

References Cmd_AddCommand(), and UI_ResetData_f().

Referenced by UI_Init().

struct uiNode_s* UI_InitOptionIteratorAtIndex ( int  index,
uiNode_t option,
uiOptionIterator_t iterator 
) [read]

Init an option iterator at an index.

Note:
invis option are skipped, and child are counted
Parameters:
[in] index Requested index (0 is the first option)
[in] option First element of options (it can be a tree)
[out] iterator Initialised iterator
Returns:
the first option element found (current position of the iterator)
 uiOptionIterator_t iterator;
 UI_InitOptionIteratorAtIndex(index, firstOption, &iterator);   // also return the option
 while (iterator.option) {
     ...
     UI_OptionIteratorNextOption(&iterator);    // also return the option
 }
Todo:
Rework that code, we should split "Init" and "AtIndex"

Definition at line 435 of file ui_data.c.

References uiNode_s::behaviour, qtrue, uiOptionIterator_t::skipCollapsed, uiOptionIterator_t::skipInvisible, UI_FindOptionAtIndex(), and ui_optionBehaviour.

Referenced by MSO_Toggle_f(), MSO_UpdateVisibleButtons(), UI_OptionTreeNodeDraw(), UI_OptionTreeNodeGetOptionAtPosition(), and UI_OptionTreeSetSelectedValue().

struct uiNode_s* UI_OptionIteratorNextOption ( uiOptionIterator_t iterator  )  [read]
void UI_RegisterLineStrip ( int  dataId,
struct lineStrip_s text 
)
void UI_RegisterLinkedListText ( int  dataId,
linkedList_t text 
)
void UI_RegisterOption ( int  dataId,
struct uiNode_s option 
)
void UI_RegisterText ( int  dataId,
const char *  text 
)
void UI_ResetData ( int  dataId  ) 
void UI_SortOptions ( struct uiNode_s **  option  ) 

Sort options by alphabet.

Definition at line 306 of file ui_data.c.

References uiNode_s::next, and UI_OptionNodeRemoveHigherOption().

Referenced by CL_LanguageInit(), UI_OptionNodeSortOptions(), and UP_GenerateArticlesSummary().

void UI_UpdateInvisOptions ( struct uiNode_s option,
const struct linkedList_s stringList 
)

Generated by  doxygen 1.6.2