コード例 #1
1
ファイル: Program.cs プロジェクト: Celderon/oxyplot
        /// <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();
        }
コード例 #2
0
ファイル: GtkProgram.cs プロジェクト: soywiz/cspspemu
        public void Run(IGuiExternalInterface IGuiExternalInterface)
        {
            CommonGuiDisplayOpengl = new CommonGuiDisplayOpengl(IGuiExternalInterface, this);
            CommonGuiInput = new CommonGuiInput(IGuiExternalInterface);
            this.IGuiExternalInterface = IGuiExternalInterface;
            //var Window = new Window("Hello world!");
            Application.Init();
            Window = new Window("Soywiz's Psp Emulator");
            this.GLWidget = new GLWidget(OpenglGpuImpl.UsedGraphicsMode);
            Window.WindowPosition = WindowPosition.Center;
            Window.SetSizeRequest(480, 272);
            Window.Child = GLWidget;
            GLWidget.RenderFrame += GLWidget_RenderFrame;
            GLWidget.SetSizeRequest(480, 272);
            //GLWidget.ShowAll();
            Window.Removed += Window_Removed;
            Window.KeyPressEvent += Window_KeyPressEvent;
            Window.KeysChanged += Window_KeysChanged;
            Window.KeyReleaseEvent += Window_KeyReleaseEvent;

            Window.ShowAll();

            //GLWidget.KeyPressEvent += Window_KeyPressEvent;
            //GLWidget.KeyReleaseEvent += Window_KeyReleaseEvent;

            PspDisplay.DrawEvent += PspDisplay_DrawEvent;

            OpenOpenDialog();
            CommonGuiInput.ReLoadControllerConfig();

            Application.Run();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        public void SetSurfaceAtPoint(DockySurface surface, Gdk.Point point)
        {
            if (surface == currentSurface && point == currentPoint)
            {
                window.QueueDraw();
                return;
            }

            ResetBackgroundBuffer();
            currentSurface = surface;
            currentPoint   = point;

            if (surface == null)
            {
                Hide();
                return;
            }

            window.SetSizeRequest(surface.Width, surface.Height);

            Gdk.Point center  = Gdk.Point.Zero;
            int       padding = 5;

            switch (Gravity)
            {
            case DockPosition.Top:
                center = new Gdk.Point(point.X - surface.Width / 2, point.Y + padding);
                break;

            case DockPosition.Left:
                center = new Gdk.Point(point.X + padding, point.Y - surface.Height / 2);
                break;

            case DockPosition.Right:
                center = new Gdk.Point(point.X - surface.Width - padding, point.Y - surface.Height / 2);
                break;

            case DockPosition.Bottom:
                center = new Gdk.Point(point.X - surface.Width / 2, point.Y - surface.Height - padding);
                break;
            }

            Gdk.Rectangle monitor_geo = window.Screen.GetMonitorGeometry(Monitor);
            center.X = Math.Max(monitor_geo.X, Math.Min(center.X, monitor_geo.X + monitor_geo.Width - surface.Width));
            center.Y = Math.Max(monitor_geo.Y, Math.Min(center.Y, monitor_geo.Y + monitor_geo.Height - surface.Height));

            if (Visible)
            {
                window.QueueDraw();
            }
            window.Move(center.X, center.Y);
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Application.Init();
            Gtk.Window win = new Gtk.Window("test");
            win.Icon = new Pixbuf("images/icon.png");


            statusIcon            = new StatusIcon(new Pixbuf("images/icon.png"));
            statusIcon.PopupMenu += OnTrayIcon;

            win.TypeHint = WindowTypeHint.Dialog;
            win.SetSizeRequest(800, 500);

            Box box = new Box(Orientation.Vertical, 5);

            box.Show();
            win.Add(box);

            Toolbar tb = new Toolbar();

            box.Add(tb);
            tb.Show();

            ToolButton tbStop = new ToolButton(Stock.MediaPause);

            tb.Insert(tbStop, 0);


            ListBox listbx  = new ListBox();
            Label   lbltest = new Label("test");

            lbltest.Show();
            listbx.Add(lbltest);
            listbx.Add(new Label("Test2"));
            box.Add(listbx);
            listbx.ShowAll();


            win.ShowAll();
            win.KeepAbove = true;


            Application.Run();
        }
コード例 #6
0
ファイル: PoofWindow.cs プロジェクト: crystaldust/Docky
        public void Run()
        {
            var poof_file = DockServices.Paths.SystemDataFolder.GetChild("poof.png");

            if (!poof_file.Exists)
            {
                return;
            }

            poof = new Pixbuf(poof_file.Path);

            window = new Gtk.Window(Gtk.WindowType.Toplevel);
            window.AppPaintable = true;
            window.Resizable    = false;
            window.KeepAbove    = true;
            window.CanFocus     = false;
            window.TypeHint     = WindowTypeHint.Splashscreen;
            window.SetCompositeColormap();

            window.Realized += delegate { window.GdkWindow.SetBackPixmap(null, false); };

            window.SetSizeRequest(size, size);
            window.ExposeEvent += HandleExposeEvent;

            GLib.Timeout.Add(30, delegate {
                if (AnimationState == 1)
                {
                    window.Hide();
                    window.Destroy();
                    poof.Dispose();
                    return(false);
                }
                else
                {
                    window.QueueDraw();
                    return(true);
                }
            });

            window.Move(x, y);
            window.ShowAll();
            run_time = DateTime.UtcNow;
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestWinForms.MainClass"/> class.
        /// </summary>
        public MainClass()
        {
            // using Styles ( OPTIONAL EXPERIMENTAL BUT WORKING )
            Gtk.Rc.Parse(System.IO.Path.Combine("Properties", "ProcessOut.xml"));

            // Normal stuff to create a tree view
            Gtk.Window window = new Gtk.Window("TreeView Example");
            window.SetSizeRequest(800, 600);
            window.Destroyed += On_WindowDestroyed_callback;

            Gtk.TreeView tree = new Gtk.TreeView();
            window.Add(tree);

            // one Part of the Solution to host column index
            tree.AppendColumn(CreateNewColumn(0, "name", false));
            tree.AppendColumn(CreateNewColumn(1, "id", false));
            tree.AppendColumn(CreateNewColumn(2, "type", true));
            tree.AppendColumn(CreateNewColumn(3, "class", true));
            tree.AppendColumn(CreateNewColumn(4, "parameter", true));
            tree.AppendColumn(CreateNewColumn(5, "others", true));
            Type[] TypeList = Enumerable.Repeat(typeof(string), tree.Columns.Length).ToArray();
            musicListStore = new Gtk.TreeStore(TypeList);

            // some XML stuff to make something usefull
            MainXMLElement = XElement.Load("Properties/Process.xml", LoadOptions.PreserveWhitespace);
            XElement   y     = MainXMLElement.Element("processes");
            XAttribute title = y.Attribute("name");
            TreeIter   iter  = musicListStore.AppendValues(title == null ? y.Name.ToString() : title.Value);

            XElementIndexer.Add(iter, y);

            walkThroughXml(y, musicListStore, iter);

            // using row filter  ( OPTIONAL EXPERIMENTAL BUT WORKING )
            Gtk.TreeModelFilter filter = new Gtk.TreeModelFilter(musicListStore, null);
            filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);

            tree.Model = filter;

            // Now let us see
            window.ShowAll();
        }
コード例 #8
0
ファイル: HTMLView.cs プロジェクト: ed2014/ApsimX
        /// <summary>
        /// Constructor
        /// </summary>
        public HTMLView(ViewBase owner) : base(owner)
        {
            Builder builder = MasterView.BuilderFromResource("ApsimNG.Resources.Glade.HTMLView.glade");

            vpaned1     = (VPaned)builder.GetObject("vpaned1");
            vbox2       = (VBox)builder.GetObject("vbox2");
            frame1      = (Frame)builder.GetObject("frame1");
            hbox1       = (HBox)builder.GetObject("hbox1");
            _mainWidget = vpaned1;
            // Handle a temporary browser created when we want to export a map.
            if (owner == null)
            {
                popupWindow = new Gtk.Window(Gtk.WindowType.Popup);
                popupWindow.SetSizeRequest(500, 500);
                // Move the window offscreen; the user doesn't need to see it.
                // This works with IE, but not with WebKit
                // Not yet tested on OSX
                if (ProcessUtilities.CurrentOS.IsWindows)
                {
                    popupWindow.Move(-10000, -10000);
                }
                popupWindow.Add(MainWidget);
                popupWindow.ShowAll();
                while (Gtk.Application.EventsPending())
                {
                    Gtk.Application.RunIteration();
                }
            }
            memo = new MemoView(this);
            hbox1.PackStart(memo.MainWidget, true, true, 0);
            vpaned1.PositionSet = true;
            vpaned1.Position    = 200;
            hbox1.Visible       = false;
            hbox1.NoShowAll     = true;
            memo.ReadOnly       = false;
            memo.WordWrap       = true;
            memo.MemoChange    += this.TextUpdate;
            vpaned1.ShowAll();
            frame1.ExposeEvent    += OnWidgetExpose;
            hbox1.Realized        += Hbox1_Realized;
            _mainWidget.Destroyed += _mainWidget_Destroyed;
        }
コード例 #9
0
    public TreeViewExample()
    {
        songs = new ArrayList();

        songs.Add(new Song("Dancing DJs vs. Roxette", "Fading Like a Flower"));
        songs.Add(new Song("Xaiver", "Give me the night"));
        songs.Add(new Song("Daft Punk", "Technologic"));

        Gtk.Window window = new Gtk.Window("TreeView Example");
        window.SetSizeRequest(500, 200);

        Gtk.TreeView tree = new Gtk.TreeView();
        window.Add(tree);

        Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn();
        artistColumn.Title = "Artist";
        Gtk.CellRendererText artistNameCell = new Gtk.CellRendererText();
        artistColumn.PackStart(artistNameCell, true);

        Gtk.TreeViewColumn songColumn = new Gtk.TreeViewColumn();
        songColumn.Title = "Song Title";
        Gtk.CellRendererText songTitleCell = new Gtk.CellRendererText();
        songColumn.PackStart(songTitleCell, true);

        Gtk.ListStore musicListStore = new Gtk.ListStore(typeof(Song));
        foreach (Song song in songs)
        {
            musicListStore.AppendValues(song);
        }

        artistColumn.SetCellDataFunc(artistNameCell, new Gtk.TreeCellDataFunc(RenderArtistName));
        songColumn.SetCellDataFunc(songTitleCell, new Gtk.TreeCellDataFunc(RenderSongTitle));

        tree.Model = musicListStore;

        tree.AppendColumn(artistColumn);
        tree.AppendColumn(songColumn);

        window.ShowAll();
    }
コード例 #10
0
		public void Run ()
		{
			var poof_file = DockServices.Paths.SystemDataFolder.GetChild ("poof.png");
			if (!poof_file.Exists)
				return;
			
			poof = new Pixbuf (poof_file.Path);
			
			window = new Gtk.Window (Gtk.WindowType.Toplevel);
			window.AppPaintable = true;
			window.Resizable = false;
			window.KeepAbove = true;
			window.CanFocus = false;
			window.TypeHint = WindowTypeHint.Splashscreen;
			window.SetCompositeColormap ();
			
			window.Realized += delegate { window.GdkWindow.SetBackPixmap (null, false); };
			
			window.SetSizeRequest (size, size);
			window.ExposeEvent += HandleExposeEvent;
			
			GLib.Timeout.Add (30, delegate {
				if (AnimationState == 1) {
					window.Hide ();
					window.Destroy ();
					poof.Dispose ();
					return false;
				} else {
					window.QueueDraw ();
					return true;
				}
			});
			
			window.Move (x, y);
			window.ShowAll ();
			run_time = DateTime.UtcNow; 
		}
コード例 #11
0
ファイル: MainWindow.cs プロジェクト: brienjl/volatile_reader
    protected void OpenFile(object sender, EventArgs e)
    {
        FileChooserDialog fc = new FileChooserDialog("Choose the directory containing the hives to open",
                                                     this,
                                                     FileChooserAction.SelectFolder,
                                                     "Cancel", ResponseType.Cancel,
                                                     "Open", ResponseType.Accept);

        if (fc.Run() == (int)ResponseType.Accept)
        {
            string dir = fc.Filename;
            fc.Destroy();
            List <Thread> threads     = new List <Thread>();
            Window        window      = new Gtk.Window(Gtk.WindowType.Toplevel);
            VBox          progressBox = new VBox(false, 5);
            reading  = new Label("Reading hives, please wait...");
            pulseBar = new ProgressBar();
            progressBox.PackStart(reading, true, true, 0);
            progressBox.PackStart(pulseBar, true, true, 0);
            reading.Show();
            pulseBar.Show();
            progressBox.Show();
            window.Add(progressBox);
            window.SetPosition(Gtk.WindowPosition.CenterOnParent);
            window.SetSizeRequest(500, 100);
            window.Title = "Loading...";
            window.Show();
            _hives     = new List <RegistryHive>();
            _filenames = new List <string>();
            foreach (var file in System.IO.Directory.GetFiles(dir))
            {
                using (BinaryReader reader = new BinaryReader(File.OpenRead(file)))
                {
                    reader.BaseStream.Position = 0;

                    if (reader.BaseStream.Length > 4)
                    {
                        byte[] magic = reader.ReadBytes(4);
                        if (magic[0] == 'r' && magic[1] == 'e' && magic[2] == 'g' && magic[3] == 'f')
                        {
                            _total += reader.BaseStream.Length;
                            _filenames.Add(file);
                        }
                    }
                }
            }

            threads = GetReadThreads();
            foreach (Thread thread in threads)
            {
                thread.Start();
            }

            new Thread(new ThreadStart(delegate {
                foreach (Thread thread in threads)
                {
                    while (thread.IsAlive)
                    {
                        Application.Invoke(delegate {
                            pulseBar.Pulse();
                        });
                        System.Threading.Thread.Sleep(100);
                    }
                }

                Application.Invoke(delegate {
                    window.Destroy();
                    Populate();
                });
            })).Start();
        }
        else
        {
            fc.Destroy();
        }
    }
コード例 #12
0
ファイル: MainWindow.cs プロジェクト: m3579/Keyboard-Code
        /// <summary>
        /// Initialize the user interface of the KeyboardCode app; in other words,
        /// place all of the components/widgets that are part of the user interface
        /// to the user interface. This method does not show the user interface;
        /// it only places the components. Call the <see cref="Gtk.Window.ShowAll"/> method
        /// to show the user interface 
        /// </summary>
        private void InitGUI()
        {
            window = new Window ("KeyboardCode");
            window.DeleteEvent += OnDeleteEvent;

            window.SetSizeRequest(600, 500);
            window.Maximize ();
        }
コード例 #13
0
        internal Client(bool loadFiles)
        {
            app_count++;

            Window = new Gtk.Window(Gtk.WindowType.Toplevel)
            {
                Title = Catalog.GetString("PDF Mod")
            };
            Window.SetSizeRequest(640, 480);
            Window.DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Quit();
                args.RetVal = true;
            };

            // PDF Icon View
            IconView = new DocumentIconView(this);
            var iconview_sw = new Gtk.ScrolledWindow();

            iconview_sw.AddWithViewport(IconView);

            query_box = new QueryBox(this)
            {
                NoShowAll = true
            };
            query_box.Hide();

            // ActionManager
            ActionManager = new Hyena.Gui.ActionManager();
            Window.AddAccelGroup(ActionManager.UIManager.AccelGroup);
            Actions = new Actions(this, ActionManager);

            // Status bar
            StatusBar = new Gtk.Statusbar()
            {
                HasResizeGrip = true
            };
            status_label = new Label()
            {
                Xalign = 0.0f
            };
            StatusBar.PackStart(status_label, true, true, 6);
            StatusBar.ReorderChild(status_label, 0);

            var zoom_slider = new ZoomSlider(this);

            StatusBar.PackEnd(zoom_slider, false, false, 0);
            StatusBar.ReorderChild(zoom_slider, 1);

            // Properties editor box
            EditorBox = new MetadataEditorBox(this)
            {
                NoShowAll = true
            };
            EditorBox.Hide();

            // Menubar
            menu_bar = ActionManager.UIManager.GetWidget("/MainMenu") as MenuBar;

            // Toolbar
            HeaderToolbar              = ActionManager.UIManager.GetWidget("/HeaderToolbar") as Gtk.Toolbar;
            HeaderToolbar.ShowArrow    = false;
            HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons;
            HeaderToolbar.Tooltips     = true;
            HeaderToolbar.NoShowAll    = true;
            HeaderToolbar.Visible      = Configuration.ShowToolbar;

            // BookmarksView
            BookmarkView           = new BookmarkView(this);
            BookmarkView.NoShowAll = true;
            BookmarkView.Visible   = false;

            var vbox = new VBox();

            vbox.PackStart(menu_bar, false, false, 0);
            vbox.PackStart(HeaderToolbar, false, false, 0);
            vbox.PackStart(EditorBox, false, false, 0);
            vbox.PackStart(query_box, false, false, 0);

            var hbox = new HPaned();

            hbox.Add1(BookmarkView);
            hbox.Add2(iconview_sw);
            vbox.PackStart(hbox, true, true, 0);

            vbox.PackStart(StatusBar, false, true, 0);
            Window.Add(vbox);

            Window.ShowAll();

            if (loadFiles)
            {
                RunIdle(LoadFiles);
                Application.Run();
            }
        }
