示例#1
0
		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 ();
		}
示例#2
0
文件: test.cs 项目: GNOME/chronojump
    public static void Main()
    {
        Application.Init();

        //-- Crear el interfaz
        Window w = new Window("Prueba");
        Button b1 = new Button("Test 1");
        Button b2 = new Button("Test 2");
        HBox h= new HBox();
        w.DeleteEvent += new DeleteEventHandler(Window_Delete);
        b1.Clicked += new EventHandler(Button_Clicked);
        b2.Clicked += new EventHandler(Button2_Clicked);

        h.PackStart(b1,false,false,0);
        h.PackStart(b2,false,false,0);

        w.Add(h);
        w.SetDefaultSize(100,100);
        w.ShowAll();

        //-- Inicializar chronopic
        cp = new Chronopic("/dev/ttyUSB0");

        //-- Inicializar otras cosas
        Cola = new Queue();

        //-- Inicializar temporizador
        GLib.Timeout.Add(100, new GLib.TimeoutHandler(Time_Out));

        Application.Run();
    }
示例#3
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 ();
	}
示例#4
0
        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();

            };
        }
示例#5
0
		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;
		}
示例#6
0
        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();
        }
示例#7
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();
    }
示例#8
0
		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;
		}
示例#9
0
文件: Main.cs 项目: langpavel/LPS-old
    public void Run(string[] args)
    {
        Application.Init ();
        PopulateStore ();
        store.SetSortColumnId(2, SortType.Ascending);

        Window win = new Window ("Gtk Widget Attributes");
        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.AppendColumn ("Name", new CellRendererText (), "markup", 0);
        tv.AppendColumn ("Type", new CellRendererText (), "text", 1);

        foreach(TreeViewColumn col in tv.Columns)
            col.Resizable = true;

        tv.SearchColumn = 2;

        sw.Add (tv);

        dialog.Destroy ();
        dialog = null;

        win.ShowAll ();

        Application.Run ();
    }
示例#10
0
    public static void Main()
    {
        BusG.Init ();
        Application.Init ();

        Button btn = new Button ("Click me");
        btn.Clicked += OnClick;

        VBox vb = new VBox (false, 2);
        vb.PackStart (btn, false, true, 0);

        Window win = new Window ("D-Bus#");
        win.SetDefaultSize (640, 480);
        win.Add (vb);
        win.Destroyed += delegate {Application.Quit ();};
        win.ShowAll ();

        bus = Bus.Session;

        string bus_name = "org.ndesk.gtest";
        ObjectPath path = new ObjectPath ("/org/ndesk/test");

        if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
            //create a new instance of the object to be exported
            demo = new DemoObject ();
            bus.Register (path, demo);
        } else {
            //import a remote to a local proxy
            demo = bus.GetObject<DemoObject> (bus_name, path);
        }

        //run the main loop
        Application.Run ();
    }
示例#11
0
        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();
        }
示例#12
0
		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 ();
		}
示例#13
0
		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 ();
		}
示例#14
0
    public static void Main()
    {
        BusG.Init ();
        Application.Init ();

        Window win = new Window ("D-Bus#");
        win.SetDefaultSize (640, 480);
        win.Destroyed += delegate {Application.Quit ();};
        win.ShowAll ();

        bus = Bus.Session;
        sysBus = Bus.System.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));

        string bus_name = "org.ndesk.gtest";
        ObjectPath path = new ObjectPath ("/org/ndesk/test");

        if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
            //create a new instance of the object to be exported
            demo = new DemoObject ();
            sysBus.NameOwnerChanged += demo.FireChange;
            bus.Register (path, demo);
        } else {
            //import a remote to a local proxy
            demo = bus.GetObject<DemoObject> (bus_name, path);
        }

        //run the main loop
        Application.Run ();
    }
示例#15
0
文件: NDiff.cs 项目: xxjeng/nuxleus
	public static void Main(string[] args) {
		Opts options = new Opts();
		options.ProcessArgs(args);
		
		if (options.RemainingArguments.Length < 2) {
			options.DoHelp();
			return;
		}
		
		Application.Init ();
		
		Window win = new Window("NDiff");
		win.DeleteEvent += new DeleteEventHandler(Window_Delete);
		win.SetDefaultSize(800, 600);
		
		DiffWidget.Options dopts = new DiffWidget.Options();
		dopts.SideBySide = options.sidebyside;

		if (options.RemainingArguments.Length == 2) {
			dopts.LeftName = options.RemainingArguments[0];
			dopts.RightName = options.RemainingArguments[1];
			Diff diff = new Diff(options.RemainingArguments[0], options.RemainingArguments[1], options.caseinsensitive, true);
			win.Add(new DiffWidget(diff, dopts));
		} else {
			Diff[] diffs = new Diff[options.RemainingArguments.Length-1];
			for (int i = 0; i < options.RemainingArguments.Length-1; i++)
				diffs[i] = new Diff(options.RemainingArguments[0], options.RemainingArguments[i+1], options.caseinsensitive, true);
			Merge merge = new Merge(diffs);
			win.Add(new DiffWidget(merge, dopts));
		}		

		win.ShowAll();
		Application.Run();
	}
示例#16
0
 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();
 }
