C# Class MediaPortal.GUI.Library.GUIWindow

base class for every window. It contains all methods needed for basic window management like - initialization - deitialization - render itself onscreen - processing actions like keypresses, mouse clicks/movements - processing messages Each window plugin should derive from this base class Pluginwindows should be copied in the plugins/windows folder
Inheritance: ISupportInitialize, IDisposable
Datei anzeigen Open project: MediaPortal/MediaPortal-1 Class Usage Examples

Public Properties

Property Type Description
_mainThreadContext System.Threading.SynchronizationContext

Protected Properties

Property Type Description
_autoHideTopbar bool
_autoHideTopbarType AutoHideTopBar
_defaultControlId int
_disableTopBar bool
_isOverlayAllowed bool
_isOverlayAllowedCondition int
_isOverlayAllowedOriginalCondition int
_listPositions List
_loadParameter string
_loadSkinDone bool
_shouldRestore bool
_volumeOverlayOffsetX int
_volumeOverlayOffsetY int
_windowXmlFileName string

Public Methods

Method Description
Add ( GUIControl &control ) : void

add a new control to this window

AllocResources ( ) : void

Gets called by the runtime just before the window gets shown. It will ask every control of the window to allocate its (directx) resources

BeginInit ( ) : void
Clear ( ) : void

Clear() method. This method gets called when user switches skin. It removes any static vars the GUIWindow class has

ClearAll ( ) : void

remove all controls from the window

DeInit ( ) : void

Gets called by the runtime when a window will be destroyed Every window window should override this method and cleanup any resources

Dispose ( ) : void

Gets called by the runtime when the window is not longer shown. It will ask every control of the window 2 free its (directx) resources

DoRestoreSkin ( ) : void
EndInit ( ) : void
GUIWindow ( ) : System

The (empty) constructor of the GUIWindow

GUIWindow ( string skinFile ) : System

Constructor

GetControl ( int iControlId ) : GUIControl

get a control by the control ID

GetFocusControlId ( ) : int

returns the ID of the control which has the focus

GetModuleName ( ) : string
InWindow ( int x, int y ) : bool
Init ( ) : bool

Gets called by the runtime when a new window has been created Every window window should override this method and load itself by calling the Load() method

InitControls ( ) : void

This method will call the OnInit() on each control belonging to this window this gives the control a way to do some pre-initalisation stuff

IsInstance ( Object obj ) : bool
Load ( string skinFileName ) : bool

Load the XML file for this window which contains a definition of which controls the GUI has

LoadSkin ( ) : bool
LoadSkinBool ( ) : bool

Loads the xml file for the window.

LoadSkinThreaded ( int p1, int p2, object s ) : int
LooseFocus ( ) : void

This method will remove the focus from the currently focused control

NeedRefresh ( ) : bool

NeedRefresh() can be called to see if the windows needs 2 redraw itself or not some controls (for example the fadelabel) contain scrolling texts and need 2 ne re-rendered constantly

OnAction ( Action action ) : void

OnAction() method. This method gets called when there's a new action like a keypress or mousemove or... By overriding this method, the window can respond to any action

OnAdded ( ) : void
OnDeviceLost ( ) : void

Gets called when DirectX device has been lost. Any texture/font is now invalid

OnDeviceRestored ( ) : void

Gets called when DirectX device has been restored.

OnMessage ( GUIMessage message ) : bool

OnMessage() This method gets called when there's a new message. Controls send messages to notify their parents about their state (changes) By overriding this method a window can respond to the messages of its controls

PreInit ( ) : void

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
QueueAnimation ( AnimationType animType ) : void
Remove ( int dwId ) : void

remove a control by its id from this window

Render ( float timePassed ) : void

Render() method. This method draws the window by asking every control of the window to render itself

ResetAllControls ( ) : void

Resets all the controls to their original positions, width and height

Restore ( ) : void

Restores all the (x,y) positions of the XML file to their original values

RestoreControlPosition ( int iControl ) : void

Restores the position of the control to its default position.

SendToFront ( GUIControl &ctrl ) : void

Move the control with the specified id to the end of the control list (will render last; in front of other controls).

SetObject ( object obj ) : void
UpdateOverlay ( ) : void

Restores window overlay status to default value from skin condition

UpdateVisibility ( ) : void

calls UpdateVisibility for all children components (also used for allowing to switch focus to a component that can only be focused if the current component is not active)

Protected Methods

Method Description
DeInitControls ( ) : void
IsAnimating ( AnimationType animType ) : bool
LoadControl ( XmlNode node, string>.IDictionary defines ) : void

This method will load a single control from the xml node

