Esempio n. 1
0
 internal void SetFloatMode(Gdk.Rectangle rect)
 {
     ResetBarUndockMode();
     if (floatingWindow == null)
     {
         if (Widget.Parent != null)
         {
             Widget.Unparent();
         }
         floatingWindow = new Window(GetWindowTitle());
         floatingWindow.TransientFor = frame.Toplevel as Gtk.Window;
         floatingWindow.TypeHint     = Gdk.WindowTypeHint.Utility;
         floatingWindow.Add(Widget);
         floatingWindow.DeleteEvent += delegate(object o, DeleteEventArgs a) {
             if (behavior == DockItemBehavior.CantClose)
             {
                 Status = DockItemStatus.Dockable;
             }
             else
             {
                 Visible = false;
             }
             a.RetVal = true;
         };
     }
     floatingWindow.Move(rect.X, rect.Y);
     floatingWindow.Resize(rect.Width, rect.Height);
     floatingWindow.Show();
     Widget.UpdateBehavior();
     Widget.Show();
 }
Esempio n. 2
0
        public static void CenterChildToParent(Gtk.Window parent, Gtk.Window child)
        {
            if (parent == null || child == null)
            {
                return;
            }

            int parentX = 0;
            int parentY = 0;
            int parentW = 0;
            int parentH = 0;

            parent.GetPosition(out parentX, out parentY);
            parent.GetSize(out parentW, out parentH);

            int w = 0;
            int h = 0;

            child.GetSize(out w, out h);

            var x = parentX + Convert.ToInt32((parentW - w) / 2);
            var y = parentY + Convert.ToInt32((parentH - h) / 2);

            if (x <= 0)
            {
                x = 0;
            }
            if (y <= 0)
            {
                y = 0;
            }

            child.Move(x, y);
            child.KeepAbove = true;
        }
Esempio n. 3
0
        internal void SetFloatMode(Gdk.Rectangle rect)
        {
            if (floatingWindow == null)
            {
                ResetMode();
                SetRegionStyle(frame.GetRegionStyleForItem(this));

                floatingWindow = new DockFloatingWindow((Window)frame.Toplevel, GetTitle());

                VBox box = new VBox();
                box.Show();
                box.PackStart(TitleTab, false, false, 0);
                box.PackStart(Widget, true, true, 0);
                floatingWindow.Add(box);
                floatingWindow.DeleteEvent += delegate(object o, DeleteEventArgs a) {
                    if (behavior == DockItemBehavior.CantClose)
                    {
                        Status = DockItemStatus.Dockable;
                    }
                    else
                    {
                        Visible = false;
                    }
                    a.RetVal = true;
                };
            }
            floatingWindow.Move(rect.X, rect.Y);
            floatingWindow.Resize(rect.Width, rect.Height);
            floatingWindow.Show();
            if (titleTab != null)
            {
                titleTab.UpdateBehavior();
            }
            Widget.Show();
        }
Esempio n. 4
0
        public GraphicalApp()
        {
            _model = CharlieModel.LoadFromFile();
//      var accelGroup = new AccelGroup();

            var provider = new CssProvider();

            provider.LoadFromPath(GetResource("style.css"));
            StyleContext.AddProviderForScreen(Screen.Default, provider, 800);

            var window = new Window(WindowType.Toplevel)
            {
                DefaultWidth  = _model.WindowWidth,
                DefaultHeight = _model.WindowHeight,
                Title         = "",
                Role          = "Charlie",
                Resizable     = true
            };

            window.Move(_model.WindowX, _model.WindowY);
            window.SetIconFromFile(GetResource("logo.png"));
//      window.AddAccelGroup(accelGroup);

            window.Destroyed += (sender, args) => Quit();
            window.Show();

            _window      = window;
            window.Child = CreateRoot();
            window.Child.ShowAll();
        }
Esempio n. 5
0
        void PositionListWindow()
        {
            if (window == null)
            {
                return;
            }
            int ox, oy;

            ParentWindow.GetOrigin(out ox, out oy);
            int dx = ox + this.Allocation.X;
            int dy = oy + this.Allocation.Bottom;

            window.WidthRequest = Allocation.Width;
            int width, height;

            window.GetSizeRequest(out width, out height);
            Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen.Number, Screen.GetMonitorAtPoint(dx, dy));

            if (dy + height > geometry.Bottom)
            {
                dy = oy + this.Allocation.Y - height;
            }
            if (dx + width > geometry.Right)
            {
                dx = (int)geometry.Right - width;
            }

            window.Move(dx, dy);
            window.GetSizeRequest(out width, out height);
            window.GrabFocus();
            window.FocusOutEvent += delegate {
                DestroyWindow();
            };
            window.ShowAll();
        }
Esempio n. 6
0
        internal void AddTopLevel(DockFrameTopLevel w, int x, int y, int width, int height)
        {
            w.X = x;
            w.Y = y;

            if (UseWindowsForTopLevelFrames)
            {
                var win = new Gtk.Window(Gtk.WindowType.Toplevel);
                win.AcceptFocus     = false;
                win.SkipTaskbarHint = true;
                win.Decorated       = false;
                win.TypeHint        = Gdk.WindowTypeHint.Toolbar;
                w.ContainerWindow   = win;
                w.Size = new Size(width, height);
                win.Add(w);
                w.Show();
                var p = this.GetScreenCoordinates(new Gdk.Point(x, y));
                win.Opacity = 0.0;
                win.Move(p.X, p.Y);
                win.Resize(width, height);
                win.Show();
                Ide.DesktopService.AddChildWindow((Gtk.Window)Toplevel, win);
                win.AcceptFocus = true;
                win.Opacity     = 1.0;
            }
            else
            {
                w.Parent = this;
                w.Size   = new Size(width, height);
                Requisition r = w.SizeRequest();
                w.Allocation = new Gdk.Rectangle(Allocation.X + x, Allocation.Y + y, r.Width, r.Height);
                topLevels.Add(w);
            }
        }
        private void PositionCalendarPopup()
        {
            int x, y;

            Gtk.Requisition req = cal_popup.SizeRequest();
            GetWidgetPosition(date_button, out x, out y);
            cal_popup.Move(x + date_button.Allocation.Width - req.Width, y + date_button.Allocation.Height);
        }
        protected void CreatePopWindowOffScreen()
        {
            m_popupWindow.ShowNow();
            m_popupWindow.DoubleBuffered = false;
            m_popupWindow.Move(-5000, -5000);

            while (m_popupWindow.GdkWindow == null)
            {
                ProcessPendingGtkEvents();
            }
        }
