本文整理汇总了C#中Gdk.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Contains方法的具体用法?C# Gdk.Contains怎么用?C# Gdk.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk
的用法示例。
在下文中一共展示了Gdk.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDockTarget
public bool GetDockTarget (DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
{
outrect = Gdk.Rectangle.Zero;
dockDelegate = null;
if (item != this.item && this.item.Visible && rect.Contains (px, py)) {
// Check if the item is allowed to be docked here
var s = Frame.GetRegionStyleForObject (this);
int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
DockPosition pos;
/* if (ParentGroup.Type == DockGroupType.Tabbed) {
rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
pos = DockPosition.CenterAfter;
}*/
if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
if (s.SingleColumnMode.Value)
return false;
outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);
pos = DockPosition.Left;
}
else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
if (s.SingleColumnMode.Value)
return false;
outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height);
pos = DockPosition.Right;
}
else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
if (s.SingleRowMode.Value)
return false;
outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);
pos = DockPosition.Top;
}
else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
if (s.SingleRowMode.Value)
return false;
outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin);
pos = DockPosition.Bottom;
}
else {
outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
pos = DockPosition.Center;
}
dockDelegate = delegate (DockItem dit) {
DockGroupItem it = ParentGroup.AddObject (dit, pos, Id);
it.SetVisible (true);
ParentGroup.FocusItem (it);
};
return true;
}
return false;
}
示例2: DrawCaret
public void DrawCaret (Gdk.Drawable win, Gdk.Rectangle area)
{
if (Settings.Default.CursorBlink && !caretBlink || HexEditorData.IsSomethingSelected)
return;
if (caretGc == null) {
caretGc = new Gdk.GC (win);
caretGc.RgbFgColor = new Color (255, 255, 255);
caretGc.Function = Gdk.Function.Xor;
}
long caretY = HexEditorData.Caret.Line * LineHeight - (long)HexEditorData.VAdjustment.Value;
int caretX;
if (HexEditorData.Caret.InTextEditor) {
caretX = textEditorMargin.CalculateCaretXPos ();
} else {
caretX = hexEditorMargin.CalculateCaretXPos ();
}
if (!area.Contains (caretX, (int)caretY))
return;
if (HexEditorData.Caret.IsInsertMode) {
win.DrawRectangle (caretGc, true, new Gdk.Rectangle (caretX, (int)caretY, 2, LineHeight));
} else {
win.DrawRectangle (caretGc, true, new Gdk.Rectangle (caretX, (int)caretY, textEditorMargin.charWidth, LineHeight));
}
}