当前位置: 首页>>代码示例>>C#>>正文


C# Menu.SizeRequest方法代码示例

本文整理汇总了C#中Gtk.Menu.SizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.SizeRequest方法的具体用法?C# Menu.SizeRequest怎么用?C# Menu.SizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Menu的用法示例。


在下文中一共展示了Menu.SizeRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PositionMenu

		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;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:25,代码来源:MenuButton.cs

示例2: PositionPopupMenu

		void PositionPopupMenu (Menu menu, out int x, out int y, out bool pushIn)
		{
			this.GdkWindow.GetOrigin (out x, out y);
			x += this.menuPopupLocation.X;
			y += this.menuPopupLocation.Y;
			Requisition request = menu.SizeRequest ();
			Gdk.Rectangle geometry = Screen.GetMonitorGeometry (Screen.GetMonitorAtPoint (x, y));
			
			y = Math.Max (geometry.Top, Math.Min (y, geometry.Bottom - request.Height));
			x = Math.Max (geometry.Left, Math.Min (x, geometry.Right - request.Width));
			pushIn = true;
		}
开发者ID:silk,项目名称:monodevelop,代码行数:12,代码来源:ExtensibleTextEditor.cs

示例3: PositionMenu

        private void PositionMenu(Menu menu, out int x, out int y, out bool push_in)
        {
            x = menu_x;
            y = menu_y;

                        int		   monitor = ((Widget) menu).Screen.GetMonitorAtPoint  (x, y   );
            Gdk.Rectangle rect	= ((Widget) menu).Screen.GetMonitorGeometry (monitor);

                        int space_above = y - rect.Y;
                        int space_below = rect.Y + rect.Height - y;

                        Requisition requisition = menu.SizeRequest ();

                        if (requisition.Height <= space_above ||
                requisition.Height <= space_below) {

                if (requisition.Height <= space_below)
                    y += event_box.Allocation.Height;
                else
                    y -= requisition.Height;

                        } else if (requisition.Height > space_below &&
                   requisition.Height > space_above) {

                if (space_below >= space_above)
                    y = rect.Y + rect.Height - requisition.Height;
                else
                    y = rect.Y;

                        } else {
                                y = rect.Y;
                        }

                        push_in = true;
        }
开发者ID:GNOME,项目名称:last-exit,代码行数:35,代码来源:TrayIcon.cs


注:本文中的Gtk.Menu.SizeRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。