예제 #1
0
        public override void InitElements()
        {
            //Name
            MemberName.SetStyle(Styles.GetLabelStyle());
            MemberName.SetFontStyle(FontStyle.Regular);

            //Value
            MemberValue.SetStyle(Styles.GetLabelStyle());
            MemberValue.SetFontStyle(FontStyle.Regular);
            MemberValue.SetText("0%");
            MemberValue.SetWidth(45);
            MemberValue.SetWidthPolicy(SizePolicy.Fixed);
            MemberValue.SetTextAlignment(ItemAlignment.VCenter | ItemAlignment.Right);
            MemberValue.SetMargin(0, 0, 10, 0);

            //Button
            MemberRemove.SetBackground(255, 181, 111);
            MemberRemove.SetSize(14, 14);
            MemberRemove.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            MemberRemove.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            MemberRemove.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(125, 255, 255, 255)));
            MemberRemove.SetCustomFigure(new CustomFigure(false, GraphicsMathService.GetCross(14, 14, 5, 45)));
            MemberRemove.EventMouseClick += (sender, args) => DisposeSelf();

            //Adding
            AddItem(Layout);

            Layout.AddItems(
                MemberName,
                MemberValue,
                MemberRemove
                );
        }
예제 #2
0
        public override void InitElements()
        {
            base.InitElements();
            SetBackground(0, 0, 0, 200);

            Window.IsWResizable = false;
            Window.IsHResizable = false;
            Window.IsXFloating  = false;
            Window.IsYFloating  = false;

            _image.KeepAspectRatio(true);

            _close.SetSize(30, 30);
            _close.SetCustomFigure(new CustomFigure(false, GraphicsMathService.GetCross(30, 30, 3, 45)));
            _close.SetBackground(100, 100, 100);
            _close.SetAlignment(ItemAlignment.Top, ItemAlignment.Right);
            _close.SetMargin(0, 10, 10, 0);

            Window.SetSizePolicy(SizePolicy.Expand, SizePolicy.Expand);
            Window.SetMargin(20, 20, 20, 20);
            Window.SetBackground(Color.Transparent);
            AddItems(_close);

            Window.AddItem(_image);

            _close.EventMouseClick += (sender, args) =>
            {
                Close();
            };
        }
예제 #3
0
        public override void InitElements()
        {
            border  = new Ellipse();
            contact = new Label();
            close   = new ButtonCore();
            signal  = new BlankItem();

            InitContactMenu(GetHandler());

            //contact image border
            border.SetBackground(250, 166, 26);
            border.SetSize(30, 30);
            border.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            border.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Left);

            //contact name
            contact.SetText(name);
            contact.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 14, FontStyle.Bold));
            contact.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            contact.SetTextAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            contact.SetForeground(101, 102, 106);
            contact.SetSizePolicy(SizePolicy.Expand, SizePolicy.Expand);
            contact.SetMargin(40, 0, 0, 0);

            //contact close
            close.SetVisible(false);
            close.SetBackground(91, 94, 99);
            close.SetSize(10, 10);
            close.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            close.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Right);
            close.SetMargin(0, 0, 12, 0);
            close.SetCustomFigure(new Figure(false, GraphicsMathService.GetCross(10, 10, 1, 45)));
            close.AddItemState(ItemStateType.Hovered, new ItemState()
            {
                Background = Color.FromArgb(255, 255, 255, 255)
            });
            close.EventMouseClick += (sender, args) => DisposeSelf();

            signal.SetBackground(67, 181, 129);
            signal.SetSize(14, 14);
            signal.SetBorderFill(Color.FromArgb(255, 66, 70, 77));
            signal.SetBorderThickness(2);
            signal.SetBorderRadius(7);
            signal.SetAlignment(ItemAlignment.Left | ItemAlignment.Bottom);
            signal.SetMargin(18, 0, 0, 3);

            //adding
            AddItems(border, signal, contact, close);
            // IsFocusable = true;
        }
예제 #4
0
파일: Styles.cs 프로젝트: spvessel/spacevil
        public static Style GetManualKeyBinderStyle()
        {
            Style style = new Style();

            style.SetAlignment(ItemAlignment.HCenter, ItemAlignment.VCenter);
            style.SetSizePolicy(SizePolicy.Expand, SizePolicy.Expand);
            style.SetBackground(0, 0, 0, 150);
            style.BorderRadius = new CornerRadius();
            style.Padding      = new Indents();
            style.Margin       = new Indents();
            style.Spacing      = new Spacing();

            Style windowStyle = Style.GetFrameStyle();

            windowStyle.SetAlignment(ItemAlignment.HCenter, ItemAlignment.VCenter);
            windowStyle.SetPadding(0, 0, 0, 0);
            windowStyle.SetMargin(100, 150, 100, 150);
            windowStyle.SetBackground(45, 45, 45);
            windowStyle.SetShadow(new Shadow(10, 0, 0, Color.Black));
            windowStyle.IsShadowDrop = true;
            style.AddInnerStyle("window", windowStyle);

            Style closeStyle = new Style();

            closeStyle.Background = Color.FromArgb(255, 100, 100, 100);
            closeStyle.SetSize(20, 20);
            closeStyle.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            closeStyle.Alignment = ItemAlignment.Top | ItemAlignment.Right;
            closeStyle.SetMargin(0, 10, 10, 0);
            closeStyle.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(186, 95, 97)));
            closeStyle.Shape        = GraphicsMathService.GetCross(20, 20, 3, 45);
            closeStyle.IsFixedShape = true;
            style.AddInnerStyle("closebutton", closeStyle);

            return(style);
        }
예제 #5
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();
            };
        }
예제 #6
0
        internal static Style GetTitleBarStyle()
        {
            Style style = new Style();

            style.Font          = new Font(DefaultsService.GetDefaultFont().FontFamily, 14, FontStyle.Bold);
            style.Background    = Color.FromArgb(255, 32, 34, 37);
            style.Foreground    = Color.FromArgb(255, 166, 167, 168);
            style.Height        = 22;
            style.WidthPolicy   = SizePolicy.Expand;
            style.HeightPolicy  = SizePolicy.Fixed;
            style.Alignment     = ItemAlignment.Left | ItemAlignment.Top;
            style.TextAlignment = ItemAlignment.Left | ItemAlignment.VCenter;
            style.Padding       = new Indents(5, 4, 10, 0);
            style.Spacing       = new Spacing(10);

            Style close_style = new Style();

            close_style.Background = Color.FromArgb(255, 166, 167, 168);
            close_style.SetSize(10, 10);
            close_style.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            close_style.Alignment = ItemAlignment.VCenter | ItemAlignment.Right;
            close_style.AddItemState(ItemStateType.Hovered, new ItemState()
            {
                Background = Color.FromArgb(255, 186, 95, 97)
            });
            close_style.Shape = GraphicsMathService.GetCross(15, 15, 1, 45);
            style.AddInnerStyle("closebutton", close_style);

            Style minimize_style = new Style();

            minimize_style.Background = Color.FromArgb(255, 166, 167, 168);
            minimize_style.SetSize(10, 10);
            minimize_style.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            minimize_style.Alignment = ItemAlignment.VCenter | ItemAlignment.Right;
            minimize_style.AddItemState(ItemStateType.Hovered, new ItemState()
            {
                Background = Color.FromArgb(80, 255, 255, 255)
            });
            minimize_style.Shape        = GraphicsMathService.GetRectangle(10, 1, 0, 5);
            minimize_style.IsFixedShape = true;
            style.AddInnerStyle("minimizebutton", minimize_style);

            Style maximize_style = new Style();

            maximize_style.SetSize(10, 10);
            maximize_style.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            maximize_style.BorderThickness = 1;
            maximize_style.BorderFill      = Color.FromArgb(255, 166, 167, 168);
            maximize_style.Alignment       = ItemAlignment.VCenter | ItemAlignment.Right;
            maximize_style.Padding         = new Indents(2, 2, 2, 2);

            ItemState hovered = new ItemState();

            hovered.Border.SetFill(Color.FromArgb(255, 84, 124, 94));
            maximize_style.AddItemState(ItemStateType.Hovered, hovered);
            maximize_style.Shape = GraphicsMathService.GetRectangle();
            style.AddInnerStyle("maximizebutton", maximize_style);

            Style title_style = new Style();

            title_style.Margin = new Indents(10, 0, 0, 0);
            style.AddInnerStyle("title", title_style);

            return(style);
        }