コード例 #14
0
ファイル: HTMLView.cs プロジェクト: hol353/ApsimX
 /// <summary>
 /// Constructor
 /// </summary>
 public HTMLView(ViewBase owner)
     : base(owner)
 {
     Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.HTMLView.glade", "vpaned1");
     gxml.Autoconnect(this);
     _mainWidget = vpaned1;
     // Handle a temporary browser created when we want to export a map.
     if (owner == null)
     {
         popupWin = new Gtk.Window(Gtk.WindowType.Popup);
         popupWin.SetSizeRequest(500, 500);
         // Move the window offscreen; the user doesn't need to see it.
         // This works with IE, but not with WebKit
         // Not yet tested on OSX
         if (ProcessUtilities.CurrentOS.IsWindows)
             popupWin.Move(-10000, -10000);
         popupWin.Add(MainWidget);
         popupWin.ShowAll();
         while (Gtk.Application.EventsPending())
             Gtk.Application.RunIteration();
     }
     memoView1 = new MemoView(this);
     hbox1.PackStart(memoView1.MainWidget, true, true, 0);
     vpaned1.PositionSet = true;
     vpaned1.Position = 200;
     hbox1.Visible = false;
     hbox1.NoShowAll = true;
     memoView1.ReadOnly = false;
     memoView1.MemoChange += this.TextUpdate;
     vpaned1.ShowAll();
     frame1.ExposeEvent += OnWidgetExpose;
     hbox1.Realized += Hbox1_Realized;
     _mainWidget.Destroyed += _mainWidget_Destroyed;
 }
