public static ButtonCore GetButton(string name) { var button = new ButtonCore(name); button.SetStyle(Styles.GetButtonStyle()); button.SetShadow(5, 2, 2, Color.Black); return(button); }
public PruferCodeDialog() { SetItemName("PruferCodeDialog_Unique"); _info.SetStyle(Styles.GetLabelStyle()); _generate.SetStyle(Styles.GetDialogButtonStyle()); _output.SetStyle(Styles.GetLabelStyle()); }
public CheckPathExistenceDialog(int vertices) { SetItemName("CheckPathDialog_Unique"); _vertices = vertices; _info.SetStyle(Styles.GetLabelStyle()); _output.SetStyle(Styles.GetLabelStyle()); _check.SetStyle(Styles.GetButtonStyle()); }
public MinimumSpanningTreeDialog() { SetItemName("ShortestPathDialog_Unique"); //_vertices = vertices; _info.SetStyle(Styles.GetLabelStyle()); _output.SetStyle(Styles.GetLabelStyle()); _prim.SetStyle(Styles.GetDialogButtonStyle()); _kruskal.SetStyle(Styles.GetDialogButtonStyle()); _total.SetStyle(Styles.GetDialogButtonStyle()); }
public ShortestPathDialog(int vertices) { SetItemName("ShortestPathDialog_Unique"); _vertices = vertices; _info.SetStyle(Styles.GetLabelStyle()); _output.SetStyle(Styles.GetLabelStyle()); _dijkstra.SetStyle(Styles.GetDialogButtonStyle()); _bellmanFord.SetStyle(Styles.GetDialogButtonStyle()); _floyd.SetStyle(Styles.GetDialogButtonStyle()); }
public GenerateGraphDialog(int maxVertices) { _maxVertices = maxVertices; SetItemName("GenerateGraphDialog_Unique"); _info.SetStyle(Styles.GetLabelStyle()); _verticesInfo.SetStyle(Styles.GetLabelStyle()); _densityInfo.SetStyle(Styles.GetLabelStyle()); _weightInfo.SetStyle(Styles.GetLabelStyle()); _errorOutput.SetStyle(Styles.GetLabelStyle()); _generate.SetStyle(Styles.GetDialogButtonStyle()); }
public ShimbelDialog(int vertices) { SetItemName("ShimbelDialog_Unique"); _vertices = vertices; _info.SetStyle(Styles.GetLabelStyle()); _info2.SetStyle(Styles.GetLabelStyle()); _output.SetStyle(Styles.GetLabelStyle()); _output.SetBorder(new Border(Color.LightGray, new CornerRadius(2f), 2)); _shortestButton.SetStyle(Styles.GetDialogButtonStyle()); _longestButton.SetStyle(Styles.GetDialogButtonStyle()); }
public override void InitElements() { base.InitElements(); //window's attr Window.SetBackground(45, 45, 45); //title TitleBar title = new TitleBar("Adding a new member"); title.SetFont(DefaultsService.GetDefaultFont(14)); title.GetMinimizeButton().SetVisible(false); title.GetMaximizeButton().SetVisible(false); VerticalStack layout = new VerticalStack(); layout.SetMargin(0, title.GetHeight(), 0, 0); layout.SetPadding(6, 15, 6, 6); layout.SetSpacing(vertical: 30); layout.SetBackground(255, 255, 255, 20); //message _input.EventKeyRelease += OnKeyRelease; //ok _add.SetBackground(255, 181, 111); _add.SetStyle(Styles.GetButtonStyle()); _add.SetShadow(5, 0, 4, Color.FromArgb(150, 0, 0, 0)); _add.EventMouseClick += (sender, args) => { InputResult = _input.GetText(); Close(); }; //adding items Window.AddItems( title, layout ); layout.AddItems( _input, _add ); title.GetCloseButton().EventMouseClick = null; title.GetCloseButton().EventMouseClick += (sender, args) => { Close(); }; }
// Style override public override void SetStyle(Style style) { if (style == null) { return; } base.SetStyle(style); Style innerStyle = style.GetInnerStyle("hidebutton"); HideButton.SetStyle(innerStyle); innerStyle = style.GetInnerStyle("addbutton"); AddButton.SetStyle(innerStyle); }
public override void InitWindow() { SetParameters("Mainwindow", "RadialMenu Example C#", 800, 600, false); SetMinSize(300, 300); SetBackground(StyleFactory.CommonBackground); SetPadding(0, 0, 0, 0); SetAntiAliasingQuality(MSAA.MSAA8x); IsCentered = true; // title TitleBar title = new TitleBar(GetWindowTitle()); // radial menu RadialMenu = new RadialMenuItem(this); // contact menu Menu = new ContactMenu(this, RadialMenu); ShowContactsBtn = new ButtonCore("Show"); ShowContactsBtn.SetStyle(StyleFactory.GetRoundedButtonStyle()); // adding AddItems(title, ShowContactsBtn); }
public override void InitWindow() { SetParameters(nameof(MainWindow), nameof(MainWindow), 1240, 750, false); IsCentered = true; var icon = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("SimpleImageViewer.Resources.icon.png")); TitleBar title = new TitleBar("Simple Image Viewer - C#"); title.SetIcon(icon, 24, 24); title.SetPadding(4, 0, 5, 0); Frame layout = new Frame(); layout.SetMargin(0, title.GetHeight(), 0, 0); layout.SetPadding(0, 0, 0, 0); layout.SetSpacing(6); layout.SetBackground(60, 60, 60); VerticalStack vToolbar = new VerticalStack(); vToolbar.SetWidthPolicy(SizePolicy.Fixed); vToolbar.SetWidth(30); vToolbar.SetBackground(32, 32, 32); vToolbar.SetPadding(0, 30, 0, 0); HorizontalSplitArea splitArea = new HorizontalSplitArea(); splitArea.SetMargin(vToolbar.GetWidth(), 0, 0, 0); splitArea.SetSplitThickness(5); imageArea = new WrapGrid(160, 120, Orientation.Horizontal); imageArea.SetBackground(Color.Transparent); imageArea.SetPadding(15, 6, 6, 6); imageArea.GetArea().SetSpacing(6, 6); imageArea.VScrollBar.SetStyle(Style.GetSimpleVerticalScrollBarStyle()); imageArea.SetStretch(true); previewArea = new PreviewArea(imageArea); side = new AlbumSideList(this, Side.Left, imageArea, previewArea); side.SetAreaSize(400); Album defaultAlbum = new Album("MyPictures", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + "Pictures"); defaultAlbum.OnDoubleClick += (sender) => { side.Hide(); Model.FillImageArea(this, imageArea, previewArea, (sender as Album).GetPath()); }; side.AddAlbum(defaultAlbum); ButtonCore btnSideAreaShow = new ButtonCore(); btnSideAreaShow.SetStyle(CustomStyles.GetButtonStyle()); ButtonCore btnOpenFolder = new ButtonCore(); btnOpenFolder.SetStyle(CustomStyles.GetButtonStyle()); ButtonCore btnAddAlbum = new ButtonCore(); btnAddAlbum.SetStyle(CustomStyles.GetButtonStyle()); //adding AddItems( title, layout ); layout.AddItems( vToolbar, splitArea ); splitArea.AssignTopItem(previewArea); splitArea.AssignBottomItem(imageArea); splitArea.SetSplitPosition(300); vToolbar.AddItems( btnSideAreaShow, btnOpenFolder, btnAddAlbum ); btnSideAreaShow.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Lines, EmbeddedImageSize.Size32x32), false)); btnOpenFolder.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32), false)); btnAddAlbum.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Import, EmbeddedImageSize.Size32x32), false)); //events EventDrop += (sender, args) => { if (side.IsHide) { if (File.GetAttributes(args.Paths[0]).HasFlag(FileAttributes.Directory)) { Model.FillImageArea(this, imageArea, previewArea, args.Paths[0]); } } else { foreach (String path in args.Paths) { if (File.GetAttributes(path).HasFlag(FileAttributes.Directory)) { Album album = new Album(new DirectoryInfo(path).Name, path); side.AddAlbum(album); album.OnDoubleClick += (s) => { side.Hide(); Model.FillImageArea(this, imageArea, previewArea, (s as Album).GetPath()); }; } } } }; btnSideAreaShow.EventMouseClick += (sender, args) => { side.Show(); }; btnOpenFolder.EventMouseClick += (sender, args) => { OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open); browse.OnCloseDialog += () => { Model.FillImageArea(this, imageArea, previewArea, browse.GetResult()); }; browse.Show(this); }; imageArea.EventScrollUp += (sender, args) => { if (args.Mods.HasFlag(KeyMods.Control)) { int w = imageArea.GetCellWidth() + 8; int h = imageArea.GetCellHeight() + 6; if (w > 400) { return; } imageArea.SetCellSize(w, h); } }; imageArea.EventScrollDown += (sender, args) => { if (args.Mods.HasFlag(KeyMods.Control)) { int w = imageArea.GetCellWidth() - 8; int h = imageArea.GetCellHeight() - 6; if (w < 160) { return; } imageArea.SetCellSize(w, h); } }; btnAddAlbum.EventMouseClick += (sender, args) => { OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open); browse.OnCloseDialog += () => { if (browse.GetResult() == null || browse.GetResult() == String.Empty) { return; } Album album = new Album(new DirectoryInfo(browse.GetResult()).Name, browse.GetResult()); side.AddAlbum(album); album.OnDoubleClick += (s) => { side.Hide(); Model.FillImageArea(this, imageArea, previewArea, (s as Album).GetPath()); }; }; browse.Show(this); }; EventOnStart += () => { Model.FillImageArea(this, imageArea, previewArea, Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + "Pictures"); } }
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; }
public override void InitWindow() { //Window attr SetParameters(nameof(MainWindow), nameof(CustomChance), 360, 500, false); SetMinSize(350, 500); SetBackground(45, 45, 45); EventKeyRelease += (sender, args) => OnKeyRelease(sender, args); EventClose = () => { CommonLogic.GetInstance().TrySerialize(); Close(); }; //icons var big = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomChance.icon_big.png")); var small = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomChance.icon_small.png")); SetIcon(big, small); //title TitleBar title = new TitleBar("Custom Chance"); title.SetIcon(small, 16, 16); title.SetFont(DefaultsService.GetDefaultFont(14)); title.GetMaximizeButton().SetVisible(false); //layout VerticalStack layout = new VerticalStack(); layout.SetMargin(0, title.GetHeight(), 0, 0); layout.SetPadding(3, 3, 3, 3); layout.SetSpacing(vertical: 5); layout.SetBackground(255, 255, 255, 20); //listBox _listBox = new ListBox(); _listBox.SetBackground(52, 52, 52); _listBox.SetHScrollBarPolicy(VisibilityPolicy.Never); _listBox.SetVScrollBarPolicy(VisibilityPolicy.Never); _listBox.SetSelectionVisible(false); //AddButton AddButton = new ButtonStand("Add a Member!"); AddButton.SetStyle(Styles.GetButtonStyle()); AddButton.SetMargin(0, 5, 0, 5); AddButton.SetShadow(5, 0, 4, Color.FromArgb(150, 0, 0, 0)); AddButton.EventMouseClick += (sender, args) => { InputDialog dialog = new InputDialog(); dialog.OnCloseDialog += () => { String result = dialog.InputResult; //add member if (CommonLogic.GetInstance().AddMember(CommonLogic.GetInstance().Storage.Members, result)) { //add member to ui MemberItem member = new MemberItem(); member.MemberName.SetText(result); member.Index = CommonLogic.GetInstance().Storage.Members.Count - 1; _listBox.AddItem(member); } }; dialog.Show(this); }; //StartButton StartButton = new ButtonStand("Make a Chance!"); StartButton.SetStyle(Styles.GetButtonStyle()); StartButton.SetMargin(0, 5, 0, 5); StartButton.SetShadow(5, 0, 4, Color.FromArgb(150, 0, 0, 0)); StartButton.EventMouseClick += (sender, args) => { if (CommonLogic.GetInstance().Storage.Members == null || CommonLogic.GetInstance().Storage.Members.Count == 0) { return; } CommonLogic.GetInstance().StartRandom(CommonLogic.GetInstance().Storage.Members); UpdateUI(); }; //adding AddItems( title, layout ); layout.AddItems( AddButton, _listBox, StartButton ); //load save file if (CommonLogic.GetInstance().Storage.Members.Count > 0) { RestoreItems(); } }