Skip to content
Toretty edited this page Apr 29, 2014 · 33 revisions

DrawAssembly is used to generate and define positions for the frame of widgets and graphs. From there, it calls the appropriate functions and classes, so they can follow this pattern of positions.


Properties

Private

Coordinates

_coordinateNum (int) CoordinateNum is by default set to 2, since we need two values to define where an object is - X and Y.

_frameWidth (int) FrameWidth is set in the setup(), and describes how many positions you'd want from left to right.

_frameHeight (int) FrameHeight is set in the setup(), and describes how many positions you'd want from Top to Bottom.

[,,] _frameCoordinates (int) These previous four parameters is the foundation of the framework or grid. _coordinateNum, _frameWidth and _frameHeight is used to create the array of positions stored in _frameCoordinates.

GraphPosition (enum) A more descriptive setting for where the graph is put.

Adaption of Elements

These properties is set by SetGraphPosition().

RowStart (int) If the graph needs to be in top, RowStart is 1 to jump one row down.

RowJump (int) If the graph is in the middle, RowJump skips one row after taking the first one.

RowStop (int) If the graph is in the bottom, the row of widgets should stop at 2nd row.

PutGraph (int) PutGraph tells the subclasses what the graph position is.

CountWidgets (int) Defines the widget number that needs to be drawn.

Public

Swipe Properties

The swipe function, enables the possibility of jumping to another page of widgets, but basically the widgets are already placed, the surface is just pushed infront of the drawing area view.

SwipeLength (float) Contains the perspective position, therefore by default 0.

SwipeMargin (float) Contains the distance of the widgets being placed.

SwipeAmount (float) Defines how many times you need to be able to swipe to a new page.

Dimension Properties

GlobalRadius (int) Defines the radius of a widget.

ContentHeight (float) Is defined from allocation.width in the Main Window, and is the width of the drawing area.

ContentWidth (float) Is defined from allocation.height in the Main Window, and is the height of the drawing area.

Margin Properties

These properties is only created so that it is easier for other classes to get the direct measurement of the grid, widthout calculating or knowing the exact grid size.

FrameAreaMarginLEFT (int) Gives the margin from top side to frame.

FrameAreaMarginTOP (int) Gives the margin from left side to frame.

FrameAreaHeight (int) Gives a proportional measure of how much area each frame has.

FrameAreaWidth (int) Gives a proportional measure of how much area each frame has.

WidgetMarginTOP (int) Gives the margin from top side to frame, minus the radius of widgets.

WidgetMarginLEFT (int) Gives the margin from left side to frame, minus the radius of widgets.

Drawing Properties

MainDrawingArea (Gdk.Window) Includes the drawing area in the DrawAssembly to reference each surface to this one.

Setup()

The setup works like the DrawAssembly's constructor, and sets these default values.

SwipeLength = 0;

SwipeAmount = SwipeAmountSend;

_frameWidth = frameSize;

_frameHeight = frameHeigh;

GlobalRadius = 50;

GraphPosition = (int)SECTIONS.BOT;

_frameCoordinates = new int[_frameHeight,_frameWidth,_coordinatesNum];

UpdateDrawingContext()

UpdateDrawingContext is the function that updates all the properties in the DrawAssembly, so that the frame will dynamically to what windows size you choose to have. These properties are set: MainDrawingArea = context2;

ContentHeight = height;

ContentWidth = width;

FrameAreaWidth = (int)ContentWidth;

FrameAreaHeight = (int)ContentHeight / _frameHeight;

FrameAreaMarginLEFT = ((int)ContentWidth / _frameWidth/2);

FrameAreaMarginTOP = ((int)ContentHeight / _frameWidth /2);

WidgetMarginTOP = (int)FrameAreaMarginTOP - (int)GlobalRadius;

WidgetMarginLEFT = (int)FrameAreaMarginLEFT - (int)GlobalRadius;

DrawFramework()

DrawFramework is the overall function that initiates these functions:

SetCoordinates() Setting coordinates.

DrawElements Drawing the elements based on these coordinates.

SetCoordinates()

Set coordinates has 3 for loops which generates the positions.

  • One that divides _frameCoordinates in two, since X and Y will be set at the same time.
  • One that, depending on _frameHeight, runs once for each section downwards.
  • One that, depending on _frameWidth, runs once for each section to the right.

DrawElements()

DrawElements starts by setting the graph position to either 0 = Bottom, 1 = Middle or 2 = Top, and afterwards resets the count widget.

Then it looks at the times it needs to swipe, and initiates the DrawWidgets() and DrawGraphArea() for each swipe.

Clone this wiki locally