Exemple #1
0
        public int NextX(Component c)
        {
            int result = 0;

            switch (ManagerMode)
            {
                case Mode.HORIZONTAL:
                    {
                        if (!first)
                            StateX += SpacingX;
                        first = false;

                        result = StateX;
                        StateX += c.Rect.Width;
                        break;
                    }
                case Mode.VERTICAL:
                    {
                        result = StateX;
                        break;
                    }
            }

            return result;
        }
Exemple #2
0
        public int NextX(Component c)
        {
            int result = 0;

            if (NX != 0)
            {
                newrow = false;
                result = StateX;
                if (StateNX < NX)
                {
                    _stateX += c.Rect.Width + SpacingX;
                    StateNX++;
                }
                else
                {
                    StateNX = 1;
                    _stateX = initialStateX;
                    newrow = true;
                }
            }

            return result;
        }
Exemple #3
0
        public int NextY(Component c)
        {
            int result = 0;

            if (NY != 0)
            {
                result = StateY;
                if (newrow)
                {
                    _stateY += c.Rect.Height + SpacingY;
                    StateNY++;
                }
            }

            return result;
        }
Exemple #4
0
        public int NextY(Component c)
        {
            int result = 0;

            switch (ManagerMode)
            {
                case Mode.HORIZONTAL:
                    {
                        result = StateY;
                        break;
                    }
                case Mode.VERTICAL:
                    {
                        if (!first)
                            StateY += SpacingY;
                        first = false;

                        result = StateY;
                        StateY += c.Rect.Height;
                        break;
                    }
            }

            return result;
        }
Exemple #5
0
        public void Add(Component component)
        {
            if (LayoutManager == null)
                component.Rect = new Rectangle(component.Rect.X + Rect.X + MarginX, component.Rect.Y + Rect.Y + MarginY, component.Rect.Width, component.Rect.Height);
            else
                component.Rect = new Rectangle(LayoutManager.NextX(component) + MarginX, LayoutManager.NextY(component) + MarginY, component.Rect.Width, component.Rect.Height);
            components.Add(component);

            IFocusable fc = component as IFocusable;
            if (fc != null)
            {
                if (fc.TabIndex == -1)
                    fc.TabIndex = focusList.Count;
                focusList.Add(fc);
                if (fc == focusList[0])
                    fc.HasFocus = true;
            }
        }