예제 #7
0
        public override void InitElements()
        {
            ImageItem _race = new ImageItem(DefaultsService.GetDefaultImage(
                                                EmbeddedImage.User,
                                                EmbeddedImageSize.Size32x32), false);

            _race.KeepAspectRatio(true);
            _race.SetWidthPolicy(SizePolicy.Fixed);
            _race.SetWidth(20);
            _race.SetAlignment(ItemAlignment.Left, ItemAlignment.VCenter);

            switch (_characterInfo.Race)
            {
            case CharacterRace.Human:
                _race.SetColorOverlay(Color.FromArgb(0, 162, 232));
                break;

            case CharacterRace.Elf:
                _race.SetColorOverlay(Color.FromArgb(35, 201, 109));
                break;

            case CharacterRace.Dwarf:
                _race.SetColorOverlay(Color.FromArgb(255, 127, 39));
                break;
            }

            _name.SetMargin(30, 0, 30, 0);

            ButtonCore infoBtn = new ButtonCore("?");

            infoBtn.SetBackground(Color.FromArgb(255, 40, 40, 40));
            infoBtn.SetWidth(20);
            infoBtn.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Expand);
            infoBtn.SetFontStyle(FontStyle.Bold);
            infoBtn.SetForeground(210, 210, 210);
            infoBtn.SetAlignment(ItemAlignment.VCenter, ItemAlignment.Right);
            infoBtn.SetMargin(0, 0, 20, 0);
            infoBtn.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(0, 140, 210)));

            infoBtn.SetPassEvents(false);

            infoBtn.EventMouseHover += (sender, args) =>
            {
                SetMouseHover(true);
            };

            infoBtn.EventMouseClick += (sender, args) =>
            {
                ImageItem race = new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.User, EmbeddedImageSize.Size32x32), false);
                race.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
                race.SetSize(32, 32);
                race.SetAlignment(ItemAlignment.Left, ItemAlignment.Top);
                race.SetColorOverlay(_race.GetColorOverlay());

                PopUpMessage popUpInfo = new PopUpMessage(
                    _characterInfo.Name + "\n" +
                    "Age: " + _characterInfo.Age + "\n" +
                    "Sex: " + _characterInfo.Sex + "\n" +
                    "Race: " + _characterInfo.Race + "\n" +
                    "Class: " + _characterInfo.Class
                    );
                popUpInfo.SetTimeOut(3000);
                popUpInfo.SetHeight(200);
                popUpInfo.Show(GetHandler());
                popUpInfo.AddItem(race);
            };

            //close
            ButtonCore removeBtn = new ButtonCore();

            removeBtn.SetBackground(Color.FromArgb(255, 40, 40, 40));
            removeBtn.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            removeBtn.SetSize(10, 10);
            removeBtn.SetAlignment(ItemAlignment.VCenter, ItemAlignment.Right);
            removeBtn.SetCustomFigure(new CustomFigure(false, GraphicsMathService.GetCross(10, 10, 2, 45)));
            removeBtn.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(200, 95, 97)));

            //close event
            removeBtn.EventMouseClick += (sender, args) =>
            {
                RemoveSelf();
            };

            //adding
            AddItems(_race, _name, infoBtn, removeBtn);
        }
