public DemoApplicationWindow () : base ("Application Window")
		{
			SetDefaultSize (200, 200);

			vbox = new VBox (false, 0);
			Add (vbox);

			AddActions ();

			statusbar = new Statusbar ();
			UpdateStatus ();
			vbox.PackEnd (statusbar, false, false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			sw.ShadowType = ShadowType.In;
			vbox.PackEnd (sw, true, true, 0);

			TextView textview = new TextView ();
			textview.Buffer.MarkSet += new MarkSetHandler (MarkSet);
			sw.Add (textview);

			textview.GrabFocus ();

			ShowAll ();
		}
Ejemplo n.º 2
0
		//this is a popup so it behaves like other splashes on Windows, i.e. doesn't show up as a second window in the taskbar.
		public SplashScreenForm () : base (Gtk.WindowType.Popup)
		{
			AppPaintable = true;
			this.Decorated = false;
			this.WindowPosition = WindowPosition.Center;
			this.TypeHint = Gdk.WindowTypeHint.Splashscreen;
			try {
				using (var stream = BrandingService.GetStream ("SplashScreen.png", true))
					bitmap = new Gdk.Pixbuf (stream);
			} catch (Exception e) {
				LoggingService.LogError ("Can't load splash screen pixbuf 'SplashScreen.png'.", e);
			}
			progress = new ProgressBar();
			progress.Fraction = 0.00;
			progress.HeightRequest = 6;

			vbox = new VBox();
			vbox.BorderWidth = 12;
			label = new Gtk.Label ();
			label.UseMarkup = true;
			label.Xalign = 0;
			vbox.PackEnd (progress, false, true, 0);
			vbox.PackEnd (label, false, true, 3);
			this.Add (vbox);
			if (bitmap != null)
				this.Resize (bitmap.Width, bitmap.Height);
		}
Ejemplo n.º 3
0
    public Shell()
        : base("Mono Heap Profiler")
    {
        entries = new ActionEntry[] {
            new ActionEntry ("FileMenu", null, "_File", null, null, null),
            new ActionEntry ("OpenAction", Stock.Open, null, "<control>O", "Open a profile...", new EventHandler (OnOpen)),
            new ActionEntry ("QuitAction", Stock.Quit, null, "<control>Q", "Quit the application", delegate { Application.Quit (); }),
        };

        DefaultSize = new Gdk.Size (700, 700);
        DeleteEvent += delegate { Application.Quit (); };

        main_box = new VBox (false, 0);
        Add (main_box);

        shell_commands = new ActionGroup ("TestActions");
        shell_commands.Add (entries);

        uim = new UIManager ();
        uim.AddWidget += delegate (object obj, AddWidgetArgs args) {
            args.Widget.Show ();
            main_box.PackStart (args.Widget, false, true, 0);
        };

        uim.ConnectProxy += OnProxyConnect;
        uim.InsertActionGroup (shell_commands, 0);
        uim.AddUiFromResource ("shell-ui.xml");
        AddAccelGroup (uim.AccelGroup);

        sb = new Statusbar ();
        main_box.PackEnd (sb, false, true, 0);

        pager = new ShellPager (this);
        main_box.PackEnd (pager, true, true, 0);
    }
Ejemplo n.º 4
0
		public TopLevelDialog ( )
		{
			vbox = new VBox ();
			separator = new HSeparator ();
			buttonBox = new HButtonBox ();
			vbox.PackEnd (buttonBox, false, false, 0);
			vbox.PackEnd (separator, false, false, 0);
			vbox.ShowAll ();
			Add (vbox);
		}
Ejemplo n.º 5
0
    public SharpApp()
        : base("Fixed")
    {
        SetDefaultSize(300,280);
        SetPosition(WindowPosition.Center);
        ModifyBg(StateType.Normal, new Gdk.Color(10,40,40));
        DeleteEvent += delegate {Application.Quit();};

        try{
            bardejov = new Gdk.Pixbuf("bardejov.jpg");
            rotunda = new Gdk.Pixbuf("rotunda.jpg");
            mincol = new Gdk.Pixbuf("mincol.jpg");
        } catch {
            Console.WriteLine("Images not found");
            Environment.Exit(1);
        }

        Image image1 = new Image(bardejov);
        Image image2 = new Image(rotunda);
        Image image3 = new Image(mincol);

        VBox fix = new VBox(true,4);

        fix.PackStart(image1);
        fix.Pack(image2);
        fix.PackEnd(image3);

        Add(fix);

        ShowAll();
    }
Ejemplo n.º 6
0
		public LogAgentPanelWidget ()
		{
			global::Stetic.BinContainer.Attach (this);

			var reportingLabel = GettextCatalog.GetString ("Report errors and usage information to help {0} improve my experience.", BrandingService.SuiteName);

			var value = LoggingService.ReportUsage;
			chkUsage = new CheckButton (reportingLabel);
			if (value.HasValue)
				chkUsage.Active = value.Value;
			chkUsage.Toggled += (sender, e) => reportUsage = chkUsage.Active;
			
			container = new Gtk.VBox ();
			container.PackStart (chkUsage, false, false, 0);

			var privacyStatement = BrandingService.PrivacyStatement;
			if (!string.IsNullOrEmpty (privacyStatement)) {
				var privacyLabel = new Xwt.Label { Markup = privacyStatement, Wrap = Xwt.WrapMode.Word };
				container.Add (new HBox ());
				container.PackEnd (privacyLabel.ToGtkWidget (), false, false, 30);
			}
			
			Add (container);
			ShowAll ();
		}
Ejemplo n.º 7
0
        void LoadGui(MonoDevelopProxy proxy, string document, string fileName)
        {
            System.Diagnostics.Trace.WriteLine("Creating AspNetEdit EditorHost");
            host = new EditorHost(proxy);
            host.Initialise(document, fileName);
            System.Diagnostics.Trace.WriteLine("Created AspNetEdit EditorHost");

            System.Diagnostics.Trace.WriteLine("Building AspNetEdit GUI");
            Gtk.VBox outerBox = new Gtk.VBox();

            geckoFrame        = new Frame();
            geckoFrame.Shadow = ShadowType.In;
            geckoFrame.Add(host.DesignerView);
            outerBox.PackEnd(geckoFrame, true, true, 0);

            Toolbar tb = BuildToolbar();

            outerBox.PackStart(tb, false, false, 0);

            outerBox.ShowAll();
            base.DesignerWidget = outerBox;

            //grid picks up some services from the designer host
            propertyGrid = new PropertyGrid(host.Services);
            propertyGrid.ShowAll();
            base.PropertyGridWidget = propertyGrid;
            System.Diagnostics.Trace.WriteLine("Built AspNetEdit GUI");
        }
Ejemplo n.º 8
0
        public static void AddNewWordToDic(object sender, EventArgs e)
        {
            var win = new Gtk.Window("Přidej slovo");
            win.SetPosition( WindowPosition.Mouse );
            Label l = new Label();
            l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";

            Entry entry = new Entry();
            Button b = new Button("Přidej");
            VBox vbox = new VBox();
            HBox hbox = new HBox();
            vbox.BorderWidth = 10;

            vbox.PackStart( l );
            vbox.PackEnd( hbox );

            hbox.PackStart( entry );
            hbox.PackEnd( b );

            b.Clicked += delegate {
                game.dictionary.Add( entry.Text );
                win.HideAll();
                win.Destroy();
                win.Dispose();
            };

            win.Add(vbox);
            win.ShowAll();
        }
Ejemplo n.º 9
0
        private void CreateWidgets()
        {
            this.Title = APP_NAME;
            this.SetDefaultSize(700, 500);
            this.DeleteEvent += new DeleteEventHandler(OnDeleteEvent);

            CreateActions();
            CreateToolbar();
            CreateExprBar();
            CreateWebView();
            CreateFindbar();
            CreateStatusBar();

            Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow();
            scroll.Add(webview);

            vbox = new Gtk.VBox(false, 1);
            vbox.PackStart(toolbar, false, false, 0);
            vbox.PackStart(exprbar, false, false, 0);
            vbox.PackStart(scroll);
            //vbox.PackStart (findbar, false, false, 0);
            vbox.PackEnd(statusbar, false, true, 0);

            this.Add(vbox);
            this.ShowAll();
        }
Ejemplo n.º 10
0
    private void createButton()
    {
        Gtk.VBox vbox = new Gtk.VBox();

        Gtk.Image image = new Gtk.Image();
        addUserPhotoIfExists(image);
        image.HeightRequest = 150;
        image.Visible       = true;

        Gtk.Label label_select = new Gtk.Label("Select !");
        label_select.Visible = false;         //hide this to the user until button is clicked first time

        Gtk.Label label_id = new Gtk.Label(personID.ToString());
        label_id.Visible = false;         //hide this to the user

        Gtk.Viewport viewport = new Gtk.Viewport();
        UtilGtk.ViewportColorDefault(viewport);
        Gtk.Label label_name = new Gtk.Label(personName);
        label_name.Visible = true;
        label_name.Show();
        viewport.Add(label_name);
        viewport.Show();

        vbox.PackStart(image);                                  //0
        vbox.PackStart(label_id);                               //1
        vbox.PackEnd(viewport, false, false, 1);                //2 (contains label_name)

        vbox.Show();

        button = new Button(vbox);
        button.WidthRequest  = 150;
        button.HeightRequest = 170;
    }
Ejemplo n.º 11
0
		public void Clear ()
		{
			if (contentBox != null)
				contentBox.Destroy ();
			
			noContentLabel = new Label ();
			noContentLabel.Text = noContentMessage;
			noContentLabel.Xalign = 0F;
			noContentLabel.Justify = Justification.Left;
			noContentLabel.SetPadding (6, 6);
			addButton = new Button ();
			addButton.Label = addMessage;
//			addButton.Relief = ReliefStyle.None;
			addButton.Clicked += delegate {
				OnCreateNew (EventArgs.Empty);
			};
			
			contentBox = new VBox ();
			contentBox.PackStart (this.noContentLabel, true, true, 6);
			var hbox = new HBox ();
			hbox.PackStart (addButton, false, false, 0);
			contentBox.PackEnd (hbox, false, false, 0);
			
			PackStart (contentBox, true, true, 6);
			
			ShowAll ();
		}
Ejemplo n.º 12
0
    public Nim()
        : base("Play Nim!")
    {
        SetDefaultSize(250, 230);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); } ;
        ModifyBg(StateType.Normal, new Gdk.Color(0,0,0));
        VBox vbox = new VBox(false, 2);

        Label indicator_text = new Label(indicator);
        Pango.FontDescription fontdesc= Pango.FontDescription.FromString("Times New Roman 15");
        indicator_text.ModifyFont(fontdesc);
        /*
        MenuBar mb = new MenuBar();
        Menu filemenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = filemenu;
        mb.Append(file);

        vbox.PackStart(mb, false, false, 0);
        */
        Table table = new Table(3,15,true);
        table.Attach(indicator_text,0,15,0,1);
        for( uint x=1; x<16; x++){
            uint y=x-1;
            table.Attach(new Button(String.Format("{0}",x)),y,x,1,2);
        }
        /*
        table.Attach(new Button("Cls"), 0,1,0,1);
        table.Attach(new Button("Bck"), 1,2,0,1);
        table.Attach(new Label(), 2,3,0,1);
        table.Attach(new Button("Close"),3,4,0,1);

        table.Attach(new Button("7"), 0,1,1,2);
        table.Attach(new Button("8"), 1,2,1,2);
        table.Attach(new Button("9"), 2,3,1,2);
        table.Attach(new Button("/"), 3,4,1,2);

        table.Attach(new Button("4"), 0,1,2,3);
        table.Attach(new Button("5"), 1,2,2,3);
        table.Attach(new Button("6"), 2,3,2,3);
        table.Attach(new Button("*"), 3,4,2,3);

        table.Attach(new Button("1"), 0,1,3,4);
        table.Attach(new Button("2"), 1,2,3,4);
        table.Attach(new Button("3"), 2,3,3,4);
        table.Attach(new Button("-"), 3,4,3,4);

        table.Attach(new Button("0"), 0,1,4,5);
        table.Attach(new Button("."), 1,2,4,5);
        table.Attach(new Button("="), 2,3,4,5);
        table.Attach(new Button("+"), 3,4,4,5);
        */
        //		vbox.PackStart(new Entry(), false, false, 0);
        vbox.PackEnd(table, true, true,0);

        Add(vbox);
        ShowAll();
    }
Ejemplo n.º 13
0
        public StyleWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            SetSizeRequest(800, 800);

            var box = new VBox();
            Add(box);

            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            buf.Text = System.IO.File.ReadAllText("res/theme/gtk.css");
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            box.PackStart(sv, true, true, 0);

            var cssProvider = new CssProvider();
            StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);

            var isDefault = true;

            var but = new Button();
            but.Label = "Save";
            but.HeightRequest = 30;
            box.PackEnd(but, false, false, 0);
            but.Clicked += (s, e) => {
                System.IO.File.WriteAllText("res/theme/gtk.css", buf.Text);
            };

            buf.Changed += (s, e) => {
                bool error = false;
                try {
                    //StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                    cssProvider.LoadFromData(buf.Text);
                    //StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);
                } catch (Exception ex) {
                    error = true;
                }
                if (error) {
                    if (!isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider, uint.MaxValue);
                        isDefault = true;
                    }

                } else {
                    if (isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue);
                        isDefault = false;
                    }
                }

            };

            ShowAll();
        }
Ejemplo n.º 14
0
        public static void Main(string[] args)
        {
            Application.Init ();
            //MainWindow win = new MainWindow ();
            //win.Show ();
            MoonlightRuntime.Init ();
            Window w = new Window ("mldsp");
            w.DefaultHeight = 520;
            w.DefaultWidth = 760;
            w.DeleteEvent += delegate { Application.Quit (); };

            var moon = new MoonlightHost ();
            var xappath = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (new Uri (typeof (MainClass).Assembly.CodeBase).LocalPath), "mldsp.clr.xap");
            moon.LoadXap (xappath);
            if (args.Length > 0) {
                int device;
                if (int.TryParse (args [0], out device))
                    ((mldsp.App) moon.Application).OutputDeviceID = device;
                else {
                    Console.WriteLine ("WARNING: wrong device ID speficication. Specify an index.");
                    foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices)
                        if (dev.IsOutput)
                            Console.WriteLine ("{0} {1}", dev.ID, dev.Name);
                }
            }

            var vbox = new VBox (false, 0);
            w.Add (vbox);
            var mainmenu = new MenuBar ();
            vbox.PackStart (mainmenu, false, true, 0);
            var optmi = new MenuItem ("_Options");
            mainmenu.Add (optmi);
            var devmi = new MenuItem ("Select Device");
            var optmenu = new Menu ();
            optmi.Submenu = optmenu;
            optmenu.Append (devmi);
            var devlist = new SList (IntPtr.Zero);
            var devmenu = new Menu ();
            devmi.Submenu = devmenu;
            foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) {
                if (dev.IsOutput) {
                    var mi = new RadioMenuItem (devlist, dev.Name);
                    mi.Data ["Device"] = dev.ID;
                    devlist = mi.Group;
                    int id = dev.ID;
                    mi.Activated += delegate {
                        ((mldsp.App) moon.Application).ResetDevice ((int) mi.Data ["Device"]);
                    };
                    devmenu.Append (mi);
                }
            }

            vbox.PackEnd (moon);

            w.ShowAll ();
            Application.Run ();
        }
		public IPhoneDeviceConsole () : base ("iPhone Device Console")
		{
			BorderWidth = 6;
			
			//FIXME: persist these values
			DefaultWidth = 400;
			DefaultHeight = 400;
			
			var vbox = new VBox () {
				Spacing = 12
			};
			
			var bbox = new HButtonBox () {
				Layout = ButtonBoxStyle.End,
			};
			
			var closeButton = new Button (Gtk.Stock.Close);
			var reconnectButton = new Button () {
				Label = "Reconnect"
			};
			
			log = new LogView ();
			
			this.Add (vbox);
			vbox.PackEnd (bbox, false, false, 0);
			vbox.PackEnd (log, true, true, 0);
			
			bbox.PackEnd (reconnectButton);
			bbox.PackEnd (closeButton);
			
			closeButton.Clicked += delegate {
				 Destroy ();
			};
			DeleteEvent += delegate {
				Destroy ();
			};
			reconnectButton.Clicked += delegate {
				Disconnect ();
				Connect ();
			};
			
			ShowAll ();
			Connect ();
		}