示例#17
0
    /*
     *  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");
    }
示例#18
0
		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();
		}
示例#19
0
        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();
        }
示例#20
0
    // Constructor
    public Gui()
    {
        Application.Init();

        ioh = new IoHandler();
        win = new Window("Drawing lines");
        darea = new  DrawingArea();
        painter = new DrawShape(DrawLine);
        listenOnMouse = false; // Við hlustum ekki á mús við núllstöðu.

        // Aukum viðburðasett teikniborðs með ,möskum'.
        darea.AddEvents(
                (int)Gdk.EventMask.PointerMotionMask
                | (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask);

        // Úthlutum virkni á viðburði.
        win.Hidden += delegate {Application.Quit();};
        win.KeyPressEvent += onKeyboardPressed;
        darea.ExposeEvent += onDrawingAreaExposed;
        darea.ButtonPressEvent += onMouseClicked;
        darea.ButtonReleaseEvent += onMouseReleased;
        darea.MotionNotifyEvent += onMouseMotion;

        // Grunnstillum stærð glugga.
        win.SetDefaultSize(500,500);

        // Lokasamantekt til að virkja glugga.
        win.Add(darea);
        win.ShowAll();
        Application.Run();
    }
示例#21
0
    public static void Main()
    {
        BusG.Init ();
        Application.Init ();

        tv = new TextView ();
        ScrolledWindow sw = new ScrolledWindow ();
        sw.Add (tv);

        Button btn = new Button ("Click me");
        btn.Clicked += OnClick;

        Button btnq = new Button ("Click me (thread)");
        btnq.Clicked += OnClickQuit;

        VBox vb = new VBox (false, 2);
        vb.PackStart (sw, true, true, 0);
        vb.PackStart (btn, false, true, 0);
        vb.PackStart (btnq, false, true, 0);

        Window win = new Window ("D-Bus#");
        win.SetDefaultSize (640, 480);
        win.Add (vb);
        win.Destroyed += delegate {Application.Quit ();};
        win.ShowAll ();

        bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));

        Application.Run ();
    }
示例#22
0
    public TreeViewDemo()
    {
        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.EnableSearch = true;
        tv.HeadersVisible = true;
        tv.HeadersClickable = true;

        tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
        tv.AppendColumn ("Type", new CellRendererText (), "text", 1);

        sw.Add (tv);

        dialog.Destroy ();
        dialog = null;

        win.ShowAll ();

        Application.Run ();
    }
示例#23
0
    public static void Main()
    {
        BusG.Init ();
        Application.Init ();

        btn = new Button ("Click me");
        btn.Clicked += OnClick;

        VBox vb = new VBox (false, 2);
        vb.PackStart (btn, false, true, 0);

        Window win = new Window ("D-Bus#");
        win.SetDefaultSize (640, 480);
        win.Add (vb);
        win.Destroyed += delegate {Application.Quit ();};
        win.ShowAll ();

        bus = Bus.Session;

        string bus_name = "org.ndesk.gtest";
        ObjectPath path = new ObjectPath ("/org/ndesk/btn");

        if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {
            bus.Register (path, btn);
            rbtn = btn;
        } else {
            rbtn = bus.GetObject<Button> (bus_name, path);
        }

        //run the main loop
        Application.Run ();
    }
示例#24
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;
		}
示例#25
0
	Knockout ()
	{
		Window win = new Window ("Cairo with Gtk#");
		win.SetDefaultSize (400, 400);
		win.DeleteEvent += new DeleteEventHandler (OnQuit);
		win.Add (this);
		win.ShowAll ();
	}
示例#26
0
文件: GMan.cs 项目: pombreda/enh
    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();
    }
示例#27
0
 SourceViewTest()
 {
     Window win = new Window ("SourceView test");
     win.SetDefaultSize (600, 400);
     win.WindowPosition = WindowPosition.Center;
     win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
     win.Add (CreateView ());
     win.ShowAll ();
 }
示例#28
0
 /**
 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 ();
 }
示例#29
0
 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();
 }
示例#30
0
 private void LoadPointers()
 {
     window = (Gtk.Window)ui["window1"];
     window.SetDefaultSize(450, 450);
     subject_entry = (Gtk.Entry)ui["subject_entry"];
     textbuffer    = ((Gtk.TextView)ui["textview1"]).Buffer;
     contrib_entry = (Gtk.Entry)ui["contrib_entry"];
     server_entry  = (Gtk.Entry)ui["server_entry"];
     statusbar     = (Gtk.Statusbar)ui["statusbar1"];
 }
示例#31
0
 static void Main()
 {
     Application.Init ();
     Window win = new Window ("Cairo with Gtk# 3");
     win.SetDefaultSize (400, 400);
     win.DeleteEvent += delegate { Application.Quit (); };
     win.Add (new CairoSample ());
     win.ShowAll ();
     Application.Run ();
 }
示例#32
0
        public static void Main(string[] args)
        {
            Application.Init ();
            Window window = new Window ("application name goes here lol");
            window.DeleteEvent += OnDeleteEvent;
            window.SetDefaultSize (800, 600);

            window.ShowAll ();
            Application.Run ();
        }
示例#33
0
	private void LoadPointers ()
	{
		window = (Gtk.Window) ui["window1"];
		window.SetDefaultSize (450, 450);
		subject_entry = (Gtk.Entry) ui["subject_entry"];
		textbuffer = ((Gtk.TextView) ui["textview1"]).Buffer;
		contrib_entry = (Gtk.Entry) ui["contrib_entry"];
		server_entry = (Gtk.Entry) ui["server_entry"];
		statusbar = (Gtk.Statusbar) ui["statusbar1"];
	}
示例#34
0
 private void creaVentana()
 {
     window=new Window("Editar categoria");
     window.SetDefaultSize (300, 100);
     window.SetPosition(WindowPosition.Center);
     VBox vbox=new VBox();
     tabla=new Table(2,2,false);
     separaFilas(tabla,10);
     vbox.PackStart(tabla,false,false,0);
     window.Add(vbox);
 }
示例#35
0
文件: GMan.cs 项目: novendraap/enh
    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();
    }
示例#36
0
    T()
    {
        Application.Init ();
        Window win = new Window ("FileBrowser test");
        win.SetDefaultSize (300, 250);
        win.DeleteEvent += new DeleteEventHandler (OnDelete);

        win.Add (new FileBrowser ());

        win.ShowAll ();
        Application.Run ();
    }
示例#37
0
	   public static int Main (string[] args)
	   {
		   Application.Init ();
		   Window win = new Window ("Viewport Tester");
		   win.SetDefaultSize (180, 50);
		   win.DeleteEvent += new DeleteEventHandler (Window_Delete);
		   ScrolledWindow scroller = CreateViewport();
		   win.Add (scroller);
		   win.ShowAll ();
		   Application.Run ();
                        return 0;
	   }
示例#38
0
	static void SetUpGui ()
	{
		Window w = new Window ("Scale Test");
		
		HScale hscale = new HScale (1, 100, 10);
		hscale.ValueChanged += hscale_value_changed_cb;
		hscale.Value = 50;
		
		w.Add (hscale);
		w.SetDefaultSize (160, 120);
		w.ShowAll ();
	}
示例#39
0
文件: Window.cs 项目: MrJoe/lat
        void LoadPreference(String key)
        {
            object val = Preferences.Get(key);

            if (val == null)
            {
                if (key == Preferences.MAIN_WINDOW_HPANED)
                {
                    hpaned1.Position = 250;
                }

                return;
            }

            Log.Debug("Setting {0} to {1}", key, val);

            switch (key)
            {
            case Preferences.MAIN_WINDOW_MAXIMIZED:
                if ((bool)val)
                {
                    mainWindow.Maximize();
                }
                else
                {
                    mainWindow.Unmaximize();
                }
                break;

            case Preferences.MAIN_WINDOW_X:
            case Preferences.MAIN_WINDOW_Y:
                mainWindow.Move((int)Preferences.Get(Preferences.MAIN_WINDOW_X),
                                (int)Preferences.Get(Preferences.MAIN_WINDOW_Y));
                break;

            case Preferences.MAIN_WINDOW_WIDTH:
            case Preferences.MAIN_WINDOW_HEIGHT:
                mainWindow.SetDefaultSize((int)Preferences.Get(Preferences.MAIN_WINDOW_WIDTH),
                                          (int)Preferences.Get(Preferences.MAIN_WINDOW_HEIGHT));

                mainWindow.ReshowWithInitialSize();
                break;

            case Preferences.MAIN_WINDOW_HPANED:
                hpaned1.Position = (int)Preferences.Get(Preferences.MAIN_WINDOW_HPANED);
                break;

            case Preferences.BROWSER_SELECTION:
                ldapTreeView.BrowserSelectionMethod = (int)val;
                break;
            }
        }
示例#40
0
    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");
    }
示例#41
0
    void CreateWindow()
    {
        window = new Gtk.Window("animation viewer");
        window.SetDefaultSize(640, 480);

        drawing_area = new Gtk.DrawingArea();

        painter = new Painter(drawing_area, 200);
        painter.Add(Layer.Background, DrawFrame);

        window.Add(drawing_area);
        window.ShowAll();
    }
示例#42
0
        public static void Main(string[] args)
        {
            Application.Init();

            var window = new Gtk.Window(Gtk.WindowType.Toplevel)
            {
                Title       = "Treemap Example",
                BorderWidth = 0,                //12,
            };

            window.SetDefaultSize(640, 480);
            window.DeleteEvent += delegate {
                Gtk.Application.Quit();
            };
            window.Show();

            var vbox = new Gtk.VBox(false, 6);

            window.Add(vbox);
            vbox.Show();

            var treemap = new TreeMap.TreeMap()
            {
                Model        = BuildModel(),
                TextColumn   = 0,
                WeightColumn = 1,
                Title        = "Treemap Example",
            };

            vbox.PackStart(treemap, true, true, 0);
            treemap.Show();

            var buttonbox = new Gtk.HButtonBox();

            buttonbox.BorderWidth = 12;
            buttonbox.Layout      = Gtk.ButtonBoxStyle.End;
            vbox.PackStart(buttonbox, false, true, 0);
            buttonbox.Show();

            var close = new Gtk.Button(Gtk.Stock.Close);

            close.CanDefault = true;
            close.Clicked   += delegate { Gtk.Application.Quit(); };
            buttonbox.PackStart(close, false, true, 0);
            window.Default = close;
            close.Show();

            Application.Run();
        }
示例#43
0
    static void Main()
    {
        Application.Init();
        myWindow              = new Window("This is a window");
        myWindow.DeleteEvent += OnDelete;
        myWindow.SetDefaultSize(200, 200);

        //Put a button in the Window
        Button button = new Button("Imprimir");

        button.Clicked += OnButtonClicked;
        myWindow.Add(button);
        myWindow.ShowAll();
        Application.Run();
    }
示例#44
0
 private void ShowSource(object o, EventArgs args)
 {
     Gtk.Window win = new Gtk.Window("Source");
     win.SetDefaultSize(800, 500);
     Gtk.ScrolledWindow sw = new ScrolledWindow();
     sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
     sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
     Gtk.TextView view = new Gtk.TextView();
     view.CursorVisible = false;
     view.Editable      = false;
     Gtk.TextBuffer buffer = view.Buffer;
     buffer.Text = canvas.Source;
     view.Buffer = buffer;
     sw.Add(view);
     win.Add(sw);
     win.ShowAll();
 }
示例#45
0
    private void on_button_video_watch_clicked(object o, EventArgs args)
    {
        if (File.Exists(videoFileName))
        {
            LogB.Information("Exists and clicked " + videoFileName);

            PlayerBin player = new PlayerBin();
            player.Open(videoFileName);

            Gtk.Window d = new Gtk.Window(Catalog.GetString("Playing video"));
            d.Add(player);
            d.Modal = true;
            d.SetDefaultSize(500, 400);
            d.ShowAll();
            d.DeleteEvent += delegate(object sender, DeleteEventArgs e) { player.Close(); player.Dispose(); };
            player.Play();
        }
    }
示例#46
0
        static Gtk.Window init_window()
        {
            //新建窗体,标题是Hello World
            var win = new Gtk.Window("Hello World");

            win.SetDefaultSize(600, 600);
            //win.SetSizeRequest(600, 600);

            //窗体关闭后退出应用
            win.DeleteEvent += (s, e) =>
            {
                Gtk.Application.Quit();
            };

            win.WindowPosition = WindowPosition.Center;
            //win.Resizable = false;

            return(win);
        }
示例#47
0
 void HandleBrowseExisting(object sender, System.EventArgs args)
 {
     if (listwindow == null)
     {
         listwindow = new Gtk.Window("Pending files to write");
         listwindow.SetDefaultSize(400, 200);
         listwindow.DeleteEvent += delegate(object o, Gtk.DeleteEventArgs e) { (o as Gtk.Window).Destroy(); listwindow = null; };
         Gtk.TextView       view = new Gtk.TextView();
         Gtk.ScrolledWindow sw   = new Gtk.ScrolledWindow();
         sw.Add(view);
         listwindow.Add(sw);
     }
     else
     {
         ((listwindow.Child as Gtk.ScrolledWindow).Child as Gtk.TextView).Buffer.Text = "";
     }
     ListAll(((listwindow.Child as Gtk.ScrolledWindow).Child as Gtk.TextView).Buffer, dest);
     listwindow.ShowAll();
 }
示例#48
0
        static void OnShowReadyEvent()
        {
            Gtk.Application.Invoke(delegate {
                BuildMainForm();
                MainForm.SetDefaultSize(1280, 800);
                MainForm.SetPosition(WindowPosition.Center);
                MainForm.Icon = m_imageIconGray.Pixbuf;

                m_scrolledWindow = new ScrolledWindow();

                m_webBrowser          = new WebView();
                m_webBrowser.Editable = false;
                m_webBrowser.Open("http://localhost:4649/index.html?mode=UI.Linux");
                m_scrolledWindow.Add(m_webBrowser);
                MainForm.Add(m_scrolledWindow);

                MainForm.ShowAll();

                Splash.Destroy();
            });
        }
示例#49
0
        private void BuildPanel()
        {
            try {
                ToolbarPanel    = new PanelGtk("media", "media", null, "media-button", true);
                ParentContainer = ToolbarPanel.Window;
                ParentContainer.ModifyBg(StateType.Normal, ParentContainer.Style.White);
                ToolbarPanel.SetSizeEvent += (o, e) => {
                    ToolbarPanelWidth  = e.Width;
                    ToolbarPanelHeight = e.Height;
                };
            } catch (Exception e) {
                Log.Exception("Could not bind to Moblin panel", e);

                var window = new Gtk.Window("Moblin Media Panel");
                window.SetDefaultSize(1000, 500);
                window.WindowPosition = Gtk.WindowPosition.Center;
                ParentContainer       = window;
            }

            ParentContainer.ShowAll();
        }
示例#50
0
    public override void Run()
    {
        Application.Init();

        Gtk.Window frame = new Gtk.Window("OpenTF Explorer");

        exploreView = new ExploreView(Driver, OptionStopAfter);
        exploreView.ShowChangeset += MyShowChangesetEventHandler;
        exploreView.ShowFile      += MyShowFileEventHandler;

        frame.Add(exploreView);
        frame.DeleteEvent     += new DeleteEventHandler(DeleteEvent);
        frame.KeyReleaseEvent += MyKeyReleaseHandler;

        int x, y, width, height, depth;

        frame.RootWindow.GetGeometry(out x, out y, out width, out height, out depth);
        frame.SetDefaultSize(Convert.ToInt32(width * .9), Convert.ToInt32(height * .9));

        frame.ShowAll();
        Application.Run();
    }
示例#51
0
        static void gtml_activate()
        {
            icons = new Gtk.IconFactory();
            icons.AddDefault();

            window              = new Gtk.Window(PN);
            window.DeleteEvent += new DeleteEventHandler(Window_Delete);
            window.SetDefaultSize(800, 120);
            window.Decorated = true;

            grid = new Gtk.Grid();
            grid.ColumnHomogeneous = true;

            Gtk.Image icon = new Gtk.Image();
            icon.IconName          = ("list-add-symbolic");
            import_button          = new Gtk.Button(icon);
            import_button.Clicked += new EventHandler(gtml_import_full);
            Gtk.Box naw = new Gtk.Box(Gtk.Orientation.Horizontal, 1);
            naw.PackStart(import_button, true, true, 1);
            naw.ShowAll();

            stack             = new Gtk.Notebook();
            stack.EnablePopup = true;
            stack.GroupName   = "Mozilla Programs";
            stack.Scrollable  = true;

            stack.SetActionWidget(naw, Gtk.PackType.End);

            stack.Hexpand = true;
            stack.Vexpand = true;

            grid.Attach(stack, 1, 1, 1, 1);
            gtml_reload();

            window.Add(grid);

            window.ShowAll();
        }
示例#52
0
 protected void OnButtonMapInWindowClicked(object sender, EventArgs e)
 {
     if (mapWindow == null)
     {
         toggleButtonHideAddresses.Sensitive = false;
         toggleButtonHideAddresses.Active    = false;
         mapWindow = new Gtk.Window("Карта мониторинга автомобилей на маршруте");
         mapWindow.SetDefaultSize(700, 600);
         mapWindow.DeleteEvent += MapWindow_DeleteEvent;
         vboxRight.Remove(gmapWidget);
         mapWindow.Add(gmapWidget);
         mapWindow.Show();
     }
     else
     {
         toggleButtonHideAddresses.Sensitive = true;
         mapWindow.Remove(gmapWidget);
         vboxRight.PackEnd(gmapWidget, true, true, 1);
         gmapWidget.Show();
         mapWindow.Destroy();
         mapWindow = null;
     }
 }
示例#53
0
        public void DetachPlayer()
        {
            bool isPlaying = Player.Playing;

            /* Pause the player here to prevent the sink drawing while the windows
             * are beeing changed */
            Player.Pause();
            if (!detachedPlayer)
            {
                Log.Debug("Detaching player");

                ExternalWindow playerWindow = new ExternalWindow();
                this.playerWindow  = playerWindow;
                playerWindow.Title = Constants.SOFTWARE_NAME;
                int player_width  = playercapturer.Allocation.Width;
                int player_height = playercapturer.Allocation.Height;
                playerWindow.SetDefaultSize(player_width, player_height);
                playerWindow.DeleteEvent += (o, args) => DetachPlayer();
                playerWindow.Show();
                playercapturer.Reparent(playerWindow.Box);
                // Hack to reposition video window in widget for OSX
                playerWindow.Resize(player_width + 10, player_height);
                videowidgetsbox.Visible = false;
            }
            else
            {
                Log.Debug("Attaching player again");
                videowidgetsbox.Visible = true;
                playercapturer.Reparent(this.videowidgetsbox);
                playerWindow.Destroy();
            }
            if (isPlaying)
            {
                Player.Play();
            }
            detachedPlayer = !detachedPlayer;
        }
