//Gtk.Action actOpen = new Gtk.Action("Open", "Open", "Open file", Stock.Open); public MainWindow() : base("TikzEdt ") { (GlobalUI.UI as GlobalUIGTK).MainForm = this; ScintillaDocumentWrapper.TheOneAndOnly = txtCode; TheVM = new MainWindowVM <ScintillaDocumentWrapper>(TheCompiler.Instance); rasterControl1 = rasterControl1Box.RasterControl; rasterControl1.Rasterizer = rasterControl1.TheRasterModel; txtStatus.Buffer.TagTable.Add(new TextTag("red") { Foreground = "red" }); //txtCode.LexerLanguage = "html"; txtCode.Lexer = 4; // html Resize(800, 600); Destroyed += (s, e) => Application.Quit(); myLabel.Text = "Hello World!!!!"; CreateMenus(); CreateToolBars(); VBox vb = new VBox(false, 0); vb.PackStart(mainMenu, false, false, 0); vb.PackStart(mainToolbar, false, false, 0); vb.PackStart(toolsToolbar, false, false, 0); HBox hb = new HBox(false, 0); hb.PackStart(toolsPaneBar, false, false, 0); ScrolledWindow scrw = txtStatusWnd = new ScrolledWindow(); scrw.Add(txtStatus); statusTabPanel.AppendPage(scrw, new Label("Status")); statusTabPanel.AppendPage(lstErrors, new Label("Errors")); scrw = new ScrolledWindow(); scrw.Add(txtTexOut); statusTabPanel.AppendPage(scrw, new Label("TeX Output")); //txtCode.SetText("This is Scintilla"); vSplitter1.Add1(txtCode); vSplitter1.Add2(statusTabPanel); vSplitter1.Position = 400; hSplitter1.Add1(vSplitter1); var sw = new ScrolledWindow(); sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; //sw.Placement = CornerType. //Alignment a = new Alignment(0.5f,0.5f,0,0); //var vv = new Table(1,1,false); //vv.Attach(rasterControl1, 0, 0, 1,1,AttachOptions.Expand, AttachOptions.Expand, 0,0); /*var vv = new VBox(); * var vh = new HBox(); * vv.PackStart(rasterControl1, true, false, 0); * vh.PackStart(vv, true, false, 0);*/ Alignment al = new Alignment(.5f, .5f, 0, 0); al.Add(rasterControl1Box); sw.Add(al); hSplitter1.Add2(sw); hSplitter1.Position = 350; hSplitter2.Add1(new TextView()); hSplitter2.Add2(hSplitter1); hSplitter2.Position = 150; hb.PackStart(hSplitter2, true, true, 0); vb.PackStart(hb, true, true, 0); statusBar.PackStart(new Alignment(.5f, .5f, 1, 1), true, true, 0); statusBar.PackStart(lblStandAlone, false, false, 0); statusBar.PackStart(new Label("Grid"), false, false, 0); statusBar.PackStart(cmbGrid, false, false, 0); statusBar.PackStart(new Label("RS"), false, false, 0); statusBar.PackStart(txtRadialSteps, false, false, 0); statusBar.PackStart(new Label("RO"), false, false, 0); statusBar.PackStart(txtRadialOffset, false, false, 0); //statusBar.PackStart(new Separator(), false, false, 0); Button b = new Button(Stock.ZoomOut); //b.Label = ""; statusBar.PackStart(b); statusBar.PackStart(scZoom); statusBar.PackStart(new Button(Stock.ZoomIn)); vb.PackEnd(statusBar, false, false, 0); Add(vb); SetupBindings(); ShowAll(); }
/// <summary> /// Initializes a new instance of the <see cref="Scrabble.GUI.ScrabbleWindow"/> class. /// </summary> /// <param name='isClient'> /// Is client. /// </param> /// <exception cref='System.NullReferenceException'> /// Is thrown when there is an attempt to dereference a null object reference. /// </exception> public ScrabbleWindow(bool isClient = false) : base(Gtk.WindowType.Toplevel) { #region Basic window properties // Basic window properties this.Title = "Scrabble - Hrací deska" + (isClient ? " (klient)" : ""); this.Name = "MainWindow"; this.DoubleBuffered = true; this.SetPosition(WindowPosition.Center); this.Icon = Scrabble.Game.InitialConfig.icon; this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent); this.DefaultWidth = 550; this.DefaultHeight = 700; #endregion this.client = isClient; if (Scrabble.Game.InitialConfig.game == null) { throw new System.NullReferenceException("During Scrabble main widow initialization is Scrabble.Game.InitialConfig.game == null"); } this.game = Scrabble.Game.InitialConfig.game; // General GUI classes this.menu = new MenuHover(this); this.desk = new Desk(this.game); this.rack = new Rack(this.game); this.control = new Control(this.game); this.info = new Info(this.game); this.bottomVbox = new VBox(true, 4); this.bottomVbox.PackStart(rack); this.bottomVbox.PackEnd(control); this.bottomVbox.ShowAll(); this.vertical = new HPaned(); this.vertical.HeightRequest = 100; // Use only CLIENT clientNotice = new Label(); clientNotice.Markup = "<b>Čekám</b> na aktualizaci dat o hře."; clientNotice.TooltipText = "Na portu " + Scrabble.Game.InitialConfig.port.ToString(); // STATUSBAR statusbar = new Statusbar(); statusbar.HeightRequest = 20; statusbar.Homogeneous = true; StatusLabelLast = new Label("Poslední tah:"); StatusLabelBest = new Label("Nejlepší tah:"); OnTurnLabel = new Label("Na tahu:"); statusbar.PackStart(OnTurnLabel, false, false, 0); statusbar.Add(StatusLabelLast); statusbar.PackEnd(StatusLabelBest, false, false, 0); // Vertical divide at bottom this.vertical = new HPaned(); this.vertical.HeightRequest = 100; this.vertical.Add1(bottomVbox); this.vertical.Add2(info); this.mainVbox = new VBox(false, 5); if (isClient) { this.mainVbox.PackStart(clientNotice, false, false, 5); } else { this.mainVbox.PackStart(menu.menuBar, false, false, 0); } this.mainVbox.Add(desk); this.mainVbox.Add(vertical); this.mainVbox.PackEnd(statusbar, false, false, 0); this.Add(mainVbox); this.changePlayer(game.GetActualPlayer()); if (isClient) { DisableButtons(); } }
// private MenuButton languageSelectorButton; public RoboPad(WindowType type, String[] args) : base(type) { noOfWindows++; SetDefaultSize(500, 500); Maximize(); DeleteEvent += (sender, s) => { if (!isChangeSaved) { MessageDialog dialog = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.OkCancel, "Changes Unsaved Are You Sure You Want To Exit "); // Dialog dialog=new Dialog() var response = dialog.Run(); noOfWindows--; if (response == (int)Gtk.ResponseType.Ok) { if (noOfWindows <= 0) { Gtk.Application.Quit(); } } else { s.RetVal = true; } dialog.Dispose(); } else { noOfWindows--; if (noOfWindows <= 0) { Gtk.Application.Quit(); } } }; VBox vBox = new VBox(); List <String> newTextList = new(); var lm = LanguageManager.Default; sourceView = new(); sourceView.Buffer.HighlightSyntax = true; sourceView.WrapMode = WrapMode.Word; sourceView.AutoIndent = true; sourceView.ShowLineNumbers = true; StyleSchemeManager schemeManager = StyleSchemeManager.Default; // StyleScheme styleScheme = schemeManager.GetScheme("pop-light"); // sourceView.Buffer.StyleScheme = styleScheme; sourceView.KeyPressEvent += (o, eventArgs) => { if (Keyval.Name(eventArgs.Event.KeyValue) == "s") { saveFile(o, eventArgs); } else if (Keyval.Name(eventArgs.Event.KeyValue) == "S") { saveAsFile(o, eventArgs); } else if (Keyval.Name(eventArgs.Event.KeyValue) == "o") { openFile(o, eventArgs); } }; headerBar = new HeaderBar(); ScrolledWindow scrolledWindow = new ScrolledWindow(); scrolledWindow.Add(sourceView); headerBar.ShowCloseButton = true; headerBar.Title = "RoboPad"; headerBarOringalText = headerBar.Title; sourceView.Buffer.Changed += (sender, eventArgs) => { headerBar.Title = "*" + headerBarOringalText; if (sourceView.Buffer.Text != previousText) { isChangeSaved = false; } else { isChangeSaved = true; headerBar.Title = headerBarOringalText; } }; ToolButtonHandler toolbar = new ToolButtonHandler(this, sourceView); // Menu menu = new Menu(); // MenuItem openItem = new RadioMenuItem("test"); // menu.Add(openItem); // // menu.ShowAll(); // PopOverMenuHandler popoverMenu = new(this); MenuButton menuButton = new MenuButton(); menuButton.Popover = popoverMenu; Image image = Gtk.Image.NewFromIconName("view-more-symbolic", IconSize.LargeToolbar); menuButton.Image = image; headerBar.PackEnd(menuButton); Statusbar statusbar = new Statusbar(); statusBarLabel = new(""); statusbar.PackStart(statusBarLabel, false, false, 5); languageSelectorButton = new LanguageSelectorButton(sourceView); statusbar.PackEnd(languageSelectorButton, false, false, 5); // Box box = new Box(Gtk.Orientation.Vertical,2); Titlebar = headerBar; vBox.PackStart(toolbar, false, false, 0); vBox.PackStart(scrolledWindow, true, true, 0); vBox.PackStart(statusbar, false, false, 0); Add(vBox); ShowAll(); Show(); if (args != null) { if (args.Length >= 1) { if (!String.IsNullOrWhiteSpace(args[0])) { openFileWithArgs(args[0]); } } } }