コード例 #15
0
        private void CreateScopeWindow()
        {
            if(scope_window != null) {
                return;
            }

            scope_window = new Window("Scope");
            scope_window.DeleteEvent += delegate {
                scope_window.Destroy();
                scope_window = null;
                GLib.Source.Remove(poll_timeout);
                poll_timeout = 0;
            };

            scope_view = new ScopeView();
            scope_window.Add(scope_view);
            scope_window.SetSizeRequest(150, 80);
            scope_window.ShowAll();

            poll_timeout = GLib.Timeout.Add(150, PollScope);
        }
コード例 #16
0
ファイル: Main.cs プロジェクト: lanicon/TreemapViewer
    public static void Main(string[] args)
    {
        Node n = null;

        if (args.Length == 0)
        {
            Console.WriteLine("Must specify the XML file with the data to load");
            return;
        }
        try {
            n = LoadNodes(args [0], "Size", "Foo");
        } catch {
            Console.WriteLine("Unable to load {0}", args [0]);
            throw;
        }

        Gtk.Application.Init();
        MoonlightRuntime.Init();

        Gtk.Window w = new Gtk.Window("Foo");
        var        v = new Gtk.VBox(false, 0);

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

        w.SetSizeRequest(width, height);
        MoonlightHost h = new MoonlightHost();

        v.PackStart(h, true, true, 0);
        var back = new Gtk.Button("Back");

        v.PackStart(back, false, false, 0);
        w.Add(v);

        w.ShowAll();

        // Make it pretty, skip all levels that are just 1 element
        while (n.Children.Count == 1)
        {
            n = n.Children [0];
        }

        // Render
        TreemapRenderer r = new TreemapRenderer(n, "");

        r.KeyDown += delegate(object sender, KeyEventArgs e) {
            if (e.Key == Key.Back)
            {
                r.Back();
            }
        };

        back.Clicked += delegate {
            r.Back();
        };

        SetSize(r, width, height);

        h.Application.RootVisual = r;

        w.ResizeChecked += delegate(object sender, EventArgs e) {
            int new_width, new_heigth;
            w.GetSize(out new_width, out new_heigth);

            SetSize(r, new_width, new_heigth);;
        };

        Gtk.Application.Run();
    }
コード例 #17
0
		private static void test(){

			Gtk.Window window = new Gtk.Window ("ニコ生フィーダー v1.0");
			window.DeleteEvent += new DeleteEventHandler (OnQuit);
			window.Gravity = Gdk.Gravity.North;
			window.SetSizeRequest (300, 550);
			Notebook nb = new Notebook ();

			nb.AppendPage(Page_tab ("common"), new MultiTab("タブ(一般)",nb));
			nb.AppendPage(Page_tab ("live"), new MultiTab("タブ(ゲーム)",nb));

			//sc.Add (tree);
			window.Add (nb);
			window.ShowAll ();
		}
コード例 #18
0
		static void GetFeed(string ticket)
		{
			nv = new NameValueCollection ();
			nv.Add ("ticket", ticket);
			XmlNodeList nl = Request (
				"http://live.nicovideo.jp/api/getalertstatus",
				@"//communities|//addr|//port|//thread",
				nv);
			if (nl.Count == 0) {
				Console.WriteLine ("チケットの値が不正です");
				LoginRequest ();
				return;
			}
			Server sv = new Server ();
			Notebook nb = new Notebook ();
			nb.AppendPage(sv.Page_all (), new MultiTab("最新の放送",nb));
			nb.AppendPage(sv.Page_mylist (), new MultiTab("お気に入り",nb));
			nb.AppendPage(Page_tab ("common"), new MultiTab("タブ(一般)",nb));
			nb.AppendPage(Page_tab ("live"), new MultiTab("タブ(ゲーム)",nb));
			nb.AppendPage(Page_tab ("face"), new MultiTab("タブ(顔出し)",nb));
			nb.AppendPage(Page_tab ("totu"), new MultiTab("タブ(凸待ち)",nb));
			nb.AppendPage(Page_tab ("req"), new MultiTab("タブ(動画紹介)",nb));
			nb.AppendPage(Page_tab ("try"), new MultiTab("タブ(やってみた)",nb));
			nb.AppendPage(Page_tab ("r18"), new MultiTab("タブ(R―18)",nb));

			//nb.SwitchPage += (sender, e) => PageChangedEvent(sender, e);

			Gtk.Window window = new Gtk.Window ("ニコ生フィーダー v1.0");
			window.DeleteEvent += new DeleteEventHandler (OnQuit);
			window.SetSizeRequest (300, 550);
			window.KeepAbove = true;
			Toolbar bar = new Toolbar ();
			ToggleToolButton sendBackBtn = new ToggleToolButton ();

			sendBackBtn.Toggled += (sender, e) => SendBack(sender, e, ref window);
			sendBackBtn.TooltipText = "最前面での固定を解除";
			ToggleToolButton logoutBtn = new ToggleToolButton ();
			logoutBtn.TooltipText = "ログアウト";
			logoutBtn.Clicked += (sender, e) => Logout(sender, e, ref window);

			bar.HeightRequest = 25;

			Gtk.Image img = new Gtk.Image();
			img.Pixbuf = new Gdk.Pixbuf("go_back.png",12,12);
			sendBackBtn.IconWidget = img;

			Gtk.Image img2 = new Gtk.Image();
			img2.Pixbuf = new Gdk.Pixbuf("logout.png",16,16);
			logoutBtn.IconWidget = img2;
			logoutBtn.HeightRequest = 25;
			sendBackBtn.HeightRequest = 25;
			bar.Add (logoutBtn);
			bar.Add (sendBackBtn);
			bar.ShowAll ();

			VBox vbox = new VBox(false, 0);
			vbox.PackStart (bar, false, true, 0);
			vbox.PackStart (nb, true, true, 0);
			window.Add (vbox);
			window.ShowAll ();
			window.Focus = nb;
			MainClass.communities = nl [0].InnerText;
			sv.receiveFromServer (nl [1].InnerText, nl [2].InnerText, nl [3].InnerText);
		}
コード例 #19
0
 public TreeViewExample ()
 {
 
     // Create a Window
 
     Gtk.Window window = new Gtk.Window ("TreeView Example");
 
     window.SetSizeRequest (500,200);
 
     window.DeleteEvent+=delegate {Application.Quit();};
 
 
 
     // Create an Entry used to filter the tree
 
     filterEntry = new Gtk.Entry ();
 
 
 
     // Fire off an event when the text in the Entry changes
 
     filterEntry.Changed += OnFilterEntryTextChanged;
 
 
 
     // Create a nice label describing the Entry
 
     Gtk.Label filterLabel = new Gtk.Label ("Search:");
 
 
 
     // Put them both into a little box so they show up side by side
 
     Gtk.HBox filterBox = new Gtk.HBox ();
 
     filterBox.PackStart (filterLabel, false, false, 5);
 
     filterBox.PackStart (filterEntry, true, true, 5);
 
 
 
     // Create our TreeView
 
     Gtk.TreeView tv = new Gtk.TreeView ();
 
 
 
     // Create a box to hold the Entry and Tree
 
     Gtk.VBox box = new Gtk.VBox ();
 
 
 
     // Add the widgets to the box
 
     box.PackStart (filterBox, false, false, 5);
 
     box.PackStart (tv, true, true, 5);
 
 
 
     window.Add (box);
 
 
 
 
 
     //setting up columns and renderers
 
 
 
 
 
     Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn{Title="Name"}; 
 
     Gtk.CellRendererText nameCell = new Gtk.CellRendererText ();        
 
     nameColumn.PackStart (nameCell, true);
 
 
 
 
 
 
 
 
 
     Gtk.TreeViewColumn emailColumn = new Gtk.TreeViewColumn {Title="Email"}; 
 
     Gtk.CellRendererText emailCell = new Gtk.CellRendererText ();
 
     emailColumn.PackStart (emailCell, true);
 
 
 
 
 
 
 
     // Add the columns to the TreeView
 
     tv.AppendColumn (nameColumn);
 
     tv.AppendColumn (emailColumn);
 
 
 
 
 
 
 
     // Tell the Cell Renderers which items in the model to display
 
     nameColumn.AddAttribute (nameCell, "text", 0);
 
     emailColumn.AddAttribute (emailCell, "text", 1);
 
 
 
 
 
 
 
     // Create a model that will hold two strings 
 
     Gtk.TreeStore contacts = new Gtk.TreeStore (typeof (string), typeof (string));
 
 
 
 
 
     // Add some hierarchical data
 
 
 
     Gtk.TreeIter treeiter;
 
 
 
 
 
     //first root
 
     treeiter= contacts.AppendValues("testFRIENDS"); 
 
 
 
         // 2 children of first root
 
         contacts.AppendValues(treeiter, "testOgre", "*****@*****.**");
 
         contacts.AppendValues(treeiter, "testBee", "*****@*****.**");
 
 
 
 
 
 
 
     // second root
 
     treeiter= contacts.AppendValues("RELATIVES"); 
 
 
 
         // 3 children of second root
 
         contacts.AppendValues (treeiter,"Mommy","*****@*****.**");
 
         contacts.AppendValues (treeiter,"Daddy", "*****@*****.**");
 
         contacts.AppendValues (treeiter,"tom", "*****@*****.**");
 
 
 
 
 
 
 
 
 
     filter = new Gtk.TreeModelFilter (contacts, null);
 
 
 
     // Specify the function that determines which rows to filter out and which ones to display
 
     filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc (FilterTree);
 
 
 
     // Assign the filter as our treeview's model
 
     tv.Model = filter;
 
 
 
     // Show the window and everything on it
 
     window.ShowAll ();
 
 }
コード例 #20
0
    protected void OpenFile(object sender, EventArgs e)
    {
        FileChooserDialog fc = new FileChooserDialog ("Choose the directory containing the hives to open",
                                                        this,
                                                        FileChooserAction.SelectFolder,
                                                        "Cancel", ResponseType.Cancel,
                                                        "Open", ResponseType.Accept);

        if (fc.Run () == (int)ResponseType.Accept) {
            string dir = fc.Filename;
            fc.Destroy();
            List<Thread> threads = new List<Thread>();
            Window window = new Gtk.Window(Gtk.WindowType.Toplevel);
            VBox progressBox = new VBox(false, 5);
            reading = new Label("Reading hives, please wait...");
            pulseBar = new ProgressBar();
            progressBox.PackStart(reading, true, true, 0);
            progressBox.PackStart(pulseBar, true, true, 0);
            reading.Show();
            pulseBar.Show ();
            progressBox.Show();
            window.Add(progressBox);
            window.SetPosition(Gtk.WindowPosition.CenterOnParent);
            window.SetSizeRequest(500,100);
            window.Title = "Loading...";
            window.Show();
            _hives = new List<RegistryHive>();
            _filenames = new List<string>();
            foreach (var file in System.IO.Directory.GetFiles(dir))
            {
                using (BinaryReader reader = new BinaryReader(File.OpenRead(file)))
                {
                    reader.BaseStream.Position = 0;

                    if (reader.BaseStream.Length > 4)
                    {
                        byte[] magic = reader.ReadBytes(4);
                        if (magic[0] == 'r' && magic[1] == 'e' && magic[2] == 'g' && magic[3] == 'f')
                        {
                            _total += reader.BaseStream.Length;
                            _filenames.Add(file);
                        }
                    }
                }
            }

            threads = GetReadThreads ();
            foreach (Thread thread in threads)
                thread.Start();

            new Thread(new ThreadStart(delegate {
                foreach (Thread thread in threads)
                {
                    while (thread.IsAlive)
                    {
                        Application.Invoke(delegate {
                            pulseBar.Pulse();
                        });
                        System.Threading.Thread.Sleep(100);
                    }
                }

                Application.Invoke(delegate {
                    window.Destroy();
                    Populate();
                });
            })).Start();
        }
        else
            fc.Destroy();
    }
コード例 #21
0
        void okButton_Clicked(object sender, EventArgs e)
        {
            if(width > max || height > max)
            {
                Window messageWindow = new Window("Info");
                messageWindow.SetSizeRequest(250, 100);
                messageWindow.SetPosition(WindowPosition.Mouse);

                MessageDialog messageDialog = new MessageDialog(messageWindow, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Width and height have to be below 6000");
                messageDialog.Run();
                messageDialog.Destroy();
                return;
            }
            response = ResponseType.Ok;
        }
コード例 #22
0
ファイル: Client.cs プロジェクト: GNOME/pdfmod
        internal Client (bool loadFiles)
        {
            app_count++;

            Window = new Gtk.Window (Gtk.WindowType.Toplevel) { Title = Catalog.GetString ("PDF Mod") };
            Window.SetSizeRequest (640, 480);
            Window.DeleteEvent += delegate (object o, DeleteEventArgs args) {
                Quit ();
                args.RetVal = true;
            };

            // PDF Icon View
            IconView = new DocumentIconView (this);
            var iconview_sw = new Gtk.ScrolledWindow ();
            iconview_sw.AddWithViewport (IconView);

            query_box = new QueryBox (this) { NoShowAll = true };
            query_box.Hide ();

            // ActionManager
            ActionManager = new Hyena.Gui.ActionManager ();
            Window.AddAccelGroup (ActionManager.UIManager.AccelGroup);
            Actions = new Actions (this, ActionManager);

            // Status bar
            StatusBar = new Gtk.Statusbar () { HasResizeGrip = true };
            status_label = new Label () { Xalign = 0.0f };
            StatusBar.PackStart (status_label, true, true, 6);
            StatusBar.ReorderChild (status_label, 0);

            var zoom_slider = new ZoomSlider (this);
            StatusBar.PackEnd (zoom_slider, false, false, 0);
            StatusBar.ReorderChild (zoom_slider, 1);

            // Properties editor box
            EditorBox = new MetadataEditorBox (this) { NoShowAll = true };
            EditorBox.Hide ();

            // Menubar
            menu_bar = ActionManager.UIManager.GetWidget ("/MainMenu") as MenuBar;

            // Toolbar
            HeaderToolbar = ActionManager.UIManager.GetWidget ("/HeaderToolbar") as Gtk.Toolbar;
            HeaderToolbar.ShowArrow = false;
            HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons;
            HeaderToolbar.Tooltips = true;
            HeaderToolbar.NoShowAll = true;
            HeaderToolbar.Visible = Configuration.ShowToolbar;

            // BookmarksView
            BookmarkView = new BookmarkView (this);
            BookmarkView.NoShowAll = true;
            BookmarkView.Visible = false;

            var vbox = new VBox ();
            vbox.PackStart (menu_bar, false, false, 0);
            vbox.PackStart (HeaderToolbar, false, false, 0);
            vbox.PackStart (EditorBox, false, false, 0);
            vbox.PackStart (query_box, false, false, 0);

            var hbox = new HPaned ();
            hbox.Add1 (BookmarkView);
            hbox.Add2 (iconview_sw);
            vbox.PackStart (hbox, true, true, 0);

            vbox.PackStart (StatusBar, false, true, 0);
            Window.Add (vbox);

            Window.ShowAll ();

            if (loadFiles) {
                RunIdle (LoadFiles);
                Application.Run ();
            }
        }
コード例 #23
0
ファイル: Program.cs プロジェクト: ugureren/agariosharp
        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 ();
        }
コード例 #24
0
ファイル: frame.cs プロジェクト: BackupTheBerlios/genaro
        private void inicia()
        {
            /* Create a new window */
                        Window window = new Window ("Ejemplo de frames y tal ...");

                        /* Here we connect the "destroy" event to a signal handler */
                        window.DeleteEvent += delete_event;

                        window.SetSizeRequest(500, 400);
                        /* Sets the border width of the window. */
                        window.BorderWidth= 10;

                        /* Create a Frame */
                        //Frame frame = new Frame("MyFrame");
            frame = new Frame("MyFrame");
                        window.Add(frame);

                        /* Set the frame's label */
                        frame.Label = "Mueveme!!!!";

                        /* Align the label at the right of the frame */

                        //frame.SetLabelAlign((float)1.0,(float)0.0); esta anticuado
            //valores entre 0.0 y 1.0, indica cada extremo
            frame.LabelXalign = (float)1.0;
            frame.LabelYalign = (float)1.0;

                        /* Set the style of the frame */
                        frame.ShadowType = (ShadowType) 4;

            /* añade mis cositas*/
            frame.Add(rellenoDelFrame());

                        frame.Show();

                        /* Display the window & all widgets*/
                        window.ShowAll();
        }
