static void AddField(string codename, string showname, bool dirbrowser = false) { var sbox = new HBox(); var ilab = new Label(showname); var itxt = new TextView(); var ibrw = new Button("Browse"); var ibox = new HBox(); sbox.SetSizeRequest(500, 25); ilab.SetSizeRequest(250, 25); ibox.SetSizeRequest(250, 25); itxt.SetSizeRequest(250, 25); ibrw.SetSizeRequest(60, 25); ibox.BorderWidth = 1; ilab.Justify = Justification.Left; sbox.ResizeChildren(); sbox.Add(ilab); sbox.Add(ibox); ibox.Add(itxt); Fields[codename] = itxt; if (dirbrowser) { itxt.SetSizeRequest(190, 25); ibox.Add(ibrw); Browse[codename] = ibrw; Browse2Source[ibrw] = codename; ibrw.Clicked += DirBrowser; } MainBox.Add(sbox); }
static public void NewTime(VBox pg, string name) { var tbox = new HBox(); var tp = new Label("time"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0); var nm = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0); #if RottenBackGround tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0)); #else tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0)); #endif var timebox = new HBox(); timebox.SetSizeRequest(400, 25); var uur = new ComboBox(SR(0, 23, 2)); var minuut = new ComboBox(SR(0, 59, 2)); var seconde = new ComboBox(SR(0, 59, 2)); tbox.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0)); timebox.Add(uur); timebox.Add(new Label(":")); timebox.Add(minuut); timebox.Add(new Label(":")); timebox.Add(seconde); objlink[uur] = name; objlink[minuut] = name; objlink[seconde] = name; uur.Changed += OnTime; minuut.Changed += OnTime; seconde.Changed += OnTime; tbox.Add(tp); tbox.Add(nm); tbox.Add(timebox); MainClass.Times[name] = new MyTime(uur, minuut, seconde); pg.Add(tbox); }
static public void NewDate(VBox pg, string name) { var tbox = new HBox(); var tp = new Label("date"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0); var nm = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0); #if RottenBackGround tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0)); #else tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0)); #endif var datebox = new HBox(); datebox.SetSizeRequest(400, 25); var month = new ComboBox(months); var day = new ComboBox(SR(1, 31)); var year = new ComboBox(SR(MyDate.yearmin, MyDate.yearmax)); var week = new Label("---"); tbox.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0)); tbox.Add(tp); tbox.Add(nm); tbox.Add(datebox); datebox.Add(week); datebox.Add(month); datebox.Add(day); datebox.Add(year); objlink[day] = name; objlink[month] = name; objlink[year] = name; MainClass.Dates[name] = new MyDate(week, day, month, year); day.Changed += OnDate; month.Changed += OnDate; year.Changed += OnDate; pg.Add(tbox); }
static void TagsInit(VBox panel) { TagList = new ListBox("Tags"); TagEditBox = new HBox(); TagEditBox.SetSizeRequest(1000, 30); var sw = new ScrolledWindow(); panel.Add(sw); var tv = TagList.Gadget; sw.Add(tv); var lb1 = new Label("Head"); lb1.ModifyFg(StateType.Normal, new Gdk.Color(0, 180, 255)); var lb2 = new Label("Content"); lb2.ModifyFg(StateType.Normal, new Gdk.Color(0, 180, 255)); var lb3 = new Label("Icon"); lb3.ModifyFg(StateType.Normal, new Gdk.Color(0, 180, 255)); TagEditHead = new Entry(); RequireTag.Add(TagEditHead); TagEditEntry = new Entry(); RequireTag.Add(TagEditEntry); TagEditIcon = new Entry(); RequireTag.Add(TagEditIcon); TagEditBox.Add(lb1); TagEditBox.Add(TagEditHead); TagEditBox.Add(lb2); TagEditBox.Add(TagEditEntry); TagEditBox.Add(lb3); TagEditBox.Add(TagEditIcon); panel.Add(TagEditBox); TagList.Gadget.RulesHint = true; RequireProject.Add(TagList.Gadget); TagList.Gadget.CursorChanged += OnTagSelect; TagEditHead.Changed += OnEditTag; TagEditEntry.Changed += OnEditTag; TagEditIcon.Changed += OnEditTag; }
public static void AddEntry(string id, string caption, bool browse = false) { var label = new Label(caption); label.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 0)); var entry = new Entry(); Button browsebutton; entry.ModifyText(StateType.Normal, new Gdk.Color(0, 180, 255)); entry.ModifyBase(StateType.Normal, new Gdk.Color(0, 18, 25)); label.SetSizeRequest(300, 30); label.SetAlignment(0, 0); var mybox = new HBox(); mybox.Add(label); mybox.Add(entry); if (browse) { entry.SetSizeRequest(250, 30); browsebutton = new Button("..."); browsebutton.SetSizeRequest(50, 30); browsebutton.ModifyBg(StateType.Normal, new Gdk.Color(255, 255, 0)); browsebutton.ModifyBg(StateType.Active, new Gdk.Color(255, 180, 0)); browsebutton.ModifyBg(StateType.Prelight, new Gdk.Color(255, 255, 180)); browsebutton.Clicked += OnBrowse; mybox.Add(browsebutton); } else { entry.SetSizeRequest(300, 30); } Data[id] = entry; DataID[entry] = id; entry.Changed += OnEntry; mybox.SetSizeRequest(600, 30); workbox.Add(mybox); }
public static void Init() { MKL.Lic("Development Log - GUI.cs", "GNU General Public License 3"); MKL.Version("Development Log - GUI.cs", "21.08.28"); Application.Init(); win = new MainWindow(); win.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0)); win.SetSizeRequest(1200, 800); win.Resizable = false; win.Title = $"Development log - version {MKL.Newest} - Coded by: Tricky"; Tabber = new Notebook(); Tabber.SetSizeRequest(1000, 770); Tabber.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 20)); Console = new TextView(); Console.Editable = false; Console.ModifyFont(Pango.FontDescription.FromString("Courier 18")); Console.SizeAllocated += new SizeAllocatedHandler(ConsoleDOWN); Prompt = new Entry(); var overlord = new VBox(); var superior = new HBox(); var sidebar = new VBox(); sidebar.SetSizeRequest(200, 770); var mainarea = new VBox(); var cscroll = new ScrolledWindow(); var promptbar = new HBox(); InitSidebar(sidebar); win.Add(overlord); overlord.Add(superior); superior.SetSizeRequest(1200, 600); overlord.Add(cscroll); cscroll.SetSizeRequest(1200, 170); cscroll.Add(Console); overlord.Add(promptbar); promptbar.SetSizeRequest(1200, 30); promptbar.Add(Prompt); var pOk = new Button("Ok"); pOk.SetSizeRequest(50, 30); pOk.Clicked += AndACTION; Prompt.Activated += AndACTION; Prompt.SetSizeRequest(1150, 30); promptbar.Add(pOk); Console.ModifyBase(StateType.Normal, new Gdk.Color(0, 20, 0)); Console.ModifyText(StateType.Normal, new Gdk.Color(0, 255, 0)); Prompt.ModifyBase(StateType.Normal, new Gdk.Color(25, 18, 0)); Prompt.ModifyText(StateType.Normal, new Gdk.Color(255, 180, 0)); superior.Add(sidebar); superior.Add(mainarea); mainarea.Add(Tabber); GeneralInit(NewTab("General")); TagsInit(NewTab("Tags")); InitEntries(NewTab("Entries")); InitPrefix(NewTab("AutoPrefix")); InitHistory(NewTab("Command History")); WriteLn("Welcome to Devlog!"); WriteLn("Coded by: Tricky"); WriteLn($"(c) 2016-20{qstr.Left(MKL.Newest,2)} Jeroen P. Broks"); WriteLn("Released under the terms of the General Public License v3\n"); AutoEnable(); //#if KEYDEBUG //WriteLn("KEYDEBUG is set!"); //Prompt.KeyPressEvent += KeyDebug; //Prompt.KeyPressEvent += StoreProperty; //#endif }
static public void Configure(Gdk.EventConfigure args) { Girl.SetSizeRequest(390, 364); MenuBoxRoot.SetSizeRequest(args.Width - 390, 364); WorkBox.SetSizeRequest(args.Width, args.Height - 364); ListRecords.SetSizeRequest(250, args.Height - 364); Pages.SetSizeRequest(args.Width - 250, args.Height - 364); }
public static void Main(string[] args) { MKL.Version("ScenLang - Creation Wizard - ScenLangCreate.cs", "18.10.23"); MKL.Lic("ScenLang - Creation Wizard - ScenLangCreate.cs", "GNU General Public License 3"); JCR6_lzma.Init(); Application.Init(); MainWindow win = new MainWindow(); win.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 25)); win.Title = "ScenLang Creator - version " + MKL.Newest; win.SetSizeRequest(1000, 500); var mainbox = new HBox(); win.Add(mainbox); mainbox.SetSizeRequest(400, 500); var mascot = new Image(); mascot.SetAlignment(0, 1); mainbox.Add(mascot); LoadMascot(mascot); mascot.SetSizeRequest(400, 500); workbox = new VBox(); mainbox.Add(workbox); workbox.SetSizeRequest(600, 500); AddEntry("Project", "Project directory:", true); AddEntry("Author", "Author:"); AddEntry("License", "License:"); var langbox = new HBox(); langbox.SetSizeRequest(600, 380); var langlabel = new Label("Laguages:\n(Put every language on a new line)"); langlabel.SetSizeRequest(300, 380); langlabel.SetAlignment(0, 0); langlabel.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 0)); var scroll = new ScrolledWindow(); Languages = new TextView(); scroll.Add(Languages); scroll.SetSizeRequest(300, 380); Languages.ModifyBase(StateType.Normal, new Gdk.Color(0, 18, 25)); Languages.ModifyText(StateType.Normal, new Gdk.Color(0, 180, 255)); langbox.Add(langlabel); langbox.Add(scroll); workbox.Add(langbox); var finbox = new HBox(); var goforit = new Button("Create Project"); finbox.Add(new HBox()); finbox.Add(goforit); goforit.Clicked += OnGoForIt; workbox.Add(finbox); win.ShowAll(); Application.Run(); }
static Entry GeneralAdd(VBox Panel, string codename, string Caption) { //,GenCallBack MyCallBack){ var e = new Entry(); var l = new Label(Caption); l.ModifyFg(StateType.Normal, EntryLabel); var b = new HBox(); b.SetSizeRequest(1000, 30); e.SetSizeRequest(500, 30); l.SetSizeRequest(500, 30); b.Add(l); b.Add(e); Panel.Add(b); RequireProject.Add(e); GenEntries[codename] = e; // e.Changed += MyCallBack; // C# FAILED! return(e); }
static public void NewBool(VBox pg, string name) { var but1 = new RadioButton("True"); but1.SetAlignment(0, 0); var but2 = new RadioButton(but1, "False"); but2.SetAlignment(0, 0); var tbox = new HBox(); var tp = new Label("bool"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0); var nm = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0); #if RottenBackGround tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0)); #else tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0)); #endif tbox.Add(tp); tbox.Add(nm); var bbox = new HBox(); bbox.SetSizeRequest(400, 25); bbox.Add(but1); but1.SetSizeRequest(200, 25); bbox.Add(but2); but2.SetSizeRequest(200, 25); tbox.Add(bbox); pg.Add(tbox); but1.ModifyText(StateType.Normal, new Gdk.Color(0, 255, 0)); but2.ModifyText(StateType.Normal, new Gdk.Color(255, 0, 0)); but1.ModifyBg(StateType.Normal, new Gdk.Color(180, 255, 180)); but2.ModifyBg(StateType.Normal, new Gdk.Color(255, 180, 180)); //bbox.ModifyBase(StateType.Normal, new Gdk.Color(180, 180, 100)); but1.Child.ModifyFg(StateType.Normal, new Gdk.Color(0, 255, 0)); but2.Child.ModifyFg(StateType.Normal, new Gdk.Color(255, 0, 0)); but1.Child.ModifyFg(StateType.Active, new Gdk.Color(50, 255, 50)); but2.Child.ModifyFg(StateType.Active, new Gdk.Color(255, 50, 50)); but1.Child.ModifyFg(StateType.Prelight, new Gdk.Color(150, 255, 150)); but2.Child.ModifyFg(StateType.Prelight, new Gdk.Color(255, 150, 150)); MainClass.RBTbools[name] = but1; MainClass.RBFbools[name] = but2; MyDataBase.fields[name] = "bool"; MyDataBase.defaults[name] = "TRUE"; objlink[but1] = name; objlink[but2] = name; but1.Toggled += OnBoolean; }
static public void NewColor(VBox pg, string name) { var tbox = new HBox(); var tp = new Label("color"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0); var nm = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0); #if RottenBackGround tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0)); #else tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0)); #endif tbox.Add(tp); tbox.Add(nm); var colbox = new HBox(); colbox.SetSizeRequest(400, 25); var r = new Entry("0"); r.SetSizeRequest(75, 25); var g = new Entry("0"); g.SetSizeRequest(75, 25); var b = new Entry("0"); b.SetSizeRequest(75, 25); var but = new Button("Pick"); but.SetSizeRequest(100, 25); MainClass.Colors[name] = new MyColor(nm, r, g, b); objlink[r] = name; objlink[g] = name; objlink[b] = name; objlink[but] = name; r.Changed += OnColor; g.Changed += OnColor; b.Changed += OnColor; MyDataBase.fields[name] = "color"; MyDataBase.defaults[name] = "255;255;255"; colbox.Add(new Label("R")); colbox.Add(r); r.ModifyBase(StateType.Normal, new Gdk.Color(0x0f, 0x00, 0x00)); r.ModifyText(StateType.Normal, new Gdk.Color(0xff, 0x00, 0x00)); colbox.Add(new Label("G")); colbox.Add(g); g.ModifyBase(StateType.Normal, new Gdk.Color(0x00, 0x0f, 0x00)); g.ModifyText(StateType.Normal, new Gdk.Color(0x00, 0xff, 0x00)); colbox.Add(new Label("B")); colbox.Add(b); b.ModifyBase(StateType.Normal, new Gdk.Color(0x00, 0x0f, 0x00)); b.ModifyText(StateType.Normal, new Gdk.Color(0x00, 0x00, 0xff)); colbox.Add(but); but.Clicked += PickColor; tbox.Add(colbox); pg.Add(tbox); }
public static void Main(string[] args) { InitExporters(); Application.Init(); Window tWin = new Window("MyData"); tWin.Resize(400, 400); if (!ChooseTheFile(tWin, args)) { return; } tWin.Hide(); //TestIncbin(win); // debug ONLY! if (!MyDataBase.Load(filename)) { return; } win = new MainWindow(); QuickGTK.MyMainWindow = win; win.Title = filename + " - MyData - Coded by Tricky"; win.ModifyBg(StateType.Normal, new Gdk.Color(12, 0, 16)); win.ModifyFg(StateType.Normal, new Gdk.Color(180, 0, 255)); MainBox = new VBox(); HeadBox = new HBox(); SetIcon(win); ButNew.SetSizeRequest(203, 121); ButDupe.SetSizeRequest(203, 121); ButRemove.SetSizeRequest(203, 121); ButRename.SetSizeRequest(203, 121); ButForceMod.SetSizeRequest(203, 121); ButSave.SetSizeRequest(203, 121); HeadBox.Add(Girl); HeadBox.Add(MenuBoxRoot); //Girl.SetSizeRequest(390, 364); //MenuBoxRoot.SetSizeRequest(1000 - 390, 364); MenuBoxRoot.Add(MenuBoxRow1); MenuBoxRow1.SetSizeRequest(1000 - 390, 114); MenuBoxRoot.Add(MenuBoxRow2); MenuBoxRow2.SetSizeRequest(1000 - 390, 114); MenuBoxRoot.Add(MenuBoxRow3); MenuBoxRow3.SetSizeRequest(1000 - 390, 114); MenuBoxRow1.Add(ButNew); MenuBoxRow1.Add(ButDupe); MenuBoxRow1.Add(ButRemove); MenuBoxRow2.Add(ButRename); MenuBoxRow2.Add(ButForceMod); MenuBoxRow2.Add(ButSave); foreach (Button butt in new Button[] { ButNew, ButDupe, ButRemove, ButRename, ButForceMod, ButSave }) { butt.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 120)); butt.ModifyBg(StateType.Prelight, new Gdk.Color(0, 120, 0)); butt.ModifyBg(StateType.Insensitive, new Gdk.Color(120, 0, 0)); butt.Child.ModifyFg(StateType.Normal, new Gdk.Color(0, 180, 255)); butt.Child.ModifyFg(StateType.Prelight, new Gdk.Color(180, 255, 0)); butt.Child.ModifyFg(StateType.Insensitive, new Gdk.Color(255, 0, 0)); } MainBox.Add(HeadBox); MainBox.Add(WorkBox); ButRemove.Clicked += OnRemove; ButRemove.Sensitive = false; ButRename.Sensitive = false; ButRename.Clicked += OnRename; ButDupe.Sensitive = false; ButDupe.Clicked += OnDupe; ButForceMod.Clicked += OnForceMod; ButForceMod.Sensitive = false; ButNew.Clicked += OnNewRecord; ButSave.Sensitive = false; ButSave.Clicked += OnSave; //ListRecords.SetSizeRequest(250, 800); var tvc = new TreeViewColumn(); var NameCell = new CellRendererText(); tvc.Title = "Records"; tvc.PackStart(NameCell, true); tvc.AddAttribute(NameCell, "text", 0); ListRecords.HeightRequest = 800 - 390; ListRecords.AppendColumn(tvc); ListRecords.RulesHint = true; //ListRecords.ModifyBg(StateType.Normal, new Gdk.Color(0, 0x3, 0)); ListRecords.ModifyText(StateType.Normal, new Gdk.Color(0, 0xf, 0)); ListRecords.ModifyBase(StateType.Selected, new Gdk.Color(0xb, 0xf, 0)); ListRecords.ModifyText(StateType.Selected, new Gdk.Color(0xbf, 0xff, 0)); //ListRecords.RowActivated += OnSelectRecord; ListRecords.CursorChanged += OnSelectRecord; //ListRecords.CursorChanged += OnSelectRecord; var ListRecordsScroll = new ScrolledWindow(); ListRecordsScroll.Add(ListRecords); WorkBox.Add(ListRecordsScroll); WorkBox.Add(Pages); Pages.ModifyBg(StateType.Normal, new Gdk.Color(4, 0, 0)); Pages.ModifyText(StateType.Normal, new Gdk.Color(255, 255, 0)); //WorkBox.SetSizeRequest(1000, 800 - 390); win.Add(MainBox); win.Resize(1000, 800); Pages.Sensitive = false; QI_Label.ModifyFg(StateType.Normal, new Gdk.Color(255, 0, 180)); QI_Input.ModifyText(StateType.Normal, new Gdk.Color(255, 0, 180)); QI_Input.ModifyBase(StateType.Normal, new Gdk.Color(25, 0, 18)); QI_Confirm.ModifyBg(StateType.Normal, new Gdk.Color(180, 0, 100)); QI_Confirm.ModifyBg(StateType.Prelight, new Gdk.Color(190, 0, 120)); MenuBoxInput.Add(QI_Label); MenuBoxInput.Add(QI_Input); MenuBoxInput.Add(QI_Confirm); QI_Confirm.SetSizeRequest(250, 21); QI_Input.SetSizeRequest(500, 21); QI_Label.SetSizeRequest(250, 21); QI_Confirm.Clicked += OnQIConfirm; MenuBoxRoot.Add(MenuBoxInput); win.ShowAll(); MenuBoxInput.Hide(); // Only show when requested Application.Run(); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); ModifyBg(StateType.Normal, new Gdk.Color(50, 50, 50)); //Design VBox allContent = new VBox(false, 2); //Alignment hAllign = new Alignment(0, 0, 0, 0); //hBox.PackStart(hAllign, false, false, 1); //connectionStatus.SetSizeRequest(50, 50); Label compLabel = new Label("Compression Ratio"); Label imgSizeLabel = new Label("Image size"); Label colorDepthLabel = new Label("Color depth"); Label FPSLabel = new Label("Frames per second"); strImgSize.Value = 300; FPS.Value = 60; Label uncprsDataLable = new Label("Uncopressed data"); Label cprsDataLabel = new Label("Compressed data"); Label cycleReceiveLAbel = new Label("Receive cycles per second"); Label cycleSendLabel = new Label("Sending cycles per second"); Label thrSleepLabel = new Label("Thread sleep time"); rightSide.Add(imgSizeLabel); rightSide.Add(strImgSize); rightSide.Add(compLabel); rightSide.Add(strImgCompression); rightSide.Add(colorDepthLabel); rightSide.Add(strImgCD); rightSide.Add(FPSLabel); rightSide.Add(FPS); rightSide.Add(cycleReceiveLAbel); rightSide.Add(cycleSpeedReceive); rightSide.Add(cycleSendLabel); rightSide.Add(cycleSpeedSend); rightSide.Add(thrSleepLabel); rightSide.Add(thrSleepTime); //rightSide.Add(connectionStatus); rightSide.Add(aliveMeter); //rightSide.Add(currIP); rightSide.Add(uncprsDataLable); rightSide.Add(dataAmount); rightSide.Add(cprsDataLabel); rightSide.Add(compressedDataAmount); Alignment vAlignRP = new Alignment(0, 0, 1, 0); vAlignRP.Add(rightSide); vAlignRP.SetSizeRequest(200, 300); VBox connectPart = new VBox(true, 0); Button connectBtn = new Button("Connect"); connectBtn.Pressed += NetworkLogic.ConnectBtnPressed; connectPart.Add(connectIP); connectPart.Add(connectBtn); Alignment vAlignConnect = new Alignment(0, 0, 1, 0); vAlignConnect.Add(connectPart); vAlignConnect.SetSizeRequest(200, 200); Alignment consoleTop = new Alignment(0, 0, 0, 0); consoleTop.Add(consoleTxt); VBox consoleLabelHolder = new VBox(false, 0); consoleLabelHolder.PackStart(consoleTop); consoleLabelHolder.SetSizeRequest(500, 500); HBox mainBox = new HBox(false, 0); mainBox.SetSizeRequest(600, 480); mainBox.Add(vAlignConnect); mainBox.Add(vAlignRP); mainBox.PackEnd(consoleLabelHolder); MenuBar menuBar = new MenuBar(); Menu fileMenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = fileMenu; MenuItem exit = new MenuItem("Exit"); exit.Activated += OnExitEvent; fileMenu.Append(exit); menuBar.Append(file); allContent.PackStart(menuBar, false, false, 0); allContent.PackEnd(mainBox, false, false, 0); Add(allContent); ShowAll(); Thread aMC = new Thread(AliveMeterCount); aMC.Start(); }
public MainWindow() : base(WindowType.Toplevel) { VBox mainVBox = new VBox(false, 0); HBox nodeViewHBox = new HBox(true, 0); HBox crudButtonsHBox = new HBox(true, 0); HBox transactionContolButtonsHBox = new HBox(true, 0); Button refreshButton = new Button("Refresh"); Button createButton = new Button("Create"); Button deleteButton = new Button("Delete"); Button commitButton = new Button("Commit"); Button rollbackButton = new Button("Rollback"); refreshButton.Clicked += RefreshButtonClicked; createButton.Clicked += CreateButtonClicked; deleteButton.Clicked += DeleteButtonClicked; commitButton.Clicked += CommitButtonClicked; rollbackButton.Clicked += RollbackButtonClicked; HSeparator separator = new HSeparator(); view = new NodeView(Store); CellRendererText titleRenderer = new CellRendererText(); CellRendererText contentRenderer = new CellRendererText(); titleRenderer.Editable = true; contentRenderer.Editable = true; titleRenderer.Edited += NoteTitleEdited; contentRenderer.Edited += NoteContentEdited; view.AppendColumn("Title", titleRenderer, "text", 0); view.AppendColumn("Content", contentRenderer, "text", 1); ScrolledWindow scrolledWindow = new ScrolledWindow(); scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); scrolledWindow.AddWithViewport(view); try { //Если сервер и клиент запускаются из ИДЕ (по порядку, но практически одновременно), //сервер не успевает создать сокет, поэтому надо немного подождать System.Threading.Thread.Sleep(1000); RemotingConfiguration.Configure("remoteNotes.exe.config", false); clientActivated = new NotesClientActivated(); singleton = new NotesSingleton(); singlecall = new NotesTransactionSinglecall(); } catch (System.Net.WebException) { Logger.Write("Unable to connect"); return; } foreach (Note note in singleton.GetPesistentData()) { store.AddNode(new NoteTreeNode(note)); } nodeViewHBox.PackStart(scrolledWindow, false, true, 0); nodeViewHBox.SetSizeRequest(200, 200); crudButtonsHBox.PackStart(refreshButton, false, true, 0); crudButtonsHBox.PackStart(createButton, false, true, 0); crudButtonsHBox.PackStart(deleteButton, false, true, 0); transactionContolButtonsHBox.PackStart(commitButton, false, true, 0); transactionContolButtonsHBox.PackStart(rollbackButton, false, true, 0); mainVBox.PackStart(nodeViewHBox, true, false, 0); mainVBox.PackStart(crudButtonsHBox, true, false, 0); mainVBox.PackStart(separator, true, false, 2); mainVBox.PackStart(transactionContolButtonsHBox, true, false, 0); Add(mainVBox); mainVBox.ShowAll(); Build(); }
public void InitializeWindow() { // Menubar _primaryWindowContainer = new VBox(); _primaryWindowMenuBar = new MenuBar(); _primaryMenuItemFile = new MenuItem(); _primaryWindowMenuFile = new Menu(); _primaryWindowMenuQuitItem = new MenuItem(); _primaryWindowInstallLinkHandler = new MenuItem(); _primaryMenuItemAbout = new MenuItem(); // Top level window pane. _primaryWindowPane = new HPaned(); _primaryWindowLeftContainer = new VBox(); // Left side User Settings Pane _userSettingsParentFrame = new Frame(); _userSettingsParentContainer = new VBox(); _gameInfoParentFrame = new Frame(); _gameInfoParentContainer = new VBox(); // Left Side Current State Field _currentStateFrame = new Frame(); _currentStateContainer = new Box(Orientation.Vertical, 0); _currentStateLabel = new Label(); // Left Side Game Code Fields _gameCodeParentFrame = new Frame(); _gameCodeLayoutContainer = new HBox(); _gameCodeCopyButton = new Button(); _gameCodeEntryField = new Entry(); // Left Side Websocket/Host Control _hostControlFrame = new Frame(); _hostControlLayoutContainer = new VBox(); _urlHostEntryFrame = new Frame(); _urlHostEntryLayoutContainer = new HBox(); _urlHostEntryField = new Entry(); _connectCodeParentFrame = new Frame(); _connectCodeLayoutContainer = new HBox(); _connectCodeSubmitButton = new Button(); _connectCodeEntryField = new Entry(); // Right Side Console _consoleScrolledWindow = new ScrolledWindow(); _consoleLayoutContainer = new VBox(); _consoleParentFrame = new Frame(); _consoleTextView = new TextView(); // _primaryWindowContainer.Name = "_primaryWindowContainer"; _primaryWindowContainer.PackStart(_primaryWindowMenuBar, false, false, 2); _primaryWindowContainer.PackStart(_primaryWindowPane, true, true, 0); _primaryWindowMenuBar.Name = "_primaryWindowMenuBar"; _primaryWindowMenuBar.Append(_primaryMenuItemFile); _primaryWindowMenuBar.Append(_primaryMenuItemAbout); _primaryMenuItemFile.Name = "_primaryMenuItemFile"; _primaryMenuItemFile.Label = "File"; _primaryMenuItemFile.Submenu = _primaryWindowMenuFile; _primaryMenuItemAbout.Name = "_primaryMenuItemAbout"; _primaryMenuItemAbout.Label = "About"; _primaryMenuItemAbout.Activated += _primaryWindowMenuItemAbout_Activated; _primaryWindowMenuFile.Name = "_primaryWindowMenu"; _primaryWindowMenuFile.Append(_primaryWindowInstallLinkHandler); _primaryWindowMenuFile.Append(_primaryWindowMenuQuitItem); _primaryWindowMenuQuitItem.Name = "_primaryWindowMenuQuitItem"; _primaryWindowMenuQuitItem.Label = "Quit"; _primaryWindowMenuQuitItem.Activated += _primaryWindowMenuQuitItem_Activated; _primaryWindowInstallLinkHandler.Name = "_primaryWindowInstallLinkHandler"; _primaryWindowInstallLinkHandler.Label = "One-Click Connection Management"; _primaryWindowInstallLinkHandler.Activated += _primaryWindowInstallLinkWindow_Dialog; // _primaryWindowPane definition (splitContainer1) _primaryWindowPane.Name = "_primaryWindowPane"; _primaryWindowPane.SetSizeRequest(824, 476); _primaryWindowPane.Position = 180; _primaryWindowPane.Pack1(_primaryWindowLeftContainer, true, false); _primaryWindowPane.Pack2(_consoleParentFrame, true, false); _primaryWindowLeftContainer.PackStart(_userSettingsParentFrame, true, true, 10); _primaryWindowLeftContainer.Name = "_primaryWindowLeftContainerH"; _primaryWindowLeftContainer.Margin = 5; // UserSettings _userSettingsParentFrame.Label = "Settings"; _userSettingsParentFrame.Name = "_userSettingsParentFrame"; _userSettingsParentFrame.SetSizeRequest(276, 274); _userSettingsParentFrame.Add(_userSettingsParentContainer); _userSettingsParentContainer.Margin = 5; _userSettingsParentContainer.PackStart(_gameInfoParentFrame, true, false, 10); _userSettingsParentContainer.PackStart(_hostControlFrame, true, false, 10); _userSettingsParentContainer.Name = "_userSettingsParentContainer"; _gameInfoParentFrame.Name = "_gameInfoParentFrame"; _gameInfoParentFrame.Label = "Game Information"; _gameInfoParentFrame.SetSizeRequest(55, 40); _gameInfoParentFrame.Add(_gameInfoParentContainer); _gameInfoParentContainer.Name = "_gameInfoParentContainer"; _gameInfoParentContainer.PackStart(_currentStateFrame, true, false, 10); _gameInfoParentContainer.PackStart(_gameCodeParentFrame, true, false, 10); _gameInfoParentContainer.Margin = 5; // CurrentStateFrame _currentStateFrame.Add(_currentStateContainer); _currentStateFrame.Label = "Current State"; _currentStateFrame.Name = "_currentStateFrame"; _currentStateFrame.SetSizeRequest(55, 40); // CurrentStateBox _currentStateContainer.Name = "_currentStateContainer"; _currentStateContainer.SetSizeRequest(55, 40); _currentStateContainer.PackStart(_currentStateLabel, true, false, 5); _currentStateContainer.Halign = Align.Center; _currentStateContainer.Valign = Align.Center; // CurrentState _currentStateLabel.Name = "_currentStateLabel"; _currentStateLabel.Text = "Disconnected"; // // GAME CODE UI BLOCK // // _gameCodeParentFrame _gameCodeParentFrame.Add(_gameCodeLayoutContainer); _gameCodeParentFrame.Name = "_gameCodeParentFrame"; _gameCodeParentFrame.Label = "Game Code"; _gameCodeLayoutContainer.Name = "_gameCodeLayoutContainer"; _gameCodeLayoutContainer.MarginBottom = 7; _gameCodeLayoutContainer.SetSizeRequest(25, 25); _gameCodeLayoutContainer.PackStart(_gameCodeEntryField, true, false, 10); _gameCodeLayoutContainer.PackStart(_gameCodeCopyButton, true, false, 10); _gameCodeCopyButton.SetSizeRequest(20, 25); _gameCodeCopyButton.Name = "_gameModeCopyButton"; _gameCodeCopyButton.Label = "Copy"; _gameCodeCopyButton.Clicked += _gameCodeCopyButton_Click; _gameCodeEntryField.Xalign = (float)0.5; _gameCodeEntryField.SetSizeRequest(50, 20); _gameCodeEntryField.IsEditable = false; // HOST CONTROL UI BLOCK _hostControlFrame.Name = "_hostControlFrame"; _hostControlFrame.Label = "Server Connection"; _hostControlFrame.Add(_hostControlLayoutContainer); _hostControlLayoutContainer.Name = "_hostControlLayoutContainer"; _hostControlLayoutContainer.Margin = 5; _hostControlLayoutContainer.SetSizeRequest(25, 20); _hostControlLayoutContainer.PackStart(_urlHostEntryFrame, true, false, 5); _hostControlLayoutContainer.PackStart(_connectCodeParentFrame, true, false, 5); _urlHostEntryFrame.Name = "_urlHostEntryFrame"; _urlHostEntryFrame.Label = "Server URL"; _urlHostEntryFrame.Add(_urlHostEntryLayoutContainer); _urlHostEntryLayoutContainer.Name = "_urlHostEntryLayoutContainer"; _urlHostEntryLayoutContainer.SetSizeRequest(70, 20); _urlHostEntryLayoutContainer.PackStart(_urlHostEntryField, true, false, 5); _urlHostEntryLayoutContainer.MarginBottom = 5; _connectCodeParentFrame.Name = "_connectCodeParentFrame"; _connectCodeParentFrame.Label = "Connect Code"; _connectCodeParentFrame.Add(_connectCodeLayoutContainer); _connectCodeLayoutContainer.Name = "_connectCodeLayoutContainer"; _connectCodeLayoutContainer.SetSizeRequest(25, 20); _connectCodeLayoutContainer.PackStart(_connectCodeEntryField, true, false, 5); _connectCodeLayoutContainer.PackStart(_connectCodeSubmitButton, true, false, 5); _connectCodeLayoutContainer.MarginBottom = 5; _connectCodeEntryField.Name = "_connectCodeEntryField"; _connectCodeEntryField.Xalign = (float)0.5; _connectCodeEntryField.SetSizeRequest(70, 20); _connectCodeEntryField.MaxLength = 8; _connectCodeSubmitButton.Name = "_connectCodeSubmitButton"; _connectCodeSubmitButton.Label = "Submit"; _connectCodeSubmitButton.SetSizeRequest(30, 20); _connectCodeSubmitButton.Clicked += _connectCodeSubmitButton_Click; _connectCodeSubmitButton.CanDefault = true; // Right Side _consoleParentFrame.Name = "_consoleParentFrame"; _consoleParentFrame.Label = "Console"; _consoleParentFrame.Add(_consoleLayoutContainer); _consoleLayoutContainer.Name = "_consoleLayoutContainer"; _consoleLayoutContainer.PackStart(_consoleScrolledWindow, true, true, 5); _consoleLayoutContainer.Margin = 5; _consoleScrolledWindow.Name = "_consoleScrolledWindow"; _consoleScrolledWindow.Add(_consoleTextView); _consoleTextView.Name = "_consoleTextView"; _consoleTextView.Editable = false; _consoleTextView.WrapMode = WrapMode.Word; //_autoScrollCheckMenuItem.Name = "_autoscrollMenuItem"; _consoleTextView.PopulatePopup += _consoleTextView_OnPopulateContextMenu; _consoleTextView.Buffer.Changed += _consoleTextView_BufferChanged; SetDefaultSize(824, 476); Add(_primaryWindowContainer); }
public MainDemograftSim() { window = new Window("HDemografiSim"); window.DeleteEvent += (o, eargs) => { Application.Quit(); eargs.RetVal = true; }; window.ModifyBg(StateType.Normal, new Gdk.Color(130, 130, 160)); ageDistribution = new HIndexedChartLine("Age Distribution", new DColor(250, 100, 255)); ageDistribution.AddPoints(); ageDistributionChart = new HChart("Age chart", ageDistribution); AddDefaultToAgeDist(); populationLine = new HIndexedChartLine("Population", new DColor(200, 140, 255)); populationChart = new HChart("Population chart", populationLine); RecalculatePopulation(); birthRate = new HIndexedChartLine("Birth rate", new DColor(100, 140, 255)); deathRate = new HIndexedChartLine("Death rate", new DColor(55, 80, 180)); rateChart = new HChart("Rates Chart", birthRate, deathRate); //RecalculateRates (0, 2, 1000); //RecalculateRates (0, 2, 1000); chanceOfDeath = new HStandardChartLine("Chance of death", new DColor(255, 80, 180)); chanceOfDeath.AddPoint(0, 0.003f); chanceOfDeath.AddPoint(4, 0.001f); chanceOfDeath.AddPoint(8, 0.0005f); chanceOfDeath.AddPoint(16, 0.001f); chanceOfDeath.AddPoint(25, 0.0005f); chanceOfDeath.AddPoint(60, 0.003f); chanceOfDeath.AddPoint(80, 0.01f); chanceOfDeath.AddPoint(90, 0.03f); chanceOfDeath.AddPoint(119, 0.4f); chanceOfDeath.AddPoint(120, 0f); how1000PeopleDie = new HIndexedChartLine("How 1000 people die", new DColor(255, 20, 40)); chanceOfDeathChart = new HDoubleChart("Death Chart", new HChartLine[] { how1000PeopleDie }, chanceOfDeath); OnChanceOfDeathUpdated(); var charts = new Table(2, 2, true); charts.SetRowSpacing(0, 10); charts.SetColSpacing(0, 10); charts.Attach(ageDistributionChart, 0, 1, 0, 1); charts.Attach(populationChart, 1, 2, 0, 1); charts.Attach(chanceOfDeathChart, 0, 1, 1, 2); charts.Attach(rateChart, 1, 2, 1, 2); var prevYear = new Button("Prev Year"); prevYear.Clicked += (sender, e) => PrevYear(); var nextYear = new Button("Next Year"); nextYear.Clicked += (sender, e) => NextYear(); var clearHistory = new Button("Halv history"); clearHistory.Clicked += (sender, e) => ClearHistory(); var traceCharts = new Button("Tace age distribution"); traceCharts.Clicked += (sender, e) => TraceCharts(); var shrinkCharts = new Button("Shrink Charts"); shrinkCharts.Clicked += (sender, e) => ShrinkCharts(); var fertilityRateLabel = new Label("Fertility rate:"); fertilityRateLabel.ModifyFont(Pango.FontDescription.FromString("Sans 12")); fertilitySpinner = new SpinButton(0, 100, 0.01f); fertilitySpinner.Value = 2.1f; fertilitySpinner.SnapToTicks = false; var fertilitySettings = new HBox(false, 1); fertilitySettings.SetSizeRequest(10, -1); fertilitySpinner.ModifyBg(StateType.Normal, new Gdk.Color(150, 190, 200)); fertilitySettings.Add(fertilityRateLabel); fertilitySettings.Add(fertilitySpinner); var bottomBar = new Table(1, 8, false); bottomBar.SetSizeRequest(-1, 30); bottomBar.Attach(prevYear, 0, 1, 0, 1); bottomBar.Attach(nextYear, 1, 2, 0, 1); bottomBar.Attach(clearHistory, 2, 3, 0, 1); bottomBar.Attach(traceCharts, 3, 4, 0, 1); bottomBar.Attach(shrinkCharts, 4, 5, 0, 1); bottomBar.Attach(fertilitySettings, 5, 8, 0, 1); var everythingBox = new VBox(false, 1); everythingBox.PackStart(charts, true, true, 0); everythingBox.PackStart(bottomBar, false, false, 0); window.Add(everythingBox); window.ShowAll(); }
protected void Populate() { this.SetDefaultSize(1024, 768); Window pingpong = new Window(Gtk.WindowType.Toplevel); pingpong.SetDefaultSize(500, 50); pingpong.SetPosition(Gtk.WindowPosition.CenterOnParent); pingpong.Title = "Loading..."; _pulseBar = new ProgressBar(); pingpong.Add(_pulseBar); pingpong.ShowAll(); pingpong.Show(); while (_currentStrs == null) { Application.Invoke(delegate { _pulseBar.Pulse(); }); Thread.Sleep(100); } Application.Invoke(delegate { pingpong.Destroy(); this.Remove(_vbox); _vbox = new VBox(false, 10); MenuBar bar = new MenuBar(); Menu fileMenu = new Menu(); MenuItem fileMenuItem = new MenuItem("File"); fileMenuItem.Submenu = fileMenu; MenuItem exit = new MenuItem("Exit"); exit.Activated += delegate(object sender, EventArgs e) { Application.Quit(); }; MenuItem openFile = new MenuItem("Open file..."); openFile.Activated += OpenFile; fileMenu.Append(openFile); fileMenu.Append(exit); bar.Append(fileMenuItem); _vbox.PackStart(bar, false, false, 0); _regxTitle = ComboBox.NewText(); _regxTitle.Changed += HandleChanged; foreach (KeyValuePair <string, string> pair in _regexes) { _regxTitle.AppendText(pair.Key); } _regx = new Entry(); _regx.IsEditable = false; _regx.CanFocus = false; HBox comboRegexBox = new HBox(true, 10); comboRegexBox.SetSizeRequest(768, 50); comboRegexBox.PackStart(_regxTitle, false, false, 0); comboRegexBox.PackStart(_regx, true, true, 0); Button search = new Button("Search!"); search.Clicked += HandleClicked; comboRegexBox.PackStart(search, false, false, 20); _vbox.PackStart(comboRegexBox, true, true, 10); ScrolledWindow sw = new ScrolledWindow(); _tv = new TreeView(); sw.Add(_tv); CellRendererText tsText = new CellRendererText(); TreeViewColumn match = new TreeViewColumn(); match.Title = "Match"; match.PackStart(tsText, true); match.AddAttribute(tsText, "text", 0); _tv.AppendColumn(match); TreeStore store = new TreeStore(typeof(string)); foreach (string str in _currentStrs) { store.AppendValues(str); } _tv.Model = store; sw.SetSizeRequest(768, 600); _vbox.PackStart(sw, false, false, 0); this.Add(_vbox); this.ShowAll(); }); }