Ejemplo n.º 16
0
 public iFolderExceptionDialog( Gtk.Window parent,
   System.Exception exception)
     : base()
 {
     this.Title = Util.GS("iFolder Error");
        this.HasSeparator = true;
        this.Resizable = false;
        this.Modal = true;
        this.ex = exception;
        if(parent != null)
     this.TransientFor = parent;
        HBox h = new HBox();
        h.BorderWidth = 10;
        h.Spacing = 10;
        Image i = new Image();
        i.SetFromStock(Gtk.Stock.DialogError, IconSize.Dialog);
        i.SetAlignment(0.5F, 0);
        h.PackStart(i, false, false, 0);
        VBox v = new VBox();
        v.BorderWidth = 10;
        v.Spacing = 10;
        Label l = new Label("<span weight=\"bold\" size=\"larger\">" +
     GLib.Markup.EscapeText(exception.Message) + "</span>");
        l.LineWrap = true;
        l.UseMarkup = true;
        l.UseUnderline = false;
        l.Selectable = true;
        l.Xalign = 0; l.Yalign = 0;
        v.PackStart(l);
        dButton = new Button(Util.GS("Show Details"));
        dButton.Clicked += new EventHandler(ButtonPressed);
        HBox bhbox = new HBox();
        bhbox.PackStart(dButton, false, false, 0);
        v.PackEnd(bhbox, false, false, 0);
        details = new Label(Util.GS("Click \"Show Details\" below to get the full message returned with this error"));
        details.LineWrap = true;
        details.Selectable = true;
        details.Xalign = 0; details.Yalign = 0;
        v.PackEnd(details);
        h.PackEnd(v);
        h.ShowAll();
        this.VBox.Add(h);
        this.AddButton(Stock.Close, ResponseType.Ok);
 }
Ejemplo n.º 17
0
        public Dialog(VariableSet variables, Variable<int> performed, 
		  Variable<int> total)
            : base("UnitTest", variables)
        {
            var vbox = new VBox(false, 12) {BorderWidth = 12};
              VBox.PackStart(vbox, true, true, 0);

              vbox.PackStart(CreateTestDllButton(), false, false, 0);
              vbox.PackEnd(CreateProgressBar(performed, total));
        }
        public RecommendationPane()
        {
            Visible = false;

            EventBox event_box = new EventBox ();
            event_box.ModifyBg(StateType.Normal, new Gdk.Color(0xff,0xff,0xff));

            main_box = new HBox ();
            main_box.BorderWidth = 5;

            similar_box = new VBox (false, 3);
            tracks_box = new VBox (false, 3);
            albums_box = new VBox (false, 3);

            Label similar_header = new Label ();
            similar_header.Xalign = 0;
            similar_header.Ellipsize = Pango.EllipsizeMode.End;
            similar_header.Markup = String.Format ("<b>{0}</b>", Catalog.GetString ("Recommended Artists"));
            similar_box.PackStart (similar_header, false, false, 0);

            tracks_header = new Label ();
            tracks_header.Xalign = 0;
            tracks_header.WidthChars = 25;
            tracks_header.Ellipsize = Pango.EllipsizeMode.End;
            tracks_box.PackStart (tracks_header, false, false, 0);

            albums_header = new Label ();
            albums_header.Xalign = 0;
            albums_header.WidthChars = 25;
            albums_header.Ellipsize = Pango.EllipsizeMode.End;
            albums_box.PackStart (albums_header, false, false, 0);

            similar_items_table = new Table (DEFAULT_SIMILAR_TABLE_ROWS, DEFAULT_SIMILAR_TABLE_COLS, false);
            similar_items_table.SizeAllocated += OnSizeAllocated;
            similar_box.PackEnd (similar_items_table, true, true, 0);

            tracks_items_box = new VBox (false, 0);
            tracks_box.PackEnd (tracks_items_box, true, true, 0);

            albums_items_box = new VBox (false, 0);
            albums_box.PackEnd (albums_items_box, true, true, 0);

            main_box.PackStart (similar_box, true, true, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (tracks_box, false, false, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (albums_box, false, false, 5);

            event_box.Add (main_box);
            Add (event_box);

            if (!Directory.Exists (CACHE_PATH))
                Directory.CreateDirectory (CACHE_PATH);
        }
        public CS_PlayListAdmin(CS_PlayListsView plsview,CS_PlayListsModel mdl,CS_PlayListCollection cl)
        {
            _col=cl;
            _model=mdl;
            Gtk.HBox hb=new Gtk.HBox();

            Gtk.Button _add=new Gtk.Button(Gtk.Stock.Add);
            _add.Clicked+=delegate (object sender,EventArgs args) {
                OnAddPls();
            };

            Gtk.Button _remove=new Gtk.Button(Gtk.Stock.Remove);
            _remove.Clicked+=delegate (object sender,EventArgs args) {
                OnRemovePls();
            };

            hb.PackStart (_add);
            hb.PackStart (_remove);

            plsscroll=new Gtk.ScrolledWindow();
            plsscroll.Add (plsview);

            _pls=null;
            _pls_name=new Gtk.Entry();
            _pls_model=new CS_PlayListModel();
            _pls_view=new CS_PlayListView();
            _pls_view.SetModel (_pls_model);
            plscroll=new Gtk.ScrolledWindow();
            plscroll.Add (_pls_view);

            _pls_view.DragEnd+=delegate(object sender,DragEndArgs args) {
                Console.WriteLine (args);
            };
            Gtk.VBox plsvbox=new Gtk.VBox();
            plsvbox.PackStart (_pls_name,false,false,2);
            plsvbox.PackEnd (plscroll);

            Gtk.VPaned vpn=new Gtk.VPaned();
            vpn.Add1 (plsscroll);
            vpn.Add2 (plsvbox);

            base.PackStart (hb,false,false,2);
            base.PackEnd (vpn);

            base.ShowAll ();

            mdl.SetListener (delegate(CS_PlayList pls) {
                _pls=pls;
                _pls_model.SetPlayList (_pls);
                _pls_name.Text=_pls.PlsName;
            });
        }
Ejemplo n.º 20
0
        public CS_PlayListAdmin(CS_PlayListsView plsview, CS_PlayListsModel mdl, CS_PlayListCollection cl)
        {
            _col   = cl;
            _model = mdl;
            Gtk.HBox hb = new Gtk.HBox();

            Gtk.Button _add = new Gtk.Button(Gtk.Stock.Add);
            _add.Clicked += delegate(object sender, EventArgs args) {
                OnAddPls();
            };

            Gtk.Button _remove = new Gtk.Button(Gtk.Stock.Remove);
            _remove.Clicked += delegate(object sender, EventArgs args) {
                OnRemovePls();
            };

            hb.PackStart(_add);
            hb.PackStart(_remove);

            plsscroll = new Gtk.ScrolledWindow();
            plsscroll.Add(plsview);

            _pls       = null;
            _pls_name  = new Gtk.Entry();
            _pls_model = new CS_PlayListModel();
            _pls_view  = new CS_PlayListView();
            _pls_view.SetModel(_pls_model);
            plscroll = new Gtk.ScrolledWindow();
            plscroll.Add(_pls_view);

            _pls_view.DragEnd += delegate(object sender, DragEndArgs args) {
                Console.WriteLine(args);
            };
            Gtk.VBox plsvbox = new Gtk.VBox();
            plsvbox.PackStart(_pls_name, false, false, 2);
            plsvbox.PackEnd(plscroll);

            Gtk.VPaned vpn = new Gtk.VPaned();
            vpn.Add1(plsscroll);
            vpn.Add2(plsvbox);

            base.PackStart(hb, false, false, 2);
            base.PackEnd(vpn);

            base.ShowAll();

            mdl.SetListener(delegate(CS_PlayList pls) {
                _pls = pls;
                _pls_model.SetPlayList(_pls);
                _pls_name.Text = _pls.PlsName;
            });
        }
Ejemplo n.º 21
0
        public void ShowControlBox(Gtk.VBox labels, Gtk.VBox widgets)
        {
            Label label = new Label("Target height:");

            heightscale               = new HScale(minheight, maxheight, (maxheight - minheight) / 20);
            heightscale.Value         = lastheight;
            heightscale.ValueChanged += new EventHandler(heightscale_ValueChanged);

            labels.PackEnd(label);
            widgets.PackEnd(heightscale);
            labels.ShowAll();
            widgets.ShowAll();
        }
Ejemplo n.º 22
0
    public SharpApp()
        : base("Calculator")
    {
        SetDefaultSize(250, 230);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); } ;

        VBox vbox = new VBox(false, 2);

        MenuBar mb = new MenuBar();
        Menu filemenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = filemenu;
        mb.Append(file);

        vbox.PackStart(mb, false, false, 0);

        Table table = new Table(5,4,true);

        table.Attach(new Button("Cls"), 0,1,0,1);
        table.Attach(new Button("Bck"), 1,2,0,1);
        table.Attach(new Label(), 2,3,0,1);
        table.Attach(new Button("Close"),3,4,0,1);

        table.Attach(new Button("7"), 0,1,1,2);
        table.Attach(new Button("8"), 1,2,1,2);
        table.Attach(new Button("9"), 2,3,1,2);
        table.Attach(new Button("/"), 3,4,1,2);

        table.Attach(new Button("4"), 0,1,2,3);
        table.Attach(new Button("5"), 1,2,2,3);
        table.Attach(new Button("6"), 2,3,2,3);
        table.Attach(new Button("*"), 3,4,2,3);

        table.Attach(new Button("1"), 0,1,3,4);
        table.Attach(new Button("2"), 1,2,3,4);
        table.Attach(new Button("3"), 2,3,3,4);
        table.Attach(new Button("-"), 3,4,3,4);

        table.Attach(new Button("0"), 0,1,4,5);
        table.Attach(new Button("."), 1,2,4,5);
        table.Attach(new Button("="), 2,3,4,5);
        table.Attach(new Button("+"), 3,4,4,5);

        vbox.PackStart(new Entry(), false, false, 0);
        vbox.PackEnd(table, true, true,0);

        Add(vbox);
        ShowAll();
    }