예제 #8
0
        public override void InitWindow()
        {
            //window init
            SetParameters(nameof(MainWindow), nameof(MainWindow), 1300, 840, false);
            SetMinSize(500, 300);
            SetBackground(32, 34, 37);

            //title
            title = new TitleBar("Mimic");
            title.SetStyle(Styles.GetTitleBarStyle());

            HorizontalStack h_stack = new HorizontalStack();

            h_stack.SetMargin(0, 22, 0, 0);
            h_stack.SetSpacing(0, 0);

            //left block
            VerticalStack left = new VerticalStack();//70

            left.SetWidth(70);
            left.SetWidthPolicy(SizePolicy.Fixed);
            left.SetPadding(2, 0, 2, 2);
            left.SetSpacing(0, 10);

            SpaceVIL.Rectangle line = new SpaceVIL.Rectangle();
            line.SetBackground(32, 34, 37);
            line.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            line.SetHeight(1);
            line.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));
            line.SetMargin(8, 0, 8, 0);

            ButtonCore mimic_icon = new ButtonCore("M");

            mimic_icon.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 30, FontStyle.Bold));
            mimic_icon.SetSize(50, 50);
            mimic_icon.SetBackground(114, 137, 208);
            mimic_icon.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            mimic_icon.SetBorderRadius(new CornerRadius(15));

            SpaceVIL.Rectangle divider = new SpaceVIL.Rectangle();
            divider.SetBackground(47, 49, 54);
            divider.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            divider.SetHeight(2);
            divider.SetMargin(15, 0, 15, 0);

            ButtonToggle notes_area_btn = new ButtonToggle("N");

            notes_area_btn.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 30, FontStyle.Bold));
            notes_area_btn.SetSize(50, 50);
            notes_area_btn.SetBackground(Color.Transparent);
            notes_area_btn.SetForeground(100, 101, 105);
            notes_area_btn.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            notes_area_btn.SetBorderRadius(new CornerRadius(15));
            notes_area_btn.SetBorderFill(100, 101, 105);
            notes_area_btn.SetBorderThickness(1);
            notes_area_btn.EventMouseClick += (sender, args) =>
            {
                if (notes_area_btn.IsToggled())
                {
                    freeNotes.SetVisible(true);
                    conversation.SetVisible(false);
                    freeNotes.GetParent().Update(GeometryEventType.ResizeHeight);
                }
                else
                {
                    freeNotes.SetVisible(false);
                    conversation.SetVisible(true);
                    freeNotes.GetParent().Update(GeometryEventType.ResizeHeight);
                }
            };

            ButtonCore add_btn = new ButtonCore();

            add_btn.SetSize(50, 50);
            add_btn.SetBackground(Color.Transparent);
            add_btn.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            add_btn.SetBorderRadius(new CornerRadius(25));
            add_btn.SetBorderFill(100, 101, 105);
            add_btn.SetBorderThickness(1);
            add_btn.SetToolTip("Add a new friend.");
            add_btn.EventMouseClick += (sender, args) =>
            {
                AddMenuDialog dialog = new AddMenuDialog();
                dialog.OnCloseDialog += () =>
                {
                    string result = dialog.InputResult;
                    if (!result.Equals(String.Empty))
                    {
                        contacts_bar.AddItem(InfinityItemsBox.GetVisualContact(result, input_message));
                    }
                };
                dialog.Show(this);
            };

            CustomShape plus = new CustomShape();

            plus.SetBackground(100, 101, 105);
            plus.SetSize(20, 20);
            plus.SetAlignment(ItemAlignment.VCenter | ItemAlignment.HCenter);
            plus.SetTriangles(GraphicsMathService.GetCross(20, 20, 2, 0));

            //middleblock
            VerticalStack middle = new VerticalStack();//240

            middle.SetStyle(Styles.GetCommonContainerStyle());
            middle.SetWidth(240);
            middle.SetWidthPolicy(SizePolicy.Fixed);
            middle.SetBackground(47, 49, 54);
            middle.SetBorderRadius(new CornerRadius(6, 0, 6, 0));

            Frame search_bar = new Frame();

            search_bar.SetBorderRadius(new CornerRadius(6, 0, 0, 0));
            search_bar.SetBackground(47, 49, 54);
            search_bar.SetHeight(48);
            search_bar.SetPadding(15, 0, 15, 0);
            search_bar.SetHeightPolicy(SizePolicy.Fixed);
            search_bar.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));

            contacts_bar = new ListBox();
            contacts_bar.SetPadding(8, 8, 8, 8);
            contacts_bar.SetBackground(Color.Transparent);
            contacts_bar.SetHScrollBarVisible(ScrollBarVisibility.Never);
            contacts_bar.SetVScrollBarVisible(ScrollBarVisibility.Never);
            contacts_bar.SetSelectionVisible(false);

            Frame user_bar = new Frame();

            user_bar.SetBorderRadius(new CornerRadius(0, 0, 6, 0));
            user_bar.SetBackground(42, 44, 49);
            user_bar.SetHeight(48);
            user_bar.SetPadding(15, 0, 15, 0);
            user_bar.SetHeightPolicy(SizePolicy.Fixed);
            user_bar.SetAlignment(ItemAlignment.Bottom);

            TextEdit search = new TextEdit();

            search.SetPadding(10, 0, 10, 0);
            search.SetFont(DefaultsService.GetDefaultFont(12));
            search.SetForeground(150, 150, 150);
            search.SetSubstrateText("Find or start conversation");
            search.SetSubstrateFontSize(12);
            search.SetSubstrateFontStyle(FontStyle.Regular);
            search.SetSubstrateForeground(100, 100, 100);
            search.SetHeight(32);
            search.SetBackground(37, 39, 43);
            search.SetAlignment(ItemAlignment.HCenter, ItemAlignment.VCenter);
            search.SetBorderRadius(4);
            search.SetBorderThickness(1);
            search.SetBorderFill(32, 34, 37);

            //right block
            VerticalStack right = new VerticalStack();//expand

            right.SetStyle(Styles.GetCommonContainerStyle());
            right.SetSpacing(0, 2);

            HorizontalStack conversation_bar = new HorizontalStack();

            conversation_bar.SetBackground(54, 57, 63);
            conversation_bar.SetHeight(48);
            conversation_bar.SetHeightPolicy(SizePolicy.Fixed);
            conversation_bar.SetPadding(10, 0, 0, 0);
            conversation_bar.SetSpacing(5, 0);
            conversation_bar.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));

            freeNotes = new FreeArea();
            freeNotes.SetVisible(false);
            freeNotes.SetBackground(Color.FromArgb(5, 255, 255, 255));

            conversation = new ListBox();
            conversation.SetPadding(4, 4, 4, 4);
            conversation.SetBackground(Color.Transparent);
            conversation.SetHScrollBarVisible(ScrollBarVisibility.Never);
            conversation.GetArea().SetPadding(16, 10, 2, 2);
            conversation.SetSelectionVisible(false);

            VerticalScrollBar vs = conversation.VScrollBar;

            vs.SetWidth(16);
            vs.SetBorderThickness(4);
            vs.SetBorderFill(54, 57, 63);
            vs.SetBorderRadius(new CornerRadius(9));
            vs.SetArrowsVisible(false);
            vs.SetBackground(47, 49, 54);
            vs.SetPadding(0, 0, 0, 0);
            vs.Slider.Track.SetBackground(Color.Transparent);
            vs.Slider.SetBorderThickness(4);
            vs.Slider.SetBorderFill(54, 57, 63);
            vs.Slider.SetBorderRadius(new CornerRadius(9));
            vs.Slider.SetBackground(32, 34, 37, 255);
            vs.Slider.SetMargin(new Indents(0, 0, 0, 0));
            vs.Slider.RemoveAllItemStates();

            HorizontalStack input_bar = new HorizontalStack();

            input_bar.SetHeight(44);
            input_bar.SetHeightPolicy(SizePolicy.Fixed);
            input_bar.SetMargin(20, 10, 20, 30);
            input_bar.SetPadding(15, 0, 8, 0);
            input_bar.SetSpacing(10, 0);
            input_bar.SetBackground(72, 75, 81);
            input_bar.SetBorderRadius(new CornerRadius(6, 6, 6, 6));

            ButtonCore emoji = new ButtonCore("+");

            emoji.SetSize(24, 24);
            emoji.SetBackground(126, 128, 132);
            emoji.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            emoji.SetBorderRadius(new CornerRadius(12));

            SpaceVIL.Rectangle divider_v = new SpaceVIL.Rectangle();
            divider_v.SetBackground(126, 128, 132);
            divider_v.SetWidth(2);
            divider_v.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Expand);
            divider_v.SetMargin(0, 10, 0, 10);

            input_message = new TextEdit();
            input_message.SetBackground(Color.Transparent);
            input_message.SetForeground(Color.White);
            input_message.SetAlignment(ItemAlignment.VCenter);
            input_message.SetBorderRadius(new CornerRadius(0, 3, 0, 3));
            input_message.SetSubstrateText("Message @Jackson");
            input_message.EventKeyPress += (sender, args) =>
            {
                if (args.Key == KeyCode.Enter)
                {
                    conversation.AddItem(InfinityItemsBox.GetMessage(input_message.GetText()));
                    input_message.Clear();
                }
            };

            ButtonCore add_note = InfinityItemsBox.GetOrdinaryButton();

            add_note.SetForeground(166, 167, 168);
            add_note.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 12, FontStyle.Bold));
            add_note.SetText("Add new note");
            add_note.SetWidth(100);
            add_note.SetShadow(4, 0, 2, Color.FromArgb(150, 0, 0, 0));
            add_note.EventMouseClick += (sender, args) =>
            {
                NoteBlock block = InfinityItemsBox.GetNoteBlock();
                block.SetPosition(100, 100);
                freeNotes.AddItem(block);
            };

            //adding items
            AddItems(
                title,
                h_stack
                );
            h_stack.AddItems(
                left,
                middle,
                right
                );
            left.AddItems(
                line,
                mimic_icon,
                divider,
                notes_area_btn,
                add_btn
                );
            add_btn.AddItem(
                plus
                );
            middle.AddItems(
                search_bar,
                contacts_bar,
                user_bar
                );
            search_bar.AddItems(
                search
                );
            user_bar.AddItems(
                new UserBar("Daniel")
                );
            right.AddItems(
                conversation_bar,
                conversation,
                freeNotes,
                input_bar
                );
            conversation_bar.AddItems(
                add_note,
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton()
                );
            input_bar.AddItems(
                emoji,
                divider_v,
                input_message
                );
            contacts_bar.AddItems(
                InfinityItemsBox.GetVisualContact("Jackson", input_message),
                InfinityItemsBox.GetVisualContact("Evelyn", input_message),
                InfinityItemsBox.GetVisualContact("Alexander", input_message),
                InfinityItemsBox.GetVisualContact("Matthew", input_message)
                );
        }
