C# Class MediaPortal.GUI.Library.GUIWindowManager

static class which takes care of window management Things done are: - loading and initializing all windows - routing messages, key presses, mouse clicks etc to the currently active window - rendering the currently active window - methods for switching to the previous window - methods to switch to another window
Mostra file Open project: MediaPortal/MediaPortal-1

Public Methods

Method Description
ActivateWindow ( int windowId ) : void

ActivateWindow() This function will show/present/activate the window specified

ActivateWindow ( int windowId, String loadParameter ) : void

This function will show/present/activate the window specified and pass a parameter to the window.

ActivateWindow ( int windowId, String loadParameter, bool replaceWindow ) : void

This function will show/present/activate the window specified and pass a parameter to the window.

ActivateWindow ( int windowId, bool replaceWindow ) : void

ActivateWindow() This function will show/present/activate and replace current window with the window specified

ActivateWindow ( int windowId, bool replaceWindow, bool skipAnimation, int focusControlId ) : void

ActivateWindow() This function will show/present/activate and replace current window with the window specified.

Add ( GUIWindow &Window ) : void

Add new window to the window manager

Clear ( ) : void

Removes all windows

CloseCurrentWindow ( ) : void

Close current window. When MediaPortal closes we need to close current window

DispatchThreadMessages ( ) : void

process the thread messages and actions This method gets called by the main thread only and ensures that all messages & actions are handled by 1 thread only

Dispose ( ) : void

Asks all windows to cleanup their resources

GetPreviousActiveWindow ( ) : int
GetWindow ( int dwID ) : GUIWindow

GetWindow() returns the window with the specified ID

HasPreviousWindow ( ) : bool

Checks if ShowPreviousWindow could activate a previous window. If no, then there is no previous window.

Initialize ( ) : void

Initialize the window manager

MadVrProcess ( ) : void

MyInterfaceFilter ( Type typeObj, Object criteriaObj ) : bool
NeedRefresh ( ) : bool

returns true if current window wants to refresh/redraw itself other wise false

OnAction ( Action action ) : void

This method will handle a given action. Its called by the process() function The window manager will give the action to the current active window 2 handle

OnDeviceRestored ( ) : void

called by the runtime when DirectX device has been restored Just let current active window know about this so they can re-allocate their directx resources

OnResize ( ) : void

OnResize() will restore all the positions of all controls of all windows to their original values as specified in the skin files

PreInit ( ) : void

Call preinit for every window This function gets called once by the runtime when everything is up & running directX is now initialized, but before the first window is activated. It gives the window the oppertunity to allocate any (directx) resources it may need

Process ( ) : void

ProcessWindows ( ) : void

This method will call the process() method on the currently active window This method gets calle on a regular basis and allows the window todo some stuff without any user action necessary

Render ( float timePassed ) : void

Render() ask the current active window to render itself

Replace ( int windowId, GUIWindow window ) : void
ReplaceWindow ( int windowId ) : void

ReplaceWindow() This function will replace current window with specified window

ResetAllControls ( ) : void

call ResetallControls() for every window This will cause each control to use the default position, width and size as mentioned in the skin files

ResetWindowsHistory ( ) : void
RouteToWindow ( int dialogId ) : void
SendMessage ( GUIMessage message ) : void

Send message to a window/control

SendThreadCallback ( Callback callback, int param1, int param2, object data ) : void
SendThreadCallbackAndWait ( Callback callback, int param1, int param2, object data ) : int

This function can be used to call a callback within the context of the message processing thread. The function waits until the message thread has picked up and executed the callback. This function is also safe if the current thread is the message processing thread.

SendThreadCallbackSkin ( Callback callback, int param1, int param2, object data ) : int
SendThreadMessage ( GUIMessage message ) : void

send thread message. Same as sendmessage() however message is placed on a queue which is processed later.

ShowPreviousWindow ( ) : void

Show previous window. When user goes back (ESC) this function will show the previous active window

ShowWarning ( int iHeading, int iLine1, int iLine2 ) : void

This method will show a warning dialog onscreen and returns when the user has clicked the dialog away

UnRoute ( ) : void

tell the window manager to unroute the current routing

Private Methods

Method Description
ActivateWindow ( int newWindowId, bool replaceWindow, bool skipHistory, String loadParameter ) : void
ActivateWindow ( int newWindowId, bool replaceWindow, bool skipHistory, String loadParameter, bool skipAnimation, int focusControlId ) : void
AddNewWindowToHistory ( int WindowId ) : void
CallbackMsg ( GUIMessage msg ) : void
GUIWindowManager ( ) : System
GetWindow ( int dwID, bool tryRestoreSkin ) : GUIWindow
LockAndDoOnAllRegisteredWindows ( Action toDo ) : void
OnActionReceived ( Action action ) : void

event handler which is called by GUIGraphicsContext when a new action has occurred The method will add the action to a list which is processed later on in the process () function The reason for this is that multiple threads can add new action and they should only be processed by the main thread

RemoveDoubleHistory ( int newWindow ) : void
StartFrameClock ( ) : void
StartMadVrFrameClock ( ) : void
WaitForFrameClock ( ) : void
WaitForMadVrFrameClock ( ) : void

Method Details

ActivateWindow() public static method

ActivateWindow() This function will show/present/activate the window specified
public static ActivateWindow ( int windowId ) : void
windowId int
return void

ActivateWindow() public static method

This function will show/present/activate the window specified and pass a parameter to the window.
public static ActivateWindow ( int windowId, String loadParameter ) : void
windowId int window id of the window to activate
loadParameter String a parameter string to pass to the new window
return void

ActivateWindow() public static method

This function will show/present/activate the window specified and pass a parameter to the window.
public static ActivateWindow ( int windowId, String loadParameter, bool replaceWindow ) : void
windowId int window id of the window to activate
loadParameter String a parameter string to pass to the new window
replaceWindow bool
return void

