|
SatCat5
|
User-facing interface for drawing graphical elements on a screen.
Definition at line 140 of file gui_display.h.
#include <gui_display.h>
Public Member Functions | |
| Canvas (satcat5::gui::Display *display) | |
| Link this object to a Display in immediate mode. More... | |
| Canvas (satcat5::gui::Display *display, u8 *buffer, unsigned bsize) | |
| Link this object to a Display in buffered mode. More... | |
| bool | color_fg (u32 color) |
| Set foreground color for subsequent commands. | |
| bool | color_bg (u32 color) |
| Set background color for subsequent commands. | |
| bool | cursor (u16 r, u16 c) |
| Set cursor position for subsequent commands. | |
| bool | clear (u32 color) |
| Clear the entire display contents. | |
| bool | draw_rect (u16 h, u16 w, bool fg=true) |
| Draw a solid rectangle using the specified color. More... | |
| bool | scroll (s16 rows) |
| On supported displays, scroll the designated scrollable window. More... | |
| const satcat5::gui::Cursor & | cursor () const |
| satcat5::gui::Display * | display () |
| u16 | height () const |
| u16 | width () const |
| void | request_poll () |
| Call this method to request polling at a later time. More... | |
| void | request_cancel () |
| Call this method to cancel a previous request_poll(). | |
| bool | draw_icon (const satcat5::gui::Icon8x8 *icon, u8 mag=1) |
| Draw icon with the designated location and color. More... | |
| bool | draw_icon (const satcat5::gui::Icon16x16 *icon, u8 mag=1) |
| Draw icon with the designated location and color. More... | |
| bool | draw_icon (const satcat5::gui::Icon32x32 *icon, u8 mag=1) |
| Draw icon with the designated location and color. More... | |
| u16 | draw_text (const char *msg, const satcat5::gui::Font8x8 &font=BASIC_FONT, u8 mag=1) |
| Draw a full line of text with the designated font. More... | |
| u16 | draw_text (const char *msg, const satcat5::gui::Font16x16 &font, u8 mag=1) |
| Draw a full line of text with the designated font. More... | |
| u16 | draw_text (const char *msg, const satcat5::gui::Font32x32 &font, u8 mag=1) |
| Draw a full line of text with the designated font. More... | |
| u16 | raw_text (const char *msg, const satcat5::gui::Font8x8 &font=BASIC_FONT, u8 mag=1) |
| Draw a partial line of text with the designated font. More... | |
| u16 | raw_text (const char *msg, const satcat5::gui::Font16x16 &font, u8 mag=1) |
| Draw a partial line of text with the designated font. More... | |
| u16 | raw_text (const char *msg, const satcat5::gui::Font32x32 &font, u8 mag=1) |
| Draw a partial line of text with the designated font. More... | |
Static Public Member Functions | |
| static unsigned | count_ondemand () |
| Count queued objects of this type (i.e., non-idle). | |
Protected Member Functions | |
| bool | cmd_retry () |
| bool | draw_char (char ch, const satcat5::gui::DrawCmd &cmd, u16 &total_rows) |
| bool | draw_eol (u16 height, u16 &total_rows) |
| bool | enqueue (const satcat5::gui::DrawCmd &cmd) |
| bool | execute (const satcat5::gui::DrawCmd &cmd) |
| bool | finalize () |
| void | poll_demand () override |
| Deferred event handler, called after request(). More... | |
Protected Attributes | |
| satcat5::gui::Display *const | m_display |
| satcat5::gui::Cursor | m_cursor_draw |
| satcat5::gui::Cursor | m_cursor_user |
| satcat5::gui::DrawCmd | m_cmd_retry |
| satcat5::io::PacketBuffer | m_buffer |
Private Attributes | |
| satcat5::poll::OnDemand * | m_next |
| bool | m_idle |
|
explicit |
Link this object to a Display in immediate mode.
Preferred when draw commands can always be executed promptly.
Definition at line 124 of file gui_display.cc.
| Canvas::Canvas | ( | satcat5::gui::Display * | display, |
| u8 * | buffer, | ||
| unsigned | bsize | ||
| ) |
Link this object to a Display in buffered mode.
Preferred when draw commands may take some time to execute.
Definition at line 133 of file gui_display.cc.
| bool Canvas::draw_icon | ( | const satcat5::gui::Icon16x16 * | icon, |
| u8 | mag = 1 |
||
| ) |
Draw icon with the designated location and color.
Optionally specify magnification factor to increase size. Note: Only a pointer to the icon is copied to the queue; do not pass a reference to a stack-allocated object.
Definition at line 170 of file gui_display.cc.
| bool Canvas::draw_icon | ( | const satcat5::gui::Icon32x32 * | icon, |
| u8 | mag = 1 |
||
| ) |
Draw icon with the designated location and color.
Optionally specify magnification factor to increase size. Note: Only a pointer to the icon is copied to the queue; do not pass a reference to a stack-allocated object.
Definition at line 175 of file gui_display.cc.
| bool Canvas::draw_icon | ( | const satcat5::gui::Icon8x8 * | icon, |
| u8 | mag = 1 |
||
| ) |
Draw icon with the designated location and color.
Optionally specify magnification factor to increase size. Note: Only a pointer to the icon is copied to the queue; do not pass a reference to a stack-allocated object.
Definition at line 165 of file gui_display.cc.
| bool Canvas::draw_rect | ( | u16 | h, |
| u16 | w, | ||
| bool | fg = true |
||
| ) |
Draw a solid rectangle using the specified color.
The upper-left corner is the current cursor position. This function can be used to draw horizontal lines (h = 1), draw vertical lines (w = 1), or clear screen contents.
Definition at line 180 of file gui_display.cc.
| u16 Canvas::draw_text | ( | const char * | msg, |
| const satcat5::gui::Font16x16 & | font, | ||
| u8 | mag = 1 |
||
| ) |
Draw a full line of text with the designated font.
Same as raw_text(...) + draw_rect(...) to clear remainder of row.
Definition at line 190 of file gui_display.cc.
| u16 Canvas::draw_text | ( | const char * | msg, |
| const satcat5::gui::Font32x32 & | font, | ||
| u8 | mag = 1 |
||
| ) |
Draw a full line of text with the designated font.
Same as raw_text(...) + draw_rect(...) to clear remainder of row.
Definition at line 195 of file gui_display.cc.
| u16 Canvas::draw_text | ( | const char * | msg, |
| const satcat5::gui::Font8x8 & | font = BASIC_FONT, |
||
| u8 | mag = 1 |
||
| ) |
Draw a full line of text with the designated font.
Same as raw_text(...) + draw_rect(...) to clear remainder of row.
Definition at line 185 of file gui_display.cc.
|
overrideprotectedvirtual |
Deferred event handler, called after request().
Child class MUST override this method. (Call "request_poll" to enqueue a callback to this method.)
Implements satcat5::poll::OnDemand.
Definition at line 299 of file gui_display.cc.
| u16 Canvas::raw_text | ( | const char * | msg, |
| const satcat5::gui::Font16x16 & | font, | ||
| u8 | mag = 1 |
||
| ) |
Draw a partial line of text with the designated font.
Optionally specify magnification factor to increase size. Long strings will auto-wrap to column zero of the next row. Note: String contents are internally translated into a series of Icon pointers, one per letter. Therefore, the "msg" input may be ephemeral, but the "font" object must have a longer lifetime. Note: Whitespace characters are processed (space, newline, tab), but non-printable characters (e.g., UTF-8 emoji) are ignored.
Definition at line 209 of file gui_display.cc.
| u16 Canvas::raw_text | ( | const char * | msg, |
| const satcat5::gui::Font32x32 & | font, | ||
| u8 | mag = 1 |
||
| ) |
Draw a partial line of text with the designated font.
Optionally specify magnification factor to increase size. Long strings will auto-wrap to column zero of the next row. Note: String contents are internally translated into a series of Icon pointers, one per letter. Therefore, the "msg" input may be ephemeral, but the "font" object must have a longer lifetime. Note: Whitespace characters are processed (space, newline, tab), but non-printable characters (e.g., UTF-8 emoji) are ignored.
Definition at line 218 of file gui_display.cc.
| u16 Canvas::raw_text | ( | const char * | msg, |
| const satcat5::gui::Font8x8 & | font = BASIC_FONT, |
||
| u8 | mag = 1 |
||
| ) |
Draw a partial line of text with the designated font.
Optionally specify magnification factor to increase size. Long strings will auto-wrap to column zero of the next row. Note: String contents are internally translated into a series of Icon pointers, one per letter. Therefore, the "msg" input may be ephemeral, but the "font" object must have a longer lifetime. Note: Whitespace characters are processed (space, newline, tab), but non-printable characters (e.g., UTF-8 emoji) are ignored.
Definition at line 200 of file gui_display.cc.
|
inherited |
Call this method to request polling at a later time.
Safe to stack requests, but only one call to poll().
Definition at line 208 of file polling.cc.
| bool Canvas::scroll | ( | s16 | rows | ) |
On supported displays, scroll the designated scrollable window.
For display objects that support the scroll() command, advance the preconfigured viewport by the specified number of pixels.
Definition at line 227 of file gui_display.cc.