C# Class SIL.FieldWorks.SharpViews.RootBox

Inheritance: DivBox, IDisposable
Mostrar archivo Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
CanApplyStyle bool
Dispose void
ExtendSelection void
ExtendSelection void
GetBuilder ViewBuilder
RaiseLazyExpanded void
RaiseSizeChanged void
Relayout bool
ResumePaint void
SuspendPaint void

Public Methods

Method Description
CanCopy ( ) : bool
CanCut ( ) : bool
CanDelete ( ) : bool

Checks whether the Selection can be deleted

CanPaste ( ) : bool
ChildTransformFromRootTransform ( PaintTransform rootTransform ) : PaintTransform

Since this IS the root, by definition the root transform is its transform.

Dispose ( ) : void
FlashInsertionPoint ( ) : void

Call this ever half second or so to make the insertion point (if any) flash.

Layout ( LayoutInfo transform ) : void
OnApplyStyle ( string style ) : void

Changes the style of the Selection to the chosen style

OnDelete ( ) : void

If the Selection is an Insertion Point the character following the Selection will be removed If the Selection is a Ranged Selection the entire Selection will be removed

OnDoubleClick ( EventArgs e ) : void
OnDragDrop ( DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans ) : void

Implement dragging to this view.

OnDragEnter ( DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans ) : void

Returns information about possible drops with these arguments.

OnDragLeave ( ) : void

Called when drag leaves this control.

OnEditCopy ( ) : void
OnEditCut ( ) : void
OnEditPaste ( ) : void
OnMouseClick ( MouseEventArgs e, Keys keys, IVwGraphics vg, PaintTransform ptrans ) : void

Places an insertion point within a ranged selection, only if the mouse down occured within the selection. OnMouseDown takes care of all other situations.

OnMouseDown ( MouseEventArgs e, Keys keys, IVwGraphics vg, PaintTransform ptrans ) : void

Places an insertion point unless it would be placed within a ranged selection. Also determines sets whether the mouse down occured within a ranged selection, so that OnMouseMove can know if it can drag and so that OnMouseClick can know if can place an insertion point within the ranged selection.

OnMouseMove ( MouseEventArgs e, Keys keys, IVwGraphics vg, PaintTransform ptrans ) : void

Allows for text to be selected and dragged. This method starts the drag instead of OnMouseDown because once the drag is started, OnMouseClick/DoubleClick is overridden. OnMouseDown would start the drag too early.

OnQueryContinueDrag ( System.Windows.Forms.QueryContinueDragEventArgs e ) : void

Despite the method name (chosen to match the method of Control which it implements), our main reason for implementing this is to be notified when the drop takes place and, if it is a move, delete the original.

Paint ( IVwGraphics vg, PaintTransform ptrans ) : void

The root box handles the overall paint.

RootBox ( AssembledStyles styles ) : System
ScrollToShowSelection ( IVwGraphics vg, PaintTransform ptrans, Rectangle targetRect, int &dx, int &dy ) : void

Determine how far we need to scroll to make the current selection visible within the target rectangle (typically the clientRect of the view). Currently the goal is - if the selection is entirely within the rectangle return 0,0 (don't move) - otherwise if possible move the smallest distance that will put the selection at least 10 pixels inside the rectangle on both sides - if that is not possible move the smallest distance that will put the selection entirely inside the rectangle - if that is not possible move so that the primary rectangle of the IP at the DragEnd of the selection is inside the rectangle, at the top if it is the start and at the bottom if it is at the end. - if it is not possible to display even the primary rectangle of one IP, move so that equal amounts of it are above and below the rectangle. Eventually when we do horizontal scrolling the two directions will be independent. For example, even if we must move vertically, don't move horizontally to get the 10 pixel margin unless we must to see it at all.

Private Methods

Method Description
CanApplyStyle ( string style ) : bool

Checks whether a Selection's style can be changed

Dispose ( bool beforeDestructor ) : void
ExtendSelection ( MouseEventArgs e, bool makeRange, IVwGraphics vg, PaintTransform ptrans ) : void

This is basically the common logic of MouseDown and MouseMove, when the left mouse button is pressed. If makeRange is true, as for shift-click or mouse move, we try to move the drag end of a range; otherwise, we make the selection where it is.

ExtendSelection ( Selection sel, bool makeRange ) : void
GetBuilder ( GroupBox destination ) : ViewBuilder

Answer a viewbuilder for adding stuff to the specified box. Subclasses may wish to return a subclass of ViewBuilder.

RaiseLazyExpanded ( LazyExpandedEventArgs args ) : void
RaiseSizeChanged ( ) : void
Relayout ( LayoutInfo transform, Rectangle>.Dictionary fixupMap, LayoutCallbacks lcb ) : bool

Overriden since, if our old Height is zero, the base method will assume the box is new and does not need invalidate, since it's container will figure its new area. But the root has no container, so we handle this special case here.

ResumePaint ( ) : void
SuspendPaint ( LayoutCallbacks layoutCallbacks ) : void

Method Details

CanCopy() public method

public CanCopy ( ) : bool
return bool

CanCut() public method

public CanCut ( ) : bool
return bool

CanDelete() public method

Checks whether the Selection can be deleted
public CanDelete ( ) : bool
return bool

CanPaste() public method

public CanPaste ( ) : bool
return bool

ChildTransformFromRootTransform() public method

Since this IS the root, by definition the root transform is its transform.
public ChildTransformFromRootTransform ( PaintTransform rootTransform ) : PaintTransform
rootTransform PaintTransform
return PaintTransform

Dispose() public method

public Dispose ( ) : void
return void

FlashInsertionPoint() public method

Call this ever half second or so to make the insertion point (if any) flash.
public FlashInsertionPoint ( ) : void
return void

Layout() public method

public Layout ( LayoutInfo transform ) : void
transform LayoutInfo
return void

OnApplyStyle() public method

Changes the style of the Selection to the chosen style
public OnApplyStyle ( string style ) : void
style string
return void

OnDelete() public method

If the Selection is an Insertion Point the character following the Selection will be removed If the Selection is a Ranged Selection the entire Selection will be removed
public OnDelete ( ) : void
return void

OnDoubleClick() public method

public OnDoubleClick ( EventArgs e ) : void
e System.EventArgs
return void

OnDragDrop() public method

Implement dragging to this view.
public OnDragDrop ( DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans ) : void
drgevent System.Windows.Forms.DragEventArgs
location Point
vg IVwGraphics
ptrans PaintTransform
return void

OnDragEnter() public method

Returns information about possible drops with these arguments.
public OnDragEnter ( DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans ) : void
drgevent System.Windows.Forms.DragEventArgs
location Point
vg IVwGraphics
ptrans PaintTransform
return void

OnDragLeave() public method

Called when drag leaves this control.
public OnDragLeave ( ) : void
return void

OnEditCopy() public method

public OnEditCopy ( ) : void
return void

OnEditCut() public method

public OnEditCut ( ) : void
return void

OnEditPaste() public method

public OnEditPaste ( ) : void
return void

OnMouseClick() public method

Places an insertion point within a ranged selection, only if the mouse down occured within the selection. OnMouseDown takes care of all other situations.
public OnMouseClick ( MouseEventArgs e, Keys keys, IVwGraphics vg, PaintTransform ptrans ) : void
e MouseEventArgs
keys Keys
vg IVwGraphics
ptrans PaintTransform
return void

OnMouseDown() public method

Places an insertion point unless it would be placed within a ranged selection. Also determines sets whether the mouse down occured within a ranged selection, so that OnMouseMove can know if it can drag and so that OnMouseClick can know if can place an insertion point within the ranged selection.
public OnMouseDown ( MouseEventArgs e, Keys keys, IVwGraphics vg, PaintTransform ptrans ) : void
e MouseEventArgs
keys Keys
vg IVwGraphics
ptrans PaintTransform
return void

OnMouseMove() public method

Allows for text to be selected and dragged. This method starts the drag instead of OnMouseDown because once the drag is started, OnMouseClick/DoubleClick is overridden. OnMouseDown would start the drag too early.
public OnMouseMove ( MouseEventArgs e, Keys keys, IVwGraphics vg, PaintTransform ptrans ) : void
e MouseEventArgs
keys Keys
vg IVwGraphics
ptrans PaintTransform
return void

OnQueryContinueDrag() public method

Despite the method name (chosen to match the method of Control which it implements), our main reason for implementing this is to be notified when the drop takes place and, if it is a move, delete the original.
public OnQueryContinueDrag ( System.Windows.Forms.QueryContinueDragEventArgs e ) : void
e System.Windows.Forms.QueryContinueDragEventArgs
return void

Paint() public method

The root box handles the overall paint.
public Paint ( IVwGraphics vg, PaintTransform ptrans ) : void
vg IVwGraphics
ptrans PaintTransform
return void

RootBox() public method

public RootBox ( AssembledStyles styles ) : System
styles AssembledStyles
return System

ScrollToShowSelection() public method

Determine how far we need to scroll to make the current selection visible within the target rectangle (typically the clientRect of the view). Currently the goal is - if the selection is entirely within the rectangle return 0,0 (don't move) - otherwise if possible move the smallest distance that will put the selection at least 10 pixels inside the rectangle on both sides - if that is not possible move the smallest distance that will put the selection entirely inside the rectangle - if that is not possible move so that the primary rectangle of the IP at the DragEnd of the selection is inside the rectangle, at the top if it is the start and at the bottom if it is at the end. - if it is not possible to display even the primary rectangle of one IP, move so that equal amounts of it are above and below the rectangle. Eventually when we do horizontal scrolling the two directions will be independent. For example, even if we must move vertically, don't move horizontally to get the 10 pixel margin unless we must to see it at all.
public ScrollToShowSelection ( IVwGraphics vg, PaintTransform ptrans, Rectangle targetRect, int &dx, int &dy ) : void
vg IVwGraphics
ptrans PaintTransform
targetRect System.Drawing.Rectangle
dx int
dy int
return void