示例#54
0
        public DemoMain()
        {
            window = new Gtk.Window("TestForm1");
            Gtk.HBox hbox = new Gtk.HBox(false, 0);
            hbox1 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox2 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox3 = new Gtk.HBox(false, 0);
            hbox.Add(hbox1);
            window.SetDefaultSize(600, 400);
            window.DeleteEvent += new DeleteEventHandler(WindowDelete);

            button1          = new Gtk.Button("button1");
            button1.Clicked += Button1Clicked;
            button2          = new Gtk.Button("button2");
            button3          = new Gtk.Button("button3");
            Gtk.Button button4 = new Gtk.Button("button4");
            button4.Clicked += Button4Clicked;
            Gtk.Button button5 = new Gtk.Button("button5");
            Gtk.Button button6 = new Gtk.Button("button6");
            Gtk.Button button7 = new Gtk.Button("button7");
            button7.Sensitive = false;

            scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]);

            hbox1.Add(hbox3);
            hbox1.Add(hbox2);
            hbox1.Add(button3);
            hbox1.Add(button2);

            button3.Accessible.Description = "help text 3";
            button3.Sensitive = false;

            label1 = new Gtk.Label("label1");

            textBox1 = new Gtk.Entry();
            Gtk.Entry textBox2 = new Gtk.Entry();
            textBox2.Visibility = false;
            textBox2.Sensitive  = false;
            textBox2.IsEditable = false;
            textBox3            = new Gtk.TextView();
            // TODO: scrollbars
            Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1");
            Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2");
            checkbox2.Sensitive = false;

            Gtk.TreeStore   store = new Gtk.TreeStore(typeof(string), typeof(string));
            Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 1", "item 1 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 1a", "item 1a (2)");
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 2", "item 2 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2a", "item 2a (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2b", "item 2b (2)");
            treeView1 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView1, 0, "column 1");
            treeView1.CollapseAll();

            treeView2 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView2, 0, "column 1");
            AddTreeViewColumn(treeView2, 1, "column 2");
            treeView2.CollapseAll();
            treeView2.Accessible.Name = "treeView2";

            tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iters [0]  = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "False", "Alice", "24", "");
            iters [0] = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "True", "Bob", "28", "");
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            AddTreeViewColumn(dataGridView1, 0, "Gender");
            AddTreeViewColumn(dataGridView1, 1, "Name");
            AddTreeViewColumn(dataGridView1, 2, "Age");
            dataGridView1.Accessible.Name = "dataGridView1";

            hboxPanel = new Gtk.HBox();
            Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove");
            btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
            Gtk.Button btnAddTextBox = new Gtk.Button("Add");
            btnAddTextBox.Clicked     += AddTextBoxClicked;
            txtCommand                 = new Gtk.Entry();
            txtCommand.Accessible.Name = "txtCommand";
            Gtk.Button btnRun = new Gtk.Button("Run");
            btnRun.Clicked += btnRunClicked;
            hboxPanel.Add(btnRemoveTextBox);
            hboxPanel.Add(btnAddTextBox);

            Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string));
            Gtk.TreeIter  iter      = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 0");
            iter = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 1");
            listView1 = new Gtk.TreeView(treeStore);
            AddTreeViewColumn(listView1, 0, "items");
            listView1.Accessible.Name = "listView1";
            listView1.ExpandAll();

            hbox2.Add(button5);
            hbox2.Add(checkbox1);
            hbox2.Add(checkbox2);
            hbox2.Add(button4);
            hbox2.Accessible.Name = "groupBox2";

            hbox3.Add(button7);
            hbox3.Add(button6);
            hbox3.Sensitive       = false;
            hbox3.Accessible.Name = "groupBox3";

            hbox.Add(textBox3);
            hbox.Add(textBox2);
            hbox.Add(textBox1);
            hbox.Add(label1);
            hbox.Add(button1);
            hbox.Add(treeView1);
            hbox.Add(treeView2);
            hbox.Add(listView1);
            hbox.Add(dataGridView1);
            hbox.Add(txtCommand);
            hbox.Add(btnRun);
            hbox.Add(hboxPanel);
            hbox.Add(scaleButton1);

            Gtk.Menu file = new Gtk.Menu();
            file.Append(new Gtk.MenuItem("_New"));
            file.Append(new Gtk.MenuItem("_Open"));
            file.Append(new Gtk.CheckMenuItem("Check"));
            Gtk.MenuItem fileItem = new Gtk.MenuItem("File");
            fileItem.Submenu = file;
            Gtk.Menu edit = new Gtk.Menu();
            edit.Append(new Gtk.MenuItem("_Undo"));
            edit.Append(new Gtk.SeparatorMenuItem());
            edit.Append(new Gtk.MenuItem("_Cut"));
            edit.Append(new Gtk.MenuItem("Copy"));
            edit.Append(new Gtk.MenuItem("_Paste"));
            Gtk.MenuItem editItem = new Gtk.MenuItem("Edit");
            editItem.Submenu = edit;
            Gtk.MenuBar menuBar = new Gtk.MenuBar();
            menuBar.Append(fileItem);
            menuBar.Append(editItem);
            hbox.Add(menuBar);

            hbox.Add(new Gtk.SpinButton(0, 100, 1));
            hbox.Add(new Gtk.ToggleButton("ToggleButton"));
            Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100,
                                                    1, 10, 10);
            hbox.Add(new Gtk.VScrollbar(adj));

            window.Add(hbox);
            window.ShowAll();
        }