Esempio n. 9
0
        /// <summary>Centers a window relative to its parent.</summary>
        static void CenterWindow(Gtk.Window child, Gtk.Window parent)
        {
            child.Child.Show();
            int w, h, winw, winh, x, y, winx, winy;

            child.GetSize(out w, out h);
            parent.GetSize(out winw, out winh);
            parent.GetPosition(out winx, out winy);
            x = Math.Max(0, (winw - w) / 2) + winx;
            y = Math.Max(0, (winh - h) / 2) + winy;
            child.Move(x, y);
        }
Esempio n. 10
0
File: Window.cs Progetto: MrJoe/lat
        void LoadPreference(String key)
        {
            object val = Preferences.Get(key);

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

                return;
            }

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

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

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

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

                mainWindow.ReshowWithInitialSize();
                break;

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

            case Preferences.BROWSER_SELECTION:
                ldapTreeView.BrowserSelectionMethod = (int)val;
                break;
            }
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
            private void UpdatePopupPosition()
            {
                int         x = 0, y = 0;
                Rectangle   bounds      = Bounds();
                Requisition requisition = popup_window.SizeRequest();

                popup_window.Resize(requisition.Width, requisition.Height);
                selector.GdkWindow.GetOrigin(out x, out y);
                x += bounds.X + (bounds.Width - requisition.Width) / 2;
                y += bounds.Y - requisition.Height;
                x  = Math.Max(x, 0);
                x  = Math.Min(x, selector.Screen.Width - requisition.Width);
                popup_window.Move(x, y);
            }
Esempio n. 13
0
        private void ShowPopup()
        {
            win              = new Gtk.Window(Gtk.WindowType.Popup);
            win.Screen       = this.Screen;
            win.WidthRequest = this.Allocation.Width;

            cal = new Gtk.Calendar();
            win.Add(cal);

            if (validDate)
            {
                cal.Date = date;
            }

            // events
            win.ButtonPressEvent       += OnWinButtonPressEvent;
            cal.DaySelectedDoubleClick += OnCalDaySelectedDoubleClick;
            cal.KeyPressEvent          += OnCalKeyPressEvent;
            cal.ButtonPressEvent       += OnCalButtonPressEvent;

            int x, y;

            GetWidgetPos(this, out x, out y);
            win.Move(x, y + Allocation.Height + 2);
            win.ShowAll();
            win.GrabFocus();

            Grab.Add(win);

            Gdk.GrabStatus grabStatus;

            grabStatus = Gdk.Pointer.Grab(win.GdkWindow, true, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, null, Gtk.Global.CurrentEventTime);
            if (grabStatus == Gdk.GrabStatus.Success)
            {
                grabStatus = Gdk.Keyboard.Grab(win.GdkWindow, true, Gtk.Global.CurrentEventTime);
                if (grabStatus != Gdk.GrabStatus.Success)
                {
                    Grab.Remove(win);
                    win.Destroy();
                    win = null;
                }
            }
            else
            {
                Grab.Remove(win);
                win.Destroy();
                win = null;
            }
        }
Esempio n. 14
0
        public void Start()
        {
            currentStep = 0;

            window = new Window(WindowType.Toplevel);
            window.Move(10, 10);
            window.KeepAbove = true;
            window.Resize(400, 30);
            window.AcceptFocus = false;
            window.Title = "Progress Bar";

            progressBar = new ProgressBar();
            progressBar.Fraction = 0;

            window.Add(progressBar);
            window.ShowAll();
        }
Esempio n. 15
0
        public TransparentWindow(Gtk.Widget main_widget, Function<int> x_pos_func, Function<int> y_pos_func, string the_name)
        {
            x_pos_function = x_pos_func;
            y_pos_function = y_pos_func;

            name = the_name;

            window = new Window(WindowType.Popup);

            //			window.ExposeEvent += Expose;

            window.Add(main_widget);

            window.Move(x_pos_function(), y_pos_function());

               			window.ShowAll();
        }
Esempio n. 16
0
        internal void AddTopLevel(DockFrameTopLevel w, int x, int y, int width, int height)
        {
            w.X = x;
            w.Y = y;

            if (UseWindowsForTopLevelFrames)
            {
                var win = new Gtk.Window(Gtk.WindowType.Toplevel);
                win.SkipTaskbarHint = true;
                win.Decorated       = false;
                win.TypeHint        = Gdk.WindowTypeHint.Toolbar;
                w.ContainerWindow   = win;
                w.Size = new Size(width, height);
                win.Add(w);
                w.Show();
                var p = this.GetScreenCoordinates(new Gdk.Point(x, y));
                win.Opacity = 0.0;
                win.Move(p.X, p.Y);
                win.Resize(width, height);
                win.Show();
                Ide.DesktopService.AddChildWindow((Gtk.Window)Toplevel, win);
                win.AcceptFocus = true;
                win.Opacity     = 1.0;

                /* When we use real windows for frames, it's possible for pads to be over other
                 * windows. For some reason simply presenting or raising those dialogs doesn't
                 * seem to work, so we hide/show them in order to force them above the pad. */
                var toplevels = Gtk.Window.ListToplevels().Where(t => t.IsRealized && t.Visible && t.TypeHint == WindowTypeHint.Dialog);                   // && t.TransientFor != null);
                foreach (var t in toplevels)
                {
                    t.Hide();
                    t.Show();
                }

                MonoDevelop.Ide.IdeApp.CommandService.RegisterTopWindow(win);
            }
            else
            {
                w.Parent = this;
                w.Size   = new Size(width, height);
                Requisition r = w.SizeRequest();
                w.Allocation = new Gdk.Rectangle(Allocation.X + x, Allocation.Y + y, r.Width, r.Height);
                topLevels.Add(w);
            }
        }
Esempio n. 17
0
        public static void CenterToParentWindow(this Window child, Window parent)
        {
            int width1;
            int height1;

            child.GetSize(out width1, out height1);
            int width2;
            int height2;

            parent.GetSize(out width2, out height2);
            int root_x;
            int root_y;

            parent.GetPosition(out root_x, out root_y);
            int x = Math.Max(0, (width2 - width1) / 2) + root_x;
            int y = Math.Max(0, (height2 - height1) / 2) + root_y;

            child.Move(x, y);
        }
Esempio n. 18
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;
        }
Esempio n. 19
0
        /// <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;
        }
Esempio n. 20
0
        /// <summary>Centers a window relative to its parent.</summary>
        static void CenterWindow(Gtk.Window child, Gtk.Window parent)
        {
            child.Child.Show();
            int w, h, winw, winh, x, y, winx, winy;

            if (child.Visible)
            {
                child.GetSize(out w, out h);
            }
            else
            {
                w = child.DefaultSize.Width;
                h = child.DefaultSize.Height;
            }
            parent.GetSize(out winw, out winh);
            parent.GetPosition(out winx, out winy);
            x = Math.Max(0, (winw - w) / 2) + winx;
            y = Math.Max(0, (winh - h) / 2) + winy;
            child.Move(x, y);
        }
