Prusa MINI Firmware overview
window_numb.c File Reference
#include "window_numb.h"
#include "gui.h"

Macros

#define WINDOW_NUMB_MAX_TEXT   16
 

Functions

void window_numb_init (window_numb_t *window)
 
void window_numb_draw (window_numb_t *window)
 

Variables

const window_class_numb_t window_class_numb
 

Macro Definition Documentation

◆ WINDOW_NUMB_MAX_TEXT

#define WINDOW_NUMB_MAX_TEXT   16

Function Documentation

◆ window_numb_init()

void window_numb_init ( window_numb_t window)
7  {
10  window->font = gui_defaults.font;
11  window->value = 0;
12  window->format = "%.0f";
13  window->padding = gui_defaults.padding;
15 }

◆ window_numb_draw()

void window_numb_draw ( window_numb_t window)
17  {
19  color_t clr_back = (window->win.flg & WINDOW_FLG_FOCUSED) ? window->color_text : window->color_back;
20  color_t clr_text = (window->win.flg & WINDOW_FLG_FOCUSED) ? window->color_back : window->color_text;
21  if (window->win.flg & WINDOW_FLG_CAPTURE)
22  clr_text = COLOR_ORANGE;
23  char text[WINDOW_NUMB_MAX_TEXT];
24  if (window->win.flg & WINDOW_FLG_NUMB_FLOAT2INT) {
25  sprintf(text, window->format, (int)(window->value));
26  } else {
27  sprintf(text, window->format, (double)window->value);
28  }
29 
30  render_text_align(window->win.rect,
31  text,
32  window->font,
33  clr_back,
34  clr_text,
35  window->padding,
36  window->alignment);
37  window->win.flg &= ~WINDOW_FLG_INVALID;
38  }
39 }
Here is the call graph for this function:

Variable Documentation

◆ window_class_numb

const window_class_numb_t window_class_numb
window_draw_t
void() window_draw_t(void *window)
Definition: window.h:57
_window_numb_t::padding
padding_ui8_t padding
Definition: window_numb.h:24
window_numb_init
void window_numb_init(window_numb_t *window)
Definition: window_numb.c:7
WINDOW_NUMB_MAX_TEXT
#define WINDOW_NUMB_MAX_TEXT
Definition: window_numb.c:5
_gui_defaults_t::color_text
color_t color_text
Definition: guitypes.h:108
WINDOW_CLS_NUMB
#define WINDOW_CLS_NUMB
Definition: window.h:11
_window_numb_t::font
font_t * font
Definition: window_numb.h:21
_window_numb_t::color_text
color_t color_text
Definition: window_numb.h:20
_gui_defaults_t::font
font_t * font
Definition: guitypes.h:110
WINDOW_FLG_VISIBLE
#define WINDOW_FLG_VISIBLE
Definition: window.h:24
_window_numb_t::value
float value
Definition: window_numb.h:22
_window_numb_t::color_back
color_t color_back
Definition: window_numb.h:19
_window_numb_t::alignment
uint8_t alignment
Definition: window_numb.h:25
_gui_defaults_t::padding
padding_ui8_t padding
Definition: guitypes.h:112
_window_numb_t::format
char * format
Definition: window_numb.h:23
COLOR_ORANGE
#define COLOR_ORANGE
Definition: guitypes.h:57
WINDOW_FLG_CAPTURE
#define WINDOW_FLG_CAPTURE
Definition: window.h:29
WINDOW_FLG_NUMB_FLOAT2INT
#define WINDOW_FLG_NUMB_FLOAT2INT
Definition: window_numb.h:8
_gui_defaults_t::color_back
color_t color_back
Definition: guitypes.h:107
render_text_align
void render_text_align(rect_ui16_t rc, const char *text, font_t *font, color_t clr0, color_t clr1, padding_ui8_t padding, uint16_t flags)
Definition: display_helper.c:6
_window_t::rect
rect_ui16_t rect
Definition: window.h:101
WINDOW_FLG_FOCUSED
#define WINDOW_FLG_FOCUSED
Definition: window.h:27
window_numb_draw
void window_numb_draw(window_numb_t *window)
Definition: window_numb.c:17
color_t
uint32_t color_t
Definition: guitypes.h:62
window_init_t
void() window_init_t(void *window)
Definition: window.h:55
gui_defaults
gui_defaults_t gui_defaults
Definition: gui.c:20
_gui_defaults_t::alignment
uint8_t alignment
Definition: guitypes.h:113
window_numb_t
struct _window_numb_t window_numb_t
_window_t::flg
uint32_t flg
Definition: window.h:81
_window_numb_t::win
window_t win
Definition: window_numb.h:18
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26