示例#55
0
        private static void Init()
        {
            _random = new Random();

            InitializeLua();

            Application.Init();
            if (!GLib.Thread.Supported)
            {
                GLib.Thread.Init();
            }
            Gdk.Threads.Init();

            Gdk.Threads.Enter();

            _window = new Gtk.Window(Globals.WINDOW_NAME);
            _window.SetDefaultSize(Globals.WIDTH, Globals.HEIGHT);
            _window.AppPaintable     = true;
            _window.DoubleBuffered   = false;
            _window.DeleteEvent     += OnWinDelete;
            _window.KeyPressEvent   += OnKeyPress;
            _window.KeyReleaseEvent += OnKeyRelease;
            //_window.ConfigureEvent += OnWindowConfigure;

            DrawingArea da = new DrawingArea();

            da.ExposeEvent += OnExposed;

            Gdk.Color col = new Gdk.Color(0, 0, 0);
            _window.ModifyBg(StateType.Normal, col);
            da.ModifyBg(StateType.Normal, col);

            GLib.Timeout.Add(33, new GLib.TimeoutHandler(Graphics.TimedDraw));

            _window.Add(da);
            _window.ShowAll();

            Gdk.Threads.Leave();

            Graphics.Init();    // depends on _window being initialized
            Item.Init();
            Enemy.Init();       // depends on Globals ctor
            Weapon.Init();      // depends on Globals ctor
            Armor.Init();       // depends on Globals ctor
            Accessory.Init();   // depends on Globals ctor
            Materia.Init();     // depends on Globals ctor
            Character.Init();   // depends on [Weapons|Armor|Materia].Init()
            Globals.Init();     // depends on Character.Init()
            MenuScreen.Init();  // depends on Globals.Init()
            Inventory.Init();   // depends on a whole lot of things
            Spell.Init();       // depends on Globals ctor
            Materiatory.Init(); // depends on Materia.Init()

            int time = Int32.Parse(Globals.SaveGame.SelectSingleNode("//time").InnerText);

            _clock = new Clock(time); // depends on Globals ctor

            // Go to Main Menu
            _state = MainMenu;

            // Go to new Battle
            //GoToBattleState();

            // Go to Post-Battle
            //List<IItem> i = new List<IItem>();
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["potion"]);
            //PostBattle = new PostBattleState(234, 12, 1200, i);
            //_state = PostBattle;

            _state.Init();

            if (Globals.Party[0] == null && Globals.Party[1] == null && Globals.Party[2] == null)
            {
                throw new GamedataException("No character in party!");
            }

            // Level-up demo
            //using (StreamWriter w = new StreamWriter(@"c:\scripts\test.txt"))
            //{
            //    while (Character.Cloud.Level < 98)
            //    {
            //        Character.Cloud.GainExperience(Character.Cloud.ToNextLevel + 10);
            //        w.WriteLine(Character.Cloud.ToString());
            //    }
            //    w.Flush();
            //}
        }
