C# Class SIL.FieldWorks.Common.RootSites.VerticalOrientationManager

A base class for orientation managers that do vertical alignment.
Inheritance: OrientationManager
Mostra file Open project: sillsdev/FieldWorks

Private Properties

Property Type Description
ConvertKeyValue int
GetCoordRects void
RotatePointDstToPaint Point
RotatePointPaintToDst Point
RotateRectDstToPaint System.Drawing.Rectangle

Public Methods

Method Description
DrawTheRoot ( IVwDrawRootBuffered vdrb, IVwRootBox rootb, IntPtr hdc, SIL drawRect, uint backColor, bool drawSel, Rectangle clipRect ) : void

The core of the Draw() method, where the rectangle actually gets painted. Vertical views use a rotated drawing routine.

GetAvailWidth ( ) : int

The width available for laying out a line of text, before subtracting margins. Normally this is the width of the pane, but for vertical alignment it is the height.

VerticalOrientationManager ( SimpleRootSite site ) : System

Constructor

Private Methods

Method Description
ConvertKeyValue ( int keyValue ) : int

Convert arrow key codes so as to handle rotation (and line inversion). Enhance JohnT: possibly up/down inversion should be handled by the VwVerticalRootBox class, in which case, Up and Down results should be swapped here?

GetCoordRects ( Rectangle &rcSrcRoot, Rectangle &rcDstRoot ) : void

Construct coord transformation rectangles. Height and width are dots per inch (swapped for rotation); src origin is 0, dest origin is controlled by scrolling. A change in the y value of rcDstRoot origin will move the view left or right. A zero position of the scroll bar puts the 'bottom' at the right of the window. We want instead to put the 'top' at the left of the window for offset zero, and move it to the left as the offset increases. Passing an actual offset of 0 puts the bottom of the view at the right of the window. Adding the rootbox height puts the top just out of sight beyond the right edge; subtracting the client rectangle puts it in the proper zero-offset position with the top just at the left of the window. Further subtracting the scroll offset moves it further right, or 'up'.

RotatePointDstToPaint ( Point pt ) : Point

The specified point is in 'destination' coordinates. In a vertical view it requires rotation in the same way that the drawing code rotates the actual pixels drawn. This basically means that pt.Y is measured from the right of the window and pt.X is measured from the top. The result needs to be the same point in normal coordinates.

RotatePointPaintToDst ( Point pt ) : Point

The specified point is in 'paint' coordinates. In a vertical view it requires rotation reversing way that the drawing code rotates the actual pixels drawn to get 'destination' coordinates that the root box will interpret correctly. This basically converts a normal point to one where X is measured from the top of the client rectangle and Y from the right.

RotateRectDstToPaint ( Rectangle rect ) : Rectangle

The specified rectangle is in 'destination' coordinates. In a vertical view it requires rotation in the same way that the drawing code rotates the actual pixels drawn. This basically means that the input is a rectangle whose top and bottom are distances from the right of the window and whose left and right are measured from the top of the window. We need to convert it to one measured from the top left.

Method Details

DrawTheRoot() public method

The core of the Draw() method, where the rectangle actually gets painted. Vertical views use a rotated drawing routine.
public DrawTheRoot ( IVwDrawRootBuffered vdrb, IVwRootBox rootb, IntPtr hdc, SIL drawRect, uint backColor, bool drawSel, Rectangle clipRect ) : void
vdrb IVwDrawRootBuffered
rootb IVwRootBox
hdc System.IntPtr
drawRect SIL
backColor uint
drawSel bool
clipRect System.Drawing.Rectangle
return void

GetAvailWidth() public method

The width available for laying out a line of text, before subtracting margins. Normally this is the width of the pane, but for vertical alignment it is the height.
public GetAvailWidth ( ) : int
return int

VerticalOrientationManager() public method

Constructor
public VerticalOrientationManager ( SimpleRootSite site ) : System
site SimpleRootSite
return System