예제 #1
0
 protected override bool OnExposeEvent(Gdk.EventExpose ev)
 {
     base.OnExposeEvent(ev);
     Gtk.Requisition req = SizeRequest();
     Gtk.Style.PaintFlatBox(this.Style, this.GdkWindow, Gtk.StateType.Normal, Gtk.ShadowType.Out, Gdk.Rectangle.Zero, this, "tooltip", 0, 0, req.Width, req.Height);
     return(true);
 }
예제 #2
0
		public PopoverWindow (Gtk.WindowType type) : base(type)
		{
			SkipTaskbarHint = true;
			SkipPagerHint = true;
			AppPaintable = true;
			TypeHint = WindowTypeHint.Tooltip;
			CheckScreenColormap ();

			alignment = new Alignment (0, 0, 1f, 1f);
			alignment.Show ();
			Add (alignment);

			disableSizeCheck = false;

			SizeRequested += (object o, SizeRequestedArgs args) => {
				if (this.AnimationIsRunning("Resize") && !disableSizeCheck) {
					Gtk.Requisition result = new Gtk.Requisition ();
					result.Width  = Math.Max (args.Requisition.Width, Math.Max (Allocation.Width, targetSize.Width));
					result.Height = Math.Max (args.Requisition.Height, Math.Max (Allocation.Height, targetSize.Height));
					args.Requisition = result;
				}
			};

			UpdatePadding ();
		}
예제 #3
0
        private void PositionPopup()
        {
            int x, y;

            Gtk.Requisition event_box_req = event_box.SizeRequest();
            Gtk.Requisition popup_req     = popup.SizeRequest();

            PositionWidget(popup, out x, out y, 5);

            int monitor      = event_box.Screen.GetMonitorAtPoint(x, y);
            var monitor_rect = event_box.Screen.GetMonitorGeometry(monitor);

            x = x - (popup_req.Width / 2) + (event_box_req.Width / 2);

            if (x + popup_req.Width >= monitor_rect.Right - 5)
            {
                x = monitor_rect.Right - popup_req.Width - 5;
            }
            else if (x < monitor_rect.Left + 5)
            {
                x = monitor_rect.Left + 5;
            }

            popup.Move(x, y);
        }
예제 #4
0
        /// <summary>
        /// Shows the tracker.
        /// </summary>
        /// <param name="data">The data.</param>
        public void ShowTracker(TrackerHitResult data)
        {
            if (this.trackerLabel == null)
            {
                // Holding the tracker label inside an EventBox allows
                // us to set the background color
                Gtk.EventBox labelHolder = new Gtk.EventBox();
                this.trackerLabel = new Gtk.Label();
                this.trackerLabel.SetPadding(3, 3);
                OxyColor bgColor = OxyColors.LightSkyBlue;
                labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
                labelHolder.Add(this.trackerLabel);
                this.Add(labelHolder);
                labelHolder.ShowAll();
            }
            this.trackerLabel.Parent.Visible = true;
            this.trackerLabel.Text           = data.ToString();
            Gtk.Requisition req  = this.trackerLabel.Parent.SizeRequest();
            int             xPos = (int)data.Position.X - req.Width / 2;
            int             yPos = (int)data.Position.Y - req.Height;

            xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
            yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
            this.Move(trackerLabel.Parent, xPos, yPos);
        }
예제 #5
0
        protected override void OnSizeRequested(ref Gtk.Requisition requisition)
        {
            // GUI designer automatically puts this widget into Viewport when property "Show Scrollbars" is set
            // necessary for automatic scroll support.
            // Need additional access in here to improve positioning when zooming.
            // cannot be initialized in constructor
            if (viewport == null)
            {
                viewport = (Gtk.Viewport) this.Parent;


                viewport.AddEvents((int)Gdk.EventMask.ScrollMask);
                // not called when scrollbar is being moved
                //viewport.ScrollAdjustmentsSet += Viewport_ScrollAdjustmentsSet;
                viewport.ScrollEvent += Viewport_ScrollEvent;
                ;
            }
            //var vr = viewport.Allocation;
            //Console.WriteLine ("Viewport size request Width={0} Height={1}", vr.Width, vr.Height);

            // Calculate desired size here.
            requisition.Width  = minWidth;
            requisition.Height = minHeight;
            //Console.WriteLine ("OnSizeRequested -> Requisition: {0}x{1}", requisition.Width, requisition.Height);
        }