示例#56
0
    public static void Main()
    {
        ClutterRun.Init();
        Gtk.Application.Init();

        Gtk.Window window = new Gtk.Window(WindowType.Toplevel);
        window.DeleteEvent += HandleDelete;
        Toplevel            = window;

        Gtk.VBox vbox = new Gtk.VBox(false, 6);
        window.Add(vbox);

        Embed clutter = new Embed();

        vbox.Add(clutter);

        Stage stage = clutter.Stage as Stage;

        Gtk.Label label = new Gtk.Label("This is a label");
        vbox.PackStart(label, false, false, 0);

        Gtk.Button button = Gtk.Button.NewWithLabel("This is a button...clicky");
        button.Clicked += HandleClickity;
        vbox.PackStart(button, false, false, 0);

        button          = new Gtk.Button(Gtk.Stock.Quit);
        button.Clicked += delegate { Gtk.Application.Quit(); };

        vbox.PackEnd(button, false, false, 0);

        stage.Color = new Clutter.Color(0x61, 0x64, 0x8c, 0xff);

        uint radius = stage.Width / n_hands / 2;

        SuperOH oh = new SuperOH();

        CurrentOH = oh;
        oh.Group  = new Group();
        oh.Hands  = new Actor[n_hands];

        for (int i = 0; i < n_hands; i++)
        {
            Texture hand_text = new Texture("redhand.png");
            uint    w         = hand_text.Width;
            uint    h         = hand_text.Height;

            oh.Hands[i] = hand_text;

            int x = (int)(stage.Width / 2
                          + radius
                          * Math.Cos(i * Math.PI / (n_hands / 2))
                          - w / 2);
            int y = (int)(stage.Height / 2
                          + radius
                          * Math.Sin(i * Math.PI / (n_hands / 2))
                          - h / 2);

            oh.Hands[i].SetPosition(x, y);

            oh.Group.AddActor(oh.Hands[i]);
        }

        oh.Group.ShowAll();

        oh.FadeTimeline      = new Timeline(2000);
        oh.FadeTimeline.Loop = true;
        BehaviourOpacity behaviour = new BehaviourOpacity(new Alpha(oh.FadeTimeline, Sine.Func), 0xff, 0x00);

        behaviour.Apply(oh.Group);

        stage.AddActor(oh.Group);
        stage.ButtonPressEvent += HandleButtonPress;
        stage.KeyPressEvent    += HandleKeyPress;

        stage.ShowAll();

        timeline      = new Timeline(360, 90);
        timeline.Loop = true;

        timeline.NewFrame += HandleNewFrame;

        window.ExposeEvent += delegate { timeline.Start(); };

        window.SetDefaultSize(400, 600);
        window.ShowAll();

        Gtk.Application.Run();
    }