ActivateWindow() public static method

ActivateWindow() This function will show/present/activate and replace current window with the window specified
public static ActivateWindow ( int windowId, bool replaceWindow ) : void
windowId int
replaceWindow bool
return void

ActivateWindow() public static method

ActivateWindow() This function will show/present/activate and replace current window with the window specified.
public static ActivateWindow ( int windowId, bool replaceWindow, bool skipAnimation, int focusControlId ) : void
windowId int window id of the window to activate
replaceWindow bool replace current window
skipAnimation bool do not perform open and close animation during this activation
focusControlId int focus on this control rather than the window default
return void

Add() public static method

Add new window to the window manager
public static Add ( GUIWindow &Window ) : void
Window GUIWindow new window to add
return void

Clear() public static method

Removes all windows
public static Clear ( ) : void
return void

CloseCurrentWindow() public static method

Close current window. When MediaPortal closes we need to close current window
public static CloseCurrentWindow ( ) : void
return void

DispatchThreadMessages() public static method

process the thread messages and actions This method gets called by the main thread only and ensures that all messages & actions are handled by 1 thread only
public static DispatchThreadMessages ( ) : void
return void

Dispose() public static method

Asks all windows to cleanup their resources
public static Dispose ( ) : void
return void

GetPreviousActiveWindow() public static method

public static GetPreviousActiveWindow ( ) : int
return int

GetWindow() public static method

GetWindow() returns the window with the specified ID
public static GetWindow ( int dwID ) : GUIWindow
dwID int id of window
return GUIWindow

HasPreviousWindow() public static method

Checks if ShowPreviousWindow could activate a previous window. If no, then there is no previous window.
public static HasPreviousWindow ( ) : bool
return bool

Initialize() public static method

Initialize the window manager
public static Initialize ( ) : void
return void

MadVrProcess() public static method

public static MadVrProcess ( ) : void
return void

MyInterfaceFilter() public static method

public static MyInterfaceFilter ( Type typeObj, Object criteriaObj ) : bool
typeObj System.Type
criteriaObj Object
return bool

NeedRefresh() public static method

returns true if current window wants to refresh/redraw itself other wise false
public static NeedRefresh ( ) : bool
return bool

OnAction() public static method

This method will handle a given action. Its called by the process() function The window manager will give the action to the current active window 2 handle
public static OnAction ( Action action ) : void
action Action new action for current active window
return void

OnDeviceRestored() public static method

called by the runtime when DirectX device has been restored Just let current active window know about this so they can re-allocate their directx resources
public static OnDeviceRestored ( ) : void
return void

OnResize() public static method

OnResize() will restore all the positions of all controls of all windows to their original values as specified in the skin files
public static OnResize ( ) : void
return void

PreInit() public static method

Call preinit for every window This function gets called once by the runtime when everything is up & running directX is now initialized, but before the first window is activated. It gives the window the oppertunity to allocate any (directx) resources it may need
public static PreInit ( ) : void
return void

Process() public static method

public static Process ( ) : void
return void

ProcessWindows() public static method

This method will call the process() method on the currently active window This method gets calle on a regular basis and allows the window todo some stuff without any user action necessary
public static ProcessWindows ( ) : void
return void

Render() public static method

Render() ask the current active window to render itself
public static Render ( float timePassed ) : void
timePassed float
return void

Replace() public static method

public static Replace ( int windowId, GUIWindow window ) : void
windowId int
window GUIWindow
return void

ReplaceWindow() public static method

ReplaceWindow() This function will replace current window with specified window
public static ReplaceWindow ( int windowId ) : void
windowId int
return void

ResetAllControls() public static method

call ResetallControls() for every window This will cause each control to use the default position, width and size as mentioned in the skin files
public static ResetAllControls ( ) : void
return void

ResetWindowsHistory() public static method

public static ResetWindowsHistory ( ) : void
return void

RouteToWindow() public static method

public static RouteToWindow ( int dialogId ) : void
dialogId int
return void

SendMessage() public static method

Send message to a window/control
public static SendMessage ( GUIMessage message ) : void
message GUIMessage message to send
return void

SendThreadCallback() public static method

public static SendThreadCallback ( Callback callback, int param1, int param2, object data ) : void
callback Callback
param1 int
param2 int
data object
return void

SendThreadCallbackAndWait() public static method

This function can be used to call a callback within the context of the message processing thread. The function waits until the message thread has picked up and executed the callback. This function is also safe if the current thread is the message processing thread.
public static SendThreadCallbackAndWait ( Callback callback, int param1, int param2, object data ) : int
callback Callback Callback to be executed
param1 int Param to callback
param2 int Param to callback
data object Param to callback
return int

SendThreadCallbackSkin() public static method

public static SendThreadCallbackSkin ( Callback callback, int param1, int param2, object data ) : int
callback Callback
param1 int
param2 int
data object
return int

SendThreadMessage() public static method

send thread message. Same as sendmessage() however message is placed on a queue which is processed later.
public static SendThreadMessage ( GUIMessage message ) : void
message GUIMessage new message to send
return void

ShowPreviousWindow() public static method

Show previous window. When user goes back (ESC) this function will show the previous active window
public static ShowPreviousWindow ( ) : void
return void

ShowWarning() public static method

This method will show a warning dialog onscreen and returns when the user has clicked the dialog away
public static ShowWarning ( int iHeading, int iLine1, int iLine2 ) : void
iHeading int label id for the dialog header
iLine1 int label id for the 1st line in the dialog
iLine2 int label id for the 2nd line in the dialog
return void

UnRoute() public static method

tell the window manager to unroute the current routing
public static UnRoute ( ) : void
return void