Пример #1
0
        // ReSharper restore MemberCanBePrivate.Global

        #endregion

        public HSliderTrackSkin()
        {
            States = new List<State>(new[]
            {
                new State("up"),
                new State("over"),
                new State("down"),
                new State("disabled")
                {
                    Overrides = new List<IOverride>
                    {
                        new SetProperty("_backgroundImage", "Alpha", 0.5f),
                    }
                },
                new State("upAndSelected"),
                new State("overAndSelected"),
                new State("downAndSelected"),
                new State("disabledAndSelected")
                {
                    Overrides = new List<IOverride>
                    {
                        new SetProperty("_backgroundImage", "Alpha", 1f),
                    }
                }
            });
        }
 /**
  *  Create an instance of a dynamic skin part. 
  *  Dynamic skin parts should always be instantiated by this method, 
  *  rather than directly by calling the <code>newInstance()</code> method on the factory.
  *  This method creates the part, but does not add it to the display list.
  *  The component must call the <code>Group.addElement()</code> method, or the appropriate 
  *  method to add the skin part to the display list. 
  *
  *  Param: partName The name of the part.
  */
 /// <summary>
 /// 
 /// </summary>
 /// <param name="partName"></param>
 /// <returns></returns>
 protected object CreateDynamicPartInstance(string partName)
 {
     IFactory factory = (IFactory) CoreReflector.GetValue(Skin, partName);
     
     if (null != factory)
     {
         DisplayObject instance = (DisplayObject)factory.NewInstance();
     
         // Add to the dynamic parts cache
         if (null == _dynamicPartsCache)
             _dynamicPartsCache = new Dictionary<string, List<object>>();
         
         if (!_dynamicPartsCache.ContainsKey(partName))
             _dynamicPartsCache[partName] = new List<object>();
     
         _dynamicPartsCache[partName].Add(instance);
     
         // Send notification
         PartAdded(partName, instance);
     
         return instance;
     }
 
     return null;
 }
Пример #3
0
 public WindowSkin3()
 {
     States = new List<State>(new[]
     {
         new State("normal"),
         new State("disabled")
     });
 }
Пример #4
0
 public AlertSkin()
 {
     States = new List<State>(new[]
     {
         new State("normal"),
         new State("disabled")
     });
 }
Пример #5
0
 public ButtonBarSkin2()
 {
     States = new List<State>
     {
         new State("normal"),
         new State("disabled")
     };
 }
Пример #6
0
 public ModalOverlaySkin2()
 {
     States = new List<State>(new[]
     {
         new State("normal"),
         new State("disabled")
     });
 }
Пример #7
0
 public ToolbarSkin()
 {
     States = new List<State>
     {
         new State("normal"),
         new State("disabled")
     };
 }
Пример #8
0
 /// <summary>
 /// Prints out the component list
 /// </summary>
 /// <param name="collection"></param>
 public static string DescribeComponentList(List<Component> collection)
 {
     StringBuilder sb = new StringBuilder();
     foreach (Component child in collection)
     {
         sb.AppendLine(string.Format("    -> {0}", child));
     }
     return sb.ToString();
 }