示例#57
0
        public static Widget show_chat_form()
        {
            //新建窗体,标题是Hello World
            var win = new Gtk.Window("聊天");

            win.SetDefaultSize(800, 600);
            //win.SetSizeRequest(800, 600);

            //窗体关闭后退出应用
            //win.DeleteEvent += (s, e) =>
            //{
            //    Gtk.Application.Quit();
            //};

            win.WindowPosition = WindowPosition.Center;
            //win.Resizable = false;
            win.BorderWidth = 10;

            var paned1 = new VPaned();

            win.Add(paned1);
            var paned2 = new HPaned();

            paned1.SetSizeRequest(200, -1);
            paned2.SetSizeRequest(200, -1);
            paned1.Add(paned2);
            var button1 = new Button("按钮一");

            paned1.Pack1(button1, true, false);
            var button2 = new Button("按钮二");

            paned2.Pack1(button2, true, false);
            var paned3 = new VPaned();

            paned3.SetSizeRequest(200, -1);
            paned2.Pack2(paned3, true, false);
            //var button3 = new Button("按钮三");
            RecvChatWidget = new TextView();
            var recvScrollView = new ScrolledWindow();

            recvScrollView.Add(RecvChatWidget);
            //RecvChatWidget.SizeAllocated += new SizeAllocatedHandler(ScrollToBottom);
            paned3.Pack1(recvScrollView, true, false);
            //var button4 = new Button("按钮四");
            SendChatWidget = new TextView();
            var sendScrollView = new ScrolledWindow();

            sendScrollView.Add(SendChatWidget);
            var vbox       = new VBox(false, 0);
            var hbox       = new VBox(true, 0);
            var sendMsgBtn = new Button("发送消息");

            sendMsgBtn.Clicked += (s, e) =>
            {
                TextIter start, end;
                RecvChatWidget.Buffer.GetBounds(out start, out end);
                RecvChatWidget.Buffer.Insert(ref end, SendChatWidget.Buffer.Text);
                RecvChatWidget.Buffer.Insert(ref end, "\n");
                RecvChatWidget.ScrollToIter(RecvChatWidget.Buffer.EndIter, 0.0, false, 0.0, 0.0);
            };
            hbox.PackStart(sendMsgBtn, false, false, 0);
            vbox.PackStart(hbox, false, false, 0);
            vbox.PackEnd(sendScrollView, true, true, 0);
            paned3.Pack2(vbox, true, false);

            win.ShowAll();

            return(paned1);
        }
示例#58
0
    public static void Main(string [] args)
    {
        if (args.Length <= 0)
        {
            Console.WriteLine("\nUSAGE: ImageViewer.exe <filename>\n");
            return;
        }

        string filename = args [0];

        Application.Init();
        window = new Gtk.Window("Image Viewer");
        window.SetDefaultSize(200, 200);

        window.DeleteEvent += new EventHandler(Window_Delete);

        Gtk.ScrolledWindow scrolled_window = new Gtk.ScrolledWindow(new Adjustment(IntPtr.Zero), new Adjustment(IntPtr.Zero));

        Gtk.VBox vbox    = new VBox(false, 2);
        Gtk.VBox menubox = new VBox(false, 0);

        // Pack menubar
        MenuBar mb = new MenuBar();

        Menu     file_menu = new Menu();
        MenuItem exit_item = new ImageMenuItem("gtk-close", new Gtk.AccelGroup(IntPtr.Zero));
        MenuItem open_item = new ImageMenuItem("gtk-open", new Gtk.AccelGroup(IntPtr.Zero));

        exit_item.Activated += new EventHandler(Window_Delete);
        open_item.Activated += new EventHandler(Window_Open);

        file_menu.Append(open_item);
        file_menu.Append(new Gtk.SeparatorMenuItem());
        file_menu.Append(exit_item);
        MenuItem file_item = new MenuItem("_File");

        file_item.Submenu = file_menu;

        mb.Append(file_item);
        menubox.PackStart(mb, false, false, 0);

        // Pack toolbar
        Gtk.Toolbar toolbar = new Gtk.Toolbar();
        toolbar.InsertStock("gtk-open", "Open", String.Empty, new Gtk.SignalFunc(Window_Open), IntPtr.Zero, 0);
        toolbar.InsertStock("gtk-close", "Close", String.Empty, new Gtk.SignalFunc(Window_Delete), IntPtr.Zero, 1);
        menubox.PackStart(toolbar, false, false, 0);
        vbox.PackStart(menubox, false, false, 0);

        Pixbuf pix = GetPixbufFromFile(filename);

        image = new Image(pix);

        Refresh(filename, pix);

        scrolled_window.AddWithViewport(image);
        vbox.PackStart(scrolled_window, true, true, 0);

        scrolled_window.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
        window.Add(vbox);
        window.ShowAll();

        Application.Run();
    }
