本文整理汇总了C#中Gdk.Rectangle类的典型用法代码示例。如果您正苦于以下问题:C# Rectangle类的具体用法?C# Rectangle怎么用?C# Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle类属于Gdk命名空间,在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlockProcessor
public BlockProcessor(Rectangle area, int step)
{
this.area = area;
rect = new Gdk.Rectangle (area.X, area.Y,
Math.Min (step, area.Width),
Math.Min (step, area.Height));
}
示例2: OnSizeAllocated
protected override void OnSizeAllocated (Rectangle allocation)
{
Requisition headerReq;
Rectangle childAlloc;
base.OnSizeAllocated (allocation);
headerReq = header.ChildRequisition;
childAlloc.X = allocation.X + (int)BorderWidth;
childAlloc.Width = allocation.Width - (int)BorderWidth;
childAlloc.Y = allocation.Y + (int)BorderWidth;
childAlloc.Height = headerReq.Height;
header.Allocation = childAlloc;
// Indent the tiles by the same distance as the height of the header.
childAlloc.X += headerReq.Height;
childAlloc.Width -= headerReq.Height;
foreach (Widget w in VisibleTiles) {
childAlloc.Y += childAlloc.Height;
childAlloc.Height = w.ChildRequisition.Height;
w.Allocation = childAlloc;
}
}
示例3: Render
public override void Render(Drawable window,
Widget widget,
Rectangle cell_area,
Rectangle expose_area,
StateType cell_state,
IPhoto photo)
{
string text = GetRenderText (photo);
var layout = new Pango.Layout (widget.PangoContext);
layout.SetText (text);
Rectangle layout_bounds;
layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height);
layout_bounds.Y = cell_area.Y;
layout_bounds.X = cell_area.X + (cell_area.Width - layout_bounds.Width) / 2;
if (layout_bounds.IntersectsWith (expose_area)) {
Style.PaintLayout (widget.Style, window, cell_state,
true, expose_area, widget, "IconView",
layout_bounds.X, layout_bounds.Y,
layout);
}
}
示例4: Render
protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
{
int width = 0, height = 0, x_offset = 0, y_offset = 0;
StateType state;
GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
if (widget.HasFocus)
state = StateType.Active;
else
state = StateType.Normal;
width -= (int) this.Xpad * 2;
height -= (int) this.Ypad * 2;
//FIXME: Style.PaintBox needs some customization so that if you pass it
//a Gdk.Rectangle.Zero it gives a clipping area big enough to draw
//everything
Gdk.Rectangle clipping_area = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);
Style.PaintBox (widget.Style, (Gdk.Window) window, StateType.Normal, ShadowType.In, clipping_area, widget, "trough", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);
Gdk.Rectangle clipping_area2 = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
Style.PaintBox (widget.Style, (Gdk.Window) window, state, ShadowType.Out, clipping_area2, widget, "bar", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
}
示例5: StartEditing
public EditSession StartEditing (Rectangle cellArea, StateType state)
{
IPropertyEditor ed = CreateEditor (cellArea, state);
if (ed == null)
return null;
return new EditSession (container, context, ed);
}
示例6: Face
public Face (uint id, Gdk.Rectangle r) : base (id) {
rect = r;
photo_id = 0;
tag_id = 0;
tag = null;
}
示例7: ImageInfo
public ImageInfo(ImageInfo info, Gdk.Rectangle allocation)
{
#if false
Surface = new ImageSurface (Format.RGB24,
allocation.Width,
allocation.Height);
Context ctx = new Context (Surface);
#else
Console.WriteLine ("source status = {0}", info.Surface.Status);
Surface = info.Surface.CreateSimilar (Content.Color,
allocation.Width,
allocation.Height);
System.Console.WriteLine ("status = {1} pointer = {0}", Surface.Handle.ToString (), Surface.Status);
Context ctx = new Context (Surface);
#endif
Bounds = allocation;
ctx.Matrix = info.Fill (allocation);
Pattern p = new SurfacePattern (info.Surface);
ctx.Source = p;
ctx.Paint ();
((IDisposable)ctx).Dispose ();
p.Destroy ();
}
示例8: GetSize
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 (CategoryIcon != null) {
height = (int)CategoryIcon.Height + ((int)Ypad * 2) + topLevelTemplateHeadingTotalYPadding;
}
}
示例9: OnSizeAllocated
protected override void OnSizeAllocated (Rectangle allocation)
{
if (Child != null) {
Child.SizeAllocate (allocation);
}
base.OnSizeAllocated (allocation);
}
示例10: DragRect
private IEnumerator DragRect(Gdk.Point[] p)
{
var i = Array.FindLastIndex (rects, x => x.Contains (p [0]));
if (i < 0) {
i = rects.Length;
Array.Resize(ref rects, i + 1);
rects[i] = new Gdk.Rectangle(p[0].X, p[0].Y, 3, 3);
}
var start = rects [i];
var move = p [0].X < start.Right - 5 && p [0].Y < start.Bottom - 5;
for (;;) {
yield return null;
var r = rects [i];
var movedX = p [1].X - p [0].X;
var movedY = p [1].Y - p [0].Y;
if (move) {
rects [i].X = start.X + movedX;
rects [i].Y = start.Y + movedY;
} else {
rects [i].Width = Math.Max (3, start.Width + movedX);
rects [i].Height = Math.Max (3, start.Height + movedY);
}
r = r.Union (rects [i]);
QueueDrawArea (r.X, r.Y, r.Width + 1, r.Height + 1);
}
}
示例11: OnSizeAllocated
protected override void OnSizeAllocated (Rectangle allocation)
{
base.OnSizeAllocated (allocation);
if (child != null)
child.Allocation = allocation;
}
示例12: OnSizeAllocated
protected override void OnSizeAllocated (Rectangle allocation)
{
base.OnSizeAllocated (allocation);
radius = allocation.Height / 2;
center = new Cairo.PointD(allocation.Width / 2, allocation.Height / 2);
hourLength = allocation.Height / 3 / 1.65F;
minuteLength = allocation.Height / 3 / 1.20F;
secondLength = allocation.Height / 3 / 1.15F;
}
示例13: GetSize
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;
}
}
示例14: GetSize
public override void GetSize(Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
Rectangle result;
Father.OnMeasureItem( ItemIndex, widget, ref cell_area, out result );
x_offset = result.X;
y_offset = result.Y;
width = result.Width;
height = result.Height;
}
示例15: GetSize
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 (TemplateIcon != null) {
height = (int)TemplateIcon.Height + ((int)Ypad * 2);
} else {
height += groupTemplateHeadingTotalYPadding;
}
}