Permalink
Browse files

Initial implementation for GUIControl enabled attribute.

  • Loading branch information...
1 parent 6e94ca7 commit 08030263a4ab9706183c11159d64d3f04b19af50 @ajp8164 ajp8164 committed Jan 7, 2012
Showing with 17 additions and 0 deletions.
  1. +16 −0 mediaportal/Core/guilib/GUIControl.cs
  2. +1 −0 mediaportal/Core/guilib/GUIWindow.cs
@@ -114,6 +114,7 @@ public abstract class GUIControl : GUIBaseControl, IDisposable // Control, IDisp
[XMLSkinElement("dimColor")] protected int _dimColor = 0x60ffffff;
[XMLSkinElement("layoutDetail")] protected ILayoutDetail _layoutDetail;
[XMLSkinElement("onfocus")] protected string _onfocus = "";
+ [XMLSkinElement("enabled")] protected string _enabledFromSkinExpression = "";
protected int _parentControlId = 0;
protected bool _isSelected = false;
@@ -2024,6 +2025,21 @@ public virtual void SetVisibleCondition(int visible, bool allowHiddenFocus)
_allowHiddenFocus = allowHiddenFocus;
}
+ public void UpdateEnableState()
+ {
+ if (_enabledFromSkinExpression.Length != 0)
+ {
+ try
+ {
+ IsEnabled = bool.Parse(GUIPropertyManager.Parse(_enabledFromSkinExpression, GUIExpressionManager.ExpressionOptions.EVALUATE_ALWAYS));
+ }
+ catch (System.Exception)
+ {
+ Log.Debug("GUIControl: id={0} <enabled> expression does not return a boolean value", GetID);
+ }
+ }
+ }
+
protected virtual void OnFocus() {}
public Point Camera
@@ -1364,6 +1364,7 @@ public virtual void Render(float timePassed)
foreach (GUIControl control in Children)
{
control.UpdateVisibility();
+ control.UpdateEnableState();
control.DoRender(timePassed, currentTime);
}

0 comments on commit 0803026

Please sign in to comment.