C# Class MediaPortal.GUI.Library.GUIControl

Base class for GUIControls.
Inheritance: GUIBaseControl, IDisposable
Exibir arquivo Open project: MediaPortal/MediaPortal-1 Class Usage Examples

Protected Properties

Property Type Description
_calibration bool
_data object
_isAnimating bool
_isDimmed bool
_isSelected bool
_originalDiffuseColor long
_originalRectangle Rectangle
_parentControl GUIControl
_parentControlId int
_selectedItem int
_subItemList ArrayList
_windowId int

Private Properties

Property Type Description
CalcBearing double
CalcDistance double
FlattenHierarchy System.Collections.ArrayList
FlattenHierarchy void
FreeResources void
Navigate int
UpdateStates void

Public Methods

Method Description
AddAnimations ( List animations ) : void
AddItemLabelControl ( int iWindowId, int iControlId, string strLabel ) : void

Sends a GUI_MSG_LABEL_ADD message to a control (Add an ItemLabel to a control).

AddListItemControl ( int iWindowId, int iControlId, GUIListItem item ) : void

Sends a GUI_MSG_LABEL_ADD message to a control (Add a ListItem to a control).

AddSubItem ( object obj ) : void

Add an subitem to a control

AllocResources ( ) : void

Allocates the control its DirectX resources.

Animate ( float timePassed, MediaPortal.GUI.Library.Animator animator ) : void

Method to get animate the current control

CanFocus ( ) : bool

Checks if the control can focus.

ClearControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_LABEL_RESET message to a control (Clears a control).

DeSelectControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_DESELECTED message to a control (Deselect a control).

DisableControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_DISABLED message to a control (Disables a control).

Dispose ( ) : void

Frees the control its DirectX resources.

DoRender ( float timePassed, uint currentTime ) : void
DoUpdate ( ) : void
EnableControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_ENABLED message to a control (Enables a control).

FinalizeConstruction ( ) : void

This function is called after all of the XmlSkinnable fields have been filled with appropriate data. Use this to do any construction work other than simple data member assignments, for example, initializing new reference types, extra calculations, etc..

FocusControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_SETFOCUS message to a control (Set the focus on a control).

FocusControl ( int iWindowId, int iControlId, Direction direction ) : void
FocusItemControl ( int iWindowId, int iControlId, int iItem ) : void

Sends a GUI_MSG_ITEM_FOCUS message to a control (set item in control to selected state).

GUIControl ( ) : System

empty constructor

GUIControl ( int dwParentID ) : System

The basic constructur of the GUIControl class.

GUIControl ( int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight ) : System

The constructor of the GUIControl class.

GetAnimation ( AnimationType type, bool checkConditions ) : VisualEffect
GetAnimations ( AnimationType type, bool checkConditions ) : List
GetCenter ( float &centerX, float &centerY ) : void
GetControlById ( int ID ) : GUIControl

Property to get the control for a specific control ID

GetItemCount ( int lWindowId, int iControlId ) : int

Sends a GUI_MSG_ITEMS message to a control (Gets the number of Items in a control).

GetListItem ( int lWindowId, int iControlId, int iItem ) : GUIListItem

Sends a GUI_MSG_GET_ITEM message to a control (Gets a GUIListItem based on the lWindowId, iControlId, iItem parameters).

GetRect ( int &x, int &y, int &width, int &height ) : void

Method to get the rectangle of the current control

GetSelectedListItem ( int lWindowId, int iControlId ) : GUIListItem

Sends a GUI_MSG_GET_SELECTED_ITEM message to a control (Gets the selected GUIListItem based on the lWindowId, iControlId).

GetSubItem ( int index ) : object

Property to get a subitem

GetVisibleCondition ( ) : int
HideControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_HIDDEN message to a control (Hide a control).

HitTest ( int x, int y, int &controlID, bool &focused ) : bool

Checks if the x and y coordinates correspond to the current control.

InControl ( int x, int y, int &controlID ) : bool

Method which determines of the coordinate(x,y) is within the current control

IsEffectAnimating ( AnimationType animType ) : bool
LoadAnimationControl ( int parentID, int controlId, int posX, int posY, int width, int height, string texture ) : GUIAnimation
LoadControl ( string xmlFilename ) : List
NeedRefresh ( ) : bool

NeedRefresh() can be called to see if the control 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 control can respond to any action

OnDeInit ( ) : void

Virtual method. This method gets called when the control is de-initialized and allows it to do any de-initalization

OnInit ( ) : void

Virtual method. This method gets called when the control is initialized and allows it to do any initalization

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 control can respond to the messages of its controls

PreAllocResources ( ) : void

Preallocates the control its DirectX resources.