コード例 #25
0
    public TreeViewExample(List <List <String> > tokens)
    {
        // Create a Window
        window = new Gtk.Window("Lista De Tokens");
        window.SetSizeRequest(500, 200);

        // Create an Entry used to filter the tree
        filterEntry = new Gtk.Entry();

        // Fire off an event when the text in the Entry changes
        filterEntry.Changed += OnFilterEntryTextChanged;

        // Create a nice label describing the Entry
        Gtk.Label filterLabel = new Gtk.Label("Token:");

        // Put them both into a little box so they show up side by side
        Gtk.HBox filterBox = new Gtk.HBox();
        filterBox.PackStart(filterLabel, false, false, 5);
        filterBox.PackStart(filterEntry, true, true, 5);

        // Create our TreeView
        Gtk.TreeView tree = new Gtk.TreeView();

        // Create a box to hold the Entry and Tree
        Gtk.VBox box = new Gtk.VBox();

        // Add the widgets to the box
        box.PackStart(filterBox, false, false, 5);
        box.PackStart(tree, true, true, 5);

        window.Add(box);

        // Create a column for the artist name
        Gtk.TreeViewColumn tipoTokenColumn = new Gtk.TreeViewColumn();
        tipoTokenColumn.Title = "TIPO";

        // Create the text cell that will display the artist name
        Gtk.CellRendererText tipoTokenDescriptionCell = new Gtk.CellRendererText();

        // Add the cell to the column
        tipoTokenColumn.PackStart(tipoTokenDescriptionCell, true);

        // Create a column for the song title
        Gtk.TreeViewColumn tokenColumn = new Gtk.TreeViewColumn();
        tokenColumn.Title = "Token";

        // Do the same for the song title column
        Gtk.CellRendererText tokenTitleCell = new Gtk.CellRendererText();
        tokenColumn.PackStart(tokenTitleCell, true);

        // Add the columns to the TreeView
        tree.AppendColumn(tipoTokenColumn);
        tree.AppendColumn(tokenColumn);

        // Tell the Cell Renderers which items in the model to display
        tipoTokenColumn.AddAttribute(tipoTokenDescriptionCell, "text", 0);
        tokenColumn.AddAttribute(tokenTitleCell, "text", 1);

        // Create a model that will hold two strings - Artist Name and Song Title
        this.tokenListStore = new Gtk.ListStore(typeof(string), typeof(string));

        // Add some data to the store
        int c = 1;

        tokens.ForEach(lst =>
        {
            lst.ForEach(x => {
                switch (c)
                {
                case 1:

                    tokenListStore.AppendValues("Entero", x);
                    break;

                case 2:

                    tokenListStore.AppendValues("Decimal", x);
                    break;

                case 3:

                    tokenListStore.AppendValues("Palabra", x);
                    break;

                case 4:

                    tokenListStore.AppendValues("Moneda", x);
                    break;
                }
            });
            c++;
        });


        // Instead of assigning the ListStore model directly to the TreeStore, we create a TreeModelFilter
        // which sits between the Model (the ListStore) and the View (the TreeView) filtering what the model sees.
        // Some may say that this is a "Controller", even though the name and usage suggests that it is still part of
        // the Model.
        filter = new Gtk.TreeModelFilter(tokenListStore, null);

        // Specify the function that determines which rows to filter out and which ones to display
        filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);

        // Assign the filter as our tree's model
        tree.Model = filter;

        // Show the window and everything on it
    }
コード例 #26
0
    private Application(Options opts)
    {
        selection = new TileSelection();

        Glade.XML.CustomHandler = GladeCustomWidgetHandler;
        Glade.XML gxml = new Glade.XML("editor.glade", "MainWindow");
        gxml.Autoconnect(this);

        if (MainWindow == null)
        {
            throw new Exception("Couldn't resolve all widgets");
        }

        ((GameObjectListWidget)ToolGObjectsProps).SetGtkFrame(fGObjects);

        Tileset.LoadEditorImages = true;

        // Initialize status bar for PrintStatus()
        printStatusContextID = sbMain.GetContextId("PrintStatus");
        printStatusMessageID = sbMain.Push(printStatusContextID, "Welcome to Supertux-Editor.");

        MainWindow.DeleteEvent += OnDelete;

        MainWindow.SetSizeRequest(900, 675);
        MainWindowTitlePrefix = MainWindow.Title;
        UpdateTitlebar();
        UpdateRecentDocuments();
        MainWindow.Icon = EditorStock.WindowIcon;
        //HACK: not a typo, EditorStock adds icons to the stock only when called 2x or more..
        MainWindow.Icon = EditorStock.WindowIcon;
        MainWindow.ShowAll();

        // Manually set icons for Tools, automatic stock initialization is broken on some systems
        ToolSelect.StockId       = EditorStock.ToolSelect;
        ToolTiles.StockId        = EditorStock.ToolTiles;
        ToolObjects.StockId      = EditorStock.ToolObjects;
        ToolBrush.StockId        = EditorStock.ToolBrush;
        ToolFill.StockId         = EditorStock.ToolFill;
        ToolReplace.StockId      = EditorStock.ToolReplace;
        ToolPath.StockId         = EditorStock.ToolPath;
        ToolButtonCamera.StockId = EditorStock.Camera;

        // Hide some extra widgets (because MainWindow.ShowAll(); showed them all)
        fGObjects.Visible = false;
        if (Settings.Instance.ToolboxOnRight)
        {
            aTools.Reparent(fToolsRight);
            fToolsLeft.Hide();
        }
        else
        {
            aTools.Reparent(fToolsLeft);
            fToolsRight.Hide();
        }


        // Tool "Select" is selected by default - call its event handler
        OnToolSelect(null, null);

        //Setup drag destination for "files"
        Gtk.Drag.DestSet(MainWindow, Gtk.DestDefaults.All, target_table,
                         Gdk.DragAction.Default |
                         Gdk.DragAction.Copy |
                         Gdk.DragAction.Move |
                         Gdk.DragAction.Link |
                         Gdk.DragAction.Private |
                         Gdk.DragAction.Ask);
        MainWindow.DragDataReceived += OnDragDataReceived;

        fileChooser = new Gtk.FileChooserDialog("Choose a Level", MainWindow, Gtk.FileChooserAction.Open, new object[] {});
        if (!Directory.Exists(Settings.Instance.LastDirectoryName))             //noexistent (or null) LastDirectoryName, resetting to default
        {
            if (Settings.Instance.SupertuxData != null)
            {
                Settings.Instance.LastDirectoryName = System.IO.Path.Combine(Settings.Instance.SupertuxData, "levels") + System.IO.Path.DirectorySeparatorChar;
            }
            else
            {
                Settings.Instance.LastDirectoryName = Environment.ExpandEnvironmentVariables("%HOME%");
            }
        }
        fileChooser.SetCurrentFolder(Settings.Instance.LastDirectoryName);
        fileChooser.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
        fileChooser.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);
        fileChooser.DefaultResponse = Gtk.ResponseType.Ok;
        Gtk.FileFilter filter = new Gtk.FileFilter();
        filter.Name = "Supertux Levels and Worldmaps";
        filter.AddPattern("*.stl");
        filter.AddPattern("*.stwm");
        fileChooser.AddFilter(filter);
        Gtk.FileFilter levelfilter = new Gtk.FileFilter();
        levelfilter.Name = "Supertux Levels";
        levelfilter.AddPattern("*.stl");
        fileChooser.AddFilter(levelfilter);
        Gtk.FileFilter worldmapfilter = new Gtk.FileFilter();
        worldmapfilter.Name = "Supertux Worldmaps";
        worldmapfilter.AddPattern("*.stwm");
        fileChooser.AddFilter(worldmapfilter);
        Gtk.FileFilter brushfilter = new Gtk.FileFilter();
        brushfilter.Name = "Supertux-Editor Brushes";
        brushfilter.AddPattern("*.csv");
        fileChooser.AddFilter(brushfilter);
        Gtk.FileFilter all = new Gtk.FileFilter();
        all.Name = "All Files";
        all.AddPattern("*");
        fileChooser.AddFilter(all);
        if (Settings.Instance.SupertuxData != null)
        {
            try {
                fileChooser.AddShortcutFolder(System.IO.Path.Combine(Settings.Instance.SupertuxData, "levels"));
            } catch (Exception e) {
                LogManager.Log(LogLevel.Warning, "Couldn't add supertux level directory to File Chooser: " + e.Message);
            }
        }

        if (opts.FileNames.Count > 0)
        {
            Load(opts.FileNames[0]);
        }

        UndoManager.OnAddCommand += OnUndoManager;
        UndoManager.OnRedo       += OnUndoManager;
        UndoManager.OnUndo       += OnUndoManager;

        editorApplication = this;

        PrintStatus("Welcome to Supertux-Editor.");
    }
コード例 #27
0
ファイル: default_viewer.cs プロジェクト: Meticulus/tactical
		protected void OnFullscreenActionActivated (object sender, EventArgs e)
		{
			Button b = (Button)sender;
			Window w = new Window("Content Type Viewer");
			w.DeleteEvent += delegate(object o, DeleteEventArgs args) {
				_window_vbox.Remove(this);
				_parent.Add(this);
				b.ShowAll();
			};
			w.SetSizeRequest(800,600);
			_parent = (VBox)this.Parent;
			_parent.Remove(this);
			_window_vbox = new Gtk.VBox();
			w.Add(_window_vbox);
			_window_vbox.Add(this);
			w.ShowAll();
			w.Show();
			b.HideAll();
		}
コード例 #28
0
ファイル: MainWindow.cs プロジェクト: mdwade/Simulation-Impot
    //Button liste employés
    protected void OnButton3Clicked(object sender, EventArgs e)
    {
        Gtk.Window window = new Gtk.Window("Liste des employés");
        window.SetSizeRequest(1000, 500);

        Gtk.TreeView tree = new Gtk.TreeView();

        window.Add(tree);

        Gtk.TreeViewColumn matriculeColumn = new Gtk.TreeViewColumn();
        matriculeColumn.Title = "Matricule";

        Gtk.TreeViewColumn nomColumn = new Gtk.TreeViewColumn();
        nomColumn.Title = "Nom";

        Gtk.TreeViewColumn prenomColumn = new Gtk.TreeViewColumn();
        prenomColumn.Title = "Prénom";

        Gtk.TreeViewColumn salaireColumn = new Gtk.TreeViewColumn();
        salaireColumn.Title = "Salaire Brut";

        Gtk.TreeViewColumn NbreJourColumn = new Gtk.TreeViewColumn();
        NbreJourColumn.Title = "NbreJours";

        Gtk.TreeViewColumn conjointColumn = new Gtk.TreeViewColumn();
        conjointColumn.Title = "Conjoint";

        Gtk.TreeViewColumn nbreEnfantColumn = new Gtk.TreeViewColumn();
        nbreEnfantColumn.Title = "Enfant";

        tree.AppendColumn(matriculeColumn);


        Gtk.ListStore employeListe = new Gtk.ListStore(typeof(string));

        tree.Model = employeListe;
        ICollection key = (ICollection)listEmployees.Keys;

        foreach (string k in key)
        {
            if (listEmployees[k].getConjoint() == 0)
            {
                employeListe.AppendValues(listEmployees[k].getNom() + " " + listEmployees[k].getPrenom() + ", Célibataire, Salaire brut : " + listEmployees[k].getSalaireBrut());
            }
            else
            {
                Console.WriteLine(listEmployees[k].getNom() + " " + listEmployees[k].getPrenom() + ", Conjoint non salarié, Salaire brut : " + listEmployees[k].getSalaireBrut());
            }
        }

        Gtk.CellRendererText employeMatriculeCell = new Gtk.CellRendererText();
        matriculeColumn.PackStart(employeMatriculeCell, true);

        Gtk.CellRendererText employeNomCell = new Gtk.CellRendererText();
        nomColumn.PackStart(employeNomCell, true);

        Gtk.CellRendererText employePrenomCell = new Gtk.CellRendererText();
        prenomColumn.PackStart(employePrenomCell, true);

        Gtk.CellRendererText employeSalaireCell = new Gtk.CellRendererText();
        salaireColumn.PackStart(employeSalaireCell, true);

        Gtk.CellRendererText employeNbreJourCell = new Gtk.CellRendererText();
        NbreJourColumn.PackStart(employeNbreJourCell, true);

        Gtk.CellRendererText employeConjointCell = new Gtk.CellRendererText();
        conjointColumn.PackStart(employeConjointCell, true);

        Gtk.CellRendererText employeNbreEnfantCell = new Gtk.CellRendererText();
        nbreEnfantColumn.PackStart(employeNbreEnfantCell, true);


        // Tell the Cell Renderers which items in the model to display
        matriculeColumn.AddAttribute(employeMatriculeCell, "text", 0);
        nomColumn.AddAttribute(employeNomCell, "text", 0);
        prenomColumn.AddAttribute(employePrenomCell, "text", 0);
        salaireColumn.AddAttribute(employeSalaireCell, "text", 0);
        NbreJourColumn.AddAttribute(employeNbreJourCell, "text", 0);
        conjointColumn.AddAttribute(employeConjointCell, "text", 0);
        nbreEnfantColumn.AddAttribute(employeNbreEnfantCell, "text", 0);


        window.ShowAll();
    }
コード例 #29
0
ファイル: Main.cs プロジェクト: mono/TreemapViewer
    public static void Main(string[] args)
    {
        Node n = null;

        if (args.Length == 0){
            Console.WriteLine ("Must specify the XML file with the data to load");
            return;
        }
        try {
            n = LoadNodes (args [0], "Size", "Foo");
        } catch {
            Console.WriteLine ("Unable to load {0}", args [0]);
            throw;
        }

        Gtk.Application.Init ();
        MoonlightRuntime.Init ();

        Gtk.Window w = new Gtk.Window ("Foo");
        var v = new Gtk.VBox (false, 0);

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

        w.SetSizeRequest (width, height);
        MoonlightHost h = new MoonlightHost ();

        v.PackStart (h, true, true, 0);
        var back = new Gtk.Button ("Back");
        v.PackStart (back, false, false, 0);
        w.Add (v);

        w.ShowAll ();

        // Make it pretty, skip all levels that are just 1 element
        while (n.Children.Count == 1)
            n = n.Children [0];

        // Render
        TreemapRenderer r = new TreemapRenderer (n, "");
        r.KeyDown += delegate (object sender, KeyEventArgs e) {
            if (e.Key == Key.Back)
                r.Back ();
        };

        back.Clicked += delegate {
            r.Back ();
        };

        SetSize (r, width, height);

        h.Application.RootVisual = r;

        w.ResizeChecked += delegate(object sender, EventArgs e) {
            int new_width, new_heigth;
            w.GetSize (out new_width, out new_heigth);

            SetSize (r, new_width, new_heigth);;
        };

        Gtk.Application.Run ();
    }