Esempio n. 21
0
        public void UpdatePosition(int iconboxWidth, Pane currentPane, Rectangle resultsOffset, Rectangle normalOffset)
        {
            Gtk.Application.Invoke(delegate {
                Gdk.Rectangle geo, main, results;

                w.GetPosition(out main.X, out main.Y);
                w.GetSize(out main.Width, out main.Height);

                geo  = w.Screen.GetMonitorGeometry(GetMonitor());
                main = CalculateBasePosition(geo, main, normalOffset);
                w.Move(main.X, main.Y);

                if (r == null)
                {
                    return;
                }
                //position resultsWindow
                r.GetSize(out results.Width, out results.Height);
                results.Y = main.Y + main.Height + resultsOffset.Y;
                results.X = main.X + iconboxWidth * (int)currentPane + resultsOffset.X;
                r.Move(results.X, results.Y);
            });
        }
Esempio n. 22
0
        static void ReadConfiguration()
        {
            string file = Path.Combine(SteticMain.ConfigDir, "configuration.xml");

            Configuration = null;

            if (File.Exists(file))
            {
                try {
                    using (StreamReader sr = new StreamReader(file)) {
                        XmlSerializer ser = new XmlSerializer(typeof(Configuration));
                        Configuration = (Configuration)ser.Deserialize(sr);
                    }
                } catch {
                    // Ignore exceptions while reading the recents file
                }
            }

            if (Configuration != null)
            {
                MainWindow.Move(Configuration.WindowX, Configuration.WindowY);
                MainWindow.Resize(Configuration.WindowWidth, Configuration.WindowHeight);
                if (Configuration.WindowState == Gdk.WindowState.Maximized)
                {
                    MainWindow.Maximize();
                }
                else if (Configuration.WindowState == Gdk.WindowState.Iconified)
                {
                    MainWindow.Iconify();
                }
                SteticApp.ShowNonContainerWarning = Configuration.ShowNonContainerWarning;
            }
            else
            {
                Configuration = new Configuration();
            }
        }
Esempio n. 23
0
    static int LoadXap(string file, List <string> args)
    {
        string [] test = { "" };

        if (sync)
        {
            test [0] = "--sync";
        }

        Application.Init("mopen", ref test);
        MoonlightRuntime.Init();
        window = new Gtk.Window(file);
        window.SetDefaultSize(400, 400);

        if (transparent)
        {
            CompositeHelper.SetRgbaColormap(window);
            window.AppPaintable = true;
            window.ExposeEvent += HandleExposeEvent;
        }

        if (desklet)
        {
            ConfigureDeskletWindow(window);
        }

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

        moon_host = new MoonlightHost();

        try {
            moon_host.LoadXap(file);
        } catch (Exception e) {
            Console.Error.WriteLine("mopen: Could not load xaml: {0}", e.Message);
            return(1);
        }

        System.Windows.Application app = moon_host.Application;
        FrameworkElement           top = (FrameworkElement)app.RootVisual;

        if (top is Moon.Windows.Desktop.Window)
        {
            var moonwindow = ((Moon.Windows.Desktop.Window)top);
            /* special window handling mode */
            moonwindow.IsActive = window.IsActive;

            Wnck.Screen.Default.ActiveWindowChanged += delegate {
                moonwindow.IsActive = window.IsActive;
            };

            moonwindow.PositionChanged += delegate {
                window.Move((int)moonwindow.Position.X, (int)moonwindow.Position.Y);
            };

            moonwindow.SizeChanged += delegate {
                window.Resize((int)moonwindow.Size.Width, (int)moonwindow.Size.Height);
            };

            moonwindow.WindowOpacityChanged += delegate {
                moon_host.QueueDraw();
            };

            if (!transparent)
            {
                CompositeHelper.SetRgbaColormap(window);
                window.AppPaintable = true;
                window.ExposeEvent += HandleExposeEvent;

                moon_host.AppPaintable = true;
                moon_host.Transparent  = true;
            }
        }

        if (parse_only)
        {
            return(0);
        }

        if (width == -1)
        {
            width = (int)top.Width;
        }
        if (height == -1)
        {
            height = (int)top.Height;
        }

        if (width > 0 && height > 0)
        {
            moon_host.SetSizeRequest(width, height);
            window.Resize(width, height);
        }

        if (transparent)
        {
            moon_host.AppPaintable = true;
            moon_host.Transparent  = true;
        }

        if (desklet)
        {
            top.MouseLeftButtonDown += new MouseButtonEventHandler(HandleMouseLeftButtonDown);
            top.MouseLeftButtonUp   += new MouseButtonEventHandler(HandleMouseLeftButtonUp);
            top.MouseMove           += new MouseEventHandler(HandleMouseMove);
        }

        window.Add(moon_host);

        window.ShowAll();

        if (story_names != null)
        {
            storyboards = new List <Storyboard> ();

            foreach (string story in story_names)
            {
                object     o  = top.FindName(story);
                Storyboard sb = o as Storyboard;

                if (sb == null)
                {
                    Console.Error.WriteLine("mopen: there is no Storyboard object named {0} in the XAML file", story);
                    return(1);
                }
                sb.Completed += delegate {
                    window.Title = String.Format("Storyboard {0} completed", current_storyboard - 1);
                };

                storyboards.Add(sb);
            }
            ;

            top.MouseLeftButtonUp += delegate {
                if (current_storyboard == storyboards.Count)
                {
                    current_storyboard = 0;
                }
                if (current_storyboard == storyboards.Count)
                {
                    return;
                }

                window.Title = String.Format("Storyboard {0} running", current_storyboard);
                storyboards [current_storyboard++].Begin();
            };
        }

        if (timeout > 0)
        {
            GLib.Timeout.Add((uint)(timeout * 1000), new TimeoutHandler(Quit));
        }

        Application.Run();
        return(0);
    }
Esempio n. 24
0
		/// <summary>Centers a window relative to its parent.</summary>
		static void CenterWindow (Window child, Window parent)
		{
			if (child == null || parent == null)
				return;

			child.Child.Show ();
			int w, h, winw, winh, x, y, winx, winy;
			child.GetSize (out w, out h);
			parent.GetSize (out winw, out winh);
			parent.GetPosition (out winx, out winy);
			x = System.Math.Max (0, (winw - w) /2) + winx;
			y = System.Math.Max (0, (winh - h) /2) + winy;
			child.Move (x, y);
		}
    public GnomeArtNgApp(string[] args)
    {
        Application.Init();
        //i18n
        Catalog.Init("gnomeartng", "./locale");
        config = new CConfiguration();
        //initialize Glade
        string mainW = "MainWindow";

        Glade.XML gxml = new Glade.XML(null, "gui.glade", mainW, null);
        mainWindow = (Gtk.Window)gxml.GetWidget(mainW);
        gxml.Autoconnect(this);

        //Connect all events
        mainWindow.DeleteEvent       += new DeleteEventHandler(OnWindowDeleteEvent);
        ExtInfoPreviewButton.Clicked += new EventHandler(OnPreviewButtonClicked);
        InstallButton.Clicked        += new EventHandler(OnInstallButtonClicked);
        RevertButton.Clicked         += new EventHandler(OnRevertButtonClicked);
        RefreshButton.Clicked        += new EventHandler(OnRefreshButtonClicked);
        SaveButton.Clicked           += new EventHandler(OnSaveButtonClicked);
        MainNotebook.SwitchPage      += new SwitchPageHandler(OnSwitchPage);
        FilterEntry.Changed          += new EventHandler(OnFilterEntriesChanged);
//		SortKindCb.Changed += new EventHandler(OnSortKindEntryChanged);
//		SortDirectionCb.Changed += new EventHandler(OnSortDirectionEntryChanged);
//		SortCloseButton.Clicked += new EventHandler(OnSortCloseClicked);
        FilterEntry.KeyReleaseEvent += new KeyReleaseEventHandler(OnFilterbarKeyReleased);
        FilterCloseButton.Clicked   += new EventHandler(OnFilterbarCloseClicked);

        //Menuitems
        QuitMenuItem.Activated   += new EventHandler(OnQuitItemSelected);
        UpdateMenuItem.Activated += new EventHandler(OnUpdateItemSelected);
        DonateMenuItem.Activated += new EventHandler(CUpdateWindow.onDonateButtonClicked);
        FilterMenuItem.Activated += new EventHandler(OnFilterItemSelected);
//		SortMenuItem.Activated += new EventHandler(OnSortItemSelected);
        InfoMenuItem.Activated        += new EventHandler(OnInfoItemSelected);
        PreferencesMenuItem.Activated += new EventHandler(OnPreferencesItemSelected);
        FTAItem.Activated             += new EventHandler(onFtaItemSelected);

        //First, download all thumbs...but don't bother the user with the update message, even if there is one
        bool RestartApp = false;

        if (config.NeverStartedBefore)
        {
            new CFirstTimeAssistant(config);
        }
//		else if (config.DontBotherForUpdates==false) {
//			if (config.UpdateAvailable) {
//				Console.WriteLine("An update is available, newest version is: "+config.NewestVersionNumberOnServer);
//			RestartApp = ShowUpdateWindow();
//			}
//		}

        if (!RestartApp)
        {
            //Application placement - doesn't work properly with compiz (is it the window placement plugin?)
            if (config.SettingsLoadOk)
            {
                mainWindow.Resize(config.Window.Width, config.Window.Height);
                mainWindow.Move(config.Window.X, config.Window.Y);
                //Console.WriteLine(config.Window.X+" "+ config.Window.Y);
            }

            //ArtManager erzeugen
            man = new CArtManager(config);

            //Stores anlegen und IconViews anlegen
            for (int i = 0; i < ListStoreCount; i++)
            {
                sWins[i]     = (Gtk.ScrolledWindow)(gxml.GetWidget("swin" + i));
                stores[i]    = new ListStore(typeof(Pixbuf), typeof(string), typeof(string), typeof(int));
                IconViews[i] = new Gtk.IconView(stores[i]);
                IconViews[i].SelectionChanged += new System.EventHandler(OnSelChanged);
                IconViews[i].ItemActivated    += new ItemActivatedHandler(OnItemActivated);
                IconViews[i].PixbufColumn      = 0;
                CurrentIconView = IconViews[0];

                sWins[i].Add(IconViews[i]);
                IconViews[i].Show();
            }

            //Create the comboboxes
            imageTypeBox        = ComboBox.NewText();
            imageResolutionsBox = ComboBox.NewText();
            imageStyleBox       = ComboBox.NewText();

            //Verschiedene Styles hinzufügen
            imageStyleBox.AppendText(Catalog.GetString("Centered"));
            imageStyleBox.AppendText(Catalog.GetString("Filled"));
            imageStyleBox.AppendText(Catalog.GetString("Scaled"));
            imageStyleBox.AppendText(Catalog.GetString("Zoomed"));
            imageStyleBox.AppendText(Catalog.GetString("Tiled"));
            imageStyleBox.Active   = 0;
            imageStyleBox.Changed += new EventHandler(OnImageStyleBoxChanged);

            LowerTable.Attach(imageTypeBox, 1, 2, 2, 3);
            LowerTable.Attach(imageResolutionsBox, 1, 2, 3, 4);
            LowerTable.Attach(imageStyleBox, 1, 2, 4, 5);

            UpdateMenuItem.Hide();

            OnSwitchPage(MainNotebook, new SwitchPageArgs());
            Gtk.Application.Run();
        }
    }
Esempio n. 26
0
        public void ShowCalendar()
        {
            popup = new Window(WindowType.Popup);
            popup.Screen = parent.Screen;

            Frame frame = new Frame();
            frame.Shadow = ShadowType.Out;
            frame.Show();

            popup.Add(frame);

            VBox box = new VBox(false, 0);
            box.Show();
            frame.Add(box);

            cal = new Calendar();
            cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
                                 | CalendarDisplayOptions.ShowDayNames
                                 | CalendarDisplayOptions.ShowWeekNumbers;

            cal.KeyPressEvent += OnCalendarKeyPressed;
            popup.ButtonPressEvent += OnButtonPressed;

            cal.Show();

            Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            calAlignment.Show();
            calAlignment.SetPadding(4, 4, 4, 4);
            calAlignment.Add(cal);

            box.PackStart(calAlignment, false, false, 0);

            //Requisition req = SizeRequest();

            parent.GdkWindow.GetOrigin(out xPos, out yPos);
            //			popup.Move(x + Allocation.X, y + Allocation.Y + req.Height + 3);
            popup.Move(xPos, yPos);
            popup.Show();
            popup.GrabFocus();

            Grab.Add(popup);

            Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
                                     Gdk.EventMask.ButtonPressMask
                                     | Gdk.EventMask.ButtonReleaseMask
                                     | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);

            if (grabbed == Gdk.GrabStatus.Success) {
                grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
                                            true, CURRENT_TIME);

                if (grabbed != Gdk.GrabStatus.Success) {
                    Grab.Remove(popup);
                    popup.Destroy();
                    popup = null;
                }
            } else {
                Grab.Remove(popup);
                popup.Destroy();
                popup = null;
            }

            cal.DaySelected += OnCalendarDaySelected;
            cal.MonthChanged += OnCalendarMonthChanged;

            cal.Date = date;
        }
Esempio n. 27
0
        private void ShowPopup()
        {
            win = new Gtk.Window(Gtk.WindowType.Popup);
            win.Screen = this.Screen;
            win.WidthRequest = this.Allocation.Width;

            cal = new Gtk.Calendar();
            win.Add(cal);

            if (validDate)
                cal.Date = date;

            // events
            win.ButtonPressEvent		+= OnWinButtonPressEvent;
            cal.DaySelectedDoubleClick	+= OnCalDaySelectedDoubleClick;
            cal.KeyPressEvent			+= OnCalKeyPressEvent;
            cal.ButtonPressEvent		+= OnCalButtonPressEvent;

            int x, y;
            GetWidgetPos(this, out x, out y);
            win.Move(x, y + Allocation.Height + 2);
            win.ShowAll();
            win.GrabFocus();

            Grab.Add(win);

            Gdk.GrabStatus grabStatus;

            grabStatus = Gdk.Pointer.Grab(win.GdkWindow, true, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, null, Gtk.Global.CurrentEventTime);
            if (grabStatus == Gdk.GrabStatus.Success) {
                grabStatus = Gdk.Keyboard.Grab(win.GdkWindow, true, Gtk.Global.CurrentEventTime);
                if (grabStatus != Gdk.GrabStatus.Success) {
                    Grab.Remove(win);
                    win.Destroy();
                    win = null;
                }
            } else {
                Grab.Remove(win);
                win.Destroy();
                win = null;
            }
        }
Esempio n. 28
0
        private void ShowCalendar()
        {
            popup = new Window(WindowType.Popup);
            popup.Screen = tree.Screen;

            Frame frame = new Frame();
            frame.Shadow = ShadowType.Out;
            frame.Show();

            popup.Add(frame);

            VBox box = new VBox(false, 0);
            box.Show();
            frame.Add(box);

            cal = new Calendar();
            cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
                                 | CalendarDisplayOptions.ShowDayNames
                                 | CalendarDisplayOptions.ShowWeekNumbers;

            cal.KeyPressEvent += OnCalendarKeyPressed;
            popup.ButtonPressEvent += OnButtonPressed;

            cal.Show();

            Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            calAlignment.Show();
            calAlignment.SetPadding(4, 4, 4, 4);
            calAlignment.Add(cal);

            box.PackStart(calAlignment, false, false, 0);

            // FIXME: Make the popup appear directly below the date
            Gdk.Rectangle allocation = tree.Allocation;
            //   Gtk.Requisition req = tree.SizeRequest ();
            int x = 0, y = 0;
            tree.GdkWindow.GetOrigin(out x, out y);
            //   popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3);
            popup.Move(x + allocation.X, y + allocation.Y);
            popup.Show();
            popup.GrabFocus();

            Grab.Add(popup);

            Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
                                     Gdk.EventMask.ButtonPressMask
                                     | Gdk.EventMask.ButtonReleaseMask
                                     | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);

            if (grabbed == Gdk.GrabStatus.Success) {
                grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
                                            true, CURRENT_TIME);

                if (grabbed != Gdk.GrabStatus.Success) {
                    Grab.Remove(popup);
                    popup.Destroy();
                    popup = null;
                }
            } else {
                Grab.Remove(popup);
                popup.Destroy();
                popup = null;
            }

            cal.DaySelectedDoubleClick += OnCalendarDaySelected;
            cal.ButtonPressEvent += OnCalendarButtonPressed;

            cal.Date = date == DateTime.MinValue ? DateTime.Now : date;
        }
Esempio n. 29
0
        public void MoveWindowToWindowPos(Gtk.Window window)
        {
            Point windowPos = GetWindowPos();

            window.Move(windowPos.X, windowPos.Y);
        }
Esempio n. 30
0
		internal void AddTopLevel (DockFrameTopLevel w, int x, int y, int width, int height)
		{
			w.X = x;
			w.Y = y;

			if (UseWindowsForTopLevelFrames) {
				var win = new Gtk.Window (Gtk.WindowType.Toplevel);
				win.SkipTaskbarHint = true;
				win.Decorated = false;
				win.TypeHint = Gdk.WindowTypeHint.Toolbar;
				w.ContainerWindow = win;
				w.Size = new Size (width, height);
				win.Add (w);
				w.Show ();
				var p = this.GetScreenCoordinates (new Gdk.Point (x, y));
				win.Opacity = 0.0;
				win.Move (p.X, p.Y);
				win.Resize (width, height);
				win.Show ();
				Ide.DesktopService.AddChildWindow ((Gtk.Window)Toplevel, win);
				win.AcceptFocus = true;
				win.Opacity = 1.0;

				/* When we use real windows for frames, it's possible for pads to be over other
				 * windows. For some reason simply presenting or raising those dialogs doesn't
				 * seem to work, so we hide/show them in order to force them above the pad. */
				var toplevels = Gtk.Window.ListToplevels ().Where (t => t.IsRealized && t.Visible && t.TypeHint == WindowTypeHint.Dialog); // && t.TransientFor != null);
				foreach (var t in toplevels) {
					t.Hide ();
					t.Show ();
				}

				MonoDevelop.Ide.IdeApp.CommandService.RegisterTopWindow (win);
			} else {
				w.Parent = this;
				w.Size = new Size (width, height);
				Requisition r = w.SizeRequest ();
				w.Allocation = new Gdk.Rectangle (Allocation.X + x, Allocation.Y + y, r.Width, r.Height);
				topLevels.Add (w);
			}
		}
Esempio n. 31
0
 /// <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;
 }
Esempio n. 32
0
        public void MoveWindowToMousePos(Gtk.Window window)
        {
            Point mousePos = GetWindowMousePos();

            window.Move(mousePos.X, mousePos.Y);
        }
Esempio n. 33
0
        public MainWindow()
        {
            ToolItem        spacerItem;
            FileSearchEntry searchEntry;
            ToolItem        searchEntryItem;
            Alignment       searchEntryBox;

            object[] attrs= Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
            AssemblyTitleAttribute attr = (AssemblyTitleAttribute)attrs[0];
            AssemblyName asmName = Assembly.GetExecutingAssembly().GetName();

            string title = String.Format ("{0} (BETA) {1} (Protocol Version: {2})",
                                      attr.Title, asmName.Version,
                                      Core.ProtocolVersion);

            // Create the interface
            window = new Window (title);
            window.SetDefaultSize (850, 550);
            window.DeleteEvent += on_win_delete;
            window.ConfigureEvent += on_MainWindow_configure_event;
            window.FocusInEvent += window_FocusInEvent;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainToolbar"]).Active = Gui.Settings.ShowToolbar;
            Runtime.BuiltinActions["ToggleMainToolbar"].Activated += ToggleMainToolbar_Activated;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainStatusbar"]).Active = Gui.Settings.ShowStatusBar;
            Runtime.BuiltinActions["ToggleMainStatusbar"].Activated += ToggleMainStatusbar_Activated;
            window.AddAccelGroup (Runtime.UIManager.AccelGroup);

            mainVBox = new VBox ();
            window.Add (mainVBox);
            mainVBox.Show ();

            if (Common.OSName == "Darwin") {
                MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/OSXAppMenu");

                Imendio.MacIntegration.Menu.SetMenuBar(menubar);

                MenuItem preferencesItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Preferences");
                MenuItem aboutItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/About");

                IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork");

                group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences");

                MenuItem quitItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Quit");
                Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem);
            } else {
                MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/MainWindowMenuBar");
                mainVBox.PackStart (menubar, false, false, 0);
                menubar.Show ();
            }

            toolbar = (Toolbar) Runtime.UIManager.GetWidget ("/MainWindowToolbar");
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.IconSize = IconSize.LargeToolbar;

            spacerItem = new ToolItem();
            spacerItem.Expand = true;
            toolbar.Insert(spacerItem, -1);
            spacerItem.Show();

            searchEntry = new FileSearchEntry();

            searchEntryBox = new Alignment(0.5f, 0.5f, 0, 0);
            searchEntryBox.LeftPadding = 4;
            searchEntryBox.RightPadding = 1;
            searchEntryBox.Add(searchEntry);

            searchEntryItem = new ToolItem();
            searchEntryItem.Add(searchEntryBox);

            toolbar.Insert(searchEntryItem, -1);
            searchEntryItem.ShowAll();

            mainVBox.PackStart (toolbar, false, false, 0);

            mainPaned = new HPaned();
            mainPaned.Mapped += delegate (object sender, EventArgs args) {
                // XXX: Remember the user's last setting instead
                mainPaned.Position = 190;

                // Set some colors
                //infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2));
                //infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active));
                //infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected));
            };
            mainPaned.Show();
            mainVBox.PackStart (mainPaned, true, true, 0);

            // Create page notebook
            pageNotebook = new Notebook();
            pageNotebook.ShowTabs = false;
            pageNotebook.ShowBorder = false;
            mainPaned.Pack2(pageNotebook, true, true);
            pageNotebook.ShowAll();

            // Create sidebar
            sidebar = new MainSidebar();
            sidebar.ItemAdded += sidebar_ItemAdded;
            sidebar.SelectedItemChanged += sidebar_SelectedItemChanged;
            sidebar.AddBuiltinItems();

            mainPaned.Pack1(sidebar, false, false);
            sidebar.ShowAll();

            CreateStatusbar ();

            // Apply "view" settings
            toolbar.Visible = Gui.Settings.ShowToolbar;
            statusBar.Visible = Gui.Settings.ShowStatusBar;

            // Hook up Core events
            Core.ShareBuilder.StartedIndexing  += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing));
            Core.ShareBuilder.FinishedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing));
            Core.ShareBuilder.StoppedIndexing  += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing));
            Core.ShareBuilder.ErrorIndexing    += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing));
            Core.ShareHasher.StartedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Core.ShareHasher.QueueChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged));

            Core.FileSearchManager.SearchAdded   += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded));
            Core.FileSearchManager.SearchRemoved += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchRemoved));

            window.Resize (Gui.Settings.WindowSize.Width, Gui.Settings.WindowSize.Height);
            window.Move (Gui.Settings.WindowPosition.X, Gui.Settings.WindowPosition.Y);

            SelectedPage = NetworkOverviewPage.Instance;
        }
Esempio n. 34
0
File: mopen.cs Progetto: dfr0/moon
	static int LoadXap (string file, List<string> args)
	{
		string [] test = { "" };

		if (sync)
			test [0] = "--sync";

		Application.Init ("mopen", ref test);
		MoonlightRuntime.Init ();
		window = new Gtk.Window (file);
		window.SetDefaultSize (400, 400);

		if (transparent) {
			CompositeHelper.SetRgbaColormap (window);
			window.AppPaintable = true;
			window.ExposeEvent += HandleExposeEvent;
		}    	

		if (desklet) {
			ConfigureDeskletWindow (window);
		}

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

		moon_host = new MoonlightHost ();

		try {
			moon_host.LoadXap (file);
		} catch (Exception e) {
			Console.Error.WriteLine ("mopen: Could not load xaml: {0}", e.Message);
			return 1;
		}

		System.Windows.Application app = moon_host.Application;
		FrameworkElement top = (FrameworkElement)app.RootVisual;

		if (top is Moon.Windows.Desktop.Window) {
			var moonwindow = ((Moon.Windows.Desktop.Window)top);
			/* special window handling mode */
			moonwindow.IsActive = window.IsActive;

			Wnck.Screen.Default.ActiveWindowChanged += delegate {
				moonwindow.IsActive = window.IsActive;
			};

			moonwindow.PositionChanged += delegate {
				window.Move ((int)moonwindow.Position.X, (int)moonwindow.Position.Y);
			};

			moonwindow.SizeChanged += delegate {
				window.Resize ((int)moonwindow.Size.Width, (int)moonwindow.Size.Height);
			};

			moonwindow.WindowOpacityChanged += delegate {
				moon_host.QueueDraw ();
			};

			if (!transparent) {
				CompositeHelper.SetRgbaColormap (window);
				window.AppPaintable = true;
				window.ExposeEvent += HandleExposeEvent;

				moon_host.AppPaintable = true;
				moon_host.Transparent = true;
			}
		}

		if (parse_only)
			return 0;

		if (width == -1)
			width = (int) top.Width;
		if (height == -1)
			height = (int) top.Height;

		if (width > 0 && height > 0) {
			moon_host.SetSizeRequest (width, height);
			window.Resize (width, height);
		} 

		if (transparent){
			moon_host.AppPaintable = true;
			moon_host.Transparent = true;
		}

		if (desklet) {
			top.MouseLeftButtonDown += new MouseButtonEventHandler (HandleMouseLeftButtonDown);
			top.MouseLeftButtonUp += new MouseButtonEventHandler (HandleMouseLeftButtonUp);
			top.MouseMove += new MouseEventHandler (HandleMouseMove);
		}

		window.Add (moon_host);

		window.ShowAll ();

		if (story_names != null){
			storyboards = new List<Storyboard> ();
			
			foreach (string story in story_names){
				object o = top.FindName (story);
				Storyboard sb = o as Storyboard;

				if (sb == null){
					Console.Error.WriteLine ("mopen: there is no Storyboard object named {0} in the XAML file", story);
					return 1;
				}
				sb.Completed += delegate {
					window.Title = String.Format ("Storyboard {0} completed", current_storyboard-1);
				};
				
				storyboards.Add (sb);
			};

			top.MouseLeftButtonUp += delegate {
				if (current_storyboard == storyboards.Count)
					current_storyboard = 0;
				if (current_storyboard == storyboards.Count)
					return;
				
				window.Title = String.Format ("Storyboard {0} running", current_storyboard);
				storyboards [current_storyboard++].Begin ();
			};
		}

		if (timeout > 0)
			GLib.Timeout.Add ((uint)(timeout * 1000), new TimeoutHandler (Quit));

		Application.Run ();
		return 0;
	}
Esempio n. 35
0
        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.Move(10, 60);
            window.Resize(230, 700);
            window.Title = "Toolbar";
            window.Deletable = false;
            window.ModifyBg(StateType.Normal, new Gdk.Color(182, 195, 205));

            Fixed fix = new Fixed();

            openButton = new Button();
            openButton.Label = "Open Images";
            openButton.SetSizeRequest(100, 30);
            openButton.TooltipText = "Shortcut: " + keymap["open images"].ToString();
            openButton.Name = "open images";
            openButton.Clicked += OperatorButtonClicked;

            saveButton = new Button();
            saveButton.Label = "Save Collage";
            saveButton.SetSizeRequest(100, 30);
            saveButton.TooltipText = "Shortcut: " + keymap["save collage"].ToString();
            saveButton.Name = "save collage";
            saveButton.Clicked += OperatorButtonClicked;

            deleteButton = new Button();
            deleteButton.Label = "Delete";
            deleteButton.SetSizeRequest(100, 30);
            deleteButton.TooltipText = "Shortcut: " + keymap["delete images"].ToString();
            deleteButton.Name = "delete images";
            deleteButton.Clicked += OperatorButtonClicked;

            changeAspectRatioButton = new Button();
            changeAspectRatioButton.Label = "Aspect Ratio";
            changeAspectRatioButton.SetSizeRequest(100, 30);
            changeAspectRatioButton.TooltipText = "Shortcut: " + keymap["change aspect ratio"].ToString();
            changeAspectRatioButton.Name = "change aspect ratio";
            changeAspectRatioButton.Clicked += OperatorButtonClicked;

            autoPositionButton = new Button();
            autoPositionButton.Label = "Auto Position";
            autoPositionButton.SetSizeRequest(100, 30);
            autoPositionButton.TooltipText = "Shortcut: " + keymap["auto position"].ToString();
            autoPositionButton.Name = "auto position";
            autoPositionButton.Clicked += OperatorButtonClicked;

            changeBackgroundColorButton = new Button();
            changeBackgroundColorButton.Label = "Background";
            changeBackgroundColorButton.SetSizeRequest(100, 30);
            changeBackgroundColorButton.TooltipText = "Shortcut: " + keymap["change background color"].ToString();
            changeBackgroundColorButton.Name = "change background color";
            changeBackgroundColorButton.Clicked += OperatorButtonClicked;

            setBackwardButton = new Button();
            setBackwardButton.Label = "Set Backward";
            setBackwardButton.SetSizeRequest(100, 30);
            setBackwardButton.TooltipText = "Shortcut: " + keymap["set backward"].ToString();
            setBackwardButton.Name = "set backward";
            setBackwardButton.Clicked += OperatorButtonClicked;

            setForwardButton = new Button();
            setForwardButton.Label = "Set Forward";
            setForwardButton.SetSizeRequest(100, 30);
            setForwardButton.TooltipText = "Shortcut: " + keymap["set forward"].ToString();
            setForwardButton.Name = "set forward";
            setForwardButton.Clicked += OperatorButtonClicked;

            setAsBackgroundButton = new Button();
            setAsBackgroundButton.Label = "Set Background";
            setAsBackgroundButton.SetSizeRequest(100, 30);
            setAsBackgroundButton.TooltipText = "Shortcut: " + keymap["set as background"].ToString();
            setAsBackgroundButton.Name = "set as background";
            setAsBackgroundButton.Clicked += OperatorButtonClicked;

            setToFrontButton = new Button();
            setToFrontButton.Label = "Set to Front";
            setToFrontButton.SetSizeRequest(100, 30);
            setToFrontButton.TooltipText = "Shortcut: " + keymap["set to front"].ToString();
            setToFrontButton.Name = "set to front";
            setToFrontButton.Clicked += OperatorButtonClicked;

            clearButton = new Button();
            clearButton.Label = "Clear Collage";
            clearButton.SetSizeRequest(100, 30);
            clearButton.TooltipText = "Shortcut: " + keymap["clear collage"].ToString();
            clearButton.Name = "clear collage";
            clearButton.Clicked += OperatorButtonClicked;

            selectAllButton = new Button();
            selectAllButton.Label = "Select All";
            selectAllButton.SetSizeRequest(100, 30);
            selectAllButton.TooltipText = "Shortcut: " + keymap["select all"].ToString();
            selectAllButton.Name = "select all";
            selectAllButton.Clicked += OperatorButtonClicked;

            undoButton = new Button();
            undoButton.Label = "Undo";
            undoButton.SetSizeRequest(100, 30);
            undoButton.TooltipText = "Shortcut: " + keymap["undo"].ToString();
            undoButton.Name = "undo";
            undoButton.Clicked += OperatorButtonClicked;

            redoButton = new Button();
            redoButton.Label = "Redo";
            redoButton.SetSizeRequest(100, 30);
            redoButton.TooltipText = "Shortcut: " + keymap["redo"].ToString();
            redoButton.Name = "redo";
            redoButton.Clicked += OperatorButtonClicked;

            stayOnTopCheckbutton = new CheckButton();
            stayOnTopCheckbutton.Label = "Stay on Top";
            stayOnTopCheckbutton.Toggled += StayOnTopToogled;

            // place objects in window
            fix.Put(openButton, 10, 20); fix.Put(saveButton, 120, 20);
            fix.Put(deleteButton, 10, 55); fix.Put(changeAspectRatioButton, 120, 55);
            fix.Put(autoPositionButton, 10, 90); fix.Put(changeBackgroundColorButton, 120, 90);

            fix.Put(setBackwardButton, 10, 140); fix.Put(setForwardButton, 120, 140);
            fix.Put(setAsBackgroundButton, 10, 175); fix.Put(setToFrontButton, 120, 175);
            fix.Put(clearButton, 10, 210); fix.Put(selectAllButton, 120, 210);

            fix.Put(undoButton, 10, 260); fix.Put(redoButton, 120, 260);

            fix.Put(stayOnTopCheckbutton, 10, 300);

            window.Add(fix);
            window.ShowAll();
        }