Ejemplo n.º 23
0
        public void ShowControlBox(Gtk.VBox labels, Gtk.VBox widgets)
        {
            Tooltips tooltips = new Tooltips();

            coresize               = new HScale(0, 100, 5);
            coresize.Value         = coresizevalue;
            coresize.ValueChanged += new EventHandler(coresize_ValueChanged);
            tooltips.SetTip(coresize, "Radius of core.  Core has no fall-off", "Radius of core.  Inside core, brush has full effect; outside of core, brush effect falls off towards the edge.");
            tooltips.Enable();

            labels.PackEnd(new Label("Brush core radius:"));
            widgets.PackEnd(coresize);
            labels.ShowAll();
            widgets.ShowAll();
        }
Ejemplo n.º 24
0
        void AddNewGroup(string name, List<Tag> tags)
        {
            TagsGroup g;
            Widget t;
            VBox vbox = new VBox (false, 5);
            HBox hbox = new HBox (false, 5);

            g = new TagsGroup (vbox, tags);
            hbox.PackStart (GroupBox (name, g), false, true, 0);
            t = CreateTagsTable (g);
            vbox.PackStart (hbox, true, true, 0);
            vbox.PackStart (t, true, true, 0);
            vbox.PackEnd (new HSeparator (), true, true, 0);
            vbox.ShowAll ();
            mainvbox.PackStart (vbox, true, true, 0);
        }
Ejemplo n.º 25
0
    public ExploreView(Driver driver, int stopAfter)
        : base("Explore")
    {
        int x, y, width, height, depth;
        RootWindow.GetGeometry (out x, out y, out width, out height, out depth);
        SetDefaultSize (width - 50, height - 40);

        VBox vBox = new VBox(false, 1);
        Add(vBox);

        HPaned hPaned = new HPaned();
        vBox.Add(hPaned);

        ScrolledWindow scrolledWindow = new ScrolledWindow();
        //scrolledWindow.SetDefaultSize (Convert.ToInt32((width - 50) * 0.4), height -40);
        hPaned.Add1(scrolledWindow);

        repositoryView = new RepositoryView(driver);
        scrolledWindow.Add(repositoryView);

        viewChildren = new Notebook ();

        changesetView = new ChangesetView(driver, stopAfter);
        viewChildren.AppendPage (changesetView, new Label ("Changeset View"));

        directoryView = new DirectoryView(driver);
        viewChildren.AppendPage (directoryView, new Label ("Directory View"));

        fileView = new FileView(driver);
        viewChildren.AppendPage (fileView, new Label ("File View"));

        hPaned.Add2(viewChildren);
        hPaned.Position = (width - 50) / 3;

        // add status bar
        Statusbar sb = new Statusbar ();
        sb.HasResizeGrip = false;
        vBox.PackEnd(sb, false, false, 1);

         		ShowAll();

        repositoryView.Selection.Changed += OnPathSelectionChanged;
        viewChildren.SwitchPage += OnSwitchPage;
    }
Ejemplo n.º 26
0
        public MainWindow(HttpAgent httpAgent, IRepositoryFactory repositoryFactory)
            : base(Gtk.WindowType.Toplevel)
        {
            this.httpAgent = httpAgent;

            WindowPosition = WindowPosition.Center;

            rekeningRepository = repositoryFactory.CreateRepository<IRekeningRepository>();
            consumptieRepository = repositoryFactory.CreateRepository<IConsumptieRepository>();

            // Rekeningen overzicht
            rekeningOverzichtWidget = new RekeningOverzichtWidget();
            rekeningOverzichtWidget.Refresh(rekeningRepository.GetAll());
            rekeningOverzichtWidget.RekeningClicked += handleRekeningClicked;

            // Afrekenen button
            Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Arial");
            fontDescription.Size = 13000;
            fontDescription.Weight = Pango.Weight.Bold;
            Label afrekenenLabel = new Label("Afrekenen");
            afrekenenLabel.ModifyFont(fontDescription);
            afrekenenButton = new Button();
            afrekenenButton.Add(afrekenenLabel);
            afrekenenButton.Clicked += handleAfrekenenButtonClicked;

            // Rechter panel (bestellingen)
            bestellingenOverzichtWidget = new BestellingenOverzichtWidget();

            box = new HBox(false, 3);
            box.PackStart(rekeningOverzichtWidget);
            box.PackStart(bestellingenOverzichtWidget);

            // Main box
            vbox = new VBox(false, 0);
            vbox.PackStart(box);
            vbox.PackEnd(afrekenenButton);
            Add(vbox);

            ShowAll();

            this.DeleteEvent += OnDeleteEvent;
        }
Ejemplo n.º 27
0
 public MyControl()
 {
     Events = Gdk.EventMask.AllEventsMask;
     var vb = new VBox();
     var hScrollBar = new HScrollbar(new Adjustment(1, 1, 100, 1, 20, 10));
     hScrollBar.ChangeValue += (o, args) =>
     {
         //Console.WriteLine("Arg.Value: {0}", args.Args[1]);
         Console.WriteLine("scrollBar.Value: {0}", hScrollBar.Value);
         Console.WriteLine("scrollBar.OldValue: {0}", sbOldValue);
         sbOldValue = hScrollBar.Value;
     };
     hScrollBar.ValueChanged += (o, args) =>
     {
         Console.WriteLine("scrollBar.Value: {0}", hScrollBar.Value);
     };
     vb.PackEnd(hScrollBar, false, false, 0);
     Add(vb);
     ShowAll();
 }
Ejemplo n.º 28
0
        public MainViewImpl(DemoApp application, MenuItem[] menuItems)
            : base(WindowType.Toplevel)
        {
            _application = application;
            var menuBar = CreateMenu(menuItems);

            _applicationTitle = _application.Name + " (GtkSharp)";
            Title = _applicationTitle;
            Resize(_application.DefaultWidth, _application.DefaultHeight);

            Destroyed += MainViewImpl_Destroyed;

            var vbox = new VBox(false, 0);
            Add(vbox);

            vbox.PackStart(menuBar, false, false, 2);

            _tabs = new Notebook();
            vbox.PackEnd(_tabs, true, true, 2);

            ShowAll();
        }
Ejemplo n.º 29
0
		public static Gtk.Window Create ()
		{
			window = new Window ("Statusbar");
			window.SetDefaultSize (150, 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);

			statusbar = new Statusbar ();
			box1.PackEnd (statusbar, true, true, 0);
			statusbar.TextPopped += new TextPoppedHandler (statusbar_popped);

			Button button = new Button ("push");
			box2.PackStart (button, false, false, 0);
			button.Clicked += new EventHandler (statusbar_pushed);

			button = new Button ("pop");
			box2.PackStart (button, false, false, 0);
			button.Clicked += new EventHandler (pop_clicked);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button close_button = new Button (Stock.Close);
			close_button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (close_button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();
			
			window.ShowAll ();
			return window;
		}
Ejemplo n.º 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.Control"/> class.
        /// </summary>
        /// <param name='g'>
        /// G.
        /// </param>
        public Control(Scrabble.Game.Game g) : base("Tah")
        {
            this.HeightRequest = 60;
            this.WidthRequest  = 350;


            this.game        = g;
            this.BorderWidth = 5;

            reload          = new Gtk.Button("Reload");
            reload.Clicked += ReloadRack;
            pass            = new Gtk.Button("Vzdát se tahu");
            pass.Clicked   += delegate {
                this.game.changePlayer();
            };

            mainVbox = new Gtk.VBox();
            mainVbox.PackStart(reload);
            mainVbox.PackEnd(pass);

            this.Add(mainVbox);
        }
Ejemplo n.º 31
0
 public iFolderCrashDialog(System.Exception e)
     : base()
 {
     this.SetDefaultSize (600, 400);
        this.Title = "";
        this.HasSeparator = false;
        this.Resizable = true;
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder-crash.png"));
        Image crashImage =
     new Image(new Gdk.PixbufAnimation(Util.ImagesPath("ifolder-crash.gif")));
        VBox vbox = new VBox();
        vbox.BorderWidth = 10;
        vbox.Spacing = 10;
        Label l = new Label("<span weight=\"bold\" size=\"larger\">" +
     Util.GS("iFolder crashed because of an unhandled exception") +
     "</span>");
        l.LineWrap = false;
        l.UseMarkup = true;
        l.Selectable = false;
        l.Xalign = 0; l.Yalign = 0;
        vbox.PackStart(l, false, false, 0);
        HBox h = new HBox();
        h.BorderWidth = 10;
        h.Spacing = 12;
        crashImage.SetAlignment(0.5F, 0);
        h.PackStart(crashImage, false, false, 0);
        TextView tv = new TextView();
        tv.WrapMode = Gtk.WrapMode.Word;
        tv.Editable = false;
        tv.Buffer.Text = e.ToString();
        ScrolledWindow sw = new ScrolledWindow();
        sw.ShadowType = Gtk.ShadowType.EtchedIn;
        sw.Add(tv);
        h.PackEnd(sw, true, true, 0);
        vbox.PackEnd(h);
        vbox.ShowAll();
        this.VBox.Add(vbox);
        this.AddButton(Stock.Close, ResponseType.Ok);
 }
Ejemplo n.º 32
0
		public void Clear ()
		{
			if (contentBox != null)
				contentBox.Destroy ();
			
			noContentLabel = new Label ();
			noContentLabel.Text = noContentMessage;
			
			addButton = new Button ();
			addButton.Label = addMessage;
			addButton.Relief = ReliefStyle.None;
			addButton.Clicked += delegate {
				OnCreateNew (EventArgs.Empty);
			};
			
			contentBox = new VBox ();
			contentBox.PackStart (this.noContentLabel, true, true, 6);
			contentBox.PackEnd (addButton, false, true, 0);
			
			PackStart (contentBox, true, true, 6);
			
			ShowAll ();
		}
Ejemplo n.º 33
0
 public void LoadImages(XDocument doc)
 {
     if (posts != null) {
         foreach(VBox post in posts.Children){
             foreach (Widget obj in post.Children) {
                 post.Remove (obj);
                 obj.Destroy ();
             }
             posts.Remove (post);
             post.Destroy ();
         }
     }
     posts = new VBox ();
     vbox3.PackStart (posts,true,true,1);
     IEnumerable<XElement> posts_list = doc.XPathSelectElements("/posts/post");
     foreach (XElement elem in posts_list) {
         VBox post = new VBox ();
         string title = elem.XPathSelectElement ("title").Value;
         string description = elem.XPathSelectElement ("description").Value;
         post.PackStart (new Label (title), true, true, 1);
         IEnumerable<XElement> urls_list = elem.XPathSelectElements ("img/url");
         foreach (XElement urls in urls_list) {
             Gtk.EventBox eventBox = new Gtk.EventBox();
             string file_img_default = urls.XPathSelectElement ("default").Value;
             string file_img_original = urls.XPathSelectElement ("original").Value;
             Gtk.Image new_img = new Gtk.Image (	file_img_default);
             eventBox.Add (new_img);
             eventBox.ButtonPressEvent += delegate {
                 new Project.ImgWindow (title, description, file_img_original);
             };
             post.PackEnd (eventBox, true, true, 1);
         }
         posts.PackStart (post, true, true, 1);
     }
     posts_list = null;
     ShowAll ();
 }
Ejemplo n.º 34
0
    public Gtk.Button CreateButton()
    {
        Gtk.VBox vbox = new Gtk.VBox();

        Gtk.Image image     = new Gtk.Image();
        string    photoFile = Util.GetPhotoFileName(true, p.UniqueID);

        if (photoFile != "" && File.Exists(photoFile))
        {
            try {
                Pixbuf pixbuf = new Pixbuf(photoFile);                  //from a file
                image.Pixbuf  = pixbuf;
                image.Visible = true;
            }
            catch {
                LogB.Warning("catched while adding photo");
            }
        }

        Gtk.Label label_id = new Gtk.Label(p.UniqueID.ToString());
        label_id.Visible = false;         //hide this to the user

        Gtk.Label label_name = new Gtk.Label(p.Name);
        label_name.Visible = true;

        vbox.PackStart(image);
        vbox.PackStart(label_id);
        vbox.PackEnd(label_name, false, false, 1);

        vbox.Show();

        Button b = new Button(vbox);

        b.WidthRequest = 150;

        return(b);
    }
Ejemplo n.º 35
0
        /// <summary>
        /// Builds the UI.
        /// </summary>
        private void Build()
        {
            SetDefaultSize (600, 600);

            var image = new Image ("./logo.png");

            this.calendarVbox = new Gtk.VBox(false, 5);
            this.bottomHBox = new Gtk.HBox (true, 5);
            this.eventDetail = new Gtk.VBox (false, 5);

            this.cal = new Gtk.Calendar ();
            calendarVbox.PackStart (image);
            calendarVbox.PackStart (this.cal, true, false, 5);

            this.bottomHBox.PackStart(this.buildStats(), true, false, 5);
            this.bottomHBox.PackStart (eventDetail, true, false, 5);

            calendarVbox.PackEnd (bottomHBox, true, false, 5);

            this.Add(calendarVbox);

            // Mark events for calendar
            this.MarkEventsForMonth (this.cal.Month);

            // Events
            this.DeleteEvent += (o, args) => this.OnClose();
            //this.btnAdd.Clicked += (o, args) => this.ShowAddTrip();
            //this.btnList.Clicked += (o, args) => this.ShowListTrips();
            this.cal.DaySelected += (o, args) => this.ShowEventsForDay ();
            this.cal.MonthChanged += (object sender, EventArgs e) => this.MarkEventsForMonth (this.cal.Month);
            this.cal.NextYear += (object sender, EventArgs e) => this.MarkEventsForMonth (this.cal.Month);
            this.cal.PrevYear += (object sender, EventArgs e) => this.MarkEventsForMonth (this.cal.Month);

            // Show current day after bootstrap
            this.ShowEventsForDay();
        }
Ejemplo n.º 36
0
        public App(Settings set, DebugManager mgr, string argsOverride)
        {
            settings = set;
            debugPane = new DebugPane(set, mgr);

            AccelGroup agr = new AccelGroup();
            menu = new AppMenu(mgr, agr, set, mainWin, debugPane,
                   argsOverride);
            toolbar = new AppToolbar(mgr, debugPane);

            VBox vb = new VBox(false, 3);

            mainWin.Resize(settings.WindowWidth, settings.WindowHeight);
            mainWin.DeleteEvent += (obj, evt) => Application.Quit();
            mainWin.AddAccelGroup(agr);

            vb.PackStart(menu.View, false, false, 0);
            vb.PackStart(toolbar.View, false, false, 0);
            vb.PackEnd(debugPane.View, true, true, 0);
            mainWin.Add(vb);

            mainWin.DeleteEvent += OnDeleteEvent;
            mainWin.ShowAll();
        }
Ejemplo n.º 37
0
		public CompareWindow ()
			: base ("Mono GuiCompare")
		{
			SetDefaultSize (500, 400);

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

			treeStore = new Gtk.TreeStore (typeof (string), typeof (Gdk.Pixbuf), typeof (Gdk.Pixbuf),
						       typeof (Gdk.Pixbuf), typeof (string),
						       typeof (Gdk.Pixbuf), typeof (string),
						       typeof (Gdk.Pixbuf), typeof (string));

			tree.Model = treeStore;

			// Create a column for the node name
			Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn ();
			nameColumn.Title = "Name";
			nameColumn.Resizable = true;

			Gtk.CellRendererText nameCell = new Gtk.CellRendererText ();
			Gtk.CellRendererPixbuf typeCell = new Gtk.CellRendererPixbuf ();
			Gtk.CellRendererPixbuf statusCell = new Gtk.CellRendererPixbuf ();

			nameColumn.PackStart (statusCell, false);
			nameColumn.PackStart (typeCell, false);
			nameColumn.PackStart (nameCell, true);

			tree.AppendColumn (nameColumn);

			nameColumn.AddAttribute (nameCell, "text", 0);
			nameColumn.AddAttribute (typeCell, "pixbuf", 1);
			nameColumn.AddAttribute (statusCell, "pixbuf", 2);

			// Create a column for the status counts
			Gtk.TreeViewColumn countsColumn = new Gtk.TreeViewColumn ();
			countsColumn.Title = "Counts";
			countsColumn.Resizable = true;

			Gtk.CellRendererPixbuf missingPixbufCell = new Gtk.CellRendererPixbuf ();
			Gtk.CellRendererText missingTextCell = new Gtk.CellRendererText ();
			Gtk.CellRendererPixbuf extraPixbufCell = new Gtk.CellRendererPixbuf ();
			Gtk.CellRendererText extraTextCell = new Gtk.CellRendererText ();
			Gtk.CellRendererPixbuf errorPixbufCell = new Gtk.CellRendererPixbuf ();
			Gtk.CellRendererText errorTextCell = new Gtk.CellRendererText ();

			countsColumn.PackStart (missingPixbufCell, false);
			countsColumn.PackStart (missingTextCell, false);
			countsColumn.PackStart (extraPixbufCell, false);
			countsColumn.PackStart (extraTextCell, false);
			countsColumn.PackStart (errorPixbufCell, false);
			countsColumn.PackStart (errorTextCell, false);

			tree.AppendColumn (countsColumn);

			countsColumn.AddAttribute (missingPixbufCell, "pixbuf", 3);
			countsColumn.AddAttribute (missingTextCell, "text", 4);
			countsColumn.AddAttribute (extraPixbufCell, "pixbuf", 5);
			countsColumn.AddAttribute (extraTextCell, "text", 6);
			countsColumn.AddAttribute (errorPixbufCell, "pixbuf", 7);
			countsColumn.AddAttribute (errorTextCell, "text", 8);

			
			scroll = new Gtk.ScrolledWindow ();

			scroll.HscrollbarPolicy = scroll.VscrollbarPolicy = PolicyType.Automatic;
			scroll.Add (tree);

			vbox.PackStart (scroll, true, true, 0);

			status = new Gtk.Statusbar ();

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

			progressbar = new Gtk.ProgressBar ();

			status.PackEnd (progressbar, false, false, 0);

			Add (vbox);
		}
Ejemplo n.º 38
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();
    }
Ejemplo n.º 39
0
        public ImageEditor(string filePath)
        {
            fileName = filePath;

            fileBarierName = fileName + ".mso";
            if (System.IO.File.Exists(fileBarierName))
            {
                string barierFile;
                try {
                    using (StreamReader file = new StreamReader(fileBarierName)) {
                        barierFile = file.ReadToEnd();
                        file.Close();
                        file.Dispose();
                    }
                    if (!string.IsNullOrEmpty(barierFile))
                    {
                        //listPoint =  JsonConvert.DeserializeObject<List<BarierPoint>>(barierFile);
                        System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
                        jss.RegisterConverters(new[] { new BarierPointJavaScriptConverter() });
                        listPoint = jss.Deserialize <List <BarierPoint> >(barierFile);
                    }
                } catch (Exception ex) {
                    MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_cannot_open", fileBarierName), ex.Message, Gtk.MessageType.Error, null);
                    ms.ShowDialog();
                }
            }


            editorAction = new Gtk.ActionGroup("imageeditor");

            //ic = new ImageCanvas(filePath,listPoint);
            ic = new ImageCanvas(filePath, listPoint)
            {
                Name       = "canvas",
                CanDefault = true,
                CanFocus   = true,
                Events     = (Gdk.EventMask) 16134
            };

            vbox = new Gtk.VBox();

            /*Gdk.Color col = new Gdk.Color(255,255,0);
             * vbox.ModifyBg(StateType.Normal, col);*/

            itc = new ImageToolBarControl(ic);             //new ImageToolBarControl(ic);
            itc.DeleteBarierLayerEvent += delegate(object sender, EventArgs e) {
                if (System.IO.File.Exists(fileBarierName))
                {
                    try{
                        System.IO.File.Delete(fileBarierName);
                        OnModifiedChanged(false);
                        ic.DeleteBarier();
                    }catch (Exception ex) {
                        MessageDialogs mdd =
                            new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_delete_file", fileBarierName), ex.Message, Gtk.MessageType.Error);
                        mdd.ShowDialog();
                    }
                }
                else
                {
                    ic.DeleteBarier();
                }
            };

            vbox.PackStart(itc, false, false, 0);

            ScrolledWindow sw = new Gtk.ScrolledWindow();

            sw.ShadowType = Gtk.ShadowType.Out;

            sw.Hadjustment.ValueChanged += delegate(object sender, EventArgs e) {
                //Console.WriteLine("sw.Hadjustment -> {0}",sw.Hadjustment.Value);
            };

            sw.Vadjustment.ValueChanged += delegate(object sender, EventArgs e) {
                //Console.WriteLine("sw.Vadjustment -> {0}",sw.Vadjustment.Value);
            };

            Viewport vp = new Viewport()
            {
                ShadowType = ShadowType.None
            };

            vp.ScrollEvent += delegate(object o, ScrollEventArgs args) {
                if (args.Event.State == ModifierType.ControlMask)
                {
                    switch (args.Event.Direction)
                    {
                    case ScrollDirection.Down:
                    case ScrollDirection.Right:
                        itc.ZoomOut();
                        return;

                    case ScrollDirection.Left:
                    case ScrollDirection.Up:
                        itc.ZoomIn();
                        return;
                    }
                }
            };

            vp.MotionNotifyEvent += delegate(object o, MotionNotifyEventArgs args) {
                Cairo.PointD offset = new Cairo.PointD(sw.Hadjustment.Value, sw.Vadjustment.Value);
                int          x      = (int)args.Event.X;
                int          y      = (int)args.Event.Y;
                if (ic.ConvertPointToCanvasPoint(offset, ref x, ref y))
                {
                    OnWriteToStatusbar(String.Format(statusFormat, x, y, ic.WidthImage, ic.HeightImage));
                }

                if (itc.ToolState == ImageToolBarControl.ToolStateEnum.nothing)
                {
                    return;
                }

                if (itc.ToolState == ImageToolBarControl.ToolStateEnum.editpoint)
                {
                    ic.StepMovingPoint((int)args.Event.X, (int)args.Event.Y, offset);
                    //OnModifiedChanged(true);
                }
            };

            vp.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) {
                //Console.WriteLine("1_ButtonReleaseEvent");
                if (args.Event.Button != 1)
                {
                    return;
                }

                if (itc.ToolState == ImageToolBarControl.ToolStateEnum.nothing)
                {
                    return;
                }
                Cairo.PointD offset = new Cairo.PointD(sw.Hadjustment.Value, sw.Vadjustment.Value);

                if (itc.ToolState == ImageToolBarControl.ToolStateEnum.editpoint)
                {
                    ic.EndMovingPoint((int)args.Event.X, (int)args.Event.Y, offset);
                    OnModifiedChanged(true);
                }
            };

            vp.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                if (args.Event.Button != 1)
                {
                    return;
                }

                if (itc.ToolState == ImageToolBarControl.ToolStateEnum.nothing)
                {
                    return;
                }

                Cairo.PointD offset = new Cairo.PointD(sw.Hadjustment.Value, sw.Vadjustment.Value);
                if (itc.ToolState == ImageToolBarControl.ToolStateEnum.addpoint)
                {
                    ic.AddPoint((int)args.Event.X, (int)args.Event.Y, offset);
                    OnModifiedChanged(true);
                }
                else if (itc.ToolState == ImageToolBarControl.ToolStateEnum.deletepoint)
                {
                    ic.DeletePoint((int)args.Event.X, (int)args.Event.Y, offset);
                    OnModifiedChanged(true);
                }
                else if (itc.ToolState == ImageToolBarControl.ToolStateEnum.moviepoint)
                {
                    ic.StartMovingPoint((int)args.Event.X, (int)args.Event.Y, offset);
                    OnModifiedChanged(true);
                }
                else if (itc.ToolState == ImageToolBarControl.ToolStateEnum.editpoint)
                {
                    if (args.Event.State == ModifierType.ShiftMask)
                    {
                        ic.DeletePoint((int)args.Event.X, (int)args.Event.Y, offset);
                        OnModifiedChanged(true);
                        return;
                    }
                    ic.EditPoint((int)args.Event.X, (int)args.Event.Y, offset);
                    OnModifiedChanged(true);
                }
            };


            sw.Add(vp);
            vp.Add(ic);

            vbox.PackEnd(sw, true, true, 0);
            ic.Show();
            vp.Show();

            vbox.ShowAll();
        }