Пример #9
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            Button button;

            for (int i = 0; i < 14; i++)
            {
                button = new Button
                             {
                                 Text = "Button " + (i + 1),
                                 SkinClass = typeof(ImageButtonSkin),
                                 FocusEnabled = false,
                                 Icon = ImageLoader.Instance.Load("Icons/shape_square_add"),
                                 Width = 400,
                                 Height = 200
                             };
                AddContentChild(button);
            }

            /*List<string> icons = new List<string> { "maximize", "cancel" };
            for (int i = 0; i < icons.Count; i++)
            {
                button = new Button
                             {
                                 FocusEnabled = false,
                                 SkinClass = typeof(ImageButtonSkin),
                                 Icon = ImageLoader.Instance.Load("Icons/" + icons[i])
                             };
                button.Click += delegate(Event e) { Debug.Log("Clicked: " + e.Target); };
                ToolGroup.AddChild(button);
            }*/

            button = new Button
            {
                Text = "Toggle",
                SkinClass = typeof(ImageButtonSkin),
                Icon = ImageLoader.Instance.Load("Icons/color_swatch"),
                ToggleMode = true,
                FocusEnabled = false,
                Selected = true
            };
            ControlBarGroup.AddChild(button);

            List<string> icons = new List<string> { "lock", "star", "accept" };
            for (int i = 0; i < 3; i++)
            {
                button = new Button
                             {
                                 Text = UppercaseFirst(icons[i]),
                                 SkinClass = typeof(ImageButtonSkin),
                                 FocusEnabled = false,
                                 Icon = ImageLoader.Instance.Load("Icons/" + icons[i])
                             };
                ControlBarGroup.AddChild(button);
            }
        }
Пример #10
0
 public VScrollBarTrackSkin()
 {
     States = new List<State>(new[]
     {
         new State("up"), 
         new State("over"),
         new State("down"),
         new State("disabled")
     });
 }
Пример #11
0
 public HScrollBarButtonSkin()
 {
     States = new List<State>
     {
         new State("up", new StateTable()), 
         new State("over", new StateTable()), 
         new State("down", new StateTable()), 
         new State("selected", new StateTable())
     };
 }
Пример #12
0
 public HScrollBarTrackSkin()
 {
     States = new List<State>(new[]
     {
         new State("normal"),
         new State("up"), 
         new State("over"),
         new State("down")
     });
 }
Пример #13
0
        public static List<PropertyInfo> GetPropertiesByType(Type type, Type propertyType)
        {
            var allProperties = new List<PropertyInfo>(type.GetProperties());

            //Debug.Log(string.Format("GetPropertiesByType [{0}, {1}]", type, propertyType));
            return allProperties.FindAll(delegate(PropertyInfo propertyInfo)
                                             {
                                                 //Debug.Log(string.Format("   [{0}, {1}]", propertyInfo.PropertyType, propertyType));
                                                 return propertyInfo.PropertyType == propertyType;
                                             });
        }
Пример #14
0
// ReSharper restore UnassignedField.Global
#endif

        ///<summary>
        ///</summary>
        ///<param name="adapterList"></param>
        ///<returns></returns>
        public static bool ListContainsNullReference(List<ComponentAdapter> adapterList)
        {
            int count = adapterList.Count;

            for (int i = 0; i < count; i++)
            {
                if (adapterList[i] == null) 
                    return true;
            }
            return false;
        }
Пример #15
0
        /// <summary>
        /// Pushes the child to back in a depth list
        /// </summary>
        /// <param name="depthList"></param>
        /// <param name="child"></param>
        public static void PushToBack(List<DisplayListMember> depthList, DisplayListMember child)
        {
            var min = GetMinDepth(depthList);
            //Debug.Log("min: " + min);

            if (child.Depth < min)
                return;

            if (child.Depth == min && IsOnlyChildWithDepth(depthList, child, min))
                return;

            SetDepth(depthList, child, GetMinDepth(depthList) - 1, true);
        }
Пример #16
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ModalOverlaySkin()
 {
     States = new List<State>(new[]
     {
         new State("up"), 
         new State("over"),
         new State("down"),
         new State("disabled"),
         new State("upAndSelected"), 
         new State("overAndSelected"),
         new State("downAndSelected"),
         new State("disabledAndSelected")
     });
 }
 public NumericStepperDecrementButtonSkin()
 {
     States = new List<State>(new[]
     {
         new State("up"), 
         new State("over"),
         new State("down"),
         new State("disabled"),
         new State("upAndSelected"), 
         new State("overAndSelected"),
         new State("downAndSelected"),
         new State("disabledAndSelected")
     });
 }
Пример #18
0
 /// <summary>
 /// Prints out the component list
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="showInstanceIds"></param>
 public static string DescribeAdapterList(List<ComponentAdapter> collection, bool showInstanceIds)
 {
     StringBuilder sb = new StringBuilder();
     foreach (ComponentAdapter adapter in collection)
     {
         string id = string.Empty;
         if (null != adapter && showInstanceIds)
         {
             id = string.Format(" [{0}]", adapter.GetInstanceID());
         }
         sb.AppendLine(string.Format("    -> {0}{1}", null == adapter ? "-" : adapter.ToString(), id));
     }
     return sb.ToString();
 }
Пример #19
0
 public PanelSkin2()
 {
     States = new List<State>(new[]
     {
         new State("normal"),
         new State("disabled")
         {
             Overrides = new List<IOverride>
             {
                 new SetProperty(this, "BackgroundColor", Color.gray)
             }
         }
     });
 }
Пример #20
0
 /// <summary>
 /// Constructor
 /// </summary>
 public LoadingMaskSkin()
 {
     States = new List<State>
     {
         new State("up"), 
         new State("over"),
         new State("down"),
         new State("disabled"),
         new State("upAndSelected"), 
         new State("overAndSelected"), 
         new State("downAndSelected"),
         new State("disabledAndSelected")
     };
 }
Пример #21
0
 public VSliderTrackSkin()
 {
     States = new List<State>(new[]
     {
         new State("up"), 
         new State("over"),
         new State("down"),
         new State("disabled"),
         new State("upAndSelected"), 
         new State("overAndSelected"),
         new State("downAndSelected"),
         new State("disabledAndSelected")
     });
 }
Пример #22
0
        public DropDownListButtonSkin()
        {
            MinHeight = 25;

            States = new List<State>(new[]
            {
                new State("up"), 
                new State("over"),
                new State("down"),
                new State("disabled"),
                new State("upAndSelected"), 
                new State("overAndSelected"),
                new State("downAndSelected"),
                new State("disabledAndSelected")
            });
        }
Пример #23
0
        public void Move()
        {

#if DEBUG
            if (DebugMode)
            {
                Debug.Log(string.Format(@"Moving: {0}
", DescribeMoves()));
            }
#endif

            // TODO: CreatingContentPane pane has already been set from the outside (the caller of this method)
            // that is because this flag has to be set not only for mover operations, but also for "manual" aditions
            // so we must rethink if this is to be used also here (it's redundant)

            List<DisplayListMember> childrenToTransfer = new List<DisplayListMember>();

            for (int i = 0; i < _numberOfChildrenToMove; i++)
            {
                childrenToTransfer.Add(_docFrom.QChildren[i]);
            }

            foreach (DisplayListMember child in childrenToTransfer)
            {
                /**
                 * Note: we have to use container's AddChild/RemoveChild stuff, because else the control won't initialize properly and its Visible will be false! // 20130507
                 * */
                if (null != _docFrom)
                    _docFrom.RemoveChild(child);

                if (null != _docTo)
                    _docTo.AddChild(child);
            }

#if DEBUG
            if (DebugMode)
            {
                Debug.Log(string.Format(@"Moved: {0}
", DescribeMoves()));
            }
#endif

            if (null != _docFrom)
                _docFrom.InvalidateDrawingList();
            if (null != _docTo)
                _docTo.InvalidateDrawingList();
        }
Пример #24
0
        public ButtonSkin5()
        {
            MouseEnabled = false;
            MouseChildren = false;

            States = new List<State>(new[]
            {
                new State("up"),
                new State("over"),
                new State("down"),
                new State("disabled"),
                new State("upAndSelected"),
                new State("overAndSelected"),
                new State("downAndSelected"),
                new State("disabledAndSelected")
            });
        }
Пример #25
0
        public PanelSkin4()
        {
            States = new List<State>(new[]
            {
                new State("normal"),
                new State("disabled")
                {
                    Overrides = new List<IOverride>
                    {
                        new global::eDriven.Gui.States.SetProperty(this, "BackgroundColor", Color.gray)
                    }
                }
            });

            AddEventListener(MouseEvent.ROLL_OVER, RollOverHandler, EventPhase.Capture | EventPhase.Target);
            AddEventListener(MouseEvent.ROLL_OUT, RollOutHandler, EventPhase.Capture | EventPhase.Target);
        }
Пример #26
0
        /// <summary>
        /// Brings the child to front in a depth list
        /// </summary>
        /// <param name="depthList"></param>
        /// <param name="child"></param>
        public static void BringToFront(List<DisplayListMember> depthList, DisplayListMember child)
        {
            //Debug.Log("BringToFront");

            var max = GetMaxDepth(depthList);
            //Debug.Log(string.Format(@"depthList.Count: {0}; max: {1}; child.Depth: {2}; child: {3}", depthList.Count, max, child.Depth, child));

            if (child.Depth > max)
                return;

            //Debug.Log(1);

            if (child.Depth == max && IsOnlyChildWithDepth(depthList, child, max))
                return;

            //Debug.Log(2);

            SetDepth(depthList, child, GetMaxDepth(depthList) + 1, true);
        }
Пример #27
0
        /// <summary>
        /// Gets all skin classes
        /// </summary>
        public static List<Type> GetAllStyleableClasses()
        {
            List<Type> allTypes = TypeReflector.GetAllLoadedTypes();
            List<Type> output = new List<Type>();

            foreach (Type type in allTypes)
            {
                if (type.IsClass)
                {
                    if (/*!GuiComponentsOnly || */StyleClientType.IsAssignableFrom(type))
                    {
                        if (CoreReflector.HasClassAttributes<StyleAttribute>(type))
                            output.Add(type);
                    }
                }
            }

            return output;
        }
Пример #28
0
        /// <summary>
        /// Gets a parent chain
        /// Example: If out component is in a chain Stage-A-B-C-Component, this method returns the list of: Stage, A, B, C.
        /// </summary>
        /// <param name="component">Compo</param>
        /// <param name="reverse">Reverse the chain</param>
        /// <returns></returns>
        public static List<DisplayListMember> GetParentChain(DisplayListMember component, bool reverse)
        {
            if (null == component)
                throw new Exception("Component not defined");

            List<DisplayListMember> list = new List<DisplayListMember>();
            DisplayListMember current = component;

            //list.Add(current); // removed on 2011-09-18

            while (!(current is Stage) && null != current.Parent)
            {
                current = current.Parent;
                list.Add(current);
            }

            if (reverse)
                list.Reverse();

            return list;
        }
Пример #29
0
 public DropDownListSkin()
 {
     States = new List<State>(new[]
     {
         new State("normal")
         {
             Overrides = new List<IOverride>
             {
                 new SetProperty("_anchor", "DisplayPopup", false)
             }
         }, 
         new State("open")
         {
             Overrides = new List<IOverride>
             {
                 new SetProperty("_anchor", "DisplayPopup", true)
             }
         }, 
         new State("disabled")
     });
 }
Пример #30
0
        public override void Apply(Component component)
        {
            DataGroup dataProviderClient = component as DataGroup;
            SkinnableDataContainer skinnableDataContainer = component as SkinnableDataContainer;
            if (null == dataProviderClient && null == skinnableDataContainer)
            {
                Debug.LogWarning("GUI component is not a DataGroup nor SkinnableDataContainer");
                return;
            }

            List<object> list = new List<object>();
            foreach (string s in Data)
            {
                list.Add(new ListItem(s, s));
            }

            if (null != dataProviderClient)
                dataProviderClient.DataProvider = new ArrayList(list);
            else
                skinnableDataContainer.DataProvider = new ArrayList(list);
        }