OnClicked ( int controlId, GUIControl control, Action actionType ) : void
OnClickedDown ( int controlId, GUIControl control, Action actionType ) : void
OnClickedUp ( int controlId, GUIControl control, Action actionType ) : void
OnMouseClick ( int posX, int posY, Action action ) : void
OnMouseMove ( int cx, int cy, Action action ) : void
OnPageDestroy ( int newWindowId ) : void
OnPageLoad ( ) : void
OnPreviousWindow ( ) : void
OnShowContextMenu ( ) : void
OnWindowLoaded ( ) : void

Gets by the window manager when it has loaded the window default implementation stores the position of all controls in _listPositions

PreLoadPage ( ) : void

Private Methods

Method Description
AnimationTrigger ( GUIMessage message ) : void
FreeResources ( ) : void
HasAnimation ( AnimationType animType ) : bool
LoadDefines ( XmlDocument document ) : string>.IDictionary
LoadInclude ( XmlNode node, string>.IDictionary defines ) : bool
RenderAnimation ( uint time ) : bool
SetControlVisibility ( ) : void
SetInitialOverlayAllowed ( ) : void
TemporaryAnimationTrigger ( ) : void
UpdateOverlayAllowed ( ) : void
UpdateOverlayAllowed ( bool useOriginal ) : void
UpdateStates ( AnimationType type, AnimationProcess currentProcess, AnimationState currentState ) : void

Method Details

Add() public method

add a new control to this window
public Add ( GUIControl &control ) : void
control GUIControl new control to add
return void

AllocResources() public method

Gets called by the runtime just before the window gets shown. It will ask every control of the window to allocate its (directx) resources
public AllocResources ( ) : void
return void

BeginInit() public method

public BeginInit ( ) : void
return void

Clear() public static method

Clear() method. This method gets called when user switches skin. It removes any static vars the GUIWindow class has
public static Clear ( ) : void
return void

ClearAll() public method

remove all controls from the window
public ClearAll ( ) : void
return void

DeInit() public method

Gets called by the runtime when a window will be destroyed Every window window should override this method and cleanup any resources
public DeInit ( ) : void
return void

DeInitControls() protected method

protected DeInitControls ( ) : void
return void

Dispose() public method

Gets called by the runtime when the window is not longer shown. It will ask every control of the window 2 free its (directx) resources
public Dispose ( ) : void
return void

DoRestoreSkin() public method

public DoRestoreSkin ( ) : void
return void

EndInit() public method

public EndInit ( ) : void
return void

GUIWindow() public method

The (empty) constructor of the GUIWindow
public GUIWindow ( ) : System
return System

GUIWindow() public method

Constructor
public GUIWindow ( string skinFile ) : System
skinFile string filename of xml skin file which belongs to this window
return System

GetControl() public method

get a control by the control ID
public GetControl ( int iControlId ) : GUIControl
iControlId int id of control
return GUIControl

GetFocusControlId() public method

returns the ID of the control which has the focus
public GetFocusControlId ( ) : int
return int

GetModuleName() public method

public GetModuleName ( ) : string
return string

InWindow() public method

public InWindow ( int x, int y ) : bool
x int
y int
return bool

Init() public method

Gets called by the runtime when a new window has been created Every window window should override this method and load itself by calling the Load() method
public Init ( ) : bool
return bool

InitControls() public method

This method will call the OnInit() on each control belonging to this window this gives the control a way to do some pre-initalisation stuff
public InitControls ( ) : void
return void

IsAnimating() protected method

protected IsAnimating ( AnimationType animType ) : bool
animType AnimationType
return bool

IsInstance() public method

public IsInstance ( Object obj ) : bool
obj Object
return bool

Load() public method

Load the XML file for this window which contains a definition of which controls the GUI has
public Load ( string skinFileName ) : bool
skinFileName string filename of the .xml file
return bool

LoadControl() protected method

This method will load a single control from the xml node
protected LoadControl ( XmlNode node, string>.IDictionary defines ) : void
node System.Xml.XmlNode XmlNode describing the control
defines string>.IDictionary on return this will contain an arraylist of all controls loaded
return void

LoadSkin() public method

public LoadSkin ( ) : bool
return bool

LoadSkinBool() public method

Loads the xml file for the window.
public LoadSkinBool ( ) : bool
return bool

LoadSkinThreaded() public method

public LoadSkinThreaded ( int p1, int p2, object s ) : int
p1 int
p2 int
s object
return int

LooseFocus() public method

This method will remove the focus from the currently focused control
public LooseFocus ( ) : void
return void

NeedRefresh() public method

NeedRefresh() can be called to see if the windows needs 2 redraw itself or not some controls (for example the fadelabel) contain scrolling texts and need 2 ne re-rendered constantly
public NeedRefresh ( ) : bool
return bool

OnAction() public method

OnAction() method. This method gets called when there's a new action like a keypress or mousemove or... By overriding this method, the window can respond to any action
public OnAction ( Action action ) : void
action Action action : contains the action
return void

OnAdded() public method

