ui_windows.h File Reference

#include "../../common/common.h"
Include dependency graph for ui_windows.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void UI_InitWindows (void)
int UI_GetLastFullScreenWindow (void)
 Returns the ID of the last fullscreen ID. Before this, window should be hidden.
struct uiNode_sUI_PushWindow (const char *name, const char *parentName)
 Push a window onto the window stack.
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.
void UI_PopWindow (qboolean all)
 Pops a window from the window stack.
void UI_PopWindowWithEscKey (void)
void UI_CloseWindow (const char *name)
struct uiNode_sUI_GetActiveWindow (void)
 Returns the current active window from the window stack or NULL if there is none.
int UI_CompleteWithWindow (const char *partial, const char **match)
 Complete function for mn_push.
qboolean UI_IsWindowOnStack (const char *name)
 Check if a named window is on the stack if active windows.
qboolean UI_IsPointOnWindow (void)
 Check if a point is over a window from the stack.
void UI_InvalidateStack (void)
 Invalidate all windows of the current stack.
void UI_InsertWindow (struct uiNode_s *window)
 Add a new window to the list of all windows.
void UI_MoveWindowOnTop (struct uiNode_s *window)
 Move the window on top of compatible windows. "Compatible" mean non full screen windows, and windows with the same window parent.
const char * UI_GetActiveWindowName (void)
 Returns the name of the current window.
void UI_GetActiveRenderRect (int *x, int *y, int *width, int *height)
 Determine the position and size of render.
void UI_SetNewWindowPos (struct uiNode_s *window, int x, int y)
 Sets new x and y coordinates for a given window.
struct uiNode_sUI_GetWindow (const char *name)
 Searches all windows for the specified one.

Detailed Description

Definition in file ui_windows.h.


Function Documentation

void UI_CloseWindow ( const char *  name  ) 
int UI_CompleteWithWindow ( const char *  partial,
const char **  match 
)

Complete function for mn_push.

See also:
Cmd_AddParamCompleteFunction
UI_PushWindow
Note:
Does not really complete the input - but shows at least all parsed windows

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().

void UI_GetActiveRenderRect ( int *  x,
int *  y,
int *  width,
int *  height 
)

Determine the position and size of render.

Todo:
the better way is to add a 'battlescape' node

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().

struct uiNode_s* UI_GetActiveWindow ( void   )  [read]

Returns the current active window from the window stack or NULL if there is none.

Returns:
uiNode_t pointer from window stack
See also:
UI_GetWindow

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.

Returns:
Active window name, else empty string
See also:
UI_GetActiveWIndow

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.

Returns:
The last full screen window on the screen, else 0. If the stack is empty, return -1

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().

struct uiNode_s* UI_GetWindow ( const char *  name  )  [read]

Searches all windows for the specified one.

Parameters:
[in] name Name of the window we search
Returns:
The window found, else NULL
Note:
Use dichotomic search
See also:
UI_GetActiveWindow

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().

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.

Parameters:
[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
Todo:

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().

void UI_InitWindows ( void   ) 
void UI_InsertWindow ( uiNode_t window  ) 

Add a new window to the list of all windows.

Note:
Sort windows by alphabet

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().

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.

See also:
IN_Parse

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.

Parameters:
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  ) 
void UI_PopWindowWithEscKey ( void   ) 
struct uiNode_s* UI_PushWindow ( const char *  name,
const char *  parentName 
) [read]
void UI_SetNewWindowPos ( uiNode_t window,
int  x,
int  y 
)

Sets new x and y coordinates for a given window.

Todo:
move it on m_nodes, its a common getter/setter
Todo:
remove that

Definition at line 688 of file ui_windows.c.

References uiNode_s::pos, and Vector2Set.

Referenced by UI_ControlsNodeCapturedMouseMove(), and UI_SetNewWindowPos_f().


Generated by  doxygen 1.6.2