Implements everything in the colr.controls.h header. More...
#include "colr.controls.h"
Functions | |
ColorResult * | Colr_cursor_hide (void) |
Returns an allocated ColorResult that hides the cursor when printed. More... | |
ColorResult * | Colr_cursor_show (void) |
Returns an allocated ColorResult that shows the cursor when printed. More... | |
ColorResult * | Colr_erase_display (EraseMethod method) |
Returns an allocated ColorResult that will erase the display or part of the display when printed. More... | |
ColorResult * | Colr_erase_line (EraseMethod method) |
Returns an allocated ColorResult that will erase line or part of a line when printed. More... | |
ColorResult * | Colr_move_back (unsigned int columns) |
Returns an allocated ColorResult that will move the cursor back a number of columns when printed. More... | |
ColorResult * | Colr_move_column (unsigned int column) |
Returns an allocated ColorResult that will move the cursor to a specific column when printed. More... | |
ColorResult * | Colr_move_down (unsigned int lines) |
Returns an allocated ColorResult that will move the cursor down a number of lines when printed. More... | |
ColorResult * | Colr_move_forward (unsigned int columns) |
Returns an allocated ColorResult that will move the cursor forward a number of columns when printed. More... | |
ColorResult * | Colr_move_next (unsigned int lines) |
Returns an allocated ColorResult that will move the cursor down a number of lines, at the start of the line, when printed. More... | |
ColorResult * | Colr_move_pos (unsigned int line, unsigned int column) |
Returns an allocated ColorResult that will position the cursor on the desired line and column when printed. More... | |
ColorResult * | Colr_move_prev (unsigned int lines) |
Returns an allocated ColorResult that will move the cursor up a number of lines, at the start of the line, when printed. More... | |
ColorResult * | Colr_move_return (void) |
Returns an allocated ColorResult that will move the cursor back to the beginning of the line with a carriage return character when printed. More... | |
ColorResult * | Colr_move_up (unsigned int lines) |
Returns an allocated ColorResult that will move the cursor up a number of lines when printed. More... | |
ColorResult * | Colr_pos_restore (void) |
Returns an allocated ColorResult that restores a previously saved cursor position when printed. More... | |
ColorResult * | Colr_pos_save (void) |
Returns an allocated ColorResult that saves the cursor position when printed. More... | |
ColorResult * | Colr_scroll_down (unsigned int lines) |
Returns an allocated ColorResult that will scroll the cursor down a number of lines when printed. More... | |
ColorResult * | Colr_scroll_up (unsigned int lines) |
Returns an allocated ColorResult that will scroll the cursor up a number of lines when printed. More... | |
Implements everything in the colr.controls.h header.
To use ColrC Controls in your project, you will need to include colr.controls.h and compile both colr.c and colr.controls.c with the rest of your files.
Don't forget to compile with colr.c
and -lm
.
ColorResult* Colr_cursor_hide | ( | void | ) |
Returns an allocated ColorResult that hides the cursor when printed.
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_cursor_show | ( | void | ) |
Returns an allocated ColorResult that shows the cursor when printed.
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_erase_display | ( | EraseMethod | method | ) |
Returns an allocated ColorResult that will erase the display or part of the display when printed.
[in] | method | The erase method. |
An allocated ColorResult, or NULL
if the EraseMethod was invalid.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_erase_line | ( | EraseMethod | method | ) |
Returns an allocated ColorResult that will erase line or part of a line when printed.
[in] | method | The erase method. |
An allocated ColorResult, or NULL
if the EraseMethod was invalid.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_back | ( | unsigned int | columns | ) |
Returns an allocated ColorResult that will move the cursor back a number of columns when printed.
[in] | columns | The number of columns to move. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_column | ( | unsigned int | column | ) |
Returns an allocated ColorResult that will move the cursor to a specific column when printed.
Columns start at 1
.
[in] | column | The column to move to. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_down | ( | unsigned int | lines | ) |
Returns an allocated ColorResult that will move the cursor down a number of lines when printed.
[in] | lines | The number of lines to move. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_forward | ( | unsigned int | columns | ) |
Returns an allocated ColorResult that will move the cursor forward a number of columns when printed.
[in] | columns | The number of columns to move. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_next | ( | unsigned int | lines | ) |
Returns an allocated ColorResult that will move the cursor down a number of lines, at the start of the line, when printed.
[in] | lines | The number of lines to move. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_pos | ( | unsigned int | line, |
unsigned int | column | ||
) |
Returns an allocated ColorResult that will position the cursor on the desired line and column when printed.
Positions start at 1
.
[in] | line | The line to move to. Using 0 is the same as using 1 . |
[in] | column | The column to move to. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_prev | ( | unsigned int | lines | ) |
Returns an allocated ColorResult that will move the cursor up a number of lines, at the start of the line, when printed.
[in] | lines | The number of lines to move. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_return | ( | void | ) |
Returns an allocated ColorResult that will move the cursor back to the beginning of the line with a carriage return character when printed.
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_move_up | ( | unsigned int | lines | ) |
Returns an allocated ColorResult that will move the cursor up a number of lines when printed.
Positions start at 1
.
[in] | lines | The number of lines to move. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_pos_restore | ( | void | ) |
Returns an allocated ColorResult that restores a previously saved cursor position when printed.
This only restores the column position, not the line position.
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_pos_save | ( | void | ) |
Returns an allocated ColorResult that saves the cursor position when printed.
This only saves the column position, not the line position.
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_scroll_down | ( | unsigned int | lines | ) |
Returns an allocated ColorResult that will scroll the cursor down a number of lines when printed.
New lines are added to the top.
[in] | lines | The number of lines to scroll. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.
ColorResult* Colr_scroll_up | ( | unsigned int | lines | ) |
Returns an allocated ColorResult that will scroll the cursor up a number of lines when printed.
New lines are added to the bottom.
[in] | lines | The number of lines to scroll. Using 0 is the same as using 1 . |
An allocated ColorResult.
If allocation fails, NULL
is returned.
If used inside of the Colr(), colr_cat(), colr_join(), Colr_cat(), Colr_join(), Colr_center(), Colr_ljust(), and Colr_rjust() macros, or their backing functions, they will free()
the result. Otherwise, you are responsible for calling free()
.