Inheritance: Gtk.ScrolledWindow
Esempio n. 1
0
        static int RunApp(string[] args, int n)
        {
            Project = SteticApp.CreateProject ();

            Project.WidgetAdded += OnWidgetAdded;
            Project.WidgetRemoved += OnWidgetRemoved;
            Project.ModifiedChanged += OnProjectModified;
            Project.ProjectReloaded += OnProjectReloaded;

            Palette = SteticApp.PaletteWidget;
            widgetTree = SteticApp.WidgetTreeWidget;
            Signals = SteticApp.SignalsWidget;
            propertyTree = SteticApp.PropertiesWidget;
            ProjectView = new WindowListWidget ();

            UIManager = new Stetic.UIManager (Project);

            Glade.XML.CustomHandler = CustomWidgetHandler;
            Glade.XML glade = new Glade.XML ("stetic.glade", "MainWindow");
            glade.Autoconnect (typeof (SteticMain));

            if (ProjectView.Parent is Gtk.Viewport &&
                ProjectView.Parent.Parent is Gtk.ScrolledWindow) {
                Gtk.Viewport viewport = (Gtk.Viewport)ProjectView.Parent;
                Gtk.ScrolledWindow scrolled = (Gtk.ScrolledWindow)viewport.Parent;
                viewport.Remove (ProjectView);
                scrolled.Remove (viewport);
                scrolled.AddWithViewport (ProjectView);
            }

            foreach (Gtk.Widget w in glade.GetWidgetPrefix ("")) {
                Gtk.Window win = w as Gtk.Window;
                if (win != null) {
                    win.AddAccelGroup (UIManager.AccelGroup);
                    win.ShowAll ();
                }
            }
            MainWindow = (Gtk.Window)Palette.Toplevel;
            WidgetNotebook = (Gtk.Notebook) glade ["notebook"];
            WidgetNotebook.SwitchPage += OnPageChanged;
            ProjectView.ComponentActivated += OnWidgetActivated;
            widgetTree.SelectionChanged += OnSelectionChanged;

            #if GTK_SHARP_2_6
            // This is needed for both our own About dialog and for ones
            // the user constructs
            Gtk.AboutDialog.SetUrlHook (ActivateUrl);
            #endif

            if (n < args.Length) {
                LoadProject (args [n]);
            }

            ReadConfiguration ();

            foreach (string s in Configuration.WidgetLibraries) {
                SteticApp.AddWidgetLibrary (s);
            }
            SteticApp.UpdateWidgetLibraries (false);

            ProjectView.Fill (Project);

            Program.Run ();
            return 0;
        }
Esempio n. 2
0
        static int RunApp(string[] args, int n)
        {
            Project = SteticApp.CreateProject();

            Project.WidgetAdded     += OnWidgetAdded;
            Project.WidgetRemoved   += OnWidgetRemoved;
            Project.ModifiedChanged += OnProjectModified;
            Project.ProjectReloaded += OnProjectReloaded;

            Palette      = SteticApp.PaletteWidget;
            widgetTree   = SteticApp.WidgetTreeWidget;
            Signals      = SteticApp.SignalsWidget;
            propertyTree = SteticApp.PropertiesWidget;
            ProjectView  = new WindowListWidget();

            UIManager = new Stetic.UIManager(Project);

            Glade.XML.CustomHandler = CustomWidgetHandler;
            Glade.XML glade = new Glade.XML("stetic.glade", "MainWindow");
            glade.Autoconnect(typeof(SteticMain));

            if (ProjectView.Parent is Gtk.Viewport &&
                ProjectView.Parent.Parent is Gtk.ScrolledWindow)
            {
                Gtk.Viewport       viewport = (Gtk.Viewport)ProjectView.Parent;
                Gtk.ScrolledWindow scrolled = (Gtk.ScrolledWindow)viewport.Parent;
                viewport.Remove(ProjectView);
                scrolled.Remove(viewport);
                scrolled.AddWithViewport(ProjectView);
            }

            foreach (Gtk.Widget w in glade.GetWidgetPrefix(""))
            {
                Gtk.Window win = w as Gtk.Window;
                if (win != null)
                {
                    win.AddAccelGroup(UIManager.AccelGroup);
                    win.ShowAll();
                }
            }
            MainWindow                      = (Gtk.Window)Palette.Toplevel;
            WidgetNotebook                  = (Gtk.Notebook)glade ["notebook"];
            WidgetNotebook.SwitchPage      += OnPageChanged;
            ProjectView.ComponentActivated += OnWidgetActivated;
            widgetTree.SelectionChanged    += OnSelectionChanged;

#if GTK_SHARP_2_6
            // This is needed for both our own About dialog and for ones
            // the user constructs
            Gtk.AboutDialog.SetUrlHook(ActivateUrl);
#endif

            if (n < args.Length)
            {
                LoadProject(args [n]);
            }

            ReadConfiguration();

            foreach (string s in Configuration.WidgetLibraries)
            {
                SteticApp.AddWidgetLibrary(s);
            }
            SteticApp.UpdateWidgetLibraries(false);

            ProjectView.Fill(Project);

            Program.Run();
            return(0);
        }