QueueAnimation ( AnimationType animType ) : void
ReStorePosition ( ) : void

Method to restore the saved-current control rectangle

RefreshControl ( int iWindowId, int iControlId ) : void
RemoveSubItem ( int index ) : void

Remove an subitem from an control

RemoveSubItem ( object obj ) : void

Remove an subitem from an control

Render ( float timePassed ) : void

The default render method. This needs to be overwritten when inherited to give every control its specific look and feel.

ResetAnimations ( ) : void
ScaleToScreenResolution ( ) : void

Does any scaling on the inital size\position values to fit them to screen resolution.

SelectControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_SELECTED message to a control (Select a control).

SelectItemControl ( int iWindowId, int iControlId, int iItem ) : void

Sends a GUI_MSG_ITEM_SELECT message to a control (Select an item in a control).

SetAlpha ( int dwAlpha ) : void

Changes the alpha transparency component of the colordiffuse.

SetAnimations ( List animations ) : void
SetControlLabel ( int iWindowId, int iControlId, string strText ) : void

Sends a GUI_MSG_LABEL_SET message to a control (Set the label of a control).

SetInitialVisibility ( ) : void
SetNavigation ( int dwUp, int dwDown, int dwLeft, int dwRight ) : void

Set the up/down/left/right control

SetPosition ( int dwPosX, int dwPosY ) : void

Sets the position of the control.

SetSubItem ( int index, object o ) : void

Property to set an subitem

SetThumbAnimations ( List animations ) : void
SetVisibleCondition ( int visible, bool allowHiddenFocus ) : void
ShowControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_VISIBLE message to a control (Make a control visible).

StorePosition ( ) : void

Method to store(save) the current control rectangle

UnfocusControl ( int iWindowId, int iControlId ) : void

Sends a GUI_MSG_LOSTFOCUS message to a control (Set the focus on a control).

UpdateVisibility ( ) : void
getTransformMatrix ( uint currentTime ) : TransformMatrix

Protected Methods

Method Description
OnFocus ( ) : void
Update ( ) : void

Perform an update after a change has occured. E.g. change to a new position.

Private Methods

Method Description
CalcBearing ( Drawing p1, Drawing p2 ) : double
CalcDistance ( Drawing p2, Drawing p1 ) : double
FlattenHierarchy ( ICollection elements ) : ArrayList
FlattenHierarchy ( ICollection collection, ArrayList targetList ) : void
FreeResources ( ) : void
Navigate ( Direction direction ) : int
UpdateStates ( AnimationType type, AnimationProcess currentProcess, AnimationState currentState ) : void

Method Details

AddAnimations() public method

public AddAnimations ( List animations ) : void
animations List
return void

AddItemLabelControl() public static method

Sends a GUI_MSG_LABEL_ADD message to a control (Add an ItemLabel to a control).
public static AddItemLabelControl ( int iWindowId, int iControlId, string strLabel ) : void
iWindowId int The SenderId.
iControlId int The target control.
strLabel string The text of the label that needs to be added.
return void

AddListItemControl() public static method

Sends a GUI_MSG_LABEL_ADD message to a control (Add a ListItem to a control).
public static AddListItemControl ( int iWindowId, int iControlId, GUIListItem item ) : void
iWindowId int The SenderId.
iControlId int The target control.
item GUIListItem The item that needs to be added to the ListControl
return void

AddSubItem() public method

Add an subitem to a control
public AddSubItem ( object obj ) : void
obj object subitem
return void

AllocResources() public method

Allocates the control its DirectX resources.
public AllocResources ( ) : void
return void

Animate() public method

Method to get animate the current control
public Animate ( float timePassed, MediaPortal.GUI.Library.Animator animator ) : void
timePassed float
animator MediaPortal.GUI.Library.Animator
return void

CanFocus() public method

Checks if the control can focus.
public CanFocus ( ) : bool
return bool

ClearControl() public static method

Sends a GUI_MSG_LABEL_RESET message to a control (Clears a control).
public static ClearControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

DeSelectControl() public static method

Sends a GUI_MSG_DESELECTED message to a control (Deselect a control).
public static DeSelectControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

DisableControl() public static method

Sends a GUI_MSG_DISABLED message to a control (Disables a control).
public static DisableControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

Dispose() public method

Frees the control its DirectX resources.
public Dispose ( ) : void
return void

DoRender() public method

public DoRender ( float timePassed, uint currentTime ) : void
timePassed float
currentTime uint
return void

DoUpdate() public method

public DoUpdate ( ) : void
return void

EnableControl() public static method

Sends a GUI_MSG_ENABLED message to a control (Enables a control).
public static EnableControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

FinalizeConstruction() public method

