void HandleComparisonWidgetSizeAllocated (object o, Gtk.SizeAllocatedArgs args)
		{
			ComparisonWidget.SizeAllocated -= HandleComparisonWidgetSizeAllocated;
			var sourceEditorView = info.Document.GetContent<MonoDevelop.SourceEditor.SourceEditorView> ();
			if (sourceEditorView != null) {
				int line = GetLineInCenter (sourceEditorView.TextEditor);
				ComparisonWidget.OriginalEditor.CenterTo (line, 1);
				ComparisonWidget.OriginalEditor.GrabFocus ();
			}
		}
Beispiel #2
0
		void HandleComparisonWidgetSizeAllocated (object o, Gtk.SizeAllocatedArgs args)
		{
			ComparisonWidget.SizeAllocated -= HandleComparisonWidgetSizeAllocated;
			var textView = info.Controller.GetContent<ITextView> ();
			if (textView != null) {
				int firstLineNumber = textView.TextViewLines.FirstVisibleLine.Start.GetContainingLine ().LineNumber;
				ComparisonWidget.OriginalEditor.VAdjustment.Value = ComparisonWidget.OriginalEditor.LineToY (firstLineNumber + 1);
				ComparisonWidget.OriginalEditor.GrabFocus ();
			}
		}
Beispiel #3
0
 void HandleWidgetBoundsChanged(object o, Gtk.SizeAllocatedArgs args)
 {
     if (Widget.Allocation != lastAllocation)
     {
         lastAllocation = Widget.Allocation;
         ApplicationContext.InvokeUserCode(delegate {
             EventSink.OnBoundsChanged();
         });
     }
 }
 void HandleSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     Gtk.Window wndMax = (Gtk.Window)o;
     if (args.Allocation.Width == 200)
     {
         if (RestrictionLibrary.CurrentOS.IsMac)
         {
             wndMax.Maximize();
         }
     }
 }
Beispiel #5
0
            public void HandleWindowSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
            {
                var handler = Handler;
                var newSize = handler.Size;

                if (handler.Control.IsRealized && oldSize != newSize)
                {
                    Handler.Callback.OnSizeChanged(Handler.Widget, EventArgs.Empty);
                    oldSize = newSize;
                }
            }
Beispiel #6
0
        void HandleLabelDynamicSizeAllocate(object o, Gtk.SizeAllocatedArgs args)
        {
            int unused, oldHeight = wrapHeight;

            Label.Layout.Width = Pango.Units.FromPixels(args.Allocation.Width);
            Label.Layout.GetPixelSize(out unused, out wrapHeight);
            if (wrapWidth != args.Allocation.Width || oldHeight != wrapHeight)
            {
                wrapWidth = args.Allocation.Width;
                Label.QueueResize();
            }
        }
Beispiel #7
0
        private void HandleSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
        {
            var message  = o as Gtk.Label;
            var newWidth = args.Allocation.Size.Width;

            if (newWidth != _messageAreaWidth)
            {
                // Totally arbitrary fudge. Without it, you can't make the window narrower.
                message.SetSizeRequest(newWidth - 8, -1);
            }
            _messageAreaWidth = newWidth;
        }
Beispiel #8
0
        private void Tab_SizeAllocated(object o, Gtk.SizeAllocatedArgs args)
        {
            var imagewidth = (gtkimage != null) ? gtkimage.Allocation.Width : 0;
            var closewidth = (closeButton.Visible) ? closeButton.Allocation.Width : 0;
            var width      = (float)label.Allocation.Width / (label.Allocation.Width - Math.Abs(closewidth - imagewidth));

            if (imagewidth >= closewidth)
            {
                label.SetAlignment(1 - width / 2, 0.5f);
            }
            else
            {
                label.SetAlignment(width / 2, 0.5f);
            }
        }
Beispiel #9
0
        /// <summary>Handler called when the window is resized.</summary>
        /// <remarks>Sets the new size in GConf if keys are present.</remarks>
        private void OnSizeAllocated
            (object o, Gtk.SizeAllocatedArgs args)
        {
            if (!HasGConfSize())
            {
                return;
            }

            int width, height;

            window.GetSize(out width, out height);

            Config.Set(gconf_key_width, width);
            Config.Set(gconf_key_height, height);
        }
Beispiel #10
0
            public void HandleWindowSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
            {
                var handler = Handler;
                var newSize = handler.Size;

                if (handler.Control.IsRealized && oldSize != newSize)
                {
                    handler.Callback.OnSizeChanged(Handler.Widget, EventArgs.Empty);
                    if (handler.WindowState == WindowState.Normal)
                    {
                        handler.restoreBounds = handler.Widget.Bounds;
                    }
                    oldSize = newSize;
                }
            }
