C# 클래스 SIL.FieldWorks.SharpViews.Box

The root class of all boxes, that is, rectanglar screen areas that lay out data.
파일 보기 프로젝트 열기: sillsdev/FieldWorks 1 사용 예제들

Private Properties

프로퍼티 타입 설명
GapBottom int
GapLeading int
GapTop int
GapTrailing int
PrepareToPaint Box
Relayout bool
RelayoutParents void
RelayoutParents void
RelayoutWithParents void
RelayoutWithParents void
SurroundHeight int
SurroundWidth int

공개 메소드들

메소드 설명
Box ( AssembledStyles style ) : System
CommonContainer ( Box other ) : Box
CommonContainer ( Box other, Box &thisChild, Box &otherChild ) : Box

Returns the closest container of this and other which is a container of both of them, and also the child of that container which is or contains each of them. Special cases: if they are the same box, all three return values are that box. if one of the boxes contains the other, the return value and the corresponding child output are both the containing box.

Contains ( Box other ) : bool

Return true if this box contains the other one, that is, is one of its containers. Only group boxes can contain others.

FindBoxAt ( Point where, PaintTransform ptrans, PaintTransform &leafBoxTransform ) : LeafBox

If there is a leaf box at the specified position, return it. Also return the paint transform that should be passed to operations on that box. By default we return this if the point is inside the box, and the transform we are passed. Where is in drawing coords. Todo JohnT: verify the point actually is in the box.

Follows ( Box other ) : bool

Answer true if this box is in the sequence of boxes chained after other. Optimize JohnT: if we assume they are usually close together but either order is likely, it would usually be more efficient to have a double loop that searches both Next chains at once until one runs out or we find the other.

Layout ( LayoutInfo transform ) : void

Determine the height and width of the box for the circumstances indicated by the transform. Also positions (and lays out) any contained boxes.

NextInSelectionSequence ( bool includeChildren ) : Box

Answer the next box in which to draw a selection after the current one. This is basically a sequence which considers a box to be come immediately before - its first child, if it has one, and if includeChildren is true; - otherwise, its Next box, if any; - otherwise, the Next box of its closest ancestor that has one. Todo JohnT: eventually will be able to be constrained to the same column.

PaintBackground ( IVwGraphics vg, PaintTransform ptrans ) : void

Any box knows how to paint its background. Some subclasses may override.

PaintForeground ( IVwGraphics vg, PaintTransform ptrans ) : void

Any box knows how to paint itself. Most subclasses should override.

PrepareFixupMap ( ) : Rectangle>.Dictionary

Make a fixup map indicating that this box and all its containers need adjusting.

SelectAtEnd ( ) : InsertionPoint

Make a selection at the end of the box. Subclasses override.

SelectAtEnd ( ParaBox para ) : InsertionPoint

This overload fulfils the interface contract for some kinds of Box to function as ClientRun. In general a box can select at end without needing to know its containing paragraph (if any) or index within it.

SelectAtStart ( ) : InsertionPoint

Make a selection at the start of the box. Subclasses override.

SelectAtStart ( ParaBox para ) : InsertionPoint

This overload fulfils the interface contract for some kinds of Box to function as ClientRun. In general a box can select at start without needing to know its containing paragraph (if any) or index within it.

SwapIfRightToLeft ( int &left, int &right ) : void

비공개 메소드들

메소드 설명
GapBottom ( LayoutTransform trans ) : int

The gap at the bottom of the box (margin + border + pad) in layout pixels.

GapLeading ( LayoutTransform trans ) : int

The gap at the leading edge of the box (margin + border + pad) in layout pixels.

GapTop ( LayoutTransform trans ) : int

The gap at the top of the box (margin + border + pad) in layout pixels.

GapTrailing ( LayoutTransform trans ) : int

The gap at the top of the box (margin + border + pad) in layout pixels.

PrepareToPaint ( LayoutInfo transform, Box prevBox, int yTop, int yBottom ) : Box

This routine and its overrides are used to make sure that the part of the root box between yTop and yBottom (measured from the top of the root) can be painted successfully. To facilitate the process of replacing a lazy box with real boxes, it is passed the previous box in its container (or null if there is none) and returns the next box which the container should check is prepared to paint. By default this is simply the next box, but if a lazy box expands (part of) itself, it should answer the replacement box. Most box classes are always prepared to paint and just answer Next. Lazy boxes convert all or part of themselves to real boxes if they intersect the specified vertical range (relative to the root as a whole). Boxes (currently DivBoxes only) which might contain lazy boxes pass the message on to their children, making the appropriate adjustment to the layout transform, just as when asking their children to Layout.

Relayout ( LayoutInfo transform, Rectangle>.Dictionary fixupMap, LayoutCallbacks lcb ) : bool

When the contents of a box changes, and its size consequently might change, something needs to be done about the layout of that box and all its containers. The process begins by constructing a FixupMap, which contains the changed box and all its parents, each recording (against the box as a key) the invalidate rectangle appropriate to the old box layout. We then pass this to the Relayout method of the root box. By default, any box which finds itself in the map, or which has never been laid out (its height is zero), does a full normal layout, and invalidates its old (if any) rectangle. It can't invalidate its new rectangle, because at the point where relayout is called, the parent box may not have finalized the new position of the child... so return true if the parent needs to invalidate the new position. Relayout should not be used in cases where the available width may have changed, as this could affect the layout of boxes that are not in the map. Note that, if the box moves, invalidating its new size at its old position, or vice versa, may not do much good. If it moves, the containing box must do appropriate extra invalidating. Some boxes, notably VwDivBox, may not need to relayout all their children, or even to invalidate all their own contents. This can be an important optimization, but must be done with care to ensure that what is actually drawn is always correct.

RelayoutParents ( IGraphicsHolder gh ) : void

This routine typically fires off the whole relayout process. It builds the fixmap and calls Relayout. It also invalidates the new area of this, if it has moved. Todo: write a test for this moving if that ever becomes possible, and implement.

RelayoutParents ( IGraphicsHolder gh, LayoutCallbacks lcb ) : void

This variant of RelayoutParents is used if the caller also needs the lcb, and therefore must be the thing to create it.

RelayoutWithParents ( IGraphicsHolder gh ) : void
RelayoutWithParents ( IGraphicsHolder gh, bool skipInvalidate ) : void
SurroundHeight ( LayoutTransform trans ) : int

The sum of the top and bottom gaps, that is, how much higher a box is because of its top and bottom margin, border, and pad.

SurroundWidth ( LayoutTransform trans ) : int

The sum of the leading and trailing gaps, that is, how much wider a box is because of its leading and trailing margin, border, and pad.

메소드 상세

Box() 공개 메소드

public Box ( AssembledStyles style ) : System
style AssembledStyles
리턴 System

CommonContainer() 공개 메소드

public CommonContainer ( Box other ) : Box
other Box
리턴 Box

CommonContainer() 공개 메소드

Returns the closest container of this and other which is a container of both of them, and also the child of that container which is or contains each of them. Special cases: if they are the same box, all three return values are that box. if one of the boxes contains the other, the return value and the corresponding child output are both the containing box.
public CommonContainer ( Box other, Box &thisChild, Box &otherChild ) : Box
other Box box to search for
thisChild Box this or a container of this
otherChild Box other or a container of other
리턴 Box

Contains() 공개 메소드

Return true if this box contains the other one, that is, is one of its containers. Only group boxes can contain others.
public Contains ( Box other ) : bool
other Box
리턴 bool

FindBoxAt() 공개 메소드

If there is a leaf box at the specified position, return it. Also return the paint transform that should be passed to operations on that box. By default we return this if the point is inside the box, and the transform we are passed. Where is in drawing coords. Todo JohnT: verify the point actually is in the box.
public FindBoxAt ( Point where, PaintTransform ptrans, PaintTransform &leafBoxTransform ) : LeafBox
where Point
ptrans PaintTransform
leafBoxTransform PaintTransform
리턴 LeafBox

Follows() 공개 메소드

Answer true if this box is in the sequence of boxes chained after other. Optimize JohnT: if we assume they are usually close together but either order is likely, it would usually be more efficient to have a double loop that searches both Next chains at once until one runs out or we find the other.
public Follows ( Box other ) : bool
other Box
리턴 bool

Layout() 공개 추상적인 메소드

Determine the height and width of the box for the circumstances indicated by the transform. Also positions (and lays out) any contained boxes.
public abstract Layout ( LayoutInfo transform ) : void
transform LayoutInfo
리턴 void

NextInSelectionSequence() 공개 메소드

Answer the next box in which to draw a selection after the current one. This is basically a sequence which considers a box to be come immediately before - its first child, if it has one, and if includeChildren is true; - otherwise, its Next box, if any; - otherwise, the Next box of its closest ancestor that has one. Todo JohnT: eventually will be able to be constrained to the same column.
public NextInSelectionSequence ( bool includeChildren ) : Box
includeChildren bool
리턴 Box

PaintBackground() 공개 메소드

Any box knows how to paint its background. Some subclasses may override.
public PaintBackground ( IVwGraphics vg, PaintTransform ptrans ) : void
vg IVwGraphics
ptrans PaintTransform
리턴 void

PaintForeground() 공개 메소드

Any box knows how to paint itself. Most subclasses should override.
public PaintForeground ( IVwGraphics vg, PaintTransform ptrans ) : void
vg IVwGraphics
ptrans PaintTransform
리턴 void

PrepareFixupMap() 공개 메소드

Make a fixup map indicating that this box and all its containers need adjusting.
public PrepareFixupMap ( ) : Rectangle>.Dictionary
리턴 Rectangle>.Dictionary

SelectAtEnd() 공개 메소드

Make a selection at the end of the box. Subclasses override.
public SelectAtEnd ( ) : InsertionPoint
리턴 SIL.FieldWorks.SharpViews.Selections.InsertionPoint

SelectAtEnd() 공개 메소드

This overload fulfils the interface contract for some kinds of Box to function as ClientRun. In general a box can select at end without needing to know its containing paragraph (if any) or index within it.
public SelectAtEnd ( ParaBox para ) : InsertionPoint
para SIL.FieldWorks.SharpViews.Paragraphs.ParaBox
리턴 SIL.FieldWorks.SharpViews.Selections.InsertionPoint

SelectAtStart() 공개 메소드

Make a selection at the start of the box. Subclasses override.
public SelectAtStart ( ) : InsertionPoint
리턴 SIL.FieldWorks.SharpViews.Selections.InsertionPoint

SelectAtStart() 공개 메소드

This overload fulfils the interface contract for some kinds of Box to function as ClientRun. In general a box can select at start without needing to know its containing paragraph (if any) or index within it.
public SelectAtStart ( ParaBox para ) : InsertionPoint
para SIL.FieldWorks.SharpViews.Paragraphs.ParaBox
리턴 SIL.FieldWorks.SharpViews.Selections.InsertionPoint

SwapIfRightToLeft() 공개 메소드

public SwapIfRightToLeft ( int &left, int &right ) : void
left int
right int
리턴 void