public OnAdded ( ) : void
return void

OnClicked() protected method

protected OnClicked ( int controlId, GUIControl control, Action actionType ) : void
controlId int
control GUIControl
actionType Action
return void

OnClickedDown() protected method

protected OnClickedDown ( int controlId, GUIControl control, Action actionType ) : void
controlId int
control GUIControl
actionType Action
return void

OnClickedUp() protected method

protected OnClickedUp ( int controlId, GUIControl control, Action actionType ) : void
controlId int
control GUIControl
actionType Action
return void

OnDeviceLost() public method

Gets called when DirectX device has been lost. Any texture/font is now invalid
public OnDeviceLost ( ) : void
return void

OnDeviceRestored() public method

Gets called when DirectX device has been restored.
public OnDeviceRestored ( ) : void
return void

OnMessage() public method

OnMessage() This method gets called when there's a new message. Controls send messages to notify their parents about their state (changes) By overriding this method a window can respond to the messages of its controls
public OnMessage ( GUIMessage message ) : bool
message GUIMessage
return bool

OnMouseClick() protected method

protected OnMouseClick ( int posX, int posY, Action action ) : void
posX int
posY int
action Action
return void

OnMouseMove() protected method

protected OnMouseMove ( int cx, int cy, Action action ) : void
cx int
cy int
action Action
return void

OnPageDestroy() protected method

protected OnPageDestroy ( int newWindowId ) : void
newWindowId int
return void

OnPageLoad() protected method

protected OnPageLoad ( ) : void
return void

OnPreviousWindow() protected method

protected OnPreviousWindow ( ) : void
return void

OnShowContextMenu() protected method

protected OnShowContextMenu ( ) : void
return void

OnWindowLoaded() protected method

Gets by the window manager when it has loaded the window default implementation stores the position of all controls in _listPositions
protected OnWindowLoaded ( ) : void
return void

PreInit() public method

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 PreInit ( ) : void
return void

PreLoadPage() protected method

protected PreLoadPage ( ) : void
return void

Process() public method

public Process ( ) : void
return void

QueueAnimation() public method

public QueueAnimation ( AnimationType animType ) : void
animType AnimationType
return void

Remove() public method

remove a control by its id from this window
public Remove ( int dwId ) : void
dwId int ID of the control
return void

Render() public method

Render() method. This method draws the window by asking every control of the window to render itself
public Render ( float timePassed ) : void
timePassed float
return void

ResetAllControls() public method

Resets all the controls to their original positions, width and height
public ResetAllControls ( ) : void
return void

Restore() public method

Restores all the (x,y) positions of the XML file to their original values
public Restore ( ) : void
return void

RestoreControlPosition() public method

Restores the position of the control to its default position.
public RestoreControlPosition ( int iControl ) : void
iControl int The identifier of the control that needs to be restored.
return void

SendToFront() public method

Move the control with the specified id to the end of the control list (will render last; in front of other controls).
public SendToFront ( GUIControl &ctrl ) : void
ctrl GUIControl ID of the control
return void

SetObject() public method

public SetObject ( object obj ) : void
obj object
return void

UpdateOverlay() public method

Restores window overlay status to default value from skin condition
public UpdateOverlay ( ) : void
return void

UpdateVisibility() public method

calls UpdateVisibility for all children components (also used for allowing to switch focus to a component that can only be focused if the current component is not active)
public UpdateVisibility ( ) : void
return void

Property Details

_autoHideTopbar protected_oe property

protected bool _autoHideTopbar
return bool

_autoHideTopbarType protected_oe property

protected AutoHideTopBar _autoHideTopbarType
return AutoHideTopBar

_defaultControlId protected_oe property

protected int _defaultControlId
return int

_disableTopBar protected_oe property

protected bool _disableTopBar
return bool

_isOverlayAllowed protected_oe property

protected bool _isOverlayAllowed
return bool

_isOverlayAllowedCondition protected_oe property

protected int _isOverlayAllowedCondition
return int

_isOverlayAllowedOriginalCondition protected_oe property

protected int _isOverlayAllowedOriginalCondition
return int

_listPositions protected_oe property

protected List _listPositions
return List

_loadParameter protected_oe property

protected string _loadParameter
return string

_loadSkinDone protected_oe static_oe property

protected static bool _loadSkinDone
return bool

_mainThreadContext public_oe static_oe property

public static SynchronizationContext,System.Threading _mainThreadContext
return System.Threading.SynchronizationContext

_shouldRestore protected_oe property

protected bool _shouldRestore
return bool

_volumeOverlayOffsetX protected_oe property

protected int _volumeOverlayOffsetX
return int

_volumeOverlayOffsetY protected_oe property

protected int _volumeOverlayOffsetY
return int

_windowXmlFileName protected_oe property

protected string _windowXmlFileName
return string