This function is called after all of the XmlSkinnable fields have been filled with appropriate data. Use this to do any construction work other than simple data member assignments, for example, initializing new reference types, extra calculations, etc..
public FinalizeConstruction ( ) : void
return void

FocusControl() public static method

Sends a GUI_MSG_SETFOCUS message to a control (Set the focus on a control).
public static FocusControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

FocusControl() public static method

public static FocusControl ( int iWindowId, int iControlId, Direction direction ) : void
iWindowId int
iControlId int
direction Direction
return void

FocusItemControl() public static method

Sends a GUI_MSG_ITEM_FOCUS message to a control (set item in control to selected state).
public static FocusItemControl ( int iWindowId, int iControlId, int iItem ) : void
iWindowId int The SenderId.
iControlId int The target control.
iItem int The id of the item that should have the selected state.
return void

GUIControl() public method

empty constructor
public GUIControl ( ) : System
return System

GUIControl() public method

The basic constructur of the GUIControl class.
public GUIControl ( int dwParentID ) : System
dwParentID int
return System

GUIControl() public method

The constructor of the GUIControl class.
public GUIControl ( int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight ) : System
dwParentID int The id of the parent control.
dwControlId int The id of this control.
dwPosX int The X position on the screen of this control.
dwPosY int The Y position on the screen of this control.
dwWidth int The width of this control.
dwHeight int The height of this control.
return System

GetAnimation() public method

public GetAnimation ( AnimationType type, bool checkConditions ) : VisualEffect
type AnimationType
checkConditions bool
return VisualEffect

GetAnimations() public method

public GetAnimations ( AnimationType type, bool checkConditions ) : List
type AnimationType
checkConditions bool
return List

GetCenter() public method

public GetCenter ( float &centerX, float &centerY ) : void
centerX float
centerY float
return void

GetControlById() public method

Property to get the control for a specific control ID
public GetControlById ( int ID ) : GUIControl
ID int Id of wanted control
return GUIControl

GetItemCount() public static method

Sends a GUI_MSG_ITEMS message to a control (Gets the number of Items in a control).
public static GetItemCount ( int lWindowId, int iControlId ) : int
lWindowId int
iControlId int The target control.
return int

GetListItem() public static method

Sends a GUI_MSG_GET_ITEM message to a control (Gets a GUIListItem based on the lWindowId, iControlId, iItem parameters).
public static GetListItem ( int lWindowId, int iControlId, int iItem ) : GUIListItem
lWindowId int
iControlId int The target control.
iItem int The item id of the item that needs to be returned.
return GUIListItem

GetRect() public method

Method to get the rectangle of the current control
public GetRect ( int &x, int &y, int &width, int &height ) : void
x int
y int
width int
height int
return void

GetSelectedListItem() public static method

Sends a GUI_MSG_GET_SELECTED_ITEM message to a control (Gets the selected GUIListItem based on the lWindowId, iControlId).
public static GetSelectedListItem ( int lWindowId, int iControlId ) : GUIListItem
lWindowId int
iControlId int The target control.
return GUIListItem

GetSubItem() public method

Property to get a subitem
public GetSubItem ( int index ) : object
index int index
return object

GetVisibleCondition() public method

public GetVisibleCondition ( ) : int
return int

HideControl() public static method

Sends a GUI_MSG_HIDDEN message to a control (Hide a control).
public static HideControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

HitTest() public method

Checks if the x and y coordinates correspond to the current control.
public HitTest ( int x, int y, int &controlID, bool &focused ) : bool
x int The x coordinate.
y int The y coordinate.
controlID int
focused bool
return bool

InControl() public method

Method which determines of the coordinate(x,y) is within the current control
public InControl ( int x, int y, int &controlID ) : bool
x int x coordinate
y int y coordiate
controlID int return id of control if coordinate is within control
return bool

IsEffectAnimating() public method

public IsEffectAnimating ( AnimationType animType ) : bool
animType AnimationType
return bool

LoadAnimationControl() public method

public LoadAnimationControl ( int parentID, int controlId, int posX, int posY, int width, int height, string texture ) : GUIAnimation
parentID int
controlId int
posX int
posY int
width int
height int
texture string
return GUIAnimation

LoadControl() public method

public LoadControl ( string xmlFilename ) : List
xmlFilename string
return List

NeedRefresh() public method

NeedRefresh() can be called to see if the control 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 control can respond to any action
public OnAction ( Action action ) : void
action Action action : contains the action
return void

OnDeInit() public method

Virtual method. This method gets called when the control is de-initialized and allows it to do any de-initalization
public OnDeInit ( ) : void
return void

OnFocus() protected method

protected OnFocus ( ) : void
return void

OnInit() public method

