mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 16:58:36 -07:00
Gui: Update elements API
This commit is contained in:
@@ -101,14 +101,17 @@ void elements_scrollbar_horizontal(
|
||||
size_t pos,
|
||||
size_t total) {
|
||||
furi_check(canvas);
|
||||
|
||||
// prevent overflows
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_box(canvas, x, y - 3, width, 3);
|
||||
|
||||
// dot line
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
for(size_t i = x; i < width + x; i += 2) {
|
||||
canvas_draw_dot(canvas, i, y - 2);
|
||||
}
|
||||
|
||||
// Position block
|
||||
if(total) {
|
||||
float block_w = ((float)width) / total;
|
||||
@@ -606,12 +609,23 @@ void elements_string_fit_width(Canvas* canvas, FuriString* string, size_t width)
|
||||
}
|
||||
}
|
||||
|
||||
void elements_scrollable_text_line_str(
|
||||
void elements_scrollable_text_line(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
int32_t y,
|
||||
size_t width,
|
||||
const char* string,
|
||||
FuriString* string,
|
||||
size_t scroll,
|
||||
bool ellipsis) {
|
||||
elements_scrollable_text_line_centered(canvas, x, y, width, string, scroll, ellipsis, false);
|
||||
}
|
||||
|
||||
void elements_scrollable_text_line_centered(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
int32_t y,
|
||||
size_t width,
|
||||
FuriString* string,
|
||||
size_t scroll,
|
||||
bool ellipsis,
|
||||
bool centered) {
|
||||
@@ -667,31 +681,6 @@ void elements_scrollable_text_line_str(
|
||||
furi_string_free(line);
|
||||
}
|
||||
|
||||
void elements_scrollable_text_line(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
int32_t y,
|
||||
size_t width,
|
||||
FuriString* string,
|
||||
size_t scroll,
|
||||
bool ellipsis) {
|
||||
elements_scrollable_text_line_str(
|
||||
canvas, x, y, width, furi_string_get_cstr(string), scroll, ellipsis, false);
|
||||
}
|
||||
|
||||
void elements_scrollable_text_line_centered(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
int32_t y,
|
||||
size_t width,
|
||||
FuriString* string,
|
||||
size_t scroll,
|
||||
bool ellipsis,
|
||||
bool centered) {
|
||||
elements_scrollable_text_line_str(
|
||||
canvas, x, y, width, furi_string_get_cstr(string), scroll, ellipsis, centered);
|
||||
}
|
||||
|
||||
void elements_text_box(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
|
||||
@@ -229,17 +229,7 @@ void elements_string_fit_width(Canvas* canvas, FuriString* string, size_t width)
|
||||
* @param string The string
|
||||
* @param[in] scroll The scroll counter: 0 - no scroll, any other number - scroll. Just count up, everything else will be calculated on the inside.
|
||||
* @param[in] ellipsis The ellipsis flag: true to add ellipse
|
||||
* @param[in] centered The centered flag: true to center text on x and y
|
||||
*/
|
||||
void elements_scrollable_text_line_str(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
int32_t y,
|
||||
size_t width,
|
||||
const char* string,
|
||||
size_t scroll,
|
||||
bool ellipsis,
|
||||
bool centered);
|
||||
void elements_scrollable_text_line(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
@@ -248,6 +238,18 @@ void elements_scrollable_text_line(
|
||||
FuriString* string,
|
||||
size_t scroll,
|
||||
bool ellipsis);
|
||||
|
||||
/** Draw scrollable text line, optionally centered
|
||||
*
|
||||
* @param canvas The canvas
|
||||
* @param[in] x X coordinate
|
||||
* @param[in] y Y coordinate
|
||||
* @param[in] width The width
|
||||
* @param string The string
|
||||
* @param[in] scroll The scroll counter: 0 - no scroll, any other number - scroll. Just count up, everything else will be calculated on the inside.
|
||||
* @param[in] ellipsis The ellipsis flag: true to add ellipse
|
||||
* @param[in] centered The centered flag: true to center text horizontally, x coordinate will indicate the middle
|
||||
*/
|
||||
void elements_scrollable_text_line_centered(
|
||||
Canvas* canvas,
|
||||
int32_t x,
|
||||
|
||||
Reference in New Issue
Block a user