Milo  0.1
Milo:EquationManipulationProgram
Public Types | Protected Attributes | List of all members
UI::Graphics Class Referenceabstract

#include <ui.h>

Inheritance diagram for UI::Graphics:
Inheritance graph
[legend]
Collaboration diagram for UI::Graphics:
Collaboration graph
[legend]

Public Types

enum  Color {
  BLACK, RED, GREEN, YELLOW,
  BLUE, MAGENTA, CYAN, WHITE
}
 
enum  Attributes { NONE =0, BOLD =1, ITALIC =2, BOLD_ITALIC =3 }
 

Public Member Functions

Constructor and Virtual Destructor
 Graphics ()
 
virtual ~Graphics ()
 
Virtual Public Member Functions
virtual void differential (int x0, int y0, char variable)=0
 
virtual void parenthesis (int x_size, int y_size, int x0, int y0)=0
 
virtual void horiz_line (int x_size, int x0, int y0)=0
 
virtual void at (int x0, int y0, int c, Attributes chrAttr, Color color=BLACK)=0
 
virtual void at (int x0, int y0, const std::string &s, Attributes chrAttr, Color color=BLACK)=0
 
virtual void clear_screen ()=0
 
virtual void out ()=0
 
virtual int getTextHeight ()=0
 
virtual int getTextLength (const std::string &s)=0
 
virtual int getCharLength (char c)=0
 
virtual int getParenthesisWidth (int height=1)=0
 
virtual int getDivideLineHeight ()=0
 
virtual int getDifferentialHeight (char c)=0
 
virtual int getDifferentialWidth (char c)=0
 
virtual int getDifferentialBase (char c)=0
 
virtual void set (int x, int y, int x0=0, int y0=0)
 
virtual void setSelect (int x, int y, int x0, int y0)
 
Public helper member functions.
void set (const Box &box)
 
void setSelect (const Box &box)
 
void parenthesis (const Box &box)
 
void relativeOrig (int &x, int &y)
 

Protected Attributes

int m_xSize
 Horizontal size of graphic window.
 
int m_ySize
 Vertical size of graphic window.
 
int m_xOrig
 Horizontal origin of graphic window.
 
int m_yOrig
 Vertical origin of graphic window.
 
Box m_select
 Currently selected area.
 

Detailed Description

Abstract base class to provide a context free graphical interface. Provides an interface of helper functions that allow nodes to draw themselves on the current graphical interface.

Member Enumeration Documentation

Predefined character attributes.

Predefined colors.

Constructor & Destructor Documentation

UI::Graphics::Graphics ( )
inline

Default constructor.

virtual UI::Graphics::~Graphics ( )
inlinevirtual

Abstract base class needs vertical destructor.

Member Function Documentation

virtual void UI::Graphics::at ( int  x0,
int  y0,
int  c,
Attributes  chrAttr,
Color  color = BLACK 
)
pure virtual

Draw a character at x,y with a color.

Parameters
x0Horizontal origin of character.
y0Vertical origin of character.
cCharacter to be drawn at x0,y0.
chrAttrAttribute of character.
colorColor of character.

Implemented in AsciiGraphics, and CursesGraphics.

virtual void UI::Graphics::at ( int  x0,
int  y0,
const std::string &  s,
Attributes  chrAttr,
Color  color = BLACK 
)
pure virtual

Draw a string at x,y with a color.

Parameters
x0Horizontal origin of line.
y0Vertical origin of line.
sString to be drawn at x0,y0.
chrAttrAttribute of character.
colorColor of line.
virtual void UI::Graphics::clear_screen ( )
pure virtual

Clear screen.

Implemented in CursesGraphics, and AsciiGraphics.

virtual void UI::Graphics::differential ( int  x0,
int  y0,
char  variable 
)
pure virtual

Draw differential of width x0 and height y0 with char variable name.

Parameters
x0Horizontal origin of differential.
y0Vertical origin of differential.
variableName of variable of differential.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getCharLength ( char  c)
pure virtual

Get length of character in pixels.

Returns
Length of character in pixels.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getDifferentialBase ( char  c)
pure virtual

Get vertical offset of differential.

Parameters
cVariable name of differential.
Returns
Vertical offset of differential in pixels.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getDifferentialHeight ( char  c)
pure virtual

Get height of differential.

Parameters
cVariable name of differential.
Returns
Height of differential in pixels.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getDifferentialWidth ( char  c)
pure virtual

Get width of differential.

Parameters
cVariable name of differential.
Returns
Width of differential in pixels.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getDivideLineHeight ( )
pure virtual

Get height of line in a division node.

Returns
Height of division line.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getParenthesisWidth ( int  height = 1)
pure virtual

Get width of a parenthesis for a given height in pixels.

Returns
Width of parenthesis.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getTextHeight ( )
pure virtual

Get height of text in pixels.

Returns
Height of text in pixels.

Implemented in CursesGraphics, and AsciiGraphics.

virtual int UI::Graphics::getTextLength ( const std::string &  s)
pure virtual

Get length of string in pixels.

Returns
Length of string in pixels.

Implemented in CursesGraphics, and AsciiGraphics.

virtual void UI::Graphics::horiz_line ( int  x_size,
int  x0,
int  y0 
)
pure virtual

Draw a horizontal line starting at x0,y0 length x_size.

Parameters
x_sizeHorizontal size of both line.
x0Horizontal origin of line.
y0Vertical origin of line.

Implemented in CursesGraphics, and AsciiGraphics.

virtual void UI::Graphics::out ( )
pure virtual

Flush all drawing so far to graphic interface.

Implemented in CursesGraphics, and AsciiGraphics.

virtual void UI::Graphics::parenthesis ( int  x_size,
int  y_size,
int  x0,
int  y0 
)
pure virtual

Draw pair of parenthesis around a node of size x_size, y_size and origin x0,y0.

Parameters
x_sizeHorizontal size of both parenthesis.
y_sizeVertical size of parenthesis.
x0Horizontal origin of parenthesis.
y0Vertical origin of parenthesis.

Implemented in CursesGraphics, and AsciiGraphics.

void UI::Graphics::parenthesis ( const Box &  box)
inline

Draw a pair of parenthesis inside the rectangle box.

Parameters
boxRectangle containing origin and size of parenthesis.
void UI::Graphics::relativeOrig ( int &  x,
int &  y 
)
inline

Change the coordinates x,y to be relative to the graphic's window origin.

Parameters
[in,out]xHorizontal coordinate to be shifted.
[in,out]yVertical coordinate to be shifted.
virtual void UI::Graphics::set ( int  x,
int  y,
int  x0 = 0,
int  y0 = 0 
)
inlinevirtual

Set size and origin of this graphics window.

Parameters
xHorizontal size of both graphics window.
yVertical size of graphics window.
x0Horizontal origin of graphics window.
y0Vertical origin of graphics window.

Reimplemented in CursesGraphics, and AsciiGraphics.

void UI::Graphics::set ( const Box &  box)
inline

Set size and origin of this graphics window from a rectangle.

Parameters
boxRectangle containing origin and size of window.
virtual void UI::Graphics::setSelect ( int  x,
int  y,
int  x0,
int  y0 
)
inlinevirtual

Select the area of size x,y at origin x0,y0.

Parameters
xHorizontal size of both selection area.
yVertical size of selection area.
x0Horizontal origin of selection area.
y0Vertical origin of selection area.

Reimplemented in CursesGraphics.

void UI::Graphics::setSelect ( const Box &  box)
inline

Set selection area from rectangle.

Parameters
boxRectangle containing origin and size of selection area.

The documentation for this class was generated from the following file: