Ejemplo n.º 1
0
        public static HorizontalStack GetToolbarLayout()
        {
            HorizontalStack layout = new HorizontalStack();

            layout.SetContentAlignment(ItemAlignment.HCenter);
            layout.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Left);
            layout.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            layout.SetHeight(30);
            layout.SetSpacing(5, 0);
            layout.SetMargin(20, 0, 20, 20);
            return(layout);
        }
Ejemplo n.º 2
0
        public override void InitElements()
        {
            //top
            _topLayout.SetHeightPolicy(SizePolicy.Fixed);
            _topLayout.SetHeight(30);
            _topLayout.SetSpacing(5, 0);
            _topLayout.SetBackground(Color.FromArgb(20, 255, 255, 255));

            _expand.SetSize(20, 30);
            _expand.SetBackground(25, 25, 25);
            _expand.GetState(ItemStateType.Toggled).Background = Color.FromArgb(25, 25, 25);
            _expand.SetPadding(4, 9, 4, 9);
            _arrow.SetRotationAngle(180);
            _arrow.SetColorOverlay(Color.FromArgb(210, 210, 210));
            _arrow.KeepAspectRatio(true);

            Name.SetHeightPolicy(SizePolicy.Fixed);
            Name.SetHeight(30);
            Name.SetMargin(5, 0, 0, 0);
            Name.SetFontSize(16);
            Name.SetFontStyle(FontStyle.Bold);

            _remove.SetSize(12, 12);
            _remove.SetCustomFigure(new Figure(false, GraphicsMathService.GetCross(12, 12, 3, 45)));
            _remove.SetBackground(100, 100, 100);
            _remove.SetAlignment(ItemAlignment.VCenter, ItemAlignment.Left);
            _remove.SetMargin(0, 0, 5, 0);

            //bottom
            _bottomLayout.SetHeightPolicy(SizePolicy.Fixed);
            _bottomLayout.SetHeight(30);
            _bottomLayout.SetSpacing(5, 0);
            _bottomLayout.SetAlignment(ItemAlignment.Left, ItemAlignment.Bottom);

            _pathLabel.SetWidthPolicy(SizePolicy.Fixed);
            _pathLabel.SetWidth(_pathLabel.GetTextWidth() + 5);
            // _pathLabel.SetMargin(5, 0, 0, 0);
            _pathLabel.SetFontSize(14);

            _pathBrowse.SetSize(30, 30);
            _pathBrowse.SetBackground(255, 255, 255, 20);
            _pathBrowse.SetPadding(7, 7, 7, 7);
            _pathBrowse.GetState(ItemStateType.Hovered).Background = Color.FromArgb(150, 255, 255, 255);

            AddItems(
                _topLayout,
                _bottomLayout
                );

            _topLayout.AddItems(
                _expand,
                Name,
                _remove
                );

            _bottomLayout.AddItems(
                _pathLabel,
                _pathEdit,
                _pathBrowse
                );

            _expand.AddItem(_arrow);
            _pathBrowse.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Pencil, EmbeddedImageSize.Size32x32), false));

            //events
            _expand.EventToggle += (sender, args) =>
            {
                _bottomLayout.SetVisible(!_bottomLayout.IsVisible());
                if (_bottomLayout.IsVisible())
                {
                    SetHeight(70);
                    _arrow.SetRotationAngle(90);
                }
                else
                {
                    SetHeight(30);
                    _arrow.SetRotationAngle(180);
                }
            };

            Name.EventMouseDoubleClick += (sender, args) =>
            {
                OnDoubleClick.Invoke(this);
            };

            _remove.EventMouseClick += (sender, args) =>
            {
                Remove();
            };
        }
Ejemplo n.º 3
0
        public override void InitElements()
        {
            base.InitElements();
            Color   gray   = Color.FromArgb(150, 150, 150);
            Indents margin = new Indents();
            int     width  = 120;

            _win.SetWidth(width);
            _win.SetMargin(margin);
            _win.SetBackground(gray);

            _lMouse.SetWidth(width);
            _lMouse.SetMargin(margin);
            _lMouse.SetBackground(gray);

            _rMouse.SetWidth(width);
            _rMouse.SetMargin(margin);
            _rMouse.SetBackground(gray);

            _mMouse.SetWidth(width);
            _mMouse.SetMargin(margin);
            _mMouse.SetBackground(gray);

            _apply.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
            _apply.SetMargin(0, 0, 20, 20);

            _deleteLast.IsFocusable = false;
            _win.IsFocusable        = false;
            _lMouse.IsFocusable     = false;
            _rMouse.IsFocusable     = false;
            _mMouse.IsFocusable     = false;

            HorizontalStack textFieldlayout = Factory.Items.GetFixedHorizontalStack(30);

            textFieldlayout.SetMargin(100, 100, 100, 0);

            HorizontalStack toolbarlayout = Factory.Items.GetFixedHorizontalStack(30);

            toolbarlayout.SetMargin(40, 0, 40, 100);
            toolbarlayout.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Left);
            toolbarlayout.SetSpacing(6, 0);

            Frame header = new Frame();

            header.SetHeightPolicy(SizePolicy.Fixed);
            header.SetHeight(40);
            header.SetBackground(Factory.Palette.ExclusiveDark);

            Window.SetMinSize(600, 300);
            Window.AddItems(header, _close, textFieldlayout, toolbarlayout, _apply);

            textFieldlayout.AddItems(_bind, _deleteLast);

            toolbarlayout.AddItems(_win, _lMouse, _rMouse, _mMouse);

            _deleteLast.EventMouseClick += (sender, args) =>
            {
                if (_keySequence.Count > 0)
                {
                    _keySequence.RemoveAt(_keySequence.Count - 1);
                    SetShortcutSequence();
                }
            };

            _win.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.LeftSuper);
            };
            _lMouse.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.MouseLeft);
            };
            _rMouse.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.MouseRight);
            };
            _mMouse.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.MouseMiddle);
            };

            _bind.SetEditable(false);
            _bind.EventKeyPress += (sender, args) =>
            {
                OnKeyDown((HardwareButtons)args.Key);
            };

            _close.EventMouseClick += (sender, args) =>
            {
                Close();
            };

            _apply.EventMouseClick += (sender, args) =>
            {
                Result = _bind.GetText();
                Close();
            };
        }