Virtual method. This method gets called when the control is initialized and allows it to do any initalization
public OnInit ( ) : 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 control can respond to the messages of its controls
public OnMessage ( GUIMessage message ) : bool
message GUIMessage message : contains the message
return bool

PreAllocResources() public method

Preallocates the control its DirectX resources.
public PreAllocResources ( ) : void
return void

QueueAnimation() public method

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

ReStorePosition() public method

Method to restore the saved-current control rectangle
public ReStorePosition ( ) : void
return void

RefreshControl() public static method

public static RefreshControl ( int iWindowId, int iControlId ) : void
iWindowId int
iControlId int
return void

RemoveSubItem() public method

Remove an subitem from an control
public RemoveSubItem ( int index ) : void
index int
return void

RemoveSubItem() public method

Remove an subitem from an control
public RemoveSubItem ( object obj ) : void
obj object subitem
return void

Render() public method

The default render method. This needs to be overwritten when inherited to give every control its specific look and feel.
public Render ( float timePassed ) : void
timePassed float
return void

ResetAnimations() public method

public ResetAnimations ( ) : void
return void

ScaleToScreenResolution() public method

Does any scaling on the inital size\position values to fit them to screen resolution.
public ScaleToScreenResolution ( ) : void
return void

SelectControl() public static method

Sends a GUI_MSG_SELECTED message to a control (Select a control).
public static SelectControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

SelectItemControl() public static method

Sends a GUI_MSG_ITEM_SELECT message to a control (Select an item in a control).
public static SelectItemControl ( int iWindowId, int iControlId, int iItem ) : void
iWindowId int The SenderId.
iControlId int The target control.
iItem int The id of the item that is selected on the control.
return void

SetAlpha() public method

Changes the alpha transparency component of the colordiffuse.
public SetAlpha ( int dwAlpha ) : void
dwAlpha int
return void

SetAnimations() public method

public SetAnimations ( List animations ) : void
animations List
return void

SetControlLabel() public static method

Sends a GUI_MSG_LABEL_SET message to a control (Set the label of a control).
public static SetControlLabel ( int iWindowId, int iControlId, string strText ) : void
iWindowId int The SenderId.
iControlId int The target control.
strText string The text that needs to be set on the target label.
return void

SetInitialVisibility() public method

public SetInitialVisibility ( ) : void
return void

SetNavigation() public method

Set the up/down/left/right control
public SetNavigation ( int dwUp, int dwDown, int dwLeft, int dwRight ) : void
dwUp int The control above this control.
dwDown int The control under this control.
dwLeft int The control left to this control.
dwRight int The control right to this control.
return void

SetPosition() public method

Sets the position of the control.
public SetPosition ( int dwPosX, int dwPosY ) : void
dwPosX int The X position.
dwPosY int The Y position.
return void

SetSubItem() public method

Property to set an subitem
public SetSubItem ( int index, object o ) : void
index int index
o object subitem
return void

SetThumbAnimations() public method

public SetThumbAnimations ( List animations ) : void
animations List
return void

SetVisibleCondition() public method

public SetVisibleCondition ( int visible, bool allowHiddenFocus ) : void
visible int
allowHiddenFocus bool
return void

ShowControl() public static method

Sends a GUI_MSG_VISIBLE message to a control (Make a control visible).
public static ShowControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

StorePosition() public method

Method to store(save) the current control rectangle
public StorePosition ( ) : void
return void

UnfocusControl() public static method

Sends a GUI_MSG_LOSTFOCUS message to a control (Set the focus on a control).
public static UnfocusControl ( int iWindowId, int iControlId ) : void
iWindowId int The SenderId.
iControlId int The target control.
return void

Update() protected method

Perform an update after a change has occured. E.g. change to a new position.
protected Update ( ) : void
return void

UpdateVisibility() public method

public UpdateVisibility ( ) : void
return void

getTransformMatrix() public method

public getTransformMatrix ( uint currentTime ) : TransformMatrix
currentTime uint
return TransformMatrix

Property Details

_calibration protected_oe property

protected bool _calibration
return bool

_data protected_oe property

protected object _data
return object

_isAnimating protected_oe property

protected bool _isAnimating
return bool

_isDimmed protected_oe property

protected bool _isDimmed
return bool

_isSelected protected_oe property

protected bool _isSelected
return bool

_originalDiffuseColor protected_oe property

protected long _originalDiffuseColor
return long

_originalRectangle protected_oe property

protected Rectangle _originalRectangle
return Rectangle

_parentControl protected_oe property

protected GUIControl _parentControl
return GUIControl

_parentControlId protected_oe property

protected int _parentControlId
return int

_selectedItem protected_oe property

protected int _selectedItem
return int

_subItemList protected_oe property

protected ArrayList _subItemList
return ArrayList

_windowId protected_oe property

protected int _windowId
return int