예제 #6
0
        private void PositionMenu(Menu menu, out int x, out int y, out bool push_in)
        {
            Gtk.Requisition menu_req    = menu.SizeRequest();
            int             monitor_num = Screen.GetMonitorAtWindow(GdkWindow);

            Gdk.Rectangle monitor = Screen.GetMonitorGeometry(monitor_num < 0 ? 0 : monitor_num);

            GdkWindow.GetOrigin(out x, out y);

            y += Allocation.Y;
            x += Allocation.X + (Direction == TextDirection.Ltr
                ? Math.Max(Allocation.Width - menu_req.Width, 0)
                : -(menu_req.Width - Allocation.Width));

            if (y + Allocation.Height + menu_req.Height <= monitor.Y + monitor.Height)
            {
                y += Allocation.Height;
            }
            else if (y - menu_req.Height >= monitor.Y)
            {
                y -= menu_req.Height;
            }
            else if (monitor.Y + monitor.Height - (y + Allocation.Height) > y)
            {
                y += Allocation.Height;
            }
            else
            {
                y -= menu_req.Height;
            }

            push_in = false;
        }
        public PopoverWindow(Gtk.WindowType type) : base(type)
        {
            SkipTaskbarHint = true;
            SkipPagerHint   = true;
            AppPaintable    = true;
            TypeHint        = WindowTypeHint.Tooltip;
            CheckScreenColormap();

            alignment = new Alignment(0, 0, 1f, 1f);
            alignment.Show();
            Add(alignment);

            disableSizeCheck = false;

            SizeRequested += (object o, SizeRequestedArgs args) => {
                if (this.AnimationIsRunning("Resize") && !disableSizeCheck)
                {
                    Gtk.Requisition result = new Gtk.Requisition();
                    result.Width     = Math.Max(args.Requisition.Width, Math.Max(Allocation.Width, targetSize.Width));
                    result.Height    = Math.Max(args.Requisition.Height, Math.Max(Allocation.Height, targetSize.Height));
                    args.Requisition = result;
                }
            };

            UpdatePadding();
        }
예제 #8
0
        protected override void OnSizeRequested(ref Requisition requisition)
        {
            base.OnSizeRequested(ref requisition);

            if (widths == null || widths.Length != buttons.Count)
            {
                widths = new int[buttons.Count];
            }

            requisition.Height = requisition.Width = 0;
            int i = 0;

            foreach (BaseButton b in buttons)
            {
                Gtk.Requisition req = b.SizeRequest();
                if (requisition.Height < req.Height)
                {
                    requisition.Height = req.Height;
                }
                requisition.Width += req.Width;
                widths[i++]        = req.Width;
            }
            if (HeightRequest != -1)
            {
                requisition.Height = HeightRequest;
            }
            if (WidthRequest != -1)
            {
                requisition.Width = WidthRequest;
            }
        }
예제 #9
0
        protected override void OnSizeRequested(ref Requisition req)
        {
            req = child.SizeRequest();
            // Make some room for the border
            req.Width  += padding * 2 + selectionBorder * 2;
            req.Height += padding * 2 + selectionBorder * 2;
            selectionBox.SizeRequest();
            if (selectionBox.Allocation.Width > req.Width)
            {
                req.Width = selectionBox.Allocation.Width;
            }
            if (selectionBox.Allocation.Height > req.Height)
            {
                req.Height = selectionBox.Allocation.Height;
            }

            foreach (TopLevelChild tchild in topLevels)
            {
                Gtk.Requisition treq = tchild.Child.SizeRequest();
                if (tchild.X + treq.Width > req.Width)
                {
                    req.Width = tchild.X + treq.Width;
                }
                if (tchild.Y + treq.Height > req.Height)
                {
                    req.Height = tchild.Y + treq.Height;
                }
            }
        }
예제 #10
0
 void OnSizeAllocatedChildren()
 {
     foreach (var child in children)
     {
         Gtk.Requisition req = child.Widget.ChildRequisition;
         child.Widget.SizeAllocate(new Gdk.Rectangle(child.X, child.Y, req.Width, req.Height));
     }
 }
