private void CreateColorControl(ControlBase parent, string name) { GroupBox colorGroup = new GroupBox(parent); colorGroup.Text = name; colorGroup.Name = name + "groupbox"; DockLayout layout = new DockLayout(colorGroup); ColorDisplay disp = new ColorDisplay(layout); disp.Height = Util.Ignore; disp.Dock = Dock.Left; disp.Name = name; TextBoxNumeric numeric = new TextBoxNumeric(layout); numeric.Dock = Dock.Right; numeric.FitToText = "000"; numeric.Name = name + "Box"; numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; HorizontalSlider slider = new HorizontalSlider(layout); slider.Dock = Dock.Fill; slider.VerticalAlignment = VerticalAlignment.Center; slider.SetRange(0, 255); slider.Name = name + "Slider"; slider.ValueChanged += SlidersMoved; }
private void CreateControls() { VerticalLayout colorControlLayout = new VerticalLayout(this); colorControlLayout.Dock = Dock.Fill; CreateColorControl(colorControlLayout, "Red"); CreateColorControl(colorControlLayout, "Green"); CreateColorControl(colorControlLayout, "Blue"); CreateColorControl(colorControlLayout, "Alpha"); GroupBox finalGroup = new GroupBox(this); finalGroup.Dock = Dock.Right; finalGroup.Text = "Result"; finalGroup.Name = "ResultGroupBox"; DockLayout finalLayout = new DockLayout(finalGroup); ColorDisplay disp = new ColorDisplay(finalLayout); disp.Dock = Dock.Fill; disp.Name = "Result"; disp.Width = Util.Ignore; disp.Height = Util.Ignore; }
public MonoGameGuiManager CreateGui( ) { var textureAtlas = new TextureAtlas("Atlas1"); var upRegion = textureAtlas.AddRegion("cog", 48, 0, 47, 47); var cogRegion = textureAtlas.AddRegion("up", 0, 0, 47, 47); _gui = new MonoGameGuiManager(_game.GraphicsDevice, _game.Content); _gui.LoadContent(new GuiContent(textureAtlas, "ExampleFont.fnt", "ExampleFont_0")); var screen = new Screen(800, 480); var dockLayout = new DockLayout(); var gridLayout = new GridLayout(1, 2); var leftStackLayout = new StackLayout() { Orientation = Orientation.Vertical, VerticalAlignment = VerticalAlignment.Bottom }; //var loadRubeFileBtn = CreateButton(cogRegion); //var dumpRubeFileBtn = CreateButton(upRegion); dockLayout.Items.Add(new DockItem(gridLayout, DockStyle.Bottom)); // dumpRubeFileBtn.Tag = "dump"; //loadRubeFileBtn.Tag = "load"; //leftStackLayout.Items.Add(loadRubeFileBtn); // leftStackLayout.Items.Add(dumpRubeFileBtn); gridLayout.Items.Add(new GridItem(leftStackLayout, 0, 0)); screen.Items.Add(dockLayout); _gui.Screen = screen; return(_gui); }
/// <summary> /// Creates dock window from view. /// </summary> /// <param name="target">The target dock.</param> /// <param name="source">The source dock.</param> /// <param name="sourceIndex">The source view index.</param> /// <param name="context">The context object.</param> /// <returns>The new instance of the <see cref="IDockWindow"/> class.</returns> public static IDockWindow CreateWindow(this IDock target, IDock source, int sourceIndex, object context) { var view = source.Views[sourceIndex]; source.RemoveView(sourceIndex); var dockStrip = new DockStrip { Id = nameof(DockStrip), CurrentView = view, Views = new ObservableCollection <IDock> { view } }; var dockLayout = new DockLayout { Id = nameof(DockLayout), CurrentView = dockStrip, Views = new ObservableCollection <IDock> { dockStrip } }; var window = new DockWindow() { Id = nameof(DockWindow), Layout = dockLayout }; target.AddWindow(window); target.Factory?.Update(window, context); return(window); }
internal void Save(DockControl dockControl) { DockLayout layout = dockControl.Save(); textBox.Text = XamlWriter.Save(layout); Show(DockControl); }
private void MakePanelVisible(DockPanel parent, DockPanel child) { DockLayout dockLayout = (DockLayout)parent.GetType().GetProperty("DockLayout", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(parent, null); dockLayout.GetType().GetField("firstVisibleTabIndex", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(dockLayout, parent.Controls.IndexOf(child)); dockLayout.GetType().GetMethod("LayoutChanged", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(dockLayout, null); }
public MonoGameGuiManager CreateGui( ) { var textureAtlas = new TextureAtlas("Atlas1"); var upRegion = textureAtlas.AddRegion("cog", 48, 0, 47, 47); var cogRegion = textureAtlas.AddRegion("up", 0, 0, 47, 47); _gui = new MonoGameGuiManager(_game.GraphicsDevice, _game.Content); _gui.LoadContent(new GuiContent(textureAtlas, "ExampleFont.fnt", "ExampleFont_0")); var screen = new Screen(800, 480); var dockLayout = new DockLayout(); var gridLayout = new GridLayout(1, 2); var leftStackLayout = new StackLayout() { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Bottom }; var loadRubeFileBtn = CreateButton(cogRegion); var dumpRubeFileBtn = CreateButton(upRegion); dockLayout.Items.Add(new DockItem(gridLayout, DockStyle.Bottom)); dumpRubeFileBtn.Tag = "dump"; loadRubeFileBtn.Tag = "load"; leftStackLayout.Items.Add(loadRubeFileBtn); leftStackLayout.Items.Add(dumpRubeFileBtn); gridLayout.Items.Add(new GridItem(leftStackLayout, 0, 0)); screen.Items.Add(dockLayout); _gui.Screen = screen; return _gui; }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { DockLayout.Save(m_DockPanel); MouseRobot.IsRecording = false; MouseRobot.IsPlaying = false; }
Rectangle GetTabRectByIndex(int index, DockLayout dockLayout, Rectangle bounds, bool isVertical) { Rectangle tabRect = bounds; for (int i = 0; i < dockLayout.Count; i++) { int size = GetTabButtonWidth(dockLayout[i]); if (isVertical) { tabRect = new Rectangle(tabRect.X, tabRect.Y, tabRect.Width, size); if (i == index) { return(tabRect); } tabRect.Y += size + TabButtonsInterval; } else { tabRect = new Rectangle(tabRect.X, tabRect.Y, size, tabRect.Height); if (i == index) { return(tabRect); } tabRect.X += size + TabButtonsInterval; } } return(tabRect); }
public override int GetButtonWidth(DockLayout dockLayout, AppearanceObject appearance, bool isHorizontal) { int result = 0; Graphics g = Painter.AddGraphics(null); if (dockLayout.Tabbed) { try { int imageSize = (isHorizontal ? GetImageSize(dockLayout).Width : GetImageSize(dockLayout).Height); int defImageSize = (isHorizontal ? GetDefaultImageSize(dockLayout).Width : GetDefaultImageSize(dockLayout).Height); int imageInterval = (imageSize > 0 ? HideBarHorzInterval : 0); for (int i = 0; i < dockLayout.Count; i++) { if (dockLayout[i].Visibility == DockVisibility.Visible) { layout = dockLayout[i]; int width = GetTabButtonWidth(dockLayout[i]); result += width + TabButtonsInterval; } } } finally { Painter.ReleaseGraphics(); } } else { return(base.GetButtonWidth(dockLayout, appearance, isHorizontal)); } return(result); }
public override void OnLoading() { base.OnLoading(); _topInfoComponent = new TopInfoComponent(this) { Header = Translator.Translate("task"), LeftButtonControl = new Image { Source = ResourceManager.GetImage("topheading_back") }, ArrowVisible = false }; _taskCommentTextView = (TextView)GetControl("TaskCommentTextView", true); _wrapUnwrapImage = (Image)GetControl("WrapUnwrapImage", true); _taskFinishedButton = (HorizontalLayout)GetControl("TaskFinishedButton", true); _taskRefuseButton = (HorizontalLayout)GetControl("TaskRefuseButton", true); _taskFinishedButtonTextView = (TextView)GetControl("TaskFinishedButtonTextView", true); _taskRefuseButtonTextView = (TextView)GetControl("TaskRefuseButtonTextView", true); _taskFinishedButtonImage = (Image)GetControl("TaskFinishedButtonImage", true); _taskRefuseButtonImage = (Image)GetControl("TaskRefuseButtonImage", true); _taskCommentEditText = (MemoEdit)GetControl("TaskCommentEditText", true); _rootLayout = (DockLayout)GetControl(0); _topInfoComponent.ActivateBackButton(); _isReadOnly = (bool)Variables[Parameters.IdIsReadonly]; _currentEvent = DBHelper.GetEventByID($"{Variables[Parameters.IdCurrentEventId]}"); _userId = (DbRef)DBHelper.GetUserInfoByUserName(Settings.User)["Id"]; }
internal ListViewItemContainer() { this.VerticalAlignment = LayoutAlignment.Fill; this._swipeItem = new ListViewSwipeItem() { HorizontalAlignment = LayoutAlignment.Fill, VerticalAlignment = LayoutAlignment.Fill, IconSize = new Size(30, 30), }; this.Children.Add(this._swipeItem, DockRegion.CenterOverlay); this._contentLayout = new DockLayout() { VerticalAlignment = LayoutAlignment.Fill, HorizontalAlignment = LayoutAlignment.Fill, }; this.Children.Add(this._contentLayout, DockRegion.CenterOverlay); this._commandBar = new CommandBar() { IsVisible = false, }; this._contentLayout.Children.Add(this._commandBar, DockRegion.Bottom); this.GestureRecognizer = new SwipeGestureRecognizer(this); }
private void InitFields() { _choosedPaymentType = 0; _paymentTypeTextView = (TextView)GetControl("7c46a01e25b34835b7ff98f6debfeac0", true); _rootDockLayout = (DockLayout)GetControl("07ec0239c319491eb406a40e1183d9b5", true); _changeHorizontalLayout = (HorizontalLayout)GetControl("c129ed940d97427fa7cd303171370fde", true); _enteredSumEditText = (EditText)GetControl("778f105408c745b48d4eab7bff782e72", true); _cashNotEnoughTextView = (TextView)GetControl("fde6ae3fe5e946b88a13eb305372e38d", true); _punchButtonLayout = (VerticalLayout)GetControl("2551f8ad1b2749d3847581fd124c841b", true); _printImage = (Image)GetControl("ecd5c17d8f904d368bb5ef92bae35447", true); _changeTextView = (TextView)GetControl("fa4aad30428344f7ac60ca62f721f67a", true); _paymentTypes = new Dictionary <object, string> { { "0", Translator.Translate("cash") }, { "1", Translator.Translate("cashless") }, { "2", Translator.Translate("bonuses") }, { "3", Translator.Translate("bottles") } }; _fptr = FptrInstance.Instance; _eventId = (string)Variables.GetValueOrDefault(Parameters.IdCurrentEventId, string.Empty); _readonly = (bool)Variables.GetValueOrDefault(Parameters.IdIsReadonly, false); _wasStarted = (bool)Variables.GetValueOrDefault(Parameters.IdWasEventStarted, true); _enteredSumEditText.Mask = @"^(\+|\-)?\d+([\.\,]\d{0,2})*$"; _enteredSumEditText.Required = true; }
public DockLayoutRenderer( DockLayout layout) : base(layout) { this._dockLayout = new NativeDockLayout(); this.SetNativeElement(this._dockLayout); }
private void LoadControls() { _rootLayout = (DockLayout)Variables["RootLayout"]; _startFinishButton = (VerticalLayout)Variables.GetValueOrDefault("StartFinishButton"); _startButton = (Button)Variables.GetValueOrDefault("StartButton"); _refuseButton = (Button)Variables.GetValueOrDefault("RefuseButton"); _statusImage = (Image)Variables.GetValueOrDefault("StatusImage"); }
private void DockDO_Click(object sender, RoutedEventArgs e) { if (TargetPanel.LayoutDefinitions[0] is DockLayout) { DockLayout dl = (DockLayout)TargetPanel.LayoutDefinitions[0]; dl.LastChildFill = !dl.LastChildFill; } }
internal override View GenerateLayout(ObservableCollection <ButtonItem> items, ButtonItem mainButton, bool isOpen) { _itemsContainer = GenerateItems(items, isOpen); _dockLayout = new DockLayout(); _dockLayout.Children.Add(_itemsContainer); _dockLayout.Children.Add(mainButton); return(_dockLayout); }
public TextPad(ControlBase parent) : base(parent) { StartPosition = StartPosition.CenterParent; Size = new Size(400, 300); Padding = new Padding(1, 0, 1, 1); Title = "TextPad"; DockLayout layout = new DockLayout(this); layout.Dock = Dock.Fill; MenuStrip menuStrip = new MenuStrip(layout); menuStrip.Dock = Dock.Top; MenuItem fileMenu = menuStrip.AddItem("File"); fileMenu.Menu.AddItem("Open...", String.Empty, "Ctrl+O").SetAction((s, a) => OnOpen(s, a)); fileMenu.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction((s, a) => OnSave(s, a)); fileMenu.Menu.AddItem("Save As...").SetAction((s, a) => OnSaveAs(s, a)); fileMenu.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction((s, a) => Close()); m_Font = Skin.DefaultFont.Copy(); m_Font.FaceName = "Courier New"; StatusBar statusBar = new StatusBar(layout); statusBar.Dock = Dock.Bottom; Label length = new Label(statusBar); length.Margin = new Margin(5, 0, 5, 0); Label label = new Label(statusBar); label.Margin = new Margin(5, 0, 5, 0); label.Text = "Length:"; Label lines = new Label(statusBar); lines.Margin = new Margin(5, 0, 5, 0); label = new Label(statusBar); label.Margin = new Margin(5, 0, 5, 0); label.Text = "Lines:"; m_TextBox = new MultilineTextBox(layout); m_TextBox.Dock = Dock.Fill; m_TextBox.ShouldDrawBackground = false; m_TextBox.Font = m_Font; m_TextBox.TextChanged += (sender, arguments) => { lines.Text = m_TextBox.TotalLines.ToString(); length.Text = m_TextBox.Text.Length.ToString(); }; m_TextBox.Text = ""; m_Path = null; }
private void loadlayout(string spath) { StreamReader sr = new StreamReader(spath, Encoding.Default); string s = sr.ReadToEnd(); sr.Close(); DockLayout layout = (DockLayout)XamlReader.Load(new XmlTextReader(new StringReader(s))); CloseAll(); c1.Load(layout, LoadDockItem); }
protected int GetTabButtonWidth(DockLayout layout) { AppearanceObject appearance = layout.DockManager.ActivePanel == layout.Panel ? layout.ActiveTabAppearance : layout.TabsAppearance; Graphics g = Painter.AddGraphics(null); int imageSize = (layout.IsHorizontal ? GetImageSize(layout).Width : GetImageSize(layout).Height); int defImageSize = (layout.IsHorizontal ? GetDefaultImageSize(layout).Width : GetDefaultImageSize(layout).Height); int imageInterval = (imageSize > 0 ? HideBarHorzInterval : 0); int width = Math.Max(DockElementsPainter.CalcTextSize(g, appearance, layout.TabText).Width + imageSize + imageInterval, defImageSize) + 10; Painter.ReleaseGraphics(); return(width); }
public RadioButtonPicker() { this._buttonsLayout = new DockLayout() { HorizontalAlignment = LayoutAlignment.Center, VerticalAlignment = LayoutAlignment.Fill, }; this.Size = new Size(Dimension.Auto, 60); this.Items = new RadioButtonItemCollection(this); this.Content = this._buttonsLayout; }
public CommandBar() { this._buttonsLayout = new DockLayout() { HorizontalAlignment = LayoutAlignment.Fill, VerticalAlignment = LayoutAlignment.Fill, }; this._primaryButtons = new CommandBarButtonCollection(this, DockRegion.Left); this._secondaryButtons = new CommandBarButtonCollection(this, DockRegion.Right); this.HorizontalAlignment = LayoutAlignment.Fill; this.VerticalAlignment = LayoutAlignment.Start; this.Content = this._buttonsLayout; }
public FlyoutButton() { this._innerButton = new InnerButton(this) { HorizontalAlignment = LayoutAlignment.Fill, VerticalAlignment = LayoutAlignment.Fill, }; this._layout = new DockLayout(); //this._layout.IsClippedToBounds = false; this._layout.Children.Add( this._innerButton, DockRegion.CenterOverlay); this.Content = this._layout; }
public MenuBar() { this._buttonsLayout = new DockLayout() { HorizontalAlignment = LayoutAlignment.Center, VerticalAlignment = LayoutAlignment.Fill, }; this.HorizontalAlignment = LayoutAlignment.Fill; this.VerticalAlignment = LayoutAlignment.Start; this.Size = new Size(Dimension.Auto, 50); this.MenuItems = new MenuItemCollection(this); this.Content = this._buttonsLayout; }
//TODO: бомбануло private void B672E6Cf63784Ca9A44Eaa6024E0B11B() { _dontSendChecksTextView = (TextView)GetControl("d93a34ef373b48939b2bf3a588b6e9b1", true); _dotSendChecksDataTextView = (TextView)GetControl("19931320adbd4fbf9f2bb2f6ae765677", true); _connectedStatusTextView = (TextView)GetControl("c3ec25a698d140e89086926246db8e2f", true); _isConnectedImage = (VerticalLayout)GetControl("ab27dfe251704c82a835a85088e98c2b", true); _connectionButtonImage = (VerticalLayout)GetControl("83841f90385143248d8e865eed46ee3a", true); _connectionButtonDescriptionTextView = (TextView)GetControl("cde826477edc449faefce13edf3da0ed", true); _rootLayout = (DockLayout)GetControl("a2dc5f6557284abe92f6d343ade27192", true); }
private void OpenWindowWithMenuAndStatusBar(ControlBase control, EventArgs args) { Window window = new Window(this); window.Title = String.Format("Window ({0})", ++m_WindowCount); window.Size = new Size(m_Rand.Next(200, 400), m_Rand.Next(200, 400)); window.Left = m_Rand.Next(700); window.Top = m_Rand.Next(400); window.Padding = new Padding(1, 0, 1, 1); DockLayout layout = new DockLayout(window); MenuStrip menuStrip = new MenuStrip(layout); menuStrip.Dock = Dock.Top; /* File */ { MenuItem root = menuStrip.AddItem("File"); root.Menu.AddItem("Load", "test16.png", "Ctrl+L"); root.Menu.AddItem("Save", String.Empty, "Ctrl+S"); root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A"); root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction((c, a) => window.Close()); } /* Resizing */ { MenuItem root = menuStrip.AddItem("Resizing"); root.Menu.AddItem("Disabled").SetAction((c, a) => window.Resizing = Resizing.None); root.Menu.AddItem("Width").SetAction((c, a) => window.Resizing = Resizing.Width); root.Menu.AddItem("Height").SetAction((c, a) => window.Resizing = Resizing.Height); root.Menu.AddItem("Both").SetAction((c, a) => window.Resizing = Resizing.Both); } StatusBar statusBar = new StatusBar(layout); statusBar.Dock = Dock.Bottom; statusBar.Text = "Status bar"; { Button br = new Button(statusBar); br.Text = "Right button"; statusBar.AddControl(br, true); } }
public ColorPickersTest(ControlBase parent) : base(parent) { /* RGB Picker */ { ColorPicker rgbPicker = new ColorPicker(this); rgbPicker.Dock = Net.Dock.Top; rgbPicker.ColorChanged += ColorChanged; } /* HSVColorPicker */ { HSVColorPicker hsvPicker = new HSVColorPicker(this); hsvPicker.Dock = Net.Dock.Fill; hsvPicker.HorizontalAlignment = Net.HorizontalAlignment.Left; hsvPicker.VerticalAlignment = Net.VerticalAlignment.Top; hsvPicker.ColorChanged += ColorChanged; } /* HSVColorPicker in Window */ { WindowTest window = new WindowTest(base.GetCanvas()); window.Size = new Net.Size(300, 200); window.Collapse(); DockLayout layout = new DockLayout(window); HSVColorPicker hsvPicker = new HSVColorPicker(layout); hsvPicker.Margin = Net.Margin.Two; hsvPicker.Dock = Net.Dock.Fill; hsvPicker.ColorChanged += ColorChanged; Button OpenWindow = new Button(this); OpenWindow.Dock = Net.Dock.Bottom; OpenWindow.HorizontalAlignment = Net.HorizontalAlignment.Left; OpenWindow.Text = "Open Window"; OpenWindow.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { window.Show(); }; } }
public FlowLayoutTest(ControlBase parent) : base(parent) { ControlBase layout = new DockLayout(this); FlowLayout flowLayout = new FlowLayout(layout); flowLayout.Width = 200; flowLayout.Padding = Net.Padding.Five; flowLayout.Dock = Net.Dock.Fill; flowLayout.DrawDebugOutlines = true; { Button button; int buttonNum = 1; const int buttonCount = 10; for (int n = 0; n < buttonCount; n++) { button = new Button(flowLayout); button.VerticalAlignment = Net.VerticalAlignment.Top; button.HorizontalAlignment = Net.HorizontalAlignment.Left; button.Margin = Net.Margin.Five; button.Padding = Net.Padding.Five; button.ShouldDrawBackground = false; button.Text = String.Format("Button {0}", buttonNum++); button.SetImage("test16.png", ImageAlign.Above); } } HorizontalSlider flowLayoutWidth = new HorizontalSlider(layout); flowLayoutWidth.Margin = Net.Margin.Five; flowLayoutWidth.Width = 500; flowLayoutWidth.Dock = Net.Dock.Top; flowLayoutWidth.Min = 50; flowLayoutWidth.Max = 500; flowLayoutWidth.Value = flowLayout.Width; flowLayoutWidth.ValueChanged += (control, args) => { flowLayout.Width = (int)flowLayoutWidth.Value; }; }
private void Initialize() { //var vl = new VerticalLayout(); //AddChild(vl); _dl = new DockLayout(); _dl.Id = "ID Of DockLayout"; _dl.OnClick += dl_OnClick; _dl.AddChild(new Button("Back", Back_OnClick)); AddChild(_dl); //vl.AddChild(new Button("Change Visibility Of DL", ChangeVisibilityOfDL_OnClick)); //vl.AddChild(new Button("Back", Back_OnClick)); //vl.AddChild(_dl); //_dl.AddChild(new TextView("ALLOHA DL")); //_dl.AddChild(new TextView("ALLOHA DL2")); //отображается только две текствьюхи //_dl.AddChild(new TextView("ALLOHA DL3")); //_dl.AddChild(new TextView("ALLOHA DL4")); }
public override void DrawHideBarButton(DrawHideBarButtonArgs args) { Rectangle bounds = args.Bounds; Rectangle tabRect = bounds, activeTabBounds = bounds; DockLayout dockLayout = args.DockLayout; if (args.DockLayout.Tabbed) { for (int i = 0; i < dockLayout.Count; i++) { int size = GetTabButtonWidth(dockLayout[i]); if (args.IsVertical) { if (dockLayout.ActiveChildIndex != i) { DrawInactiveTabContainerItem(args, dockLayout[i], GetTabRectByIndex(i, dockLayout, bounds, args.IsVertical), i == 0, false); } } else { if (dockLayout.ActiveChildIndex != i) { DrawInactiveTabContainerItem(args, dockLayout[i], GetTabRectByIndex(i, dockLayout, bounds, args.IsVertical), i == 0, false); } } } activeTabBounds = GetTabRectByIndex(args.DockLayout.ActiveChildIndex, dockLayout, bounds, args.IsVertical); dockLayout = args.DockLayout.ActiveChild; bounds = activeTabBounds; args = new DrawHideBarButtonArgs(args, activeTabBounds, args.IsActive, ObjectState.Normal); } DrawHideBarButtonEdges(args); if (dockLayout == null) { return; } DrawHideBarControlButtonContent(args, bounds, dockLayout, null, EdgePositions.None); }
private void SetWindowTheme(ThemeBase theme, bool emptyLayout = false) { if (!emptyLayout) { DockLayout.Save(m_DockPanel); DockLayout.CloseAllContents(m_DockPanel); } m_CurrentTheme = theme; m_DockPanel.Theme = theme; EnableVSDesignForToolstrips(m_VsVersion, theme); if (m_DockPanel.Theme.ColorPalette != null) { statusStrip.BackColor = m_DockPanel.Theme.ColorPalette.MainWindowStatusBarDefault.Background; } if (!emptyLayout) { DockLayout.Restore(m_DockPanel); } }
private ILayoutControl CreateOptionsScreen(TextureAtlas textureAtlas) { var dockLayout = new DockLayout(); var stackLayout = new StackLayout() { HorizontalAlignment = HorizontalAlignment.Centre, VerticalAlignment = VerticalAlignment.Centre }; var toggleButton = new ToggleButton(new VisualStyle(textureAtlas.GetRegion("TickButton")), new VisualStyle(textureAtlas.GetRegion("CrossButton"))) { Text = "Music", }; stackLayout.Controls.Add(toggleButton); dockLayout.Controls.Add(new DockItem(stackLayout, DockStyle.Fill)); var backButton = CreateScalingButton(textureAtlas.GetRegion("BackButton")); backButton.HorizontalAlignment = HorizontalAlignment.Left; backButton.Clicked += (s, e) => _gui.RootLayout = CreateTitleScreen(textureAtlas); dockLayout.Controls.Add(new DockItem(backButton, DockStyle.Bottom)); return dockLayout; }
private ILayoutControl CreateTitleScreen(TextureAtlas textureAtlas) { var layout = new DockLayout(); var stackLayout = new StackLayout() { HorizontalAlignment = HorizontalAlignment.Centre, VerticalAlignment = VerticalAlignment.Centre }; var titleImage = new Image(new VisualStyle(textureAtlas.GetRegion("CraftworkGUI"))) { Margin = new Margin(0, 0, 0, 40) }; stackLayout.Controls.Add(titleImage); var playButton = CreateScalingButton(textureAtlas.GetRegion("PlayButton")); stackLayout.Controls.Add(playButton); layout.Controls.Add(new DockItem(stackLayout, DockStyle.Fill)); var optionsButton = CreateScalingButton(textureAtlas.GetRegion("CogButton")); optionsButton.VerticalAlignment = VerticalAlignment.Bottom; optionsButton.Clicked += (s, e) => _gui.RootLayout = CreateOptionsScreen(textureAtlas); layout.Controls.Add(new DockItem(optionsButton, DockStyle.Left)); var socialStackLayout = new StackLayout() { VerticalAlignment = VerticalAlignment.Bottom }; var facebookButton = CreateTiltingButton(textureAtlas.GetRegion("Facebook"), 0.1f); facebookButton.Clicked += (s, e) => Process.Start("https://www.facebook.com/CraftworkGames"); socialStackLayout.Controls.Add(facebookButton); var twitterButton = CreateTiltingButton(textureAtlas.GetRegion("Twitter"), -0.1f); twitterButton.Clicked += (s, e) => Process.Start("https://twitter.com/craftworkgames"); socialStackLayout.Controls.Add(twitterButton); layout.Controls.Add(new DockItem(socialStackLayout, DockStyle.Right)); return layout; }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); var textureAtlas = new TextureAtlas("ExampleAtlas2.png"); var playRegion = textureAtlas.AddRegion("play", 0, 0, 128, 128); var upRegion = textureAtlas.AddRegion("up", 128, 0, 64, 64); var cogRegion = textureAtlas.AddRegion("cog", 128, 64, 64, 64); var twitterRegion = textureAtlas.AddRegion("twitter", 417, 1, 62, 62); var facebookRegion = textureAtlas.AddRegion("facebook", 353, 1, 62, 62); var titleRegion = textureAtlas.AddRegion("title", 0, 435, 448, 77); //var tickRegion = textureAtlas.AddRegion("tick", 192, 0, 64, 64); //var crossRegion = textureAtlas.AddRegion("cross", 192, 64, 64, 64); //var pauseRegion = textureAtlas.AddRegion("pause", 256, 0, 64, 64); //var resetRegion = textureAtlas.AddRegion("reset", 256, 64, 64, 64); //var boxRegion = textureAtlas.AddRegion("box", 496, 0, 16, 16); //var redRegion = textureAtlas.AddRegion("red", 0, 164, 128, 111); //var blueRegion = textureAtlas.AddRegion("blue", 0, 276, 128, 111); //var squareRegion = textureAtlas.AddRegion("square", 128, 164, 128, 128); //var greenSquareRegion = textureAtlas.AddRegion("greenSquare", 256, 164, 128, 128); _gui = new MonoGameGuiManager(GraphicsDevice, Content); _gui.LoadContent(new GuiContent(textureAtlas, "ExampleFont.fnt", "ExampleFont_0.png")); var backgroundRegion = _gui.LoadTexture("Background.png"); var screen = new Screen(800, 480); var dockLayout = new DockLayout(); var gridLayout = new GridLayout(1, 2); var leftStackLayout = new StackLayout() { Orientation = Orientation.Horizontal, VerticalAlignment = VerticalAlignment.Bottom }; var rightStackLaout = new StackLayout() { Orientation = Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Right }; var playButton = CreateButton(playRegion); var cogButton = CreateButton(cogRegion); var upButton = CreateButton(upRegion); var facebookButton = new Button(new VisualStyle(twitterRegion)) { HoverStyle = new VisualStyle(twitterRegion) { Rotation = 0.05f } }; var twitterButton = new Button(new VisualStyle(facebookRegion)) { HoverStyle = new VisualStyle(facebookRegion) { Rotation = 0.05f } }; var titleImage = new Image(new VisualStyle(titleRegion)) { Margin = new Margin(0, 50, 0, 0) }; _timeLabel = new Label() { Height = 32 }; screen.Background = new VisualStyle(backgroundRegion); dockLayout.Items.Add(new DockItem(playButton, DockStyle.Fill)); dockLayout.Items.Add(new DockItem(gridLayout, DockStyle.Bottom)); dockLayout.Items.Add(new DockItem(_timeLabel, DockStyle.Top)); dockLayout.Items.Add(new DockItem(titleImage, DockStyle.Top)); leftStackLayout.Items.Add(cogButton); leftStackLayout.Items.Add(upButton); rightStackLaout.Items.Add(facebookButton); rightStackLaout.Items.Add(twitterButton); gridLayout.Items.Add(new GridItem(leftStackLayout, 0, 0)); gridLayout.Items.Add(new GridItem(rightStackLaout, 0, 1)); screen.Items.Add(dockLayout); _gui.Screen = screen; facebookButton.Clicked += (object sender, EventArgs e) => Process.Start("https://www.facebook.com/CraftworkGames"); twitterButton.Clicked += (object sender, EventArgs e) => Process.Start("https://twitter.com/craftworkgames"); }