本文整理汇总了C#中Gdk.Rectangle.IntersectsWith方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.IntersectsWith方法的具体用法?C# Rectangle.IntersectsWith怎么用?C# Rectangle.IntersectsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Rectangle
的用法示例。
在下文中一共展示了Rectangle.IntersectsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateWindow
internal static void UpdateWindow (ICompletionWidget widget)
{
// Updates the parameter information window from the information
// of the current method overload
if (window == null && methods.Count > 0) {
window = new ParameterInformationWindow ();
wasAbove = false;
}
if (methods.Count == 0) {
if (window != null) {
window.Hide ();
wasAbove = false;
}
return;
}
var ctx = widget.CurrentCodeCompletionContext;
MethodData md = methods[methods.Count - 1];
int cparam = md.MethodProvider.GetCurrentParameterIndex (widget, md.CompletionContext);
Gtk.Requisition reqSize = window.ShowParameterInfo (md.MethodProvider, md.CurrentOverload, cparam - 1);
X = md.CompletionContext.TriggerXCoord;
if (CompletionWindowManager.IsVisible) {
// place above
Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - reqSize.Height - 10;
} else {
// place below
Y = ctx.TriggerYCoord;
}
Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (window.Screen, window.Screen.GetMonitorAtPoint (X + reqSize.Width, Y));
if (X + reqSize.Width > geometry.Right)
X = geometry.Right - reqSize.Width;
if (Y < geometry.Top)
Y = ctx.TriggerYCoord;
if (wasAbove || Y + reqSize.Height > geometry.Bottom) {
Y = Y - ctx.TriggerTextHeight - reqSize.Height - 4;
wasAbove = true;
}
if (CompletionWindowManager.IsVisible) {
Rectangle completionWindow = new Rectangle (CompletionWindowManager.X, CompletionWindowManager.Y,
CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height);
if (completionWindow.IntersectsWith (new Rectangle (X, Y, reqSize.Width, reqSize.Height))) {
X = completionWindow.X;
Y = completionWindow.Y - reqSize.Height - 6;
if (Y < 0)
Y = completionWindow.Bottom + 6;
}
}
window.Move (X, Y);
window.Show ();
}
示例2: OverlayScope
//HERZUM END SPRINT 2: TLAB-156
//HERZUM SPRINT 2.0 TLAB-135
protected void OverlayScope (ApplicationContext applicationContext)
{
ScopeNodeControl sncBrother;
ScopeNodeBase scopeNodeBrother;
Gdk.Rectangle areaBrother = new Gdk.Rectangle();
Gdk.Rectangle areaTarget = new Gdk.Rectangle();
BasicNodeControl componentControl;
ScopeNodeBase scopeNodeTarget = ExperimentNode as ScopeNodeBase;
GetSizeAreaWidget (out areaTarget.X, out areaTarget.Y, out areaTarget.Width, out areaTarget.Height);
foreach (ExperimentNode node in ExperimentNode.Owner.Vertices)
{
if (!node.Equals(ExperimentNode))
{
scopeNodeBrother= node as ScopeNodeBase;
if (scopeNodeBrother != null)
{
if (m_applicationContext.NodeControlFactory.TryGetNodeControl (node, out componentControl))
{
sncBrother = componentControl as ScopeNodeControl;
sncBrother.GetSizeAreaWidget(out areaBrother.X, out areaBrother.Y, out areaBrother.Width, out areaBrother.Height);
if (areaTarget.IntersectsWith(areaBrother) && sncBrother.stateWidget!="iconized")
{
sncBrother.IconizeScope();
sncBrother.IconisationForced = true;
}
else
if (!areaTarget.IntersectsWith(areaBrother) && sncBrother.IconisationForced)
{
sncBrother.NormalizeScope();
sncBrother.IconisationForced = false;
}
}
}
}
}
}
示例3: PositionParameterInfoWindow
static async void PositionParameterInfoWindow (Rectangle allocation)
{
lastW = allocation.Width;
lastH = allocation.Height;
wasVisi = CompletionWindowManager.IsVisible;
var ctx = window.Widget.CurrentCodeCompletionContext;
int cparam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex (currentMethodGroup.MethodProvider.StartOffset) : 0;
X = currentMethodGroup.CompletionContext.TriggerXCoord;
if (CompletionWindowManager.IsVisible) {
// place above
Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - allocation.Height - 10;
} else {
// place below
Y = ctx.TriggerYCoord;
}
var geometry = DesktopService.GetUsableMonitorGeometry (window.Screen.Number, window.Screen.GetMonitorAtPoint (X, Y));
window.ShowParameterInfo (currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, cparam - 1, (int)geometry.Width);
if (X + allocation.Width > geometry.Right)
X = (int)geometry.Right - allocation.Width;
if (Y < geometry.Top)
Y = ctx.TriggerYCoord;
if (wasAbove || Y + allocation.Height > geometry.Bottom) {
Y = Y - ctx.TriggerTextHeight - allocation.Height - 4;
wasAbove = true;
}
if (CompletionWindowManager.IsVisible) {
var completionWindow = new Rectangle (CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height);
if (completionWindow.IntersectsWith (new Rectangle (X, Y, allocation.Width, allocation.Height))) {
X = completionWindow.X;
Y = completionWindow.Y - allocation.Height - 6;
if (Y < 0)
Y = completionWindow.Bottom + 6;
}
}
window.Move (X, Y);
}
示例4: Render
/// <summary>
/// This method is used to render a sprite viewport onto a
/// drawable object, such as Gdk.Pixmap. This handles the
/// translation of widget space into sprite space and also the
/// appropriate clipping.
/// </summary>
public void Render(
Drawable drawable,
Rectangle region)
{
// Create the GC
GC gc = new GC(drawable);
// Figure out what parts of the rectangle we care about
Rectangle ourselves = new Rectangle(x, y, width, height);
if (!ourselves.IntersectsWith(region))
{
// No overlap, don't bother
return;
}
// Get the intersection of ourselves and the update
// region. This helps with keeping to a specific focus.
ourselves.Intersect(region);
// Clear everything
gc.RgbFgColor = BackgroundColor;
drawable.DrawRectangle(gc, true, ourselves);
// Go through the sprites
foreach (ISprite sprite in SpriteList)
{
sprite.Render(drawable, gc);
}
}