예제 #9
0
        public override void InitElements()
        {
            _palette.SetPassEvents(false);
            _palette.SetItemName("Palette");
            _palette.SetAlignment(ItemAlignment.Right | ItemAlignment.Top);
            _palette.SetMargin(0, 40, 0, 0);
            _palette.SetSize(16, 15);
            _palette.SetBackground(255, 128, 128);
            _palette.SetBorderRadius(new CornerRadius(3));

            CustomShape arrow = new CustomShape();

            arrow.SetTriangles(GraphicsMathService.GetTriangle(angle: 180));
            arrow.SetBackground(50, 50, 50);
            arrow.SetSize(14, 6);
            arrow.SetMargin(0, 1, 0, 0);
            arrow.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            arrow.SetAlignment(ItemAlignment.HCenter | ItemAlignment.VCenter);

            _lock.SetAlignment(ItemAlignment.Left | ItemAlignment.Top);
            _lock.SetSize(16, 16);
            _lock.SetBorderRadius(new CornerRadius(8));
            _lock.EventToggle += (sender, args) =>
            {
                IsLocked = !IsLocked;
                _text.SetEditable(!_text.IsEditable());
                _btn_close.SetDisabled(!_btn_close.IsDisabled());
            };

            VerticalScrollBar vs = _text.VScrollBar;

            vs.Slider.Handler.RemoveAllItemStates();
            vs.SetArrowsVisible(false);
            vs.SetBackground(Color.Transparent);
            vs.SetPadding(0, 2, 0, 2);
            vs.Slider.Track.SetBackground(Color.Transparent);
            vs.Slider.Handler.SetBorderRadius(new CornerRadius(3));
            vs.Slider.Handler.SetBackground(80, 80, 80, 255);
            vs.Slider.Handler.SetMargin(new Indents(5, 0, 5, 0));

            _text.SetBorderRadius(new CornerRadius(3));
            _text.SetHScrollBarPolicy(VisibilityPolicy.Never);
            _text.SetHeight(25);
            _text.SetAlignment(ItemAlignment.Left | ItemAlignment.Bottom);
            _text.SetBackground(151, 203, 255);
            _text.SetMargin(0, 60, 0, 0);

            _note.SetForeground(180, 180, 180);
            _note.SetHeight(25);
            _note.SetAlignment(ItemAlignment.Left | ItemAlignment.Top);
            _note.SetTextAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            _note.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            _note.SetText("Add a Note:");
            _note.SetMargin(0, 30, 0, 0);

            _btn_close = new ButtonCore();
            _btn_close.SetBackground(Color.FromArgb(255, 100, 100, 100));
            _btn_close.SetItemName("Close_" + GetItemName());
            _btn_close.SetSize(10, 10);
            _btn_close.SetMargin(0, 0, 0, 0);
            _btn_close.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            _btn_close.SetAlignment(ItemAlignment.Top | ItemAlignment.Right);
            _btn_close.AddItemState(ItemStateType.Hovered, new ItemState()
            {
                Background = Color.FromArgb(125, 255, 255, 255)
            });
            _btn_close.SetCustomFigure(new Figure(false, GraphicsMathService.GetCross(10, 10, 3, 45)));
            _btn_close.EventMouseClick += (sender, args) =>
            {
                Dispose();
            };

            AddItems(_lock, _note, _text, _palette, _btn_close);

            _palette.AddItem(arrow);

            _palette_menu = new ContextMenu(GetHandler());
            _palette_menu.SetBorderRadius(5);
            _palette_menu.SetBorderThickness(1);
            _palette_menu.SetBorderFill(32, 32, 32);
            _palette_menu.SetBackground(60, 60, 60);
            _palette_menu.SetWidth(100);
            _palette_menu.ItemList.SetSelectionVisible(false);
            _palette_menu.ActiveButton = MouseButton.ButtonLeft;

            MenuItem red = InfinityItemsBox.GetMenuItem("Red");

            red.EventMouseClick += (sender, args) =>
            {
                _text.SetBackground(255, 196, 196);
            };
            MenuItem green = InfinityItemsBox.GetMenuItem("Green");

            green.EventMouseClick += (sender, args) =>
            {
                _text.SetBackground(138, 255, 180);
            };
            MenuItem blue = InfinityItemsBox.GetMenuItem("Blue");

            blue.EventMouseClick += (sender, args) =>
            {
                _text.SetBackground(151, 203, 255);
            };
            MenuItem yellow = InfinityItemsBox.GetMenuItem("Yellow");

            yellow.EventMouseClick += (sender, args) =>
            {
                _text.SetBackground(234, 232, 162);
            };
            _palette_menu.AddItems(red, green, blue, yellow);

            //mouse click to show palette
            _palette.EventMouseClick += (_, x) => _palette_menu.Show(_, x);
        }
