Exemple #1
0
        public static SWinKeyInfo[] GetWinKeyInfos(IKey inWinKeyParent, CWindowTypeDescrs inWindowTypeDescrs, ILogPrinter inLogger)
        {
            int count = inWinKeyParent.GetChildCount();
            List <SWinKeyInfo> res = new List <SWinKeyInfo>(count);

            for (int i = 0; i < count; i++)
            {
                IKey window_key = inWinKeyParent.GetChild(i);

                var info = new SWinKeyInfo();

                info.WinKey = window_key;

                info.Name = Utils.GetWindowNameFromKey(window_key, i.ToString(), inLogger);

                string[] a = Utils.TryGetParamsByNameFromSubKey("Type", window_key, inLogger, true, 1);
                if (a.Length > 0)
                {
                    string stype = a[0];

                    NamedId?id = inWindowTypeDescrs.GetWinType(stype);

                    if (id.HasValue)
                    {
                        info.WinType = id.Value;
                        res.Add(info);
                    }
                    else
                    {
                        inLogger.LogError(string.Format("Undefined type. Key [{0}]!", window_key.GetPath()));
                    }
                }
            }
            return(res.ToArray());
        }
Exemple #2
0
        public CBaseWindow(CBaseWindow inParent, string inName, NamedId inWindowType, Rect inBaseRect, IGUIRealization inGUIRealization, CWindowTypeDescrs window_type_descrs)
        {
            Id = ++_id_counter;

            WindowType = inWindowType;

            _window_type_descrs = window_type_descrs;

            SetParent(inParent);

            _params.Add(SWindowParamDescr.Name.Id, new CStringParam(inName));
            _params.Add(SWindowParamDescr.Indent.Id, new CPVectorParam(new PVector2(inBaseRect.left, inBaseRect.top)));
            _params.Add(SWindowParamDescr.Shift.Id, new CPVectorParam(new PVector2()));
            _params.Add(SWindowParamDescr.Size.Id, new CPVectorParam(new PVector2(inBaseRect.Width, inBaseRect.Hight)));

            _gui_realization = inGUIRealization;
            _gui_realization.OnCreateWindow(this);
        }