public override void InitElements() { base.InitElements(); SetBackground(0, 0, 0, 0); SetAlignment(ItemAlignment.HCenter); SetBorder(new Border(Color.DimGray, new CornerRadius(10), 1)); SetSize(280, 30); var layout = new HorizontalStack(); layout.SetBackground(Color.FromArgb(0, 0, 0, 0)); var name = new Label(Name); name.SetStyle(Styles.GetLabelStyle()); name.SetTextAlignment(ItemAlignment.Left, ItemAlignment.VCenter); name.SetPadding(5); name.SetWidth(Name.Length * 8); name.SetWidthPolicy(SizePolicy.Fixed); _text.SetAlignment(ItemAlignment.Right, ItemAlignment.VCenter); _text.SetPadding(10, 0, 5, 0); _text.SetMaxWidth(250); _text.SetBackground(255, 255, 255, 100); _text.SetForeground(Color.White); _text.SetBorder(new Border(Color.DimGray, new CornerRadius(10), 1)); _text.SetWidthPolicy(SizePolicy.Expand); AddItem(layout); layout.AddItems(name, _text); }
public override void InitWindow() { SetParameters(this.GetType().Name, this.GetType().Name, 800, 800, false); IsCentered = true; TitleBar titleBar = new TitleBar(this.GetType().Name); OpenGLLayer ogl = new OpenGLLayer(); ogl.SetMargin(0, titleBar.GetHeight(), 0, 0); HorizontalStack toolbar = Items.GetToolbarLayout(); ImagedButton btnRotateLeft = Items.GetImagedButton(EmbeddedImage.ArrowUp, -90); ImagedButton btnRotateRight = Items.GetImagedButton(EmbeddedImage.ArrowUp, 90); HorizontalSlider zoom = Items.GetSlider(); ImagedButton btnRestoreView = Items.GetImagedButton(EmbeddedImage.Refresh, 0); // adding AddItems(titleBar, ogl); ogl.AddItems(toolbar); toolbar.AddItems(btnRotateLeft, btnRotateRight, zoom, btnRestoreView); // assign events btnRestoreView.EventMousePress += (sender, args) => { ogl.RestoreView(); }; btnRotateLeft.EventMousePress += (sender, args) => { ogl.Rotate(KeyCode.Left); }; btnRotateRight.EventMousePress += (sender, args) => { ogl.Rotate(KeyCode.Right); }; zoom.EventValueChanged += (sender) => { ogl.SetZoom(zoom.GetCurrentValue()); }; // Set focus ogl.SetFocus(); zoom.SetCurrentValue(3); }
public override void InitElements() { border = new Ellipse(); contact = new Label(); signal = new BlankItem(); //contact image border border.SetBackground(114, 137, 208); 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.SetForeground(Color.White); contact.SetSizePolicy(SizePolicy.Expand, SizePolicy.Expand); contact.SetMargin(40, 0, 0, 0); contact.SetAlignment(ItemAlignment.Top | ItemAlignment.Left); //signal 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); //buttons bar HorizontalStack bar = new HorizontalStack(); bar.SetMargin(120, 0, 0, 0); bar.SetSpacing(5, 0); //adding AddItems(border, signal, contact, bar); bar.AddItems( InfinityItemsBox.GetUserBarButton(), InfinityItemsBox.GetUserBarButton(), InfinityItemsBox.GetUserBarButton() ); }
public override void InitWindow() { // apply new style for ToolTipItem InitToolTipStyle(); // window attr SetParameters("MainWindow", "ToolTipExample", 800, 450); IsCentered = true; // create toolbars HorizontalStack toolBar = ItemsFactory.GetToolBarLayout(); VerticalStack sideBar = ItemsFactory.GetSideBarLayout(); // add items to window AddItems( toolBar, sideBar, ItemsFactory.GetAreaForPermanentToolTip() ); // 1. add items with standard tooltip to ToolBar toolBar.AddItems( ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.File, EmbeddedImageSize.Size32x32), "Create a new file"), ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32), "Create a new folder"), ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.RecycleBin, EmbeddedImageSize.Size32x32), "Delete"), ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32), "Refresh") ); // 2. add items with MyToolTip to sideBar sideBar.AddItems( ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.File, EmbeddedImageSize.Size32x32), new MyToolTip(this, "Create new file:\nCreates a new file in the root directory.")), ItemsFactory.GetHorizontalDivider(), // divider ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32), new MyToolTip(this, "Create new folder:\nCreates a new folder in the root directory.")), ItemsFactory.GetHorizontalDivider(), // divider ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.RecycleBin, EmbeddedImageSize.Size32x32), new MyToolTip(this, "Delete:\nDelete selected file entry in root directory.")), ItemsFactory.GetHorizontalDivider(), // divider ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32), new MyToolTip(this, "Refresh:\nUpdates the root directory.")) ); }
private void PopulateToolbar() { var resetGraph = UiElements.GetButton("Reset Graph"); resetGraph.SetAlignment(Style.GetButtonCoreStyle().Alignment); resetGraph.EventMouseClick += (sender, args) => { if (_presenter.IsGraphGenerated()) { _presenter.ResetGraph(); _presenter.SaveGraph(); } else { ShowPopUp("Generate graph first"); } }; _toolbar.AddItems(resetGraph); }
public override void InitWindow() { SetParameters(nameof(CharacterEditor), nameof(CharacterEditor), 1000, 600, false); IsCentered = true; //title TitleBar title = new TitleBar(nameof(CharacterEditor)); title.SetIcon( DefaultsService.GetDefaultImage(EmbeddedImage.User, EmbeddedImageSize.Size32x32), 20, 20); //layout VerticalStack layout = ItemFactory.GetStandardLayout(title.GetHeight()); ////////////////////////////////////////////////////////////////////////////// HorizontalStack toolbar = ItemFactory.GetToolbar(); VerticalSplitArea splitArea = ItemFactory.GetSplitArea(); BtnGenerate = ItemFactory.GetToolbarButton(); BtnSave = ItemFactory.GetToolbarButton(); NumberCount = ItemFactory.GetSpinItem(); ItemText.SetStyle(StyleFactory.GetTextAreaStyle()); ////////////////////////////////////////////////////////////////////////////// //adding AddItems(title, layout); layout.AddItems(toolbar, splitArea); splitArea.AssignLeftItem(ItemList); splitArea.AssignRightItem(ItemText); toolbar.AddItems(BtnGenerate, BtnSave, ItemFactory.GetVerticalDivider(), NumberCount); BtnGenerate.AddItem(ItemFactory.GetToolbarIcon( DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32) )); BtnSave.AddItem(ItemFactory.GetToolbarIcon( DefaultsService.GetDefaultImage(EmbeddedImage.Diskette, EmbeddedImageSize.Size32x32) )); }
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(); }; }
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) ); }
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(); }; }
public override void InitElements() { AssingSize(_languageList, _profileList, _inputModeList); HorizontalStack _profileToolbar = new HorizontalStack(); _profileToolbar.SetHeightPolicy(SizePolicy.Fixed); _profileToolbar.SetHeight(30); _profileToolbar.SetSpacing(10); AddItems( _headerTitle, _autoLaunchAppCheckBox, _startMinimizedCheckBox, _autoStartCheckBox, Items.GetHorizontalDivider(), _headerProfile, _profileToolbar, _inputModeList, Items.GetHorizontalDivider(), _headerLocale, _languageList ); _profileToolbar.AddItems(_profileList, _addProfile, _copyProfile, _removeProfile); // apply settings _languageList.SetCurrentIndex( Controller.GetLocalizations().Keys.ToList().IndexOf(Controller.GetLanguage()["Locale"])); _profileList.SetCurrentIndex( Controller.GetAllProfiles().Select(p => p.Name).ToList().IndexOf(Controller.GetProfile().Name)); _inputModeList.SetCurrentIndex( Parse.RepeatTypes(Controller.GetProfile().RepeatMode)); // events _languageList.SelectionChanged += () => { Controller.InvokeEventLanguageChanged(_languageList.GetTextSelection()); }; _profileList.SelectionChanged += () => { Controller.InvokeEventProfileChanged(_profileList.GetTextSelection()); }; _inputModeList.SelectionChanged += () => { Controller.GetProfile().RepeatMode = (RepeatType)_inputModeList.GetCurrentIndex(); }; _autoLaunchAppCheckBox.EventToggle += (value) => { Controller.GetSettings().AutoLaunchOnSystemStartUp = value; }; _startMinimizedCheckBox.EventToggle += (value) => { Controller.GetSettings().StartAppMinimized = value; }; _autoStartCheckBox.EventToggle += (value) => { Controller.GetSettings().AutoStart = value; }; _addProfile.EventMouseClick += (sender, args) => { InputDialog input = new InputDialog(Controller.GetLanguage()["InputTitle"], Controller.GetLanguage()["AddButton"]); input.SetCancelVisible(false); input.OnCloseDialog += () => { if (input.GetResult().Length > 0) { Controller.InvokeEventAddProfile(input.GetResult()); } }; input.Show(GetHandler()); }; _copyProfile.EventMouseClick += (sender, args) => { InputDialog input = new InputDialog(Controller.GetLanguage()["InputTitle"], Controller.GetLanguage()["AddButton"]); input.SetCancelVisible(false); input.OnCloseDialog += () => { if (input.GetResult().Length > 0) { Controller.InvokeEventAddProfile(input.GetResult(), true); } }; input.Show(GetHandler()); }; _removeProfile.EventMouseClick += (sender, args) => { MessageItem msg = new MessageItem( Controller.GetLanguage()["MsgDeleteProfile"] + " " + Controller.GetProfile().Name + "\n" + Controller.GetLanguage()["MsgConfirm"], Controller.GetLanguage()["DeleteProfileTitle"]); msg.GetOkButton().SetText(Controller.GetLanguage()["DeleteButton"]); msg.GetCancelButton().SetText(Controller.GetLanguage()["CancelButton"]); msg.OnCloseDialog += () => { if (msg.GetResult()) { Controller.InvokeEventDeleteProfile(); } }; msg.Show(GetHandler()); }; }
public override void InitElements() { _image.KeepAspectRatio(true); _image.IsHover = false; _toolbar.SetHeightPolicy(SizePolicy.Fixed); _toolbar.SetHeight(30); _toolbar.SetBackground(32, 32, 32); _toolbar.SetSpacing(10, 0); _toolbar.SetPadding(30, 0, 10, 0); _pictureSize.SetWidthPolicy(SizePolicy.Fixed); _pictureSize.SetWidth(100); _pictureSize.SetTextAlignment(ItemAlignment.VCenter, ItemAlignment.Right); Area.SetMargin(0, 30, 0, 0); ButtonCore _expand = new ButtonCore(); _expand.SetSize(30, 30); _expand.SetAlignment(ItemAlignment.Right, ItemAlignment.Bottom); _expand.SetMargin(0, 0, 10, 10); _expand.SetBackground(Color.Transparent); _expand.SetBorderRadius(15); _expand.SetPadding(5, 5, 5, 5); _expand.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(20, 255, 255, 255))); _expand.AddItemState(ItemStateType.Pressed, new ItemState(Color.Transparent)); ButtonCore _menu = new ButtonCore(); _menu.SetSize(30, 30); _menu.SetAlignment(ItemAlignment.Right, ItemAlignment.Top); _menu.SetMargin(0, 40, 10, 0); _menu.SetBackground(Color.Transparent); _menu.SetBorderRadius(15); _menu.SetPadding(5, 5, 5, 5); _menu.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(20, 255, 255, 255))); _menu.AddItemState(ItemStateType.Pressed, new ItemState(Color.Transparent)); base.AddItem(_toolbar); base.AddItem(Area); base.AddItem(_expand); base.AddItem(_menu); Area.AddItem(_image); ImageItem eye = new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Eye, EmbeddedImageSize.Size32x32), false); eye.KeepAspectRatio(true); ImageItem gear = new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Gear, EmbeddedImageSize.Size32x32), false); gear.KeepAspectRatio(true); _expand.AddItem(eye); _menu.AddItem(gear); ContextMenu _rotationMenu = new ContextMenu(GetHandler()); _rotationMenu.ActiveButton = MouseButton.ButtonLeft; MenuItem _rot0 = new MenuItem("Rotate 0\u00b0"); _rot0.EventMouseClick += (sender, args) => { _image.SetRotationAngle(0); }; MenuItem _rot90 = new MenuItem("Rotate 90\u00b0"); _rot90.EventMouseClick += (sender, args) => { _image.SetRotationAngle(90); }; MenuItem _rot180 = new MenuItem("Rotate 180\u00b0"); _rot180.EventMouseClick += (sender, args) => { _image.SetRotationAngle(180); }; MenuItem _rot270 = new MenuItem("Rotate -90\u00b0"); _rot270.EventMouseClick += (sender, args) => { _image.SetRotationAngle(270); }; _rotationMenu.AddItems(_rot0, _rot90, _rot180, _rot270); _menu.EventMouseClick += (sender, args) => { _rotationMenu.Show(sender, args); }; _toolbar.AddItems(_pictureName, _pictureSize); _expand.EventMouseClick += (sender, args) => { String picture = Model.GetPicturePath(_wrapLink, _pictureName.GetText()); if (picture != String.Empty) { using (Bitmap img = new Bitmap(picture)) { ImageItem image = new ImageItem(Model.DownScaleBitmap(img, 1920, 1080), false); FullImageViewer viewer = new FullImageViewer(image); viewer.Show(GetHandler()); } } }; eye.SetColorOverlay(Color.FromArgb(0, 91, 225, 152), false); gear.SetColorOverlay(Color.FromArgb(0, 110, 170, 255), false); _expand.EventMouseHover += (sender, args) => { eye.SetColorOverlay(true); }; _expand.EventMouseLeave += (sender, args) => { eye.SetColorOverlay(false); }; _menu.EventMouseHover += (sender, args) => { gear.SetColorOverlay(true); }; _menu.EventMouseLeave += (sender, args) => { gear.SetColorOverlay(false); }; }