예제 #10
0
        public override void InitElements()
        {
            base.InitElements();
            if (_isInit)
            {
                return;
            }

            Window.SetBackground(60, 60, 60);

            Label _name = new Label();

            _name.SetFont(DefaultsService.GetDefaultFont(FontStyle.Bold, 28));
            _name.SetText("My Albums");
            _name.SetMargin(0, 0, 0, 0);
            _name.SetMargin(0, 25, 0, 0);
            _name.SetPadding(10, 10, 10, 0);
            _name.SetHeightPolicy(SizePolicy.Fixed);
            _name.SetHeight(70);

            _albumList.SetSelectionVisible(false);
            _albumList.SetVScrollBarPolicy(VisibilityPolicy.AsNeeded);
            _albumList.SetHScrollBarPolicy(VisibilityPolicy.Never);
            _albumList.SetBackground(Color.Transparent);
            _albumList.SetMargin(10, 100, 10, 50);
            _albumList.VScrollBar.SetStyle(Style.GetSimpleVerticalScrollBarStyle());

            Style style = new Style();

            style.Background = Color.Transparent;
            style.Foreground = Color.Black;
            style.Font       = DefaultsService.GetDefaultFont();
            style.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            style.SetSize(40, 40);
            style.SetAlignment(ItemAlignment.Right, ItemAlignment.Bottom);
            style.SetTextAlignment(ItemAlignment.Right, ItemAlignment.Bottom);
            style.SetPadding(4, 4, 4, 4);
            style.SetMargin(0, 0, 10, 10);
            style.SetSpacing(0, 0);
            style.SetBorder(new Border(Color.Transparent, new CornerRadius(20), 0));
            style.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(100, 255, 255, 255)));
            style.AddItemState(ItemStateType.Pressed, new ItemState(Color.FromArgb(100, 0, 0, 0)));
            _addButton.SetStyle(style);

            CustomShape plus = new CustomShape(GraphicsMathService.GetCross(30, 30, 4, 0));

            plus.SetAlignment(ItemAlignment.HCenter, ItemAlignment.VCenter);
            plus.SetBackground(100, 100, 100);
            plus.SetSizePolicy(SizePolicy.Expand, SizePolicy.Expand);

            AddItems(
                _name,
                _albumList,
                _addButton
                );

            _addButton.AddItem(plus);

            _addButton.EventMouseClick += (sender, args) =>
            {
                Hide();
                OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open);
                browse.OnCloseDialog += () =>
                {
                    if (browse.GetResult() == null || browse.GetResult().Equals(String.Empty))
                    {
                        Show();
                        return;
                    }
                    Album album = new Album(new DirectoryInfo(browse.GetResult()).Name, browse.GetResult());
                    AddAlbum(album);
                    album.OnDoubleClick += (s) =>
                    {
                        Hide();
                        Model.FillImageArea(GetHandler(), _area, _preview, (s as Album).GetPath());
                    };
                };
                browse.Show(GetHandler());
            };

            if (_list.Count > 0)
            {
                foreach (Album item in _list)
                {
                    _albumList.AddItem(item);
                    item._expand.EventToggle += (sender, args) =>
                    {
                        _albumList.GetWrapper(item).UpdateSize();
                        _albumList.GetArea().UpdateLayout();
                    };
                }
            }

            _isInit = true;
        }