コード例 #30
0
ファイル: Main.cs プロジェクト: esterdam/ad
        public static void TreeView()
        {
            NpgsqlConnection connection = new NpgsqlConnection("Server=127.0.0.1; Database=dbprueba;" +
             	"User Id=dbprueba; Password=sistemas;");

            connection.Open();

            IDbCommand command = connection.CreateCommand();
            command.CommandText="SELECT * FROM prueba";
            IDataReader dataReader = command.ExecuteReader();

            columnas = new ArrayList ();

            while (dataReader.Read()) {
                int ids = (int)dataReader["id"];
                string n = (string)dataReader["nombre"];
                string a1 = (string)dataReader["apellido1"];
                string a2 = (string)dataReader["apellido2"];

                columnas.Add (new Columna (ids,n,a1,a2));
            }

            Gtk.Window window = new Gtk.Window ("TreeView Example");
            window.SetSizeRequest (500,200);

            Gtk.TreeView tree = new Gtk.TreeView ();
            window.Add (tree);

            //-----------
            Gtk.TreeViewColumn columnaId = new Gtk.TreeViewColumn ();
            columnaId.Title = dataReader.GetName(0);
            Gtk.CellRendererText columnaIdCelda = new Gtk.CellRendererText ();
            columnaId.PackStart (columnaIdCelda, true);

            Gtk.TreeViewColumn columnaNom = new Gtk.TreeViewColumn ();
            columnaNom.Title = dataReader.GetName(1);
            Gtk.CellRendererText columnaNomCelda = new Gtk.CellRendererText ();
            columnaNom.PackStart (columnaNomCelda, true);

            Gtk.TreeViewColumn columnaAp1 = new Gtk.TreeViewColumn ();
            columnaAp1.Title = dataReader.GetName(2);
            Gtk.CellRendererText columnaAp1Celda = new Gtk.CellRendererText ();
            columnaAp1.PackStart (columnaAp1Celda, true);

            Gtk.TreeViewColumn columnaAp2 = new Gtk.TreeViewColumn ();
            columnaAp2.Title = dataReader.GetName(3);
            Gtk.CellRendererText columnaAp2Celda = new Gtk.CellRendererText ();
            columnaAp2.PackStart (columnaAp2Celda, true);
             		//---------

            Gtk.ListStore listStore = new Gtk.ListStore (typeof (Columna));
            foreach (Columna col in columnas) {
                listStore.AppendValues (col);
            }

            for(int i=0; i<dataReader.FieldCount; i++) {

            }

            columnaId.SetCellDataFunc (columnaIdCelda, new Gtk.TreeCellDataFunc (RenderId));
            columnaNom.SetCellDataFunc (columnaNomCelda, new Gtk.TreeCellDataFunc (RenderNom));
            columnaAp1.SetCellDataFunc (columnaAp1Celda, new Gtk.TreeCellDataFunc (RenderAp1));
             			columnaAp2.SetCellDataFunc (columnaAp2Celda, new Gtk.TreeCellDataFunc (RenderAp2));

            tree.Model = listStore;

            tree.AppendColumn (columnaId);
            tree.AppendColumn (columnaNom);
             		tree.AppendColumn (columnaAp1);
            tree.AppendColumn (columnaAp2);

            window.ShowAll ();

            dataReader.Close();
            connection.Close();
        }
コード例 #31
0
ファイル: Application.cs プロジェクト: slackstone/tuxjunior
    private Application(string[] args)
    {
        selection = new Selection();

        Glade.XML.CustomHandler = GladeCustomWidgetHandler;
        Glade.XML gxml = new Glade.XML("editor.glade", "MainWindow");
        gxml.Autoconnect(this);

        if (MainWindow == null)
        {
            throw new Exception("Couldn't resolve all widgets");
        }

        Tileset.LoadEditorImages = true;

        // Initialize status bar for PrintStatus()
        printStatusContextID = sbMain.GetContextId("PrintStatus");
        printStatusMessageID = sbMain.Push(printStatusContextID, "Welcome to Tuxjunior-Editor.");

        MainWindow.DeleteEvent += OnDelete;

        MainWindow.SetSizeRequest(900, 675);
        MainWindowTitlePrefix = MainWindow.Title;
        UpdateTitlebar();
        UpdateRecentDocuments();
        MainWindow.Icon = EditorStock.WindowIcon;
        //HACK: not a typo, EditorStock adds icons to the stock only when called 2x or more..
        MainWindow.Icon = EditorStock.WindowIcon;
        MainWindow.ShowAll();

        // Tool "Select" is selected by default - call its event handler
        OnToolSelect(null, null);

        fileChooser = new FileChooserDialog("Choose a Level", MainWindow, FileChooserAction.Open, new object[] {});
        if (Settings.Instance.LastDirectoryName == null)
        {
            if (Settings.Instance.TuxjuniorData != null)
            {
                Settings.Instance.LastDirectoryName = Settings.Instance.TuxjuniorData + "levels" + System.IO.Path.DirectorySeparatorChar;
            }
            else
            {
                Settings.Instance.LastDirectoryName = Environment.ExpandEnvironmentVariables("%HOME%");
            }
        }
        fileChooser.SetCurrentFolder(Settings.Instance.LastDirectoryName);
        fileChooser.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
        fileChooser.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);
        fileChooser.DefaultResponse = Gtk.ResponseType.Ok;
        Gtk.FileFilter filter = new Gtk.FileFilter();
        filter.Name = "Tuxjunior Levels and Worldmaps";
        filter.AddPattern("*.stl");
        filter.AddPattern("*.stwm");
        fileChooser.AddFilter(filter);
        Gtk.FileFilter levelfilter = new Gtk.FileFilter();
        levelfilter.Name = "Tuxjunior Levels";
        levelfilter.AddPattern("*.stl");
        fileChooser.AddFilter(levelfilter);
        Gtk.FileFilter worldmapfilter = new Gtk.FileFilter();
        worldmapfilter.Name = "Tuxjunior Worldmaps";
        worldmapfilter.AddPattern("*.stwm");
        fileChooser.AddFilter(worldmapfilter);
        Gtk.FileFilter brushfilter = new Gtk.FileFilter();
        brushfilter.Name = "Tuxjunior-Editor Brushes";
        brushfilter.AddPattern("*.csv");
        fileChooser.AddFilter(brushfilter);
        Gtk.FileFilter all = new Gtk.FileFilter();
        all.Name = "All Files";
        all.AddPattern("*");
        fileChooser.AddFilter(all);
        if (Settings.Instance.TuxjuniorData != null)
        {
            try {
                fileChooser.AddShortcutFolder(Settings.Instance.TuxjuniorData + System.IO.Path.DirectorySeparatorChar + "levels");
            } catch (Exception e) {
                LogManager.Log(LogLevel.Warning, "Couldn't add tuxjunior level directory to File Chooser: " + e.Message);
            }
        }

        if (args.Length > 0)
        {
            Load(args[0]);
        }

        UndoManager.OnAddCommand += OnUndoManager;
        UndoManager.OnRedo       += OnUndoManager;
        UndoManager.OnUndo       += OnUndoManager;

        PrintStatus("Welcome to Tuxjunior-Editor.");
    }