Esempio n. 36
0
    public GnomeArtNgApp(string[] args)
    {
        Application.Init();
        //i18n
        Catalog.Init("gnomeartng","./locale");
        config=new CConfiguration();
        //initialize Glade
        string mainW = "MainWindow";
        Glade.XML gxml = new Glade.XML (null, "gui.glade", mainW, null);
        mainWindow = (Gtk.Window) gxml.GetWidget (mainW);
        gxml.Autoconnect (this);

        //Connect all events
        mainWindow.DeleteEvent+=new DeleteEventHandler(OnWindowDeleteEvent);
        ExtInfoPreviewButton.Clicked += new EventHandler(OnPreviewButtonClicked);
        InstallButton.Clicked  += new EventHandler(OnInstallButtonClicked);
        RevertButton.Clicked  += new EventHandler(OnRevertButtonClicked);
        RefreshButton.Clicked += new EventHandler(OnRefreshButtonClicked);
        SaveButton.Clicked  += new EventHandler(OnSaveButtonClicked);
        MainNotebook.SwitchPage += new SwitchPageHandler(OnSwitchPage);
        FilterEntry.Changed += new EventHandler(OnFilterEntriesChanged);
        //		SortKindCb.Changed += new EventHandler(OnSortKindEntryChanged);
        //		SortDirectionCb.Changed += new EventHandler(OnSortDirectionEntryChanged);
        //		SortCloseButton.Clicked += new EventHandler(OnSortCloseClicked);
        FilterEntry.KeyReleaseEvent += new KeyReleaseEventHandler(OnFilterbarKeyReleased);
        FilterCloseButton.Clicked += new EventHandler(OnFilterbarCloseClicked);

        //Menuitems
        QuitMenuItem.Activated += new EventHandler(OnQuitItemSelected);
        UpdateMenuItem.Activated += new EventHandler(OnUpdateItemSelected);
        DonateMenuItem.Activated += new EventHandler(CUpdateWindow.onDonateButtonClicked);
        FilterMenuItem.Activated += new EventHandler(OnFilterItemSelected);
        //		SortMenuItem.Activated += new EventHandler(OnSortItemSelected);
        InfoMenuItem.Activated += new EventHandler(OnInfoItemSelected);
        PreferencesMenuItem.Activated += new EventHandler(OnPreferencesItemSelected);
        FTAItem.Activated += new EventHandler(onFtaItemSelected);

        //First, download all thumbs...but don't bother the user with the update message, even if there is one
        bool RestartApp= false;
        if (config.NeverStartedBefore)
            new CFirstTimeAssistant(config);
        else if (config.DontBotherForUpdates==false) {
            if (config.UpdateAvailable) {
                Console.WriteLine("An update is available, newest version is: "+config.NewestVersionNumberOnServer);
                RestartApp = ShowUpdateWindow();
            }
        }

        if (!RestartApp) {
            //Application placement - doesn't work properly with compiz (is it the window placement plugin?)
            if (config.SettingsLoadOk) {
                mainWindow.Resize(config.Window.Width, config.Window.Height);
                mainWindow.Move(config.Window.X, config.Window.Y);
                //Console.WriteLine(config.Window.X+" "+ config.Window.Y);
            }

            //ArtManager erzeugen
            man = new CArtManager(config);

            //Stores anlegen und IconViews anlegen
            for(int i=0;i<ListStoreCount;i++){
                sWins[i] = (Gtk.ScrolledWindow)(gxml.GetWidget("swin"+i));
                stores[i]= new ListStore (typeof(Pixbuf),typeof (string), typeof (string), typeof(int));
                IconViews[i] = new Gtk.IconView(stores[i]);
                IconViews[i].SelectionChanged += new System.EventHandler(OnSelChanged);
                IconViews[i].ItemActivated += new ItemActivatedHandler(OnItemActivated);
                IconViews[i].PixbufColumn = 0;
                CurrentIconView = IconViews[0];

                sWins[i].Add(IconViews[i]);
                IconViews[i].Show();
            }

            //Create the comboboxes
            imageTypeBox = ComboBox.NewText();
            imageResolutionsBox = ComboBox.NewText();
            imageStyleBox = ComboBox.NewText();

            //Verschiedene Styles hinzufügen
            imageStyleBox.AppendText(Catalog.GetString("Centered"));
            imageStyleBox.AppendText(Catalog.GetString("Filled"));
            imageStyleBox.AppendText(Catalog.GetString("Scaled"));
            imageStyleBox.AppendText(Catalog.GetString("Zoomed"));
            imageStyleBox.AppendText(Catalog.GetString("Tiled"));
            imageStyleBox.Active=0;
            imageStyleBox.Changed += new EventHandler(OnImageStyleBoxChanged);

            LowerTable.Attach(imageTypeBox,1,2,2,3);
            LowerTable.Attach(imageResolutionsBox,1,2,3,4);
            LowerTable.Attach(imageStyleBox,1,2,4,5);

            OnSwitchPage(MainNotebook,new SwitchPageArgs());
            Gtk.Application.Run ();

        }
    }
Esempio n. 37
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; 
		}
Esempio n. 38
0
		/// <summary>Centers a window relative to its parent.</summary>
		static void CenterWindow (Window child, Window parent)
		{
			child.Child.Show ();
			int w, h, winw, winh, x, y, winx, winy;
			child.GetSize (out w, out h);
			parent.GetSize (out winw, out winh);
			parent.GetPosition (out winx, out winy);
			x = Math.Max (0, (winw - w) /2) + winx;
			y = Math.Max (0, (winh - h) /2) + winy;
			child.Move (x, y);
		}
Esempio n. 39
0
		internal void AddTopLevel (DockFrameTopLevel w, int x, int y, int width, int height)
		{
			w.X = x;
			w.Y = y;

			if (UseWindowsForTopLevelFrames) {
				var win = new Gtk.Window (Gtk.WindowType.Toplevel);
				win.AcceptFocus = false;
				win.SkipTaskbarHint = true;
				win.Decorated = false;
				win.TypeHint = Gdk.WindowTypeHint.Toolbar;
				w.ContainerWindow = win;
				w.Size = new Size (width, height);
				win.Add (w);
				w.Show ();
				var p = this.GetScreenCoordinates (new Gdk.Point (x, y));
				win.Opacity = 0.0;
				win.Move (p.X, p.Y);
				win.Resize (width, height);
				win.Show ();
				Ide.DesktopService.AddChildWindow ((Gtk.Window)Toplevel, win);
				win.AcceptFocus = true;
				win.Opacity = 1.0;
			} else {
				w.Parent = this;
				w.Size = new Size (width, height);
				Requisition r = w.SizeRequest ();
				w.Allocation = new Gdk.Rectangle (Allocation.X + x, Allocation.Y + y, r.Width, r.Height);
				topLevels.Add (w);
			}
		}
Esempio n. 40
0
 // Pinta TODO: This may need to be overridden for Mac?
 private void PlaceWindow(Gtk.Window window, int x, int y, int width, int height)
 {
     window.Move(x, y);
     window.Resize(width, height);
 }
Esempio n. 41
0
 void MovePatternWindow()
 {
     patternWindow.Move(Pattern.Left, Pattern.Top);
 }