Next: , Previous: The printrow class, Up: The printrow class



8.3.1 Using the printrow class

A printrow object is created by one of the following constructors. Note that there are certain options which cannot be changed once the object has been created, so unless the default options are going to be used it is necessary to use the second form of the constructor.

— Constructor: printrow::printrow (const printpage& pp);

This constructor builds a printrow object associated to the printpage object given by pp. The options are initialised to the default options.

— Constructor: printrow::printrow (const printpage& pp, const printrow::options& op);

This constructor builds a printrow object associated to the printpage object given by pp, and initialised the options to op.

Once the printrow object has been created, it must be positioned on the page before any rows can be printed.

— Function: void printrow::set_position (const dimension& x, const dimension& y);

This function sets the position of the printrow object to the given place on the page, measured from the bottom left. The position given is where the first bell of the next row printed will appear.

— Function: void printrow::move_position (const dimension& x, const dimension& y);

This function is like the preceding one, but the position given by x and y are taken relative to the current position of the printrow object. The current position is either the place where the top left bell of the last column printed appeared, or as set by a set_position or move_position function call, whichever is more recent.

Certain options (see Row printing options) may be changed while the printrow object exists.

— Function: const printrow::options& printrow::get_options (void);

This function returns the current options.

— Function: void printrow::set_options (const printrow::options& o);

This function sets the options to those given by o. Note that only certain option changes will have any effect once the object has been constructed.

After setting the position, rows can be printed.

— Operator: printrow& printrow::operator<< (const printrow& pr, const row& r);

This operator is used to print a row r using the printrow object pr. This prints the numbers of the row if the numbers flag of the options is set, and also draws the lines for any bells which have been specified in the options. The row is printed underneath the previous row.

— Function: void printrow::rule (void);

This function draws a horizontal rule below the last row printed.

— Function: void printrow::dot (int i);

This function draws a small dot at the place where bell i was in the last row printed. If i is -1, prints dots for all bells which are having lines drawn.

— Function: void printrow::placebell (int i);

This function finds what place the bell i was at in the last row printed, and then prints this number in a circle to the right of that row.

— Function: void printrow::text (const string& t, const dimension& x, text_style::alignment al, bool between, bool right);

This function prints some text to one side of the last row printed. The text is given in t and is printed in the same style as the rows. If the boolean argument right is true, the text is printed to the right of the row; otherwise the text is printed to the left of the row. The dimension x is a distance from the leftmost or rightmost number in the row, and the text is aligned about this point as given by al (see The text_style class). If the argument between is true, then the text is not aligned vertically with the previous row, but rather appears halfway between the previous row and the next one to be printed. This last option is useful, for example, for printing place notation beside a method.