Ejemplo n.º 40
0
        void CreateComponents()
        {
            fullViewVBox = new VBox (false, 0);
            rootWidget = fullViewVBox;

            InstallMenuBar ();
            Realize ();
            toolbar = DesktopService.CreateMainToolbar (this);
            DesktopService.SetMainWindowDecorations (this);
            var toolbarBox = new HBox ();
            fullViewVBox.PackStart (toolbarBox, false, false, 0);
            toolbarFrame = new CommandFrame (IdeApp.CommandService);

            fullViewVBox.PackStart (toolbarFrame, true, true, 0);

            // Create the docking widget and add it to the window.
            dock = new DockFrame ();

            dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
                dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            };

            /* Side bar is experimental. Disabled for now
            HBox hbox = new HBox ();
            VBox sideBox = new VBox ();
            sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
            hbox.PackStart (sideBox, false, false, 0);
            hbox.ShowAll ();
            sideBox.NoShowAll = true;
            hbox.PackStart (dock, true, true, 0);
            DockBar bar = dock.ExtractDockBar (PositionType.Left);
            bar.AlwaysVisible = true;
            sideBox.PackStart (bar, true, true, 0);
            toolbarFrame.AddContent (hbox);
            */

            toolbarFrame.AddContent (dock);

            // Create the notebook for the various documents.
            tabControl = new SdiDragNotebook (this);

            DockNotebook.ActiveNotebookChanged += delegate {
                OnActiveWindowChanged (null, null);
            };

            Add (fullViewVBox);
            fullViewVBox.ShowAll ();
            bottomBar = new MonoDevelopStatusBar ();
            fullViewVBox.PackEnd (bottomBar, false, true, 0);
            bottomBar.ShowAll ();
            toolbarBox.PackStart (this.toolbar, true, true, 0);

            // In order to get the correct bar height we need to calculate the tab size using the
            // correct style (the style of the window). At this point the widget is not yet a child
            // of the window, so its style is not yet the correct one.
            tabControl.InitSize ();
            var barHeight = tabControl.BarHeight;

            // The main document area
            documentDockItem = dock.AddItem ("Documents");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;
            documentDockItem.DrawFrame = false;
            documentDockItem.Label = GettextCatalog.GetString ("Documents");
            documentDockItem.Content = new DockNotebookContainer (tabControl, true);

            DockVisualStyle style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadBackgroundColor = Styles.PadBackground;
            style.InactivePadBackgroundColor = Styles.InactivePadBackground;
            style.PadTitleHeight = barHeight;
            dock.DefaultVisualStyle = style;

            style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadTitleHeight = barHeight;
            style.ShowPadTitleIcon = false;
            style.UppercaseTitles = false;
            style.ExpandedTabs = true;
            style.PadBackgroundColor = Styles.BrowserPadBackground;
            style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground;
            style.TreeBackgroundColor = Styles.BrowserPadBackground;
            dock.SetDockItemStyle ("ProjectPad", style);
            dock.SetDockItemStyle ("ClassPad", style);

            //			dock.SetRegionStyle ("Documents/Left", style);
            //dock.SetRegionStyle ("Documents/Right", style);

            //			style = new DockVisualStyle ();
            //			style.SingleColumnMode = true;
            //			dock.SetRegionStyle ("Documents/Left;Documents/Right", style);
            //			dock.SetDockItemStyle ("Documents", style);

            // Add some hiden items to be used as position reference
            DockItem dit = dock.AddItem ("__left");
            dit.DefaultLocation = "Documents/Left";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__right");
            dit.DefaultLocation = "Documents/Right";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__top");
            dit.DefaultLocation = "Documents/Top";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__bottom");
            dit.DefaultLocation = "Documents/Bottom";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            if (MonoDevelop.Core.Platform.IsMac)
                bottomBar.HasResizeGrip = true;
            else {
                if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
                    bottomBar.HasResizeGrip = false;
                SizeAllocated += delegate {
                    if (GdkWindow != null)
                        bottomBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
                };
            }

            // create DockItems for all the pads
            ExtensionNodeList padCodons = AddinManager.GetExtensionNodes (viewContentPath);
            foreach (ExtensionNode node in padCodons)
                ShowPadNode (node);

            try {
                if (System.IO.File.Exists (configFile)) {
                    dock.LoadLayouts (configFile);
                    foreach (string layout in dock.Layouts) {
                        if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
                            layouts.Add (layout);
                    }
                }
            } catch (Exception ex) {
                LoggingService.LogError (ex.ToString ());
            }
        }
Ejemplo n.º 41
0
    void CreateComponents()
    {
        fullViewVBox = new VBox(false, 0);
        rootWidget   = fullViewVBox;

        CreateMenuBar();

        CreateToolBar();

        // Create the docking widget and add it to the window.
        dock                   = new DockFrame();
        dock.Homogeneous       = false;
        dock.DefaultItemHeight = 100;
        dock.DefaultItemWidth  = 100;
        //dock.CompactGuiLevel = 1;

        toolbarFrame.AddContent(dock);

        // Create the notebook for the various documents.
        tabControl            = new DragNotebook(); //(dock.ShadedContainer);
        tabControl.Scrollable = true;
        tabControl.AppendPage(new Label("Other page"), new Label("Favorite Page  "));
        tabControl.AppendPage(new Label("What page"), new Label("Welcome/Start Page  "));
        tabControl.AppendPage(new TextView(), new Image("gtk-new", IconSize.Menu));
        tabControl.ShowAll();

        // The main document area
        documentDockItem                 = dock.AddItem("Documents");
        documentDockItem.Behavior        = DockItemBehavior.Locked;
        documentDockItem.Status          = DockItemStatus.AutoHide;
        documentDockItem.DefaultHeight   = 100;
        documentDockItem.DefaultWidth    = 100;
        documentDockItem.DefaultStatus   = DockItemStatus.AutoHide;
        documentDockItem.DefaultLocation = "Document/Right";
        documentDockItem.Expand          = true;
        documentDockItem.DrawFrame       = true;
        documentDockItem.Label           = "Documents";
        documentDockItem.Content         = tabControl;
        documentDockItem.DefaultVisible  = true;
        documentDockItem.Visible         = true;


        DockItem dit = dock.AddItem("left");

        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "left";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Left";
        dit.DefaultVisible  = true;
        dit.Visible         = true;
        DockItemToolbar tb = dit.GetToolbar(PositionType.Top);
        ToolButton      b  = new ToolButton(null, "Hello");

        tb.Add(b, false);
        tb.Visible = true;
        tb.ShowAll();

        dit                 = dock.AddItem("right");
        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Right";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Right";
        dit.DefaultVisible  = true;
        dit.Visible         = true;
        //dit.Icon = Gdk.Pixbuf.LoadFromResource("Cage.Shell.Docking.stock-close-12.png");

        dit                 = dock.AddItem("top");
        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Top";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Top";
        dit.DefaultVisible  = true;
        dit.Visible         = true;

        dit                 = dock.AddItem("bottom");
        dit.Status          = DockItemStatus.AutoHide;
        dit.DefaultHeight   = 100;
        dit.DefaultWidth    = 100;
        dit.DefaultStatus   = DockItemStatus.AutoHide;
        dit.DefaultLocation = "Documents/Bottom";
        dit.Behavior        = DockItemBehavior.Normal;
        dit.Label           = "Bottom";
        dit.DefaultVisible  = true;
        dit.Visible         = true;



        if (File.Exists("toolbar.status"))
        {
            toolbarFrame.LoadStatus("toolbar.status");
        }

        if (File.Exists("config.layout"))
        {
            dock.LoadLayouts("config.layout");
        }
        else
        {
            dock.CreateLayout("test", true);
        }


        dock.CurrentLayout = "test";
        dock.HandlePadding = 0;
        dock.HandleSize    = 10;

        dock.SaveLayouts("config.layout");
        toolbarFrame.SaveStatus("toolbar.status");

        Add(fullViewVBox);
        fullViewVBox.ShowAll();

        statusBar = new Gtk.Statusbar();
        fullViewVBox.PackEnd(statusBar, false, true, 0);
    }
Ejemplo n.º 42
0
  public NotifyWindow(Gtk.Widget parent, string message, string details,
 Gtk.MessageType messageType, uint timeout)
      : base(Gtk.WindowType.Popup)
  {
      this.AppPaintable = true;
         parentWidget = parent;
         this.timeout = timeout;
         activeBackgroundColor = new Gdk.Color(249, 253, 202);
         inactiveBackgroundColor = new Gdk.Color(255, 255, 255);
         Gtk.HBox outBox = new HBox();
         this.Add(outBox);
         outBox.BorderWidth = (uint)wbsize;
         Gtk.VBox closeBox = new VBox();
         closeBox.BorderWidth = 3;
         outBox.PackEnd(closeBox, true, true, 0);
         EventBox eBox = new EventBox();
         eBox.ButtonPressEvent +=
      new ButtonPressEventHandler(OnCloseEvent);
         Gtk.Image closeImg = new Gtk.Image();
         closeImg.SetFromStock(Gtk.Stock.Close,
         IconSize.Menu);
         eBox.Add(closeImg);
         closeBox.PackStart(eBox, false, false, 0);
         Label padder = new Label("");
         outBox.PackStart(padder, false, false, 5);
         Gtk.VBox vbox = new VBox();
         outBox.PackStart(vbox, true, true, 0);
         vbox.BorderWidth = 10;
         Gtk.HBox hbox = new HBox();
         hbox.Spacing = 5;
         vbox.PackStart(hbox, false, false, 0);
         VBox iconVBox = new VBox();
         hbox.PackStart(iconVBox, false, false, 0);
         Gtk.Image msgImage = new Gtk.Image();
         switch(messageType)
         {
      case Gtk.MessageType.Info:
       msgImage.SetFromStock(Gtk.Stock.DialogInfo,
         IconSize.Button);
       break;
      case Gtk.MessageType.Warning:
       msgImage.SetFromStock(Gtk.Stock.DialogWarning,
         IconSize.Button);
       break;
      case Gtk.MessageType.Question:
       msgImage.SetFromStock(Gtk.Stock.DialogQuestion,
         IconSize.Button);
       break;
      case Gtk.MessageType.Error:
       msgImage.SetFromStock(Gtk.Stock.DialogError,
         IconSize.Button);
       break;
         }
         iconVBox.PackStart(msgImage, false, false, 0);
         VBox messageVBox = new VBox();
         hbox.PackStart(messageVBox, true, true, 0);
         Label l = new Label();
         l.Markup = "<span size=\"small\" weight=\"bold\">" + message + "</span>";
         l.LineWrap = false;
         l.UseMarkup = true;
         l.Selectable = false;
         l.Xalign = 0;
         l.Yalign = 0;
         l.LineWrap = true;
         l.Wrap = true;
         l.WidthRequest = messageTextWidth;
         messageVBox.PackStart(l, false, true, 0);
         detailsTextView = new LinkTextView(details);
         detailsTextView.Editable = false;
         detailsTextView.CursorVisible = false;
         detailsTextView.WrapMode = WrapMode.Word;
         detailsTextView.SizeAllocate(new Gdk.Rectangle(0, 0, messageTextWidth, 600));
         detailsTextView.LinkClicked +=
      new LinkClickedEventHandler(OnLinkClicked);
         messageVBox.PackStart(detailsTextView, false, false, 3);
         Label spacer = new Label();
         spacer.UseMarkup = true;
         spacer.Markup = "<span size=\"xx-small\"> </span>";
         messageVBox.PackEnd(spacer, false, false, 0);
         closeWindowTimeoutID = 0;
  }
Ejemplo n.º 43
0
        private void build()
        {
            this.vbox1    = new Gtk.VBox();
            this.toolbar1 = new Gtk.Toolbar();
            this.toolbar1.ToolbarStyle      = ToolbarStyle.BothHoriz;
            this.new_toolbutton             = new ToolButton(Stock.New);
            this.new_toolbutton.IsImportant = true;
            this.new_toolbutton.Label       = "New Character";
            this.new_toolbutton.Clicked    += HandleNew_toolbuttonhandleClicked;
            this.toolbar1.Add(this.new_toolbutton);
            this.pref_toolbutton             = new ToolButton(Stock.Preferences);
            this.pref_toolbutton.IsImportant = true;
            this.pref_toolbutton.Label       = "Preferences";
            this.pref_toolbutton.Clicked    += HandlePref_toolbuttonhandleClicked;
            this.toolbar1.Add(this.pref_toolbutton);
            this.quit_toolbutton             = new ToolButton(Stock.Quit);
            this.quit_toolbutton.IsImportant = true;
            this.quit_toolbutton.Label       = "Quit";
            this.quit_toolbutton.Clicked    += HandleQuit_toolbuttonhandleClicked;
            this.toolbar1.Add(this.quit_toolbutton);
            this.about_toolbutton             = new ToolButton(Stock.About);
            this.about_toolbutton.IsImportant = true;
            this.about_toolbutton.Label       = "About";
            this.about_toolbutton.Clicked    += HandleAbout_toolbuttonhandleClicked;
            SeparatorToolItem sti = new SeparatorToolItem();

            sti.Draw   = false;
            sti.Expand = true;
            this.toolbar1.Add(sti);
            this.toolbar1.Add(this.about_toolbutton);
            this.statusbar1 = new Gtk.Statusbar();
            this.image1     = new Image(MediaManager.GetPixbufFromBaseFile("BLLogo.jpg").ScaleSimple(296, 149, Gdk.InterpType.Bilinear));
            Gtk.VBox vbox2 = new Gtk.VBox();

            Gtk.ScrolledWindow sw1 = new Gtk.ScrolledWindow();
            TreeStore          ts1 = new TreeStore(typeof(string), typeof(string));

            ts1.AppendValues("Player Characters", DateTime.Now.ToString());
            ts1.AppendValues("Non-Player Characters", DateTime.Now.ToString());
            ts1.AppendValues("Database", DateTime.Now.ToString());
            TreeView tv1 = new TreeView();

            tv1.Model          = ts1;
            tv1.HeadersVisible = true;
            tv1.AppendColumn("Source", new CellRendererText(), "text", 0);
            tv1.AppendColumn("Last Update", new CellRendererText(), "text", 1);
            sw1.Add(tv1);



            vbox2.PackStart(this.image1, false, true, 0);
            vbox2.PackEnd(sw1, true, true, 0);
            this.vbox1.PackStart(this.toolbar1, false, true, 0);
            this.vbox1.PackStart(vbox2, true, true, 0);
            this.vbox1.PackStart(this.statusbar1, false, true, 0);
            this.Add(this.vbox1);
            //this.SetSizeRequest(640, Screen.Height - 100);
            this.SetSizeRequest(480, 640);
            this.Icon = Battle.Gui.MediaManager.GetPixbufFromBaseFile("LSIMMS.png");
            this.statusbar1.Push(0, string.Format("{0} started @ {1}",
                                                  this.session.GetType().ToString(),
                                                  this.session.StartTime.ToString()));
            this.Maximize();
        }