示例#59
0
 public void SetSize(int width, int height)
 {
     generic_window.SetDefaultSize(width, height);
 }
示例#60
0
        public void Run()
        {
            Gtk.Application.Init();
            SetupTheme();

            ApiExtensibility.Register(typeof(Windows.UI.Core.ICoreWindowExtension), o => new GtkCoreWindowExtension(o));
            ApiExtensibility.Register <Windows.UI.Xaml.Application>(typeof(Uno.UI.Xaml.IApplicationExtension), o => new GtkApplicationExtension(o));
            ApiExtensibility.Register(typeof(Windows.UI.ViewManagement.IApplicationViewExtension), o => new GtkApplicationViewExtension(o));
            ApiExtensibility.Register(typeof(ISystemThemeHelperExtension), o => new GtkSystemThemeHelperExtension(o));
            ApiExtensibility.Register(typeof(Windows.Graphics.Display.IDisplayInformationExtension), o => _displayInformationExtension ??= new GtkDisplayInformationExtension(o, _window));
            ApiExtensibility.Register <TextBoxView>(typeof(ITextBoxViewExtension), o => new TextBoxViewExtension(o, _window));
            ApiExtensibility.Register(typeof(ILauncherExtension), o => new LauncherExtension(o));
            ApiExtensibility.Register <FileOpenPicker>(typeof(IFileOpenPickerExtension), o => new FileOpenPickerExtension(o));
            ApiExtensibility.Register <FolderPicker>(typeof(IFolderPickerExtension), o => new FolderPickerExtension(o));
            ApiExtensibility.Register(typeof(IClipboardExtension), o => new ClipboardExtensions(o));
            ApiExtensibility.Register <FileSavePicker>(typeof(IFileSavePickerExtension), o => new FileSavePickerExtension(o));

            _isDispatcherThread = true;
            _window             = new Gtk.Window("Uno Host");
            Size preferredWindowSize = ApplicationView.PreferredLaunchViewSize;

            if (preferredWindowSize != Size.Empty)
            {
                _window.SetDefaultSize((int)preferredWindowSize.Width, (int)preferredWindowSize.Height);
            }
            else
            {
                _window.SetDefaultSize(1024, 800);
            }
            _window.SetPosition(Gtk.WindowPosition.Center);

            _window.Realized += (s, e) =>
            {
                // Load the correct cursors before the window is shown
                // but after the window has been initialized.
                Cursors.Reload();
            };

            _window.DeleteEvent += delegate
            {
                Gtk.Application.Quit();
            };

            bool EnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback)
            {
                Dispatch(() => callback());

                return(true);
            }

            Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative;

            void Dispatch(System.Action d)
            {
                if (Gtk.Application.EventsPending())
                {
                    Gtk.Application.RunIteration(false);
                }

                GLib.Idle.Add(delegate
                {
                    if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace))
                    {
                        this.Log().Trace($"Iteration");
                    }

                    try
                    {
                        d();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }

                    return(false);
                });
            }

            Windows.UI.Core.CoreDispatcher.DispatchOverride        = Dispatch;
            Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride = () => _isDispatcherThread;

            _window.Realized += (s, e) =>
            {
                WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(_window.AllocatedWidth, _window.AllocatedHeight));
            };

            _window.SizeAllocated += (s, e) =>
            {
                WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(e.Allocation.Width, e.Allocation.Height));
            };

            _window.WindowStateEvent += OnWindowStateChanged;

            var overlay = new Overlay();

            _eventBox = new EventBox();
            _area     = new UnoDrawingArea();
            _fix      = new Fixed();
            overlay.Add(_area);
            overlay.AddOverlay(_fix);
            _eventBox.Add(overlay);
            _window.Add(_eventBox);

            /* avoids double invokes at window level */
            _area.AddEvents((int)GtkCoreWindowExtension.RequestedEvents);

            _window.ShowAll();

            void CreateApp(ApplicationInitializationCallbackParams _)
            {
                var app = _appBuilder();

                app.Host = this;
            }

            WUX.Application.Start(CreateApp, _args);

            UpdateWindowPropertiesFromPackage();

            Gtk.Application.Run();
        }