#include "ui_main.h"
#include "ui_internal.h"
#include "ui_input.h"
#include "node/ui_node_abstractnode.h"
#include "node/ui_node_window.h"
#include "../client.h"
Go to the source code of this file.
Defines | |
#define | WINDOWEXTRADATA(node) UI_EXTRADATA(node, windowExtraData_t) |
#define | WINDOWEXTRADATACONST(node) UI_EXTRADATACONST(node, windowExtraData_t) |
Functions | |
int | UI_GetLastFullScreenWindow (void) |
Returns the ID of the last fullscreen ID. Before this, window should be hidden. | |
void | UI_MoveWindowOnTop (uiNode_t *window) |
Move the window on top of compatible windows. "Compatible" mean non full screen windows, and windows with the same window parent. | |
static void | UI_DeleteWindowFromStack (uiNode_t *window) |
Remove the window from the window stack. | |
static int | UI_GetWindowPositionFromStackByName (const char *name) |
Searches the position in the current window stack for a given window id. | |
static void | UI_InsertWindowIntoStack (uiNode_t *window, int position) |
Insert a window at a position of the stack. | |
static uiNode_t * | UI_PushWindowDelete (const char *name, const char *parent, qboolean delete) |
Push a window onto the window stack. | |
int | UI_CompleteWithWindow (const char *partial, const char **match) |
Complete function for mn_push. | |
uiNode_t * | UI_PushWindow (const char *name, const char *parentName) |
Push a window onto the window stack. | |
static void | UI_PushChildWindow_f (void) |
Console function to push a child window onto the window stack. | |
static void | UI_PushWindow_f (void) |
Console function to push a window onto the window stack. | |
static void | UI_PushDropDownWindow_f (void) |
Console function to push a dropdown window at a position. It work like UI_PushWindow but move the window at the right position. | |
static void | UI_PushNoHud_f (void) |
Console function to hide the HUD in battlescape mode Note: relies on a "nohud" window existing. | |
static void | UI_RemoveWindowAtPositionFromStack (int position) |
static void | UI_CloseAllWindow (void) |
void | UI_InitStack (const char *activeWindow, const char *mainWindow, qboolean popAll, qboolean pushActive) |
Init the stack to start with a window, and have an alternative window with ESC. | |
qboolean | UI_IsWindowOnStack (const char *name) |
Check if a named window is on the stack if active windows. | |
static void | UI_CloseWindowByRef (uiNode_t *window) |
void | UI_CloseWindow (const char *name) |
void | UI_PopWindow (qboolean all) |
Pops a window from the window stack. | |
static void | UI_CloseWindow_f (void) |
Console function to close a named window. | |
void | UI_PopWindowWithEscKey (void) |
static void | UI_PopWindow_f (void) |
Console function to pop a window from the window stack. | |
uiNode_t * | UI_GetActiveWindow (void) |
Returns the current active window from the window stack or NULL if there is none. | |
void | UI_GetActiveRenderRect (int *x, int *y, int *width, int *height) |
Determine the position and size of render. | |
const char * | UI_GetActiveWindowName (void) |
Returns the name of the current window. | |
qboolean | UI_IsPointOnWindow (void) |
Check if a point is over a window from the stack. | |
uiNode_t * | UI_GetWindow (const char *name) |
Searches all windows for the specified one. | |
void | UI_InvalidateStack (void) |
Invalidate all windows of the current stack. | |
void | UI_SetNewWindowPos (uiNode_t *window, int x, int y) |
Sets new x and y coordinates for a given window. | |
void | UI_InsertWindow (uiNode_t *window) |
Add a new window to the list of all windows. | |
static void | UI_SetNewWindowPos_f (void) |
Console command for moving a window. | |
static void | UI_FireInit_f (void) |
This will reinitialize the current visible window. | |
static void | UI_InitStack_f (void) |
static void | UI_DebugTree (const uiNode_t *node, int depth) |
Display in the conde the tree of nodes. | |
static void | UI_DebugTree_f (void) |
void | UI_InitWindows (void) |
Variables | |
static cvar_t * | mn_sys_main |
Window name use as alternative for option. | |
static cvar_t * | mn_sys_active |
Main window of a stack. |
Definition in file ui_windows.c.
#define WINDOWEXTRADATA | ( | node | ) | UI_EXTRADATA(node, windowExtraData_t) |
Definition at line 33 of file ui_windows.c.
Referenced by UI_CloseAllWindow(), UI_CloseWindowByRef(), UI_GetActiveRenderRect(), UI_IsPointOnWindow(), UI_MoveWindowOnTop(), UI_PopWindow(), and UI_PushWindowDelete().
#define WINDOWEXTRADATACONST | ( | node | ) | UI_EXTRADATACONST(node, windowExtraData_t) |
Definition at line 34 of file ui_windows.c.
Referenced by UI_FireInit_f(), UI_IsPointOnWindow(), and UI_PopWindowWithEscKey().
static void UI_CloseAllWindow | ( | void | ) | [static] |
Definition at line 371 of file ui_windows.c.
References uiNode_s::behaviour, uiBehaviour_s::close, i, ui_global, WINDOWEXTRADATA, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_PopWindow().
void UI_CloseWindow | ( | const char * | name | ) |
Definition at line 463 of file ui_windows.c.
References Com_Printf(), UI_CloseWindowByRef(), and UI_GetWindow().
Referenced by CL_GetTipOfTheDay_f(), CL_HudRadarUp_f(), and UI_CloseWindow_f().
static void UI_CloseWindow_f | ( | void | ) | [static] |
Console function to close a named window.
Definition at line 520 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and UI_CloseWindow().
Referenced by UI_InitWindows().
static void UI_CloseWindowByRef | ( | uiNode_t * | window | ) | [static] |
Definition at line 428 of file ui_windows.c.
References uiNode_s::behaviour, uiBehaviour_s::close, Com_Printf(), i, m, uiNode_s::name, uiNode_s::parent, UI_GetWindowPositionFromStackByName(), ui_global, UI_InvalidateMouse(), UI_ReleaseInput(), UI_RemoveWindowAtPositionFromStack(), WINDOWEXTRADATA, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_CloseWindow(), and UI_PopWindow().
int UI_CompleteWithWindow | ( | const char * | partial, | |
const char ** | match | |||
) |
Complete function for mn_push.
Definition at line 214 of file ui_windows.c.
References Cmd_GenericCompleteFunction(), Com_Printf(), i, len, MAX_COMPLETE, uiNode_s::name, uiGlobal_s::numWindows, ui_global, and uiGlobal_s::windows.
Referenced by UI_InitWindows(), and UI_RegisterEditorNode().
static void UI_DebugTree | ( | const uiNode_t * | node, | |
int | depth | |||
) | [static] |
Display in the conde the tree of nodes.
Definition at line 788 of file ui_windows.c.
References uiNode_s::behaviour, Com_Printf(), uiNode_s::firstChild, i, uiNode_s::name, uiBehaviour_s::name, and uiNode_s::next.
Referenced by UI_DebugTree_f().
static void UI_DebugTree_f | ( | void | ) | [static] |
Definition at line 804 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), UI_DebugTree(), and UI_GetWindow().
Referenced by UI_InitWindows().
static void UI_DeleteWindowFromStack | ( | uiNode_t * | window | ) | [static] |
Remove the window from the window stack.
[in] | window | The window to remove from the stack |
Definition at line 106 of file ui_windows.c.
References i, ui_global, UI_InvalidateMouse(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_PushWindowDelete().
static void UI_FireInit_f | ( | void | ) | [static] |
This will reinitialize the current visible window.
Definition at line 740 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, uiNode_s::name, UI_ExecuteEventActions(), UI_GetNodeByPath(), UI_NodeInstanceOf(), and WINDOWEXTRADATACONST.
Referenced by UI_InitWindows().
void UI_GetActiveRenderRect | ( | int * | x, | |
int * | y, | |||
int * | width, | |||
int * | height | |||
) |
Determine the position and size of render.
Definition at line 572 of file ui_windows.c.
References mn_hud, pos, viddef_t::rx, viddef_t::ry, uiNode_s::size, cvar_s::string, UI_GetActiveWindow(), UI_GetNodeAbsPos(), UI_GetWindow(), UI_IsWindowOnStack(), UI_Validate(), viddef, and WINDOWEXTRADATA.
Referenced by SCR_UpdateScreen().
uiNode_t* UI_GetActiveWindow | ( | void | ) | [read] |
Returns the current active window from the window stack or NULL if there is none.
Definition at line 564 of file ui_windows.c.
References ui_global, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by Irc_Client_CmdPrivmsg(), UI_DisplayNotice(), UI_GetActiveRenderRect(), UI_GetActiveWindowName(), and UI_SetNewWindowPos_f().
const char* UI_GetActiveWindowName | ( | void | ) |
Returns the name of the current window.
Definition at line 605 of file ui_windows.c.
References uiNode_s::name, and UI_GetActiveWindow().
Referenced by CP_OnGeoscape(), GAME_SetMode_f(), HUD_RefreshButtons(), Irc_AppendToBuffer(), Irc_Client_CmdPrivmsg(), and MAP_CenterOnPoint_f().
int UI_GetLastFullScreenWindow | ( | void | ) |
Returns the ID of the last fullscreen ID. Before this, window should be hidden.
Definition at line 50 of file ui_windows.c.
References pos, ui_global, UI_WindowIsFullScreen(), uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_Draw(), UI_FocusNextActionNode(), and UI_KeyPressed().
uiNode_t* UI_GetWindow | ( | const char * | name | ) | [read] |
Searches all windows for the specified one.
[in] | name | Name of the window we search |
Definition at line 648 of file ui_windows.c.
References uiNode_s::name, uiGlobal_s::numWindows, ui_global, and uiGlobal_s::windows.
Referenced by UI_CloseWindow(), UI_DebugTree_f(), UI_DisplayNotice(), UI_EditorNodeExtract_f(), UI_GetActiveRenderRect(), UI_ParseWindow(), UI_PopupButton(), UI_PopupList(), UI_PushWindowDelete(), and UI_ReadNodePath().
static int UI_GetWindowPositionFromStackByName | ( | const char * | name | ) | [inline, static] |
Searches the position in the current window stack for a given window id.
Definition at line 129 of file ui_windows.c.
References i, uiNode_s::name, ui_global, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_CloseWindowByRef(), UI_IsWindowOnStack(), and UI_PushWindowDelete().
void UI_InitStack | ( | const char * | activeWindow, | |
const char * | mainWindow, | |||
qboolean | popAll, | |||
qboolean | pushActive | |||
) |
Init the stack to start with a window, and have an alternative window with ESC.
[in] | activeWindow | The first active window of the stack, else NULL |
[in] | mainWindow | The alternative window, else NULL if nothing |
[in] | popAll | If true, clean up the stack first |
[in] | pushActive | If true, push the active window into the stack |
remove Cvar_Set we have direct access to the cvar
check why activeWindow can be NULL. It should never be NULL: a stack must not be empty
We should only call it a very few time. When we switch from/to this different par of the game: main-option-interface / geoscape-and-base / battlescape
Update the code: popAll should be every time true
Update the code: pushActive should be every time true
Illustration about when/how we should use UI_InitStack http://ufoai.ninex.info/wiki/index.php/Image:UI_InitStack.jpg
Definition at line 400 of file ui_windows.c.
References Cvar_Set(), uiGlobal_s::numWindows, qtrue, ui_global, UI_PopWindow(), and UI_PushWindow().
Referenced by CL_Connect_f(), CL_Reset(), CP_CampaignInit(), CP_EndCampaign(), CP_StartMissionMap(), GAME_CP_Drop(), GAME_CP_Results(), GAME_CP_Spawn(), GAME_Drop(), GAME_MP_StartBattlescape(), GAME_MP_StartServer_f(), GAME_SetMode(), GAME_SK_Start_f(), GAME_StartBattlescape(), SAV_GameLoad(), and UI_InitStack_f().
static void UI_InitStack_f | ( | void | ) | [static] |
Definition at line 768 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), qtrue, and UI_InitStack().
Referenced by UI_InitWindows().
void UI_InitWindows | ( | void | ) |
Definition at line 819 of file ui_windows.c.
References _, Cmd_AddCommand(), Cmd_AddParamCompleteFunction(), Cvar_Get(), UI_CloseWindow_f(), UI_CompleteWithWindow(), UI_DebugTree_f(), UI_FireInit_f(), UI_InitStack_f(), UI_PopWindow_f(), UI_PushChildWindow_f(), UI_PushDropDownWindow_f(), UI_PushNoHud_f(), UI_PushWindow_f(), and UI_SetNewWindowPos_f().
Referenced by UI_Init().
void UI_InsertWindow | ( | uiNode_t * | window | ) |
Add a new window to the list of all windows.
Definition at line 698 of file ui_windows.c.
References Com_Error(), ERR_FATAL, i, uiNode_s::name, uiGlobal_s::numWindows, pos, ui_global, UI_MAX_WINDOWS, and uiGlobal_s::windows.
Referenced by UI_ParseWindow().
static void UI_InsertWindowIntoStack | ( | uiNode_t * | window, | |
int | position | |||
) | [inline, static] |
Insert a window at a position of the stack.
[in] | window | The window to insert |
[in] | position | Where we want to add the window (0 is the deeper element of the stack) |
Definition at line 144 of file ui_windows.c.
References i, ui_global, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_PushWindowDelete().
void UI_InvalidateStack | ( | void | ) |
Invalidate all windows of the current stack.
Definition at line 674 of file ui_windows.c.
References Cvar_SetValue(), pos, ui_global, UI_Invalidate(), viddef, viddef_t::virtualHeight, viddef_t::virtualWidth, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by R_SetMode().
qboolean UI_IsPointOnWindow | ( | void | ) |
Check if a point is over a window from the stack.
Definition at line 617 of file ui_windows.c.
References qfalse, qtrue, uiNode_s::root, UI_GetHoveredNode(), UI_GetMouseCapture(), ui_global, WINDOWEXTRADATA, WINDOWEXTRADATACONST, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by IN_Parse().
qboolean UI_IsWindowOnStack | ( | const char * | name | ) |
Check if a named window is on the stack if active windows.
Definition at line 420 of file ui_windows.c.
References UI_GetWindowPositionFromStackByName().
Referenced by CL_HudRadarDown_f(), CL_HudRadarUp_f(), GAME_SetMode(), UI_GetActiveRenderRect(), UI_Popup(), UI_PopupButton(), and UI_PopupList().
void UI_MoveWindowOnTop | ( | uiNode_t * | window | ) |
Move the window on top of compatible windows. "Compatible" mean non full screen windows, and windows with the same window parent.
window | Window we want to move |
Definition at line 69 of file ui_windows.c.
References i, uiNode_s::parent, ui_global, UI_WindowIsFullScreen(), WINDOWEXTRADATA, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_MouseDown().
void UI_PopWindow | ( | qboolean | all | ) |
Pops a window from the window stack.
[in] | all | If true pop all windows from stack |
Definition at line 480 of file ui_windows.c.
References key_game, Key_SetDest(), uiNode_s::name, uiNode_s::parent, cvar_s::string, UI_CloseAllWindow(), UI_CloseWindowByRef(), ui_global, UI_PushWindow(), WINDOWEXTRADATA, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by AIM_AircraftStart_f(), B_Destroy_AntimaterStorage_f(), B_SetBaseTitle_f(), CL_GameAutoGo(), CL_PopupAircraftClick_f(), CL_PopupChangeHomebase_f(), CL_PopupInterceptBaseClick_f(), CL_PopupInterceptGetAircraft_f(), CL_ResearchType_f(), CL_SequenceRender(), CL_UpdateEquipmentMenuParameters_f(), CL_UpdatePilotList_f(), CL_UpdateSoldierList_f(), HOS_Init_f(), Irc_Input_Activate_f(), MAP_MultiSelectExecuteAction_f(), SAV_GameContinue_f(), SAV_GameReadGameComments_f(), TR_TransferAlienAfterMissionStart(), TR_TransferStart_f(), UI_BaseMapNodeDraw(), UI_InitStack(), UI_LeftClick(), UI_MaterialEditorStart_f(), UI_PopWindow_f(), and UI_PopWindowWithEscKey().
static void UI_PopWindow_f | ( | void | ) | [static] |
Console function to pop a window from the window stack.
Definition at line 549 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), qfalse, and UI_PopWindow().
Referenced by UI_InitWindows().
void UI_PopWindowWithEscKey | ( | void | ) |
Definition at line 530 of file ui_windows.c.
References qfalse, ui_global, UI_PopWindow(), WINDOWEXTRADATACONST, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_KeyPressed().
static void UI_PushChildWindow_f | ( | void | ) | [static] |
Console function to push a child window onto the window stack.
Definition at line 256 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and UI_PushWindow().
Referenced by UI_InitWindows().
static void UI_PushDropDownWindow_f | ( | void | ) | [static] |
Console function to push a dropdown window at a position. It work like UI_PushWindow but move the window at the right position.
Definition at line 284 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_ParseValue(), Com_Printf(), mousePosX, mousePosY, uiNode_s::name, uiNode_s::pos, RESULT_OK, uiNode_s::root, UI_GetNodeByPath(), UI_NodeGetPoint(), UI_NodeRelativeToAbsolutePoint(), UI_PushWindow(), and V_INT.
Referenced by UI_InitWindows().
static void UI_PushNoHud_f | ( | void | ) | [static] |
Console function to hide the HUD in battlescape mode Note: relies on a "nohud" window existing.
Definition at line 349 of file ui_windows.c.
References CL_BattlescapeRunning(), and UI_PushWindow().
Referenced by UI_InitWindows().
uiNode_t* UI_PushWindow | ( | const char * | name, | |
const char * | parentName | |||
) | [read] |
Push a window onto the window stack.
[in] | name | Name of the window to push onto window stack |
[in] | parentName | Window name to link as parent-child (else NULL) |
Definition at line 247 of file ui_windows.c.
References qtrue, and UI_PushWindowDelete().
Referenced by AC_ResearchAlien_f(), AIR_Move(), AIR_SendAircraftToMission(), B_BuildingOpenAfterClick(), B_MakeBaseMapShot_f(), B_SelectBase(), CL_CheckCvars_f(), CL_Connect_f(), CL_ConnectionlessPacket(), CL_DisplayPopupAircraft(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CL_GameAutoGo(), CL_HudRadarDown_f(), CL_ParseServerInfoMessage(), CL_PopupInterceptRClick_f(), CL_SequenceStart_f(), CP_BaseAttackStartMission(), CP_NationStatsClick_f(), GAME_CP_Results(), HOS_ListClick_f(), INS_SelectInstallation(), Irc_Client_CmdPrivmsg(), Irc_Client_Invite_f(), Irc_Input_Activate_f(), Irc_Proto_ProcessServerMsg(), MAP_MapClick(), SAV_GameQuickLoadInit_f(), TR_TransferAliensFromMission_f(), UI_InitStack(), UI_Popup(), UI_PopupButton(), UI_PopupList(), UI_PopWindow(), UI_PushChildWindow_f(), UI_PushDropDownWindow_f(), UI_PushNoHud_f(), UI_PushWindow_f(), UP_OpenEventMail(), UP_OpenMailWith(), and UP_OpenWith().
static void UI_PushWindow_f | ( | void | ) | [static] |
Console function to push a window onto the window stack.
Definition at line 268 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and UI_PushWindow().
Referenced by UI_InitWindows().
static uiNode_t* UI_PushWindowDelete | ( | const char * | name, | |
const char * | parent, | |||
qboolean | delete | |||
) | [static] |
Push a window onto the window stack.
[in] | name | Name of the window to push onto window stack |
[in] | parent | Window name to link as parent-child (else NULL) |
[in] | delete | Delete the window from the window stack before adding it again |
Definition at line 167 of file ui_windows.c.
References uiNode_s::behaviour, Com_Printf(), uiBehaviour_s::init, key_game, Key_SetDest(), UI_DeleteWindowFromStack(), UI_GetWindow(), UI_GetWindowPositionFromStackByName(), ui_global, UI_InsertWindowIntoStack(), UI_InvalidateMouse(), UI_MAX_WINDOWSTACK, UI_ReleaseInput(), WINDOWEXTRADATA, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_PushWindow().
static void UI_RemoveWindowAtPositionFromStack | ( | int | position | ) | [static] |
Definition at line 358 of file ui_windows.c.
References i, ui_global, uiGlobal_s::windowStack, and uiGlobal_s::windowStackPos.
Referenced by UI_CloseWindowByRef().
void UI_SetNewWindowPos | ( | uiNode_t * | window, | |
int | x, | |||
int | y | |||
) |
Sets new x and y coordinates for a given window.
Definition at line 688 of file ui_windows.c.
References uiNode_s::pos, and Vector2Set.
Referenced by UI_ControlsNodeCapturedMouseMove(), and UI_SetNewWindowPos_f().
static void UI_SetNewWindowPos_f | ( | void | ) | [static] |
Console command for moving a window.
Definition at line 725 of file ui_windows.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), UI_GetActiveWindow(), and UI_SetNewWindowPos().
Referenced by UI_InitWindows().
cvar_t* mn_sys_active [static] |
Main window of a stack.
Definition at line 44 of file ui_windows.c.
cvar_t* mn_sys_main [static] |
Window name use as alternative for option.
Definition at line 39 of file ui_windows.c.