public static void Main(string[] args) { uint rows = 5; uint columns = 5; uint spacing = 2; Application.Init (); Window win = new Window ("Minesweeper"); var table = new global::Gtk.Table (rows, columns, false); table.RowSpacing = (spacing); table.ColumnSpacing = (spacing); for (uint row = 0; row < rows; row++) { for (uint column = 0; column < columns; column++) { var button = new Button(); button.CanFocus = true; button.Label = (string.Empty.PadLeft(5)); button.Clicked += new EventHandler(OnButtonClicked); table.Attach(button, row, row+1,column, column+1); } } table.ShowAll(); win.Add(table); win.Show (); Application.Run (); }
/// <summary> /// Defines the entry point of the application. /// </summary> private static void Main() { Application.Init(); var window = new Window("GtkSharpDemo"); var plotModel = new PlotModel { Title = "Trigonometric functions", Subtitle = "Example using the FunctionSeries", PlotType = PlotType.Cartesian, Background = OxyColors.White }; plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black }); plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green }); plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow }); var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel }; plotView.SetSizeRequest(400, 400); plotView.Visible = true; window.SetSizeRequest(600, 600); window.Add(plotView); window.Focus = plotView; window.Show(); window.DeleteEvent += (s, a) => { Application.Quit(); a.RetVal = true; }; Application.Run(); }
private void createGui(Gtk.Window app1, ChronopicRegisterPort crp, string labelStr) { chronopic_contacts_real_win = new Window("Chronopic connection"); chronopic_contacts_real_win.AllowGrow = false; chronopic_contacts_real_win.Modal = true; chronopic_contacts_real_win.TransientFor = app1; chronopic_contacts_real_win.BorderWidth = 20; chronopic_contacts_real_win.DeleteEvent += on_delete_event; Gtk.VBox vbox_main = new Gtk.VBox(false, 20); chronopic_contacts_real_win.Add(vbox_main); LogB.Information("Connecting real (starting connection)"); LogB.Information("Press test button on Chronopic"); Gtk.Label labelMessage = new Gtk.Label(); labelMessage.Text = labelStr + "\n" + "\n" + Catalog.GetString("Port") + ": " + crp.Port + "\n" + Catalog.GetString("Serial Number") + ": " + crp.SerialNumber; vbox_main.Add(labelMessage); progressbar = new Gtk.ProgressBar(); vbox_main.Add(progressbar); Gtk.Button button_cancel = new Gtk.Button("Cancel"); button_cancel.Clicked += new EventHandler(on_button_cancel_clicked); Gtk.HButtonBox hbox = new Gtk.HButtonBox(); hbox.Add(button_cancel); vbox_main.Add(hbox); chronopic_contacts_real_win.ShowAll(); }
public static void NextPlayer(string name) { var but = new Gtk.Button( ); but.TooltipMarkup = "Po kliknutí bude hrát další hráč"; HBox hbox = new HBox(); global::Gtk.Image im = new global::Gtk.Image(); Label l = new Label(); l.Markup = "Na tahu je hráč:\n <b>" + name + "</b>\n\nOK"; hbox.PackStart(im); hbox.PackEnd(l); but.Add(hbox); var win = new Gtk.Window(Gtk.WindowType.Toplevel); but.Clicked += delegate { win.HideAll(); win.Dispose(); win.Destroy(); }; win.Add(but); win.Fullscreen(); win.ShowAll(); }
public static void GameInfo() { var tabl = new Table((uint)(Scrabble.Game.InitialConfig.game.players.Length + 3), 4, true); tabl.RowSpacing = 6; tabl.ColumnSpacing = 10; tabl.BorderWidth = 10; tabl.Attach(new Label(string.Format("{0}. kolo hry, zbývá {1} nepřidělených kamenů. ", Scrabble.Game.InitialConfig.game.Round, Scrabble.Game.StonesBag.getNumberOfRemainig())), 0, 4, 0, 1); tabl.Attach(new Label(string.Format("Nejlepší tah: ", Scrabble.Game.InitialConfig.game.Round)), 0, 2, 1, 2); tabl.Attach(new Label(string.Format("{0}", Scrabble.Game.InitialConfig.game.bestMove.ToString())), 2, 4, 1, 2); tabl.Attach(new Label("Jméno hráče"), 0, 1, 2, 3); tabl.Attach(new Label("Score (celkem)"), 1, 2, 2, 3); tabl.Attach(new Label("Nejlepší tah"), 2, 3, 2, 3); tabl.Attach(new Label("Score"), 3, 4, 2, 3); for (int i = 0; i < Scrabble.Game.InitialConfig.game.players.Length; i++) { tabl.Attach(new Label(Scrabble.Game.InitialConfig.game.players[i].Name), 0, 1, (uint)i + 3, (uint)i + 4); tabl.Attach(new Label(Scrabble.Game.InitialConfig.game.players[i].Score.ToString()), 1, 2, (uint)i + 3, (uint)i + 4); tabl.Attach(new Label(Scrabble.Game.InitialConfig.game.players[i].bestMove.Word), 2, 3, (uint)i + 3, (uint)i + 4); tabl.Attach(new Label(Scrabble.Game.InitialConfig.game.players[i].bestMove.Score.ToString()), 3, 4, (uint)i + 3, (uint)i + 4); } var win = new Gtk.Window(Gtk.WindowType.Toplevel); win.Add(tabl); win.ShowAll(); }
public static void AddNewWordToDic(object sender, EventArgs e) { var win = new Gtk.Window("Přidej slovo"); win.SetPosition(WindowPosition.Mouse); Label l = new Label(); l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )"; Entry entry = new Entry(); Button b = new Button("Přidej"); VBox vbox = new VBox(); HBox hbox = new HBox(); vbox.BorderWidth = 10; vbox.PackStart(l); vbox.PackEnd(hbox); hbox.PackStart(entry); hbox.PackEnd(b); b.Clicked += delegate { game.dictionary.Add(entry.Text); win.HideAll(); win.Destroy(); win.Dispose(); }; win.Add(vbox); win.ShowAll(); }
/// <summary> /// Runs in a separate thread. /// </summary> public void DoWork() { Application.Init(); //Create the Window myWin = new Window("N'Oubliez pas les paroles - Fenêtre de contrôle"); myWin.DeleteEvent += this.OnWindowDeleteEvent; vBox = new VBox(); myWin.Add(vBox); myPlayerScoreController = new PlayerScoreController(this); vBox.Add(myPlayerScoreController.GetPaneBox()); mySongTestController = new SongTestController(this); vBox.Add(mySongTestController.GetPaneBox()); // Rend tout visible myWin.ShowAll(); // start the message pump messagePumper.Start(); Application.Run(); }
static void Main (string [] args) { Application.Init (); if (args.Length <= 0) { Console.WriteLine ("\nUSAGE: ImageBrowser.exe <directory>\n"); return; } string dir = args [0]; Gtk.Window window = new Gtk.Window ("Image Browser"); Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow (new Adjustment (IntPtr.Zero), new Adjustment (IntPtr.Zero)); ArrayList images = GetItemsFromDirectory (dir); Gtk.Table table = PopulateTable (images); window.Title = String.Format ("{0}: {1} ({2} images)", window.Title, dir, images.Count); window.SetDefaultSize (300, 200); window.DeleteEvent += Window_Delete; scroll.AddWithViewport (table); scroll.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); window.Add (scroll); window.ShowAll (); Application.Run (); }
static void Main() { Application.Init(); Gtk.Window w = new Gtk.Window("Rubik's Revenge"); ColorCube cube = new ColorCube(); CubeCanvas cubeCanvas = new CubeCanvas(); cubeCanvas.Colors = cube.colors; Box box = new HBox(true, 0); box.Add((DrawingArea)cubeCanvas); w.Add(box); w.Resize(40 * 4 * 4, 40 * 4 * 3); //w.DeleteEvent += close_window; w.ShowAll(); MainClass solver = new MainClass(cubeCanvas); Thread solverThread = new Thread(new ThreadStart(solver.solveCube)); solverThread.Start(); //solver.compare (Twist.l); Application.Run(); }
public static Gtk.Window Create () { window = new Window ("GtkComboBox"); window.SetDefaultSize (200, 100); VBox box1 = new VBox (false, 0); window.Add (box1); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); ComboBoxText combo = ComboBoxText.NewWithEntry (); combo.AppendText ("Foo"); combo.AppendText ("Bar"); combo.Changed += new EventHandler (OnComboActivated); combo.Entry.Changed += new EventHandler (OnComboEntryChanged); box2.PackStart (combo, true, true, 0); HSeparator separator = new HSeparator (); box1.PackStart (separator, false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, false, 0); Button button = new Button (Stock.Close); button.Clicked += new EventHandler (OnCloseClicked); button.CanDefault = true; box2.PackStart (button, true, true, 0); button.GrabDefault (); return window; }
internal static void DisplayItem(iPodSharp.ImageItemRecord item, string basepath) { Gtk.Window win = new Gtk.Window("iThumbnail Test"); Gtk.HBox hbox = new Gtk.HBox(); Gtk.VBox vbox = new Gtk.VBox(); win.Add(hbox); hbox.PackStart(vbox); foreach (iPodSharp.ImageDataObjectRecord file in item.Versions) { if (file.Child.CorrelationID > 1) { string path = file.Child.Path.Replace(':', '/'); path = basepath + path; Gdk.Pixbuf thumb = IthmbDb.Load(file.Child.CorrelationID, file.Child.ThumbPosition, file.Child.ThumbSize, path); Gtk.Image image = new Gtk.Image(thumb); vbox.PackStart(image); } } win.ShowAll(); }
public HeightMapSizeDialog( DoneCallback source ) { this.source = source; window = new Window ("Heightmap width and height:"); window.SetDefaultSize (200, 100); Table table = new Table( 3, 2, false ); table.BorderWidth = 20; table.RowSpacing = 20; table.ColumnSpacing = 20; window.Add(table); table.Attach(new Label("Width:"), 0, 1, 0, 1); table.Attach(new Label("Height:"), 0, 1, 1, 2); widthcombo = new Combo(); widthcombo.PopdownStrings = new string[]{"4","8","12","16","20","24","28","32"}; table.Attach(widthcombo, 1, 2, 0, 1); heightcombo = new Combo(); heightcombo.PopdownStrings = new string[]{"4","8","12","16","20","24","28","32"}; table.Attach(heightcombo, 1, 2, 1, 2); Button button = new Button (Stock.Ok); button.Clicked += new EventHandler (OnOkClicked); button.CanDefault = true; table.Attach(button, 1, 2, 2, 3); window.Modal = true; window.ShowAll(); }
float rtri; // Angle For The Triangle #endregion Fields #region Constructors public Lesson06() { // Create a new GLArea widget and request a size glarea = new GLArea (attrlist); glarea.SetSizeRequest (300, 300); // Set some event handlers glarea.ExposeEvent += OnExposed; glarea.Realized += OnRealized; glarea.Unrealized += OnUnrealized; glarea.ConfigureEvent += OnConfigure; // Create a new Vertical Box that the GLArea can live in VBox vb = new VBox (false, 0); // Pack the GLArea widget into the VBox vb.PackStart (glarea, true, true, 0); // Create a new window and name it appropriately Window win = new Window ("NeHe Lesson06"); // Pack the VBox into the window win.Add (vb); // Show all of win's contained widgets win.ShowAll (); }
public CanvasExample () { Gtk.Window win = new Gtk.Window ("Canvas example"); win.DeleteEvent += new DeleteEventHandler (Window_Delete); VBox vbox = new VBox (false, 0); win.Add (vbox); vbox.PackStart (new Label ("Drag - move object.\n" + "Double click - change color\n" + "Right click - delete object"), false, false, 0); canvas = new Canvas (); canvas.SetSizeRequest (width, height); canvas.SetScrollRegion (0.0, 0.0, (double) width, (double) height); vbox.PackStart (canvas, false, false, 0); HBox hbox = new HBox (false, 0); vbox.PackStart (hbox, false, false, 0); Button add_button = new Button ("Add an object"); add_button.Clicked += new EventHandler (AddObject); hbox.PackStart (add_button, false, false, 0); Button quit_button = new Button ("Quit"); quit_button.Clicked += new EventHandler (Quit); hbox.PackStart (quit_button, false, false, 0); win.ShowAll (); }
protected virtual void SetView (PhotoImageView view) { if (controls != null) controls.Destroy (); controls = null; this.view = view; if (view == null) return; Widget w = CreateControls (); if (w != null) { #if false ControlOverlay c = new ControlOverlay (view); c.AutoHide = false; w.ShowAll (); c.Add (w); c.Visibility = ControlOverlay.VisibilityType.Full; controls = c; #else Window win = new Window (String.Format ("{0}", GetTitle ())); win.TransientFor = (Gtk.Window) view.Toplevel; win.Add (w); win.ShowAll (); win.DeleteEvent += delegate { Destroy (); }; controls = win; #endif } }
//private static Gdk.Pixmap pixmap = null; //private static Gtk.InputDialog inputDialog = null; public static int Main15 (string[] args) { Application.Init (); win = new Gtk.Window ("Scribble XInput Demo"); win.DeleteEvent += new DeleteEventHandler (WindowDelete); vBox = new VBox (false, 0); win.Add (vBox); darea = new Gtk.DrawingArea (); darea.SetSizeRequest (200, 200); // darea.ExtensionEvents=ExtensionMode.Cursor; vBox.PackStart (darea, true, true, 0); //darea.ExposeEvent += new ExposeEventHandler (ExposeEvent); darea.ConfigureEvent += new ConfigureEventHandler (ConfigureEvent); darea.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEvent); darea.ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEvent); darea.Events = EventMask.ExposureMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask | EventMask.PointerMotionMask; inputButton = new Button("Input Dialog"); vBox.PackStart (inputButton, false, false, 0); inputButton.Clicked += new EventHandler (InputButtonClicked); quitButton = new Button("Quit"); vBox.PackStart (quitButton, false, false, 0); quitButton.Clicked += new EventHandler (QuitButtonClicked); win.ShowAll (); Application.Run (); return 0; }
public static int Main(string[] args) { Application.Init(); win = new Gtk.Window("Scribble XInput Demo"); win.DeleteEvent += new DeleteEventHandler(WindowDelete); vBox = new VBox(false, 0); win.Add(vBox); darea = new Gtk.DrawingArea(); darea.SetSizeRequest(200, 200); darea.ExtensionEvents = ExtensionMode.Cursor; vBox.PackStart(darea, true, true, 0); darea.ExposeEvent += new ExposeEventHandler(ExposeEvent); darea.ConfigureEvent += new ConfigureEventHandler(ConfigureEvent); darea.MotionNotifyEvent += new MotionNotifyEventHandler(MotionNotifyEvent); darea.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressEvent); darea.Events = EventMask.ExposureMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask | EventMask.PointerMotionMask; inputButton = new Button("Input Dialog"); vBox.PackStart(inputButton, false, false, 0); inputButton.Clicked += new EventHandler(InputButtonClicked); quitButton = new Button("Quit"); vBox.PackStart(quitButton, false, false, 0); quitButton.Clicked += new EventHandler(QuitButtonClicked); win.ShowAll(); Application.Run(); return(0); }
static void Main(string [] args) { Application.Init(); if (args.Length <= 0) { Console.WriteLine("\nUSAGE: ImageBrowser.exe <directory>\n"); return; } string dir = args [0]; Gtk.Window window = new Gtk.Window("Image Browser"); Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow(new Adjustment(IntPtr.Zero), new Adjustment(IntPtr.Zero)); ArrayList images = GetItemsFromDirectory(dir); Gtk.Table table = PopulateTable(images); window.Title = String.Format("{0}: {1} ({2} images)", window.Title, dir, images.Count); window.SetDefaultSize(300, 200); window.DeleteEvent += Window_Delete; scroll.AddWithViewport(table); scroll.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); window.Add(scroll); window.ShowAll(); Application.Run(); }
public DemoMain() { SetupDefaultIcon(); window = new Gtk.Window("Gtk# Code Demos"); window.SetDefaultSize(600, 400); window.DeleteEvent += new DeleteEventHandler(WindowDelete); HBox hbox = new HBox(false, 0); window.Add(hbox); treeView = CreateTree(); hbox.PackStart(treeView, false, false, 0); Notebook notebook = new Notebook(); hbox.PackStart(notebook, true, true, 0); notebook.AppendPage(CreateText(infoBuffer, false), new Label("_Info")); TextTag heading = new TextTag("heading"); heading.Font = "Sans 18"; infoBuffer.TagTable.Add(heading); notebook.AppendPage(CreateText(sourceBuffer, true), new Label("_Source")); window.ShowAll(); }
public static void Main() { Application.Init (); // TODO encapsulate in Global () GtkSharp.GtkGL.ObjectManager.Initialize (); Gtk.Window window = new Gtk.Window ("simple"); window.ReallocateRedraws = true; window.DeleteEvent += new DeleteEventHandler (OnDeleteEvent); int[] attrlist = {4, 8, 1, 9, 1, 10, 1, 5, 0}; glarea = new GtkGL.Area (attrlist); glarea.RequestSize = new System.Drawing.Size (200,200); glarea.Realized += new EventHandler (OnRealized); glarea.ConfigureEvent += new ConfigureEventHandler (OnConfigure); glarea.ExposeEvent += new ExposeEventHandler (OnExpose); window.Add (glarea); window.Show (); glarea.Show (); Application.Run (); }
public TabbedSkin(BasilProject project, ITaskBuilder taskBuilder) { _project = project; _tabsToTools = new System.Collections.Hashtable(); window = new Gtk.Window("WeSay"); window.SetDefaultSize(600, 400); window.DeleteEvent += new DeleteEventHandler(WindowDelete); HBox hbox = new HBox(false, 0); window.Add(hbox); Notebook notebook = new Notebook(); notebook.SwitchPage += new SwitchPageHandler(OnNotebookSwitchPage); hbox.PackStart(notebook, true, true, 0); foreach (ITask t in taskBuilder.Tasks) { VBox container = new VBox(); t.Container = container; int i = notebook.AppendPage(container, new Label(t.Label)); _tabsToTools.Add(i, t); } window.ShowAll(); }
public CategoriaListView() { TreeViewHelper t=new TreeViewHelper(treeView,"Select * from categoria"); Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh); //tengo acceso al actionGroup de IEntityListView actionGroup.Add(refreshAction); refreshAction.Activated += delegate {t.Refresh ();}; Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit); actionGroup.Add(editAction); editAction.Activated += delegate { Window ventana=new Window("Editar"); ventana.SetDefaultSize(500,500); VBox h=new VBox(true,10); ventana.Add (h); Label enunciado=new Label("Introduce el nuevo valor:"); h.Add (enunciado); Entry caja=new Entry(); h.Add (caja); Button b=new Button("Editar"); h.Add (b); b.Clicked+=delegate { IDbCommand dbCommand=App.Instance.DbConnection.CreateCommand(); dbCommand.CommandText = string.Format ("update categoria set nombre='{1}' where id={0}", t.Id,caja.Text); dbCommand.ExecuteNonQuery (); }; ventana.ShowAll(); }; }
public NowPlayingInterface () { GtkElementsService service = ServiceManager.Get<GtkElementsService> (); primary_window = service.PrimaryWindow; Contents = new NowPlayingContents (); // This is my really sweet hack - it's where the video widget // is sent when the source is not active. This keeps the video // widget from being completely destroyed, causing problems with // its internal windowing and GstXOverlay. It's also conveniently // the window that is used to do fullscreen video. Sweeeeeeeeeet. video_window = new FullscreenWindow (service.PrimaryWindow); video_window.Hidden += OnFullscreenWindowHidden; video_window.Realize (); video_window.Add (Contents); frame = new Hyena.Widgets.RoundedFrame (); frame.SetFillColor (new Cairo.Color (0, 0, 0)); frame.DrawBorder = false; frame.Show (); PackStart (frame, true, true, 0); fullscreen_adapter = new FullscreenAdapter (); fullscreen_adapter.SuggestUnfullscreen += OnAdapterSuggestUnfullscreen; screensaver = new ScreensaverManager (); }
static void Main() { Application.Init(); Gtk.Window w = new Gtk.Window("System.Drawing and Gtk#"); // Custom widget sample a = new PrettyGraphic(); // Event-based drawing b = new DrawingArea(); b.ExposeEvent += new ExposeEventHandler(ExposeHandler); b.SizeAllocated += new SizeAllocatedHandler(SizeAllocatedHandler); Button c = new Button("Quit"); c.Clicked += new EventHandler(quit); MovingText m = new MovingText(); Box box = new HBox(true, 0); box.Add(a); box.Add(b); box.Add(m); box.Add(c); w.Add(box); w.ShowAll(); Application.Run(); }
public DemoMain () { SetupDefaultIcon (); window = new Gtk.Window ("Gtk# Code Demos"); window.SetDefaultSize (600, 400); window.DeleteEvent += new DeleteEventHandler (WindowDelete); HBox hbox = new HBox (false, 0); window.Add (hbox); treeView = CreateTree (); hbox.PackStart (treeView, false, false, 0); Notebook notebook = new Notebook (); hbox.PackStart (notebook, true, true, 0); notebook.AppendPage (CreateText (infoBuffer, false), new Label ("_Info")); TextTag heading = new TextTag ("heading"); heading.Font = "Sans 18"; infoBuffer.TagTable.Add (heading); notebook.AppendPage (CreateText (sourceBuffer, true), new Label ("_Source")); window.ShowAll (); }
/* * invaders constructor, creates a 512x512 game window and calls the * update handler every 1/10 of a second. */ invaders() { /* 100/1000 is the 1/10 second time interval. */ mytimer = GLib.Timeout.Add(100, new GLib.TimeoutHandler(update_handler)); win = new Gtk.Window("Space Invaders"); win.SetDefaultSize(window_size, window_size); win.SetPosition(WindowPosition.Center); /* add what to do when a delete event is processed. */ win.DeleteEvent += new DeleteEventHandler(handle_quit); area = new DrawingArea(); area.AddEvents((int) (EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.KeyPressMask | EventMask.PointerMotionMask)); area.AddEvents((int)EventMask.ButtonPressMask); area.ButtonPressEvent += new ButtonPressEventHandler(MyHandler); System.Console.WriteLine("before win.Add"); win.Add(area); System.Console.WriteLine("before win.ShowAll"); win.ShowAll(); System.Console.WriteLine("before context"); context = Gdk.CairoHelper.Create(area.GdkWindow); System.Console.WriteLine("finish gamewindow"); }
public static void Main(string[] args) { Gtk.Window window; EventBox eventbox; Label label; Application.Init(); window = new Gtk.Window ("Eventbox"); window.DeleteEvent += new DeleteEventHandler (delete_event); window.BorderWidth = 10; window.Resize(400,300); eventbox = new EventBox (); window.Add (eventbox); eventbox.Show(); label = new Label ("Click here to quit"); eventbox.Add(label); label.Show(); label.SetSizeRequest(110, 20); eventbox.ButtonPressEvent += new ButtonPressEventHandler (exitbutton_event); eventbox.Realize(); window.Show(); Application.Run(); }
public static int Main(string [] args) { Application.Init(); Gtk.Window win = new Gtk.Window("testing"); VBox vbox = new VBox(false, 10); GroupSelector gs = new GroupSelector(); gs.Counts = new int [] { 20, 100, 123, 10, 5, 2, 3, 50, 8, 10, 22, 0, 55, 129, 120, 30, 14, 200, 21, 55 }; gs.Mode = RangeType.Fixed; vbox.PackStart(gs); gs = new GroupSelector(); gs.Counts = new int [] { 20, 100, 123, 10, 5, 2, 3, 50, 8, 10, 22, 0, 55, 129, 120, 30, 14, 200, 21, 55 }; gs.Mode = RangeType.Fixed; vbox.PackStart(gs); win.Add(vbox); win.ShowAll(); win.AddEvents((int)EventMask.KeyPressMask); win.KeyPressEvent += gs.HandleKeyPressEvent; Application.Run(); return(0); }
internal void SetFloatMode(Gdk.Rectangle rect) { if (floatingWindow == null) { ResetMode(); SetRegionStyle(frame.GetRegionStyleForItem(this)); floatingWindow = new DockFloatingWindow((Window)frame.Toplevel, GetTitle()); VBox box = new VBox(); box.Show(); box.PackStart(TitleTab, false, false, 0); box.PackStart(Widget, true, true, 0); floatingWindow.Add(box); floatingWindow.DeleteEvent += delegate(object o, DeleteEventArgs a) { if (behavior == DockItemBehavior.CantClose) { Status = DockItemStatus.Dockable; } else { Visible = false; } a.RetVal = true; }; } floatingWindow.Move(rect.X, rect.Y); floatingWindow.Resize(rect.Width, rect.Height); floatingWindow.Show(); if (titleTab != null) { titleTab.UpdateBehavior(); } Widget.Show(); }
public TreeViewDemo () { DateTime start = DateTime.Now; Application.Init (); PopulateStore (); Window win = new Window ("TreeView demo"); win.DeleteEvent += new DeleteEventHandler (DeleteCB); win.SetDefaultSize (640,480); ScrolledWindow sw = new ScrolledWindow (); win.Add (sw); TreeView tv = new TreeView (store); tv.HeadersVisible = true; tv.EnableSearch = false; tv.AppendColumn ("Name", new CellRendererText (), "text", 0); tv.AppendColumn ("Type", new CellRendererText (), "text", 1); sw.Add (tv); dialog.Destroy (); dialog = null; win.ShowAll (); Console.WriteLine (count + " nodes added."); Console.WriteLine ("Startup time: " + DateTime.Now.Subtract (start)); Application.Run (); }
internal void AddTopLevel(DockFrameTopLevel w, int x, int y, int width, int height) { w.X = x; w.Y = y; if (UseWindowsForTopLevelFrames) { var win = new Gtk.Window(Gtk.WindowType.Toplevel); win.AcceptFocus = false; win.SkipTaskbarHint = true; win.Decorated = false; win.TypeHint = Gdk.WindowTypeHint.Toolbar; w.ContainerWindow = win; w.Size = new Size(width, height); win.Add(w); w.Show(); var p = this.GetScreenCoordinates(new Gdk.Point(x, y)); win.Opacity = 0.0; win.Move(p.X, p.Y); win.Resize(width, height); win.Show(); Ide.DesktopService.AddChildWindow((Gtk.Window)Toplevel, win); win.AcceptFocus = true; win.Opacity = 1.0; } else { w.Parent = this; w.Size = new Size(width, height); Requisition r = w.SizeRequest(); w.Allocation = new Gdk.Rectangle(Allocation.X + x, Allocation.Y + y, r.Width, r.Height); topLevels.Add(w); } }
static void Main(string [] args) { Gtk.Application.Init(); string path = args [0]; string name = System.IO.Path.GetFileName(path); int type = Int32.Parse(name.Substring(1, 4)); Console.WriteLine("path {0}, name {1}, id {2}", path, name, type); Gdk.Pixbuf thumb = IthmbDb.Load(type, Int64.Parse(args [1]), 0, path); Gtk.Window win = new Gtk.Window("iThumbnail Test"); Gtk.HBox hbox = new Gtk.HBox(); Gtk.VBox vbox = new Gtk.VBox(); win.Add(hbox); hbox.PackStart(vbox); Gtk.Image image = new Gtk.Image(thumb); vbox.PackStart(image); win.ShowAll(); Gtk.Application.Run(); }
public static Gtk.Window Create () { window = new Window ("GtkCombo"); window.SetDefaultSize (200, 100); VBox box1 = new VBox (false, 0); window.Add (box1); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); combo = new Gtk.Combo (); string[] pop = {"Foo", "Bar"}; combo.PopdownStrings = pop; combo.Entry.Activated += new EventHandler (OnComboActivated); box2.PackStart (combo, true, true, 0); HSeparator separator = new HSeparator (); box1.PackStart (separator, false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, false, 0); Button button = new Button (Stock.Close); button.Clicked += new EventHandler (OnCloseClicked); button.CanDefault = true; box2.PackStart (button, true, true, 0); button.GrabDefault (); return window; }
private void EasterEggCB(object o, EventArgs args) { TextIter insertIter; TextBuffer buffer = new TextBuffer(null); insertIter = buffer.StartIter; buffer.Insert(ref insertIter, "This buffer is shared by a set of nested text views.\n Nested view:\n"); TextChildAnchor anchor = buffer.CreateChildAnchor(ref insertIter); buffer.Insert(ref insertIter, "\nDon't do this in real applications, please.\n"); TextView view = new TextView(buffer); RecursiveAttach(0, view, anchor); Gtk.Window window = new Gtk.Window(Gtk.WindowType.Toplevel); ScrolledWindow sw = new ScrolledWindow(); sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); window.Add(sw); sw.Add(view); window.SetDefaultSize(300, 400); window.ShowAll(); }
public static void Main21 (string[] args) { Application.Init(); Window win = new Window ("Menu Sample App"); win.DeleteEvent += new DeleteEventHandler (delete_cb); win.DefaultWidth = 200; win.DefaultHeight = 150; VBox box = new VBox (false, 2); MenuBar mb = new MenuBar (); Menu file_menu = new Menu (); MenuItem exit_item = new MenuItem("Exit"); exit_item.Activated += new EventHandler (exit_cb); file_menu.Append (exit_item); MenuItem file_item = new MenuItem("File"); file_item.Submenu = file_menu; mb.Append (file_item); box.PackStart(mb, false, false, 0); Button btn = new Button ("Yep, that's a menu"); box.PackStart(btn, true, true, 0); win.Add (box); win.ShowAll (); Application.Run (); }
public CanvasExample() { Gtk.Window win = new Gtk.Window("Canvas example"); win.DeleteEvent += new DeleteEventHandler(Window_Delete); VBox vbox = new VBox(false, 0); win.Add(vbox); vbox.PackStart(new Label("Drag - move object.\n" + "Double click - change color\n" + "Right click - delete object"), false, false, 0); canvas = new Canvas(); canvas.SetSizeRequest(width, height); canvas.SetScrollRegion(0.0, 0.0, (double)width, (double)height); vbox.PackStart(canvas, false, false, 0); HBox hbox = new HBox(false, 0); vbox.PackStart(hbox, false, false, 0); Button add_button = new Button("Add an object"); add_button.Clicked += new EventHandler(AddObject); hbox.PackStart(add_button, false, false, 0); Button quit_button = new Button("Quit"); quit_button.Clicked += new EventHandler(Quit); hbox.PackStart(quit_button, false, false, 0); win.ShowAll(); }
public Glass(GroupSelector selector) : base(selector) { popup_window = new ToolTipWindow(); popup_label = new Gtk.Label(String.Empty); popup_label.Show(); popup_window.Add(popup_label); }
public TabbedSkin(BasilProject project, ITaskBuilder taskBuilder) { _project = project; _tabsToTools = new System.Collections.Hashtable(); window = new Gtk.Window ("WeSay"); window.SetDefaultSize (600, 400); window.DeleteEvent += new DeleteEventHandler (WindowDelete); HBox hbox = new HBox (false, 0); window.Add (hbox); Notebook notebook = new Notebook (); notebook.SwitchPage += new SwitchPageHandler(OnNotebookSwitchPage); hbox.PackStart(notebook, true, true, 0); foreach (ITask t in taskBuilder.Tasks) { VBox container = new VBox(); t.Container = container; int i = notebook.AppendPage(container, new Label(t.Label)); _tabsToTools.Add(i, t); } window.ShowAll (); }
public NowPlayingInterface() { GtkElementsService service = ServiceManager.Get <GtkElementsService> (); primary_window = service.PrimaryWindow; Contents = new NowPlayingContents(); // This is my really sweet hack - it's where the video widget // is sent when the source is not active. This keeps the video // widget from being completely destroyed, causing problems with // its internal windowing and GstXOverlay. It's also conveniently // the window that is used to do fullscreen video. Sweeeeeeeeeet. video_window = new FullscreenWindow(service.PrimaryWindow); video_window.Hidden += OnFullscreenWindowHidden; video_window.Realize(); video_window.Add(Contents); frame = new Hyena.Widgets.RoundedFrame(); frame.SetFillColor(new Cairo.Color(0, 0, 0)); frame.DrawBorder = false; frame.Show(); PackStart(frame, true, true, 0); fullscreen_adapter = new FullscreenAdapter(); fullscreen_adapter.SuggestUnfullscreen += OnAdapterSuggestUnfullscreen; screensaver = new ScreensaverManager(); }
public void GetToken() { window = new Gtk.Window ("packingdemo"); window.Title = "CircleCi Indicator Configuration"; window.WindowPosition = WindowPosition.Center; HBox hbox = new HBox (); VBox vbox = new VBox (false, 0); Label label = new Label (); label.Markup = "Please provide your CircleCi token.\nYou can get one <a href=\"https://circleci.com/account/api\">here</a>."; entry = new Entry (); Button okButton = new Button ("OK"); vbox.PackStart (label, false, false, 20); vbox.PackStart (entry, false, false, 0); vbox.PackStart (okButton, false, false, 20); hbox.PackStart (vbox, false, false, 50); window.Add(hbox); entry.KeyReleaseEvent += HandleKeyReleaseEvent; okButton.Clicked += HandleClicked;; window.ShowAll (); }
public static void StartSimulation() { activesys = new Structures.PlanetarySystem(CustomBodies); if (activesys.centers == null) { activesys.centers = new List <int>(); } activesys.centers.Clear(); for (int i = 0; i < CustomCenters.Count; i++) { if (CustomCenters[i]) { activesys.centers.Add(i); } } mainWindow = new Gtk.Window("Astrodynamics Simulation"); mainWindow.SetDefaultSize(1280, 720); mainWindow.Events |= EventMask.PointerMotionMask | EventMask.ScrollMask; mainWindow.DeleteEvent += delegate { Application.Quit(); }; mainWindow.KeyPressEvent += Input.OnKeyPress; mainWindow.MotionNotifyEvent += Input.OnMouseMovement; mainWindow.ScrollEvent += Input.OnScrollMovement; sys_view = new SystemView(activesys); sys_view.radius_multiplier = radius_multiplier; sys_view.line_max = line_max; mainWindow.Add(sys_view); activesys.StartAsync(step: timestep); // Start Mechanics sys_view.PlayAsync(interval: 0); // Start Display mainWindow.ShowAll(); }
internal void SetFloatMode(Gdk.Rectangle rect) { ResetBarUndockMode(); if (floatingWindow == null) { if (Widget.Parent != null) { Widget.Unparent(); } floatingWindow = new Window(GetWindowTitle()); floatingWindow.TransientFor = frame.Toplevel as Gtk.Window; floatingWindow.TypeHint = Gdk.WindowTypeHint.Utility; floatingWindow.Add(Widget); floatingWindow.DeleteEvent += delegate(object o, DeleteEventArgs a) { if (behavior == DockItemBehavior.CantClose) { Status = DockItemStatus.Dockable; } else { Visible = false; } a.RetVal = true; }; } floatingWindow.Move(rect.X, rect.Y); floatingWindow.Resize(rect.Width, rect.Height); floatingWindow.Show(); Widget.UpdateBehavior(); Widget.Show(); }
public static void Main20 (string[] args) { Application.Init (); PopulateStore (); Window win = new Window ("TreeView demo"); win.DeleteEvent += new DeleteEventHandler (DeleteCB); win.DefaultWidth = 320; win.DefaultHeight = 480; ScrolledWindow sw = new ScrolledWindow (); win.Add (sw); TreeView tv = new TreeView (store); tv.HeadersVisible = true; tv.AppendColumn ("One", new CellRendererText (), new TreeCellDataFunc (CellDataA)); tv.AppendColumn ("Two", new CellRendererText (), new TreeCellDataFunc (CellDataB)); sw.Add (tv); win.ShowAll (); Application.Run (); }
static void Main () { Application.Init (); Gtk.Window w = new Gtk.Window ("System.Drawing and Gtk#"); // Custom widget sample a = new PrettyGraphic (); // Event-based drawing b = new DrawingArea (); b.ExposeEvent += new ExposeEventHandler (ExposeHandler); b.SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler); Button c = new Button ("Quit"); c.Clicked += new EventHandler (quit); MovingText m = new MovingText (); Box box = new HBox (true, 0); box.Add (a); box.Add (b); box.Add (m); box.Add (c); w.Add (box); w.ShowAll (); Application.Run (); }
public static void Main(string[] args) { Application.Init(); client = new AgarioClient(); w = new Gtk.Window("Agario gtk client"); w.Decorated = false; w.Maximize(); w.SetSizeRequest(1024, 768); darea = new CairoGraphic(client); darea.DoubleBuffered = true; darea.SetSizeRequest(800, 800); Box box = new HBox(false, 0); box.Add(darea); w.Add(box); w.Resize(500, 500); w.DeleteEvent += close_window; w.ShowAll(); w.KeyPressEvent += OnKeyPressEvent; //Timer loop for ui display new Timer(TimerCallback, null, 0, 20); //Timer loop for mouse events new Timer(UIControl, null, 0, 100); Application.Run(); }
public static int Main(string[] args) { Gtk.Application.Init (ref args); GtkGL.Application.Init (ref args); /* * Query OpenGL extension version. */ int major, minor; Query.Version (out major, out minor); Console.WriteLine ("\nOpenGL extension version - {0}.{1}", major, minor); // * Configure OpenGL-capable visual. // Try double-buffered visual GdkGL.Config glconfig = new GdkGL.Config (GdkGL.ConfigMode.Rgb | GdkGL.ConfigMode.Double); if (glconfig == null) { Console.WriteLine ("*** Cannot find the double-buffered visual.\n*** Trying single-buffered visual."); glconfig = new GdkGL.Config (GdkGL.ConfigMode.Rgb); if (glconfig == null) { Console.WriteLine ("*** Cannot find any OpenGL-capable visual."); return 1; } } GlUtilities.WriteOutConfig (glconfig); // Top-level window. Window window = new Window (WindowType.Toplevel); window.Title = "shapes"; // Get automatically redrawn if any of their children changed allocation. window.ReallocateRedraws = true; window.DeleteEvent += new DeleteEventHandler (OnDelete); // VBox. VBox vbox = new VBox (false, 0); window.Add (vbox); vbox.Show (); // Drawing area for drawing OpenGL scene. ShapesArea drawing_area = new ShapesArea (glconfig); drawing_area.SetSizeRequest (300, 300); vbox.PackStart (drawing_area, true, true, 0); drawing_area.Show (); // Simple quit button. Button button = new Button ("Quit"); button.Clicked += new EventHandler (OnQuit); vbox.PackStart (button, false, false, 0); button.Show (); // Show window. window.Show (); // Gtk.Application.Run (); return 0; }
public static Gtk.Window Create () { window = new Window ("GtkRadioButton"); window.SetDefaultSize (200, 100); VBox box1 = new VBox (false, 0); window.Add (box1); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); radio_button = new RadioButton ("Button 1"); box2.PackStart (radio_button, true, true, 0); radio_button = new RadioButton (radio_button, "Button 2"); radio_button.Active = true; box2.PackStart (radio_button, true, true, 0); radio_button = new RadioButton (radio_button, "Button 3"); box2.PackStart (radio_button, true, true, 0); radio_button = new RadioButton (radio_button, "Inconsistent"); radio_button.Inconsistent = true; box2.PackStart (radio_button, true, true, 0); box1.PackStart (new HSeparator (), false, true, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); radio_button = new RadioButton ("Button 4"); radio_button.Mode = false; box2.PackStart (radio_button, true, true, 0); radio_button = new RadioButton (radio_button, "Button 5"); radio_button.Active = true; radio_button.Mode = false; box2.PackStart (radio_button, true, true, 0); radio_button = new RadioButton (radio_button, "Button 6"); radio_button.Mode = false; box2.PackStart (radio_button, true, true, 0); box1.PackStart (new HSeparator (), false, true, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button button = new Button (Stock.Close); button.Clicked += new EventHandler (Close_Button); box2.PackStart (button, true, true, 0); button.CanDefault = true; button.GrabDefault (); return window; }
static void CreateWindow () { window = new Gtk.Window ("grp animation"); drawing_area = new Gtk.DrawingArea (); window.Add (drawing_area); window.ShowAll (); }
private void ImportDirectoryMenuItemOnActivated(object sender, EventArgs eventArgs) { var fileChooser = new FileChooserWidget(FileChooserAction.SelectFolder); fileChooser.SelectMultiple = true; var window = new Window(WindowType.Toplevel); window.Add(fileChooser); window.ShowAll(); }
static void CreateWindow() { window = new Gtk.Window("grp animation"); drawing_area = new Gtk.DrawingArea(); window.Add(drawing_area); window.ShowAll(); }
public static void Main() { uint r; double theta; Application.Init(); Gtk.Window win = new Gtk.Window("Polar Coordinate Container"); win.DeleteEvent += new DeleteEventHandler(Window_Delete); Notebook notebook = new Notebook(); win.Add(notebook); // Clock PolarFixed pf = new PolarFixed(); notebook.AppendPage(pf, new Label("Clock")); for (int hour = 1; hour <= 12; hour++) { theta = (Math.PI / 2) - hour * (Math.PI / 6); if (theta < 0) { theta += 2 * Math.PI; } Label l = new Label("<big><b>" + hour.ToString() + "</b></big>"); l.UseMarkup = true; pf.Put(l, theta, 200); } // Spiral pf = new PolarFixed(); notebook.AppendPage(pf, new Label("Spiral")); r = 0; theta = 0.0; foreach (string id in Gtk.Stock.ListIds()) { StockItem item = Gtk.Stock.Lookup(id); if (item.Label == null) { continue; } pf.Put(new Gtk.Button(id), theta, r); // Logarithmic spiral: r = a*e^(b*theta) r += 5; theta = 10 * Math.Log(10 * r); } win.ShowAll(); Application.Run(); }
/** Simpleclock constructor, creates a 256x256 clock window and redraws the clock every 500ms. */ Simpleclock() { win = new Window ("Simpleclock"); win.SetDefaultSize (256,256); win.DeleteEvent += new DeleteEventHandler (OnQuit); GLib.Timeout.Add (500, UpdateClock); win.Add (this); win.ShowAll (); }
public GMan() { Application.Init(); window = new Gtk.Window("GMan"); window.SetDefaultSize(800, 600); window.DeleteEvent += new DeleteEventHandler(OnWindowDelete); // FIXME: we should remember where we were when we last ran. window.WindowPosition = WindowPosition.Center; VBox vbox = new VBox(false, 2); window.Add(vbox); vbox.PackStart(MakeMenuBar(), false, false, 1); HBox hbox = new HBox(false, 1); Label label = new Label("Search:"); entry = new Gtk.Entry(""); entry.Activated += new EventHandler(OnEntryActivated); Button button = new Button("!"); button.Clicked += new EventHandler(OnButtonClicked); Button backButton = new Button(Stock.GoBack); Button forwardButton = new Button(Stock.GoForward); hbox.PackStart(backButton, false, false, 1); hbox.PackStart(forwardButton, false, false, 1); hbox.PackStart(label, false, false, 1); hbox.PackStart(entry, true, true, 1); hbox.PackStart(button, false, false, 1); vbox.PackStart(hbox, false, false, 1); ScrolledWindow sw = new ScrolledWindow(); sw.VscrollbarPolicy = PolicyType.Always; sw.HscrollbarPolicy = PolicyType.Always; vbox.PackStart(sw, true, true, 1); statusBar = new Gtk.Statusbar(); vbox.PackStart(statusBar, false, false, 1); html = new HTML(); html.LinkClicked += new LinkClickedHandler(OnLinkClicked); html.OnUrl += new OnUrlHandler(OnOnUrl); html.TitleChanged += new TitleChangedHandler(OnTitleChanged); sw.Add(html); window.ShowAll(); entry.GrabFocus(); Application.Run(); }
public Fleow() { //Create openGL widget myEngine = new Engine (); myEngine.SetSizeRequest (600, 300); // Create a new Vertical Box that the Engine can live in VBox vb = new VBox (false, 0); // Pack the Engine widget into the VBox vb.PackStart (myEngine, true, true, 0); // Create a horizontal box that holds <, exit and > buttons HBox hb = new HBox (false, 0); // This button will rotate the scene left Button btnRotL = new Button(" < "); // Attach some event handlers to the left rotation button btnRotL.Pressed += myEngine.OnRotLPress; btnRotL.Released += myEngine.OnRotLRelease; // Pack the left rotation button into the horizontal box hb.PackStart (btnRotL, false, false, 0); // This is the exit button // This button quits the program Button btn = new Button ("Play"); // Bind the key press event to the OnKeyPress method //btn.KeyPressEvent += OnKeyPress; //btn.Clicked += OnUnrealized; hb.PackStart (btn, true, true, 0); // This button will rotate the scene right Button btnRotR = new Button(" > "); // Attach some event handlers to the right rotation button btnRotR.Pressed += myEngine.OnRotRPress; btnRotR.Released += myEngine.OnRotRRelease; // Pack the right rotation button into the horizontal box hb.PackStart (btnRotR, false, false, 0); // put the hbox in the vbox vb.PackStart (hb); // Create a new window and name it appropriately Window win = new Window ("fleow-standalone"); // Pack the VBox into the window win.Add (vb); // Show all of win's contained widgets win.ShowAll (); }
public static void ShowPreviewImage(Gdk.Pixbuf image) { // now show window of things. Window win = new Window("Image Preview"); win.SetDefaultSize(image.Width, image.Height); Gtk.Image im = new Gtk.Image(image); win.Add(im); win.ShowAll(); }
private DrawingArea CreateDrawingSurface(Gtk.Window window) { var area = new DrawingArea(); area.ExposeEvent += CanvasExposed; window.Add(area); return(area); }
public static Gtk.Window Create() { window = new Window ("Toolbar"); window.Resizable = false; toolbar = new Toolbar (); toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New", new SignalFunc (set_small_icon), IntPtr.Zero, -1); toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open", new SignalFunc (set_large_icon), IntPtr.Zero, -1); toolbar.AppendSpace (); toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips", new Image (Stock.DialogInfo, IconSize.LargeToolbar), new SignalFunc (toggle_tooltips)); toolbar.AppendSpace (); toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal", new Image (Stock.GoForward, IconSize.LargeToolbar), new SignalFunc (set_horizontal)); toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical", new Image (Stock.GoUp, IconSize.LargeToolbar), new SignalFunc (set_vertical)); toolbar.AppendSpace (); toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly", new Image (Stock.Home, IconSize.LargeToolbar), new SignalFunc (set_icon_only)); toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly", new Image (Stock.JustifyFill, IconSize.LargeToolbar), new SignalFunc (set_text_only)); toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both", new Image (Stock.Index, IconSize.LargeToolbar), new SignalFunc (set_both)); toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz", new Image (Stock.Index, IconSize.LargeToolbar), new SignalFunc (set_both_horiz)); toolbar.AppendSpace (); toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close", new SignalFunc (Close_Button), IntPtr.Zero, -1); window.Add (toolbar); window.ShowAll (); return window; }
public static void Main(string[] args) { NSApplication.Init(); Gtk.Application.Init(); var gtkWindow = new Gtk.Window(Gtk.WindowType.Toplevel) { Title = "GTK Window", Gravity = Gdk.Gravity.Center, DefaultSize = new Gdk.Size(WindowWidth, WindowHeight), BorderWidth = Padding }; gtkWindow.Add(new Gtk.Widget(gtk_ns_view_new(new NativeViewHost().Handle))); gtkWindow.ShowAll(); var nativeWindow = new NSWindow( new CGRect(0, 0, WindowWidth, WindowHeight), NSWindowStyle.Titled | NSWindowStyle.Closable | NSWindowStyle.Resizable, NSBackingStore.Buffered, false) { Title = "Native Window", ContentView = new NativeViewHost() }; nativeWindow.Center(); nativeWindow.MakeKeyAndOrderFront(null); var menuBar = new NSMenu(); var appMenuItem = new NSMenuItem(); menuBar.AddItem(appMenuItem); var appMenu = new NSMenu(); appMenu.AddItem(new NSMenuItem("Quit", new ObjCRuntime.Selector("terminate:"), "q")); appMenuItem.Submenu = appMenu; NSApplication.SharedApplication.Delegate = new NSApplicationDelegate(); NSApplication.SharedApplication.MainMenu = menuBar; NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular; // Allow the native run loop to drive the app, and the GTK window // embedding a native view with a local event monitor will deliver // events as expected. // NSApplication.SharedApplication.Run(); // Let GTK drive the app, dispatching to the native run loop as // necessary, and the native view with a local event monitor will // only deliver events when the mouse is within the view's frame. Gtk.Application.Run(); }
public CProgress(string message) { _message_text = message; _win_progress = new Window(_message_text); _win_progress.DefaultWidth = 250; _win_progress.DefaultHeight = 50; img_throbber = new Gtk.Image(_image_path); _win_progress.Add(img_throbber); _win_progress.Modal = true; }
public gamewindow() { System.Console.WriteLine("inside gamewindow"); win = new Gtk.Window("Breakout"); win.SetDefaultSize(breakout_definitions.x_win, breakout_definitions.y_win); win.SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; area = new DrawingArea(); area.AddEvents((int)(EventMask.ButtonPressMask | EventMask.ButtonReleaseMask)); area.ExposeEvent += OnDrawingAreaExposed; area.KeyPressEvent += new KeyPressEventHandler(key_handler); area.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler); area.ButtonReleaseEvent += new ButtonReleaseEventHandler(ButtonReleaseHandler); MenuBar mb = new MenuBar(); Menu file_menu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = file_menu; MenuItem run = new MenuItem("Run"); run.Activated += do_run; file_menu.Append(run); MenuItem exit = new MenuItem("Exit"); exit.Activated += do_exit; file_menu.Append(exit); mb.Append(file); VBox vbox = new VBox(false, 3); vbox.PackStart(mb, false, false, 0); HBox hbox = new HBox(); hbox.Add(area); vbox.Add(hbox); System.Console.WriteLine("before win.Add"); win.Add(vbox); System.Console.WriteLine("before win.ShowAll"); win.ShowAll(); System.Console.WriteLine("before context"); context = Gdk.CairoHelper.Create(area.GdkWindow); System.Console.WriteLine("finish gamewindow"); }