Beispiel #11
0
        private void HandleTabSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
        {
            var imagewidth = (gtkimage != null) ? gtkimage.Allocation.Width : 0;
            var closewidth = (closeButton.Visible) ? closeButton.Allocation.Width : 0;
            var width      = (float)label.Allocation.Width / (label.Allocation.Width - Math.Abs(closewidth - imagewidth));

            label.Yalign = 0.5f;
            if (imagewidth >= closewidth)
            {
                label.Xalign = 1 - width / 2;
            }
            else
            {
                label.Xalign = width / 2;
            }
        }
Beispiel #12
0
        private void OnSizeAllocated(object o, Gtk.SizeAllocatedArgs e)
        {
            width  = (uint)e.Allocation.Width;
            height = (uint)e.Allocation.Height;


            if (!inresizemode && output.Pixbuf != null)
            {
                if (output.Pixbuf.Width != _width || output.Pixbuf.Height != _height)
                {
                    inresizemode  = true;
                    output.Pixbuf = output.Pixbuf.ScaleSimple((int)_width, (int)_height, InterpType.Bilinear);
                    inresizemode  = false;
                }
            }
        }
        void MoveHelpWindow(object o, Gtk.SizeAllocatedArgs args)
        {
            if (editor == null || HelpWindow == null)
            {
                return;
            }
            int ox, oy;

            editor.GdkWindow.GetOrigin(out ox, out oy);

            Gdk.Rectangle geometry = editor.Screen.GetMonitorGeometry(editor.Screen.GetMonitorAtPoint(ox, oy));
            var           req      = HelpWindow.SizeRequest();

            int x = System.Math.Min(ox + editor.Allocation.Width - req.Width / 2, geometry.Width - req.Width);
            int y = System.Math.Min(oy + editor.Allocation.Height - req.Height / 2, geometry.Height - req.Height);

            HelpWindow.Move(x, y);
        }
Beispiel #14
0
            public void HandleButtonSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
            {
                var handler = Handler;

                if (handler != null)
                {
                    var c    = (Gtk.Button)o;
                    var size = args.Allocation;
                    if (size.Width > 1 || size.Height > 1)
                    {
                        size.Width = Math.Max(size.Width, MinimumWidth);
                        if (args.Allocation != size)
                        {
                            c.SetSizeRequest(size.Width, size.Height);
                        }
                    }
                }
            }
Beispiel #15
0
 void HandleSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     if (parent.Child1 != null && parent.Child1.Visible && parent.Child2 != null && parent.Child2.Visible)
     {
         Show();
         int centerSize = Child == null ? GrabAreaSize / 2 : 0;
         if (horizontal)
         {
             SizeAllocate(new Gdk.Rectangle(parent.Child1.Allocation.X + parent.Child1.Allocation.Width - centerSize, args.Allocation.Y, GrabAreaSize, args.Allocation.Height));
         }
         else
         {
             SizeAllocate(new Gdk.Rectangle(args.Allocation.X, parent.Child1.Allocation.Y + parent.Child1.Allocation.Height - centerSize, args.Allocation.Width, GrabAreaSize));
         }
     }
     else
     {
         Hide();
     }
 }
Beispiel #16
0
            public void HandleButtonSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
            {
                var handler = Handler;

                if (handler != null)
                {
                    var size = args.Allocation;
                    //if (handler.PreferredSize.Width == -1 && (size.Width > 1 || size.Height > 1))
                    {
                        var minSize = handler.MinimumSize;
                        size.Width  = Math.Max(size.Width, minSize.Width);
                        size.Height = Math.Max(size.Height, minSize.Height);
                        if (args.Allocation != size)
                        {
                            var c = (Gtk.Button)o;
                            c.SetSizeRequest(size.Width, size.Height);
                        }
                    }
                }
            }
Beispiel #17
0
 protected override void OnParentSizeAllocated(Gtk.SizeAllocatedArgs args)
 {
     if (ParentPaned.Child1 != null && ParentPaned.Child1.Visible && ParentPaned.Child2 != null && ParentPaned.Child2.Visible)
     {
         Show();
         int centerSize = Child == null ? GrabAreaSize / 2 : 0;
         if (horizontal)
         {
             SizeAllocate(new Gdk.Rectangle(ParentPaned.Child1.Allocation.X + ParentPaned.Child1.Allocation.Width - centerSize, args.Allocation.Y, GrabAreaSize, args.Allocation.Height));
         }
         else
         {
             SizeAllocate(new Gdk.Rectangle(args.Allocation.X, ParentPaned.Child1.Allocation.Y + ParentPaned.Child1.Allocation.Height - centerSize, args.Allocation.Width, GrabAreaSize));
         }
     }
     else
     {
         Hide();
     }
     base.OnParentSizeAllocated(args);
 }
Beispiel #18
0
        void HandleWidgetSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
        {
            if ((enabledEvents & sizeCheckEvents) == 0)
            {
                // If no sizing event is set, it means this handler was set because there is a min size.
                // In that case, there isn't any thing left to do here
                return;
            }

            Toolkit.Invoke(delegate {
                if (sizeCheckStep == SizeCheckStep.SizeRequest)
                {
                    Console.WriteLine("SizeRequest not called. Should not happen");
                }
                else if (sizeCheckStep == SizeCheckStep.PreAllocate || sizeCheckStep == SizeCheckStep.AdjustSize)
                {
                    if (EventSink.GetSizeRequestMode() == SizeRequestMode.HeightForWidth)
                    {
                        realRequestedWidth = args.Allocation.Width;
                        Toolkit.Invoke(delegate {
                            realRequestedHeight = (int)eventSink.OnGetPreferredHeightForWidth(args.Allocation.Width).MinSize;
                        });
                        sizeCheckStep = SizeCheckStep.AdjustSize;
                        Widget.QueueResize();
                    }
                    else
                    {
                        realRequestedHeight = args.Allocation.Height;
                        Toolkit.Invoke(delegate {
                            realRequestedWidth = (int)eventSink.OnGetPreferredWidthForHeight(args.Allocation.Height).MinSize;
                        });
                        sizeCheckStep = SizeCheckStep.AdjustSize;
                        Widget.QueueResize();
                    }
                }
            });
        }
Beispiel #19
0
        void HandleWidgetSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
        {
            if ((enabledEvents & sizeCheckEvents) == 0)
            {
                // If no sizing event is set, it means this handler was set because there is a min size.
                // In that case, there isn't any thing left to do here
                return;
            }

            Toolkit.Invoke(delegate {
                if (sizeCheckStep == SizeCheckStep.SizeRequest && (enabledEvents & sizeCheckEvents) != sizeCheckEvents)
                {
                    var ev = EventSink.GetSizeRequestMode() == SizeRequestMode.HeightForWidth ? WidgetEvent.PreferredWidthCheck | WidgetEvent.PreferredHeightForWidthCheck : WidgetEvent.PreferredHeightCheck | WidgetEvent.PreferredWidthForHeightCheck;
                    // If all size request methods are overriden, the widget's size request won't be called, so this status is correct
                    if ((enabledEvents & ev) != ev)
                    {
                        Console.WriteLine("SizeRequest not called. Should not happen.");
                    }
                }
                else if (sizeCheckStep == SizeCheckStep.PreAllocate || sizeCheckStep == SizeCheckStep.AdjustSize)
                {
                    if (EventSink.GetSizeRequestMode() == SizeRequestMode.HeightForWidth)
                    {
                        realRequestedHeight = (int)eventSink.OnGetPreferredHeightForWidth(args.Allocation.Width).MinSize;
                        sizeCheckStep       = SizeCheckStep.AdjustSize;
                        Widget.QueueResize();
                    }
                    else
                    {
                        realRequestedWidth = (int)eventSink.OnGetPreferredWidthForHeight(args.Allocation.Height).MinSize;
                        sizeCheckStep      = SizeCheckStep.AdjustSize;
                        Widget.QueueResize();
                    }
                }
            });
        }
Beispiel #20
0
 private void OnSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     UpdateVisibleRegion();
 }
Beispiel #21
0
 protected void OnChatviewSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     chatview.ScrollToIter(chatview.Buffer.EndIter, 0, false, 0, 0);
 }
 void HandleEditorSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     SetHelpWindowPosition();
 }
 void MoveHelpWindow(object o, Gtk.SizeAllocatedArgs args)
 {
     PositionHelpWindow();
 }
Beispiel #24
0
 void HandleSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     OnParentSizeAllocated(args);
 }
Beispiel #25
0
 protected virtual void OnParentSizeAllocated(Gtk.SizeAllocatedArgs args)
 {
 }
Beispiel #26
0
 void HandleWidgetBoundsChanged(object o, Gtk.SizeAllocatedArgs args)
 {
     Toolkit.Invoke(delegate {
         EventSink.OnBoundsChanged();
     });
 }
Beispiel #27
0
 void HandleWidgetSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     Toolkit.Invoke(delegate {
         EventSink.OnBoundsChanged(new Rectangle(args.Allocation.X, args.Allocation.Y, args.Allocation.Width, args.Allocation.Height));
     });
 }
Beispiel #28
0
 void HandleWidgetSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     EventSink.OnBoundsChanged();
 }
Beispiel #29
0
 void HandleSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     Widget.Child.SizeAllocate(args.Allocation);
     args.RetVal = true;
 }
Beispiel #30
0
 void box_SizeAllocated(object obj, Gtk.SizeAllocatedArgs args)
 {
     Sync();
 }