예제 #11
0
        protected override void OnSizeRequested(ref Gtk.Requisition req)
        {
            cell_size = CalculateMaxCellSize();

            // request at least 1 cell size
            req.Height = cell_size.Height + (padding * 2);
            req.Width  = cell_size.Width + (padding * 2);
        }
 protected override void OnSizeRequested(ref Gtk.Requisition requisition)
 {
     if (report != null)
     {
         requisition.Width  = (int)(report.PageWidthPoints * scale) + rep_padding * 2;
         requisition.Height = (int)(report.PageHeightPoints * scale) + rep_padding * 2;
     }
 }
예제 #13
0
        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);
        }
예제 #14
0
        protected override void OnSizeRequested(ref Gtk.Requisition requisition)
        {
            requisition.Width = min_length + 2 * x_offset;
            if (min_length % BackgroundTile.Width != 0)
            {
                requisition.Width += BackgroundTile.Width - min_length % BackgroundTile.Width;
            }

            requisition.Height = BackgroundTile.Height + (2 * y_offset);
        }
예제 #15
0
        protected override void OnSizeRequested(ref Gtk.Requisition requisition)
        {
            base.OnSizeRequested(ref requisition);

            // Ignore the size of top levels. They are supposed to fit the available space
            foreach (EditorContainerChild tchild in containerChildren.ToArray())
            {
                tchild.Child.SizeRequest();
            }
        }
예제 #16
0
        protected override void OnSizeRequested(ref Requisition requisition)
        {
            base.OnSizeRequested(ref requisition);
            RibbonPage page = CurrentPage;

            double tabsWidth = 0, tabsHeight = 0;

            foreach (RibbonPage p in pages)
            {
                Gtk.Requisition req = p.Label.SizeRequest();
                tabsWidth         += req.Width;
                tabsHeight         = Math.Max(tabsHeight, req.Height);
                p.LabelRequisition = req;
            }
            tabsWidth  += pages.Count * 2 * tabPadding;
            tabsHeight += 2 * tabPadding;

            double headerWidth = tabsWidth;

            if (shortcuts != null && shortcuts.Visible)
            {
                shortcutsRequisition = shortcuts.SizeRequest();
                double x = shortcutsRequisition.Width + space;
                headerWidth += Math.Max(x, minimalTabsHorizontalPosition);
            }
            else
            {
                shortcutsRequisition = new Gtk.Requisition();
                headerWidth         += minimalTabsHorizontalPosition;
            }

            headerHeight = Math.Max(tabsHeight, shortcutsRequisition.Height);

            double pageWidth = 0, pageHeight = 0;

            if (page != null)
            {
                pageRequisition = page.Page.SizeRequest();
                pageWidth       = pageRequisition.Width + 2 * pagePadding;
                pageHeight      = pageRequisition.Height + 2 * pagePadding;
            }
            else
            {
                pageRequisition = new Gtk.Requisition();
            }

            double width = Math.Max(headerWidth, pageWidth);

            width = borderWidth + width + borderWidth;
            double height = borderWidth + headerHeight + pageHeight + borderWidth;

            requisition.Width  = (int)Math.Ceiling(width - double.Epsilon);
            requisition.Height = (int)Math.Ceiling(height - double.Epsilon);
        }
예제 #17
0
 protected override void OnSizeRequested(ref Gtk.Requisition requisition)
 {
     base.OnSizeRequested(ref requisition);
     if (Child != null)
     {
         Child.SizeRequest();
     }
     vScrollBar.SizeRequest();
     hScrollBar.SizeRequest();
     children.ForEach(child => child.Child.SizeRequest());
 }
        internal override Gtk.Requisition SizeRequest()
        {
            bool getMaxW = true, getMaxH = true;

            if (type == DockGroupType.Horizontal)
            {
                getMaxW = false;
            }
            else if (type == DockGroupType.Vertical)
            {
                getMaxH = false;
            }

            Requisition ret = new Requisition();

            ret.Height = VisibleObjects.Count * Frame.TotalHandleSize;
            foreach (DockObject ob in VisibleObjects)
            {
                Requisition req = ob.SizeRequest();
                if (getMaxH)
                {
                    if (req.Height > ret.Height)
                    {
                        ret.Height = req.Height;
                    }
                }
                else
                {
                    ret.Height += req.Height;
                }

                if (getMaxW)
                {
                    if (req.Width > ret.Width)
                    {
                        ret.Width = req.Width;
                    }
                }
                else
                {
                    ret.Width += req.Width;
                }
            }
            if (type == DockGroupType.Tabbed && VisibleObjects.Count > 1 && boundTabStrip != null)
            {
                Gtk.Requisition tabs = boundTabStrip.SizeRequest();
                ret.Height += tabs.Height;
                if (ret.Width < tabs.Width)
                {
                    ret.Width = tabs.Width;
                }
            }
            return(ret);
        }
 public override void GetSize(Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
 {
     base.GetSize(widget, ref cell_area, out x_offset, out y_offset, out width, out height);
     if (editor != null)
     {
         Gtk.Requisition req = editor.SizeRequest();
         if (req.Height > height)
         {
             height = req.Height;
         }
     }
 }
예제 #20
0
        protected override void OnSizeAllocated(Gdk.Rectangle allocation)
        {
            base.OnSizeAllocated(allocation);

            Gtk.Requisition table_req = table.ChildRequisition;
            allocation.X      = Math.Max((allocation.Width - table_req.Width) / 2, 0);
            allocation.Y      = Math.Max((allocation.Height - table_req.Height) / 2, 0);
            allocation.Width  = table_req.Width;
            allocation.Height = table_req.Height;

            table.SizeAllocate(allocation);
        }
예제 #21
0
 protected override void OnSizeRequested(ref Gtk.Requisition requisition)
 {
     if (WorkaroundNeeded)
     {
         requisition.Width  = 0;
         requisition.Height = wrapHeight;
     }
     else
     {
         base.OnSizeRequested(ref requisition);
     }
 }
예제 #22
0
파일: DockFrame.cs 프로젝트: rdafoe/Cage
 Gdk.Size GetBarFrameSize(DockBar bar)
 {
     if (bar.OriginalBar != null)
     {
         bar = bar.OriginalBar;
     }
     if (!bar.Visible)
     {
         return(new Gdk.Size(0, 0));
     }
     Gtk.Requisition req = bar.SizeRequest();
     return(new Gdk.Size(req.Width, req.Height));
 }
예제 #23
0
        void ScrolledWindowSizeRequested(object obj, SizeRequestedArgs args)
        {
            Gtk.Requisition req = list.SizeRequest();
            if (req.Width <= 0)
            {
                return;
            }

            Gtk.ScrolledWindow scwin = ((Gtk.ScrolledWindow)obj);
            scwin.SizeRequested -= ScrolledWindowSizeRequested;
            scwin.SetSizeRequest(req.Width, req.Width * 2 / 3);
            ActionArea.BorderWidth = 0;             // has to happen post-realize
        }
예제 #24
0
 protected override void OnSizeRequested(ref Gtk.Requisition req)
 {
     req        = Child.SizeRequest();
     req.Width += HorzPadding * 2;
     if (active)
     {
         req.Height += TopPaddingActive + BottomPaddingActive;
     }
     else
     {
         req.Height += TopPadding + BottomPadding;
     }
 }
        protected override void OnSizeRequested(ref Gtk.Requisition requisition)
        {
            if (!IsRealized || layout == null)
            {
                return;
            }

            int width, height;

            layout.GetPixelSize(out width, out height);

            requisition.Width  = width;
            requisition.Height = height;
        }
예제 #26
0
        protected override void OnSizeRequested(ref Gtk.Requisition req)
        {
            lwidth = ewidth = 0;

            if (group != null)
            {
                foreach (Grid grid in group)
                {
                    SizeRequestGrid(grid, ref req);
                }
            }

            SizeRequestGrid(this, ref req);
        }
        protected override void OnSizeAllocated(Gdk.Rectangle rect)
        {
            base.OnSizeAllocated(rect);

            if (selectionWidget != null)
            {
                PlaceSelectionBoxInternal(selectionWidget);
            }

            foreach (TopLevelChild child in topLevels)
            {
                Gtk.Requisition req = child.Child.SizeRequest();
                child.Child.SizeAllocate(new Gdk.Rectangle(rect.X + child.X, rect.Y + child.Y, req.Width, req.Height));
            }
        }
        void MaybeReanimate()
        {
            disableSizeCheck = true;
            Gtk.Requisition sizeReq = Gtk.Requisition.Zero;
            OnSizeRequested(ref sizeReq);
            disableSizeCheck = false;

            if (sizeReq.Width == paintSize.Width && sizeReq.Height == paintSize.Height)
            {
                QueueResize();
            }
            else
            {
                AnimatedResize();                  //Desired size changed mid animation
            }
        }
 protected override void OnSizeRequested(ref Gtk.Requisition req)
 {
     if (Child != null)
     {
         req        = Child.SizeRequest();
         req.Width += LeftPadding + RightPadding;
         if (active)
         {
             req.Height += TopPaddingActive + BottomPaddingActive;
         }
         else
         {
             req.Height += TopPadding + BottomPadding;
         }
     }
 }
예제 #30
0
        public static void GetMenuPosition(Gtk.Menu menu, out int x, out int y, out bool push_in)
        {
            Gtk.Requisition menu_req = menu.SizeRequest();
            menu.AttachWidget.GdkWindow.GetOrigin(out x, out y);

            if (y + menu_req.Height >= menu.AttachWidget.Screen.Height)
            {
                y -= menu_req.Height;
            }
            else
            {
                y += menu.AttachWidget.Allocation.Height;
            }

            push_in = true;
        }
예제 #31
0
 protected override void OnSizeRequested(ref Gtk.Requisition req)
 {
     if (Child != null)
     {
         req        = Child.SizeRequest();
         req.Width += (int)(TabPadding.Left + TabPadding.Right);
         if (active)
         {
             req.Height += (int)(TabActivePadding.Top + TabActivePadding.Bottom);
         }
         else
         {
             req.Height += (int)(TabPadding.Top + TabPadding.Bottom);
         }
     }
 }
예제 #32
0
		public PopoverWidget ()
		{
			AppPaintable = true;
			VisibleWindow = false;

			alignment = new Alignment (0, 0, 1f, 1f);
			alignment.Show ();
			Add (alignment);

			disableSizeCheck = false;

			SizeRequested += (object o, SizeRequestedArgs args) => {
				if (this.AnimationIsRunning("Resize") && !disableSizeCheck) {
					Gtk.Requisition result = new Gtk.Requisition ();
					result.Width  = Math.Max (args.Requisition.Width, Math.Max (Allocation.Width, targetSize.Width));
					result.Height = Math.Max (args.Requisition.Height, Math.Max (Allocation.Height, targetSize.Height));
					args.Requisition = result;
				}
			};

			UpdatePadding ();
		}
예제 #33
0
        protected override void OnSizeRequested(ref Requisition requisition)
        {
            base.OnSizeRequested (ref requisition);
            RibbonPage page = CurrentPage;

            double tabsWidth = 0, tabsHeight = 0;
            foreach(RibbonPage p in pages)
            {
                Gtk.Requisition req = p.Label.SizeRequest ();
                tabsWidth += req.Width;
                tabsHeight = Math.Max (tabsHeight, req.Height);
                p.LabelRequisition = req;
            }
            tabsWidth += pages.Count * 2 * tabPadding;
            tabsHeight += 2 * tabPadding;

            double headerWidth = tabsWidth;

            if(shortcuts != null && shortcuts.Visible)
            {
                shortcutsRequisition = shortcuts.SizeRequest ();
                double x = shortcutsRequisition.Width + space;
                headerWidth += Math.Max (x, minimalTabsHorizontalPosition);
            }
            else
            {
                shortcutsRequisition = new Gtk.Requisition ();
                headerWidth += minimalTabsHorizontalPosition;
            }

            headerHeight = Math.Max (tabsHeight, shortcutsRequisition.Height);

            bool showToolbar = toolbar != null && toolbar.Visible;
            bool showAppButton = appButton != null && appButton.Visible;

            if(showToolbar) toolbarRequisition = toolbar.SizeRequest ();
            if(showAppButton) appButtonRequisition = appButton.SizeRequest ();

            if(showToolbar)
            {
                headerHeight += 2 * space + toolbarRequisition.Height;
            }

            if(showAppButton)
            {
                headerHeight = Math.Max (headerHeight, space + appButtonRequisition.Height);
            }

            double pageWidth = 0, pageHeight = 0;
            if(page != null)
            {
                pageRequisition = page.Page.SizeRequest ();
                pageWidth = pageRequisition.Width + 2 * pagePadding;
                pageHeight = pageRequisition.Height + 2 * pagePadding;
            }
            else
            {
                pageRequisition = new Gtk.Requisition ();
            }

            double width = Math.Max (headerWidth, pageWidth);
            width = borderWidth + width + borderWidth;
            double height = borderWidth + headerHeight + pageHeight + borderWidth;

            requisition.Width = (int)Math.Ceiling (width - double.Epsilon);
            requisition.Height = (int)Math.Ceiling (height - double.Epsilon);
        }