Frame

public:


Frame(void)
Generates a new frame as a subframe of rootFrm with left top corner at the top left corner of rootFrm, right bottom corner at the botton right bottom cornet of rootFrm, and black and white colors

Frame(int lti,int ltj,int rbi,int rbj, int bgc,int fgc, int im, int jm)
It generates a new frame as a subframe of rootFrame with left top corner (lti,ltj), right bottom corner at (rbi,rbj). bgc and fgc are the background and foreground color, im and jm are the margins.

Frame(Frame &prntFrm,const At &lt,const At &rb, int bgc,int fgc, int im, int jm)
Generates a new frame as a subframe of prntFrm with left top corner lt, right bottom corner at rb, where the coordinates are given in columns and rows of the parent frame
bgcBackground color
jgcForeground color
im,jmMargins

Frame(Frame &prntFrm,int lti,int ltj,int rbi,int rbj, int bgc,int fgc, int im, int jm)
Generates a new frame as a subframe of prntFrm with left top corner (lti,ltj),right bottom corner at (rbi,rbj), where the coordinates are given in percentage of the horizontal and vertical size of the parent frame
bgcBackground color
jgcForeground color
im,jmMargins

Frame(Frame &prntFrm,int lti,int ltj,int rbi,int rbj, double swx,double swy,double nex,double ney, int bgc,int fgc, int im, int jm)
Generates a new frame as a subframe of prntFrm and sets the world coordinates and colors
lti,ltjThe coordinates of the left top corner in percentage of the parent frame
rbi,rbjThe coordinates of the right botton corner in percentage of the parent frame
swx,swy,nex,neyThe world coordinates. Check setWorldCoord for details
bgc,fgcThe background and foreground color
im,jmThe margins for text in device coordinates

void Locate(Frame &prntFrm, At &lt, At &rb)
Moves the left top corner to lt and the left botton corner to rb where the coordinates are given in text cells. This function in used internally by some constructors

void Locate(Frame &prntFrm,int lti,int ltj,int rbi,int rbj)
Moves the left top corner to (arglti, argltj) and the left botton corner to (argrbi, argrbj) where the coordinates are given in percentage. This function in used internally by some constructors

void setWorldCoord(double swx,double swy,double nex,double ney)
Sets to world coordinates.
swx,swythe coordinates of the bottom-left (southwest) corner
nex,neythe coordinates of the upper-right (northeast) corner

int NoCol(void)
Return the number of columns in the frame

int NoRow(void)
Return the number of rows in the frame

void Clear(void)
Clears the frame with the background color and moves the current position to (0,0)

void Clear(int color)
Clears the frame with the color color and moves the current position to (0,0)

void Bound(int color)
Draw a boundary around the frame in color color

void SetBgColor(int c)
Sets the background color to c.

void SetFgColor(int c)
Sets the foreground color to c.

int getRow(PXL &pxl)
returns the character row that correspond to the pixel pxl

int getCol(PXL &pxl)
returns the character column that correspond to the pixel pxl

int x2i(double x)
Translates world coordinate x to a device coordinate

int y2j(double y)
Translates world coordinate y to a device coordinate

double x2p(double x)
Same as
x2i() but returns a double

double y2q(double y)
Same as
y2j() but returns a double

double i2x(int i)
Translates device coordinate i to a world coordinate

double j2y(int j)
Translates device coordinate j to a world coordinate

void jump(int i,int j)
Moves the current position to (i, j), in device coordinates

void draw(int i,int j,int color)
draws a line from the current position to (i, j) using the color color. If color is FRAME_FG then the frame foreground color is used.

void dot(int i,int j,int color)
Draw a dot at position (i, j) (in pixel coordinates) and color color

void line(int i1,int j1,int i2,int j2,int color)
Draws a line from the point (x1, y1) to (x2, y2) (in pixel coordinates)in the color color. The current position is moved to the end of the line

void jump(double x,double y)
Moves the current position to (x, y), in world coordinates

void draw(double x,double y,int color)
Draws a line from from the current position to (x, y) (in world coordinates) using the color color

void dot(double x,double y,int color)
Draw a dot at position (x, y) (in world coordinates) and color color

void line(double x1,double y1,double x2,double y2, int color)
Draws a line from the point (x1, y1) to (x2, y2) (in world coordinates)in the color color. The current position is moved to the end of the line

void box(int lti,int ltj,int rbi,int rbj,int color)
draws a box (an empty rectangle) with the left top corner in (lti, ltj) and the right botton corner in (rbi, rbj), in device coordinates.
colorThe color of the box. If it is FRAME_FG then the frame foreground color is used

void box(double swx,double swy, double nex, double ney,int color)
draws a box (an empty rectangle) with the left botton corner in (swx, swy) and the right top corner in (nex, ney), in world coordinates.
colorThe color of the box. If it is FRAME_FG then the frame foreground color is used

void boxFill(double swx,double swy, double nex, double ney,int col)
Draws a filled box with the botton left corner at (swx, swy) and the right top corner at (nex, ney). The box is filled with color color

void Xcrss(double x,double y,int size, int color)
Draw a cross at position (x, y) (in world coordinates), color color and size size

Frame &operator<<(char c)
Prints the character c at the current position

Frame &operator<<(int n)
Prints the number n at the current position

Frame &operator<<(long n)
Prints the number n at the current position

Frame &operator<<(double r)
Outputs the double r, eg.:

frm<<3.14159;

Frame &operator<<(const frstring &a_string)
Outputs the string a_string on the frame.

Frame &operator<<(char *text)
Outputs the string text on the frame.

Frame &operator<<(colstring &a_colstring)
Print a color text on the frame. The current color isn't changed by that function

Frame &operator<<(FgColor &c)
Changes the foreground color of the frame, like:

frm<< FgColor(RED)<<"red "<< FgColor(BLUE)<<"blue"

Frame &operator<<(BgColor &c)
Changes the background color of the frame, like:

frm<< BgColor(YELLOW)<<"yellow"<< BgColor(GREEN)<<"green"

Frame &operator<<(Tab tab)
Moves the current position to the column refered by tab

Frame &operator>>(const At &at)
The same as operator<< - changes the current position to at

Frame &operator>>(FgColor &c)
The same as operator<< - changes the foreground color to c

Frame &operator>>(BgColor &c)
The same as operator<< - changes the background color to c

int isInside(PXL &p)
Checks if the pixel pxl (in device coordinates) is inside the frame

Frame &operator>>(frstring &a_string)
Reads a string from the keyboard. The same, as getText.

Frame &operator>>(int &n)
Reads a number from the keyboard using getText().

Frame &operator>>(long &n)
Reads a number from the keyboard using getText().

Frame &operator>>(double &r)
Reads a double from the keyboard using getText().

int Edit(At at, int no_col, frstring &s)
A more sophisticated version of getText. Reads a text from the keybord and allows the user to use arrows backspace and delete. Returns the key used to end the edition (eg. Enter, Escape)
atThe position of the begining of the edition
no_colThe number of columns used for the edition
sThe string. Then calling it contains the text that should appear in the edition. The result string in also returned here.