|
| TimeDisplay (Color color, double x, double y, int height) |
|
void | paint () const override |
|
void | set_value (int sec) |
|
int | get_value () const |
|
void | increment () |
|
void | decrement () |
|
void | resize (double inc) |
|
void | mouse_dragged (double x, double y) override |
|
void | move_to (double x, double y) override |
|
void | set_leading_units (bool flag) |
|
void | set_visible (bool flag) |
|
| GraphicalObject (double left, double bottom, double width, double height) |
|
| GraphicalObject (const GraphicalObject &other) |
|
GraphicalObject & | operator= (const GraphicalObject &other) |
|
virtual | ~GraphicalObject () |
|
virtual double | get_left () const |
|
virtual double | get_bottom () const |
|
virtual double | get_width () const |
|
virtual double | get_height () const |
|
virtual void | set (double x, double y, double width, double height) |
|
virtual void | mouse_pressed (double x, double y, MouseButton button) |
|
virtual void | mouse_released (double x, double y, MouseButton button) |
|
virtual void | mouse_moved (double x, double y) |
|
virtual void | key_pressed (int k, double x, double y) |
|
virtual bool | hit (double x, double y) |
|
virtual Window * | set_window (ObjectWindow *win) |
|
virtual Window * | get_window () const |
|
virtual void | set_mouse_over (bool flag) |
|
virtual CursorShape | set_cursor (CursorShape cursor) |
|
virtual CursorShape | get_cursor () |
|
◆ TimeDisplay()
sgl::TimeDisplay::TimeDisplay |
( |
Color |
color, |
|
|
double |
x, |
|
|
double |
y, |
|
|
int |
height |
|
) |
| |
The constructor sets the display's color, position, and height. The time is initially zero.
- Parameters
-
color | the color of the digit |
x | the x coordinate of the tens digit's lower-left corner |
y | the y coordinate of the tens digit's lower-left corner |
height | the height of the digits |
◆ decrement()
void sgl::TimeDisplay::decrement |
( |
| ) |
|
Decreases the time by one second.
- Returns
- nothing
◆ draw_separator()
Draw the hours-minutes or minutes-seconds colon separator.
- Parameters
-
left_ones | the ones digit of the left quantity |
right_tens | the tens digit of the right quantity |
- Returns
- nothing
◆ get_value()
int sgl::TimeDisplay::get_value |
( |
| ) |
const |
Returns the current time, in seconds.
- Returns
- the current value.
◆ increment()
void sgl::TimeDisplay::increment |
( |
| ) |
|
Increases the time by one second.
- Returns
- nothing
◆ mouse_dragged()
void sgl::TimeDisplay::mouse_dragged |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
|
overridevirtual |
Moves the display to a new location. The display's size is unaffected.
- Parameters
-
x | the new x coordinate of the display's lower-left corner. |
y | the new y coordinate of the display's lower-left corner. |
- Returns
- nothing
Reimplemented from sgl::GraphicalObject.
◆ move_to()
void sgl::TimeDisplay::move_to |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
|
overridevirtual |
Moves the display to a new location. The display's size is unaffected.
- Parameters
-
x | the new x coordinate of the display's lower-left corner. |
y | the new y coordinate of the display's lower-left corner. |
- Returns
- nothing
Reimplemented from sgl::GraphicalObject.
◆ paint()
void sgl::TimeDisplay::paint |
( |
| ) |
const |
|
overridevirtual |
◆ paint_without_leading_units()
void sgl::TimeDisplay::paint_without_leading_units |
( |
| ) |
const |
|
protected |
Draw the display without leading units that are zero; for example, 1:03:23 instead of 01:03:23, 4:10 instead of 00:04:10, and 3 instead of 00:00:03.
- Returns
- nothing
◆ resize()
void sgl::TimeDisplay::resize |
( |
double |
inc | ) |
|
Changes the height of the digits by a given amount. The digits' width changes proportionally.
- Parameters
-
the | change in the height of the digits |
- Returns
- nothing
◆ set_leading_units()
void sgl::TimeDisplay::set_leading_units |
( |
bool |
flag | ) |
|
Turns on or off the display of a leading zero.
- Parameters
-
flag | if true, a leading zero is displayed; otherwise, a leading zero is not displayed. |
- Returns
- nothing
◆ set_value()
void sgl::TimeDisplay::set_value |
( |
int |
sec | ) |
|
Sets the time.
- Parameters
-
sec | desired time, in seconds |
- Returns
- nothing
◆ set_visible()
void sgl::TimeDisplay::set_visible |
( |
bool |
flag | ) |
|
Makes the display visible or invisible.
- Parameters
-
flag | if true, the digits are visible otherwise, the digits are invisible. |
- Returns
- nothing
◆ hours_ones
The hours unit ones digit.
◆ hours_tens
The hours unit tens digit.
◆ leading_units
bool sgl::TimeDisplay::leading_units |
|
protected |
If true, leading units are visible; otherwise, leading units are not displayed.
◆ minutes_ones
The minutes unit ones digit.
◆ minutes_tens
The minutes unit tens digit.
◆ seconds
int sgl::TimeDisplay::seconds |
|
protected |
◆ seconds_ones
The seconds unit ones digit.
◆ seconds_tens
The seconds unit tens digit.
◆ visible
bool sgl::TimeDisplay::visible |
|
protected |
If true, the display is visible; otherwise, it is invisible.
The documentation for this class was generated from the following files: