Prusa MINI Firmware overview
window.h File Reference
#include <inttypes.h>
#include "guitypes.h"

Go to the source code of this file.

Classes

struct  _window_class_t
 
struct  _window_t
 

Macros

#define WINDOW_CLS_FRAME   0
 
#define WINDOW_CLS_TEXT   1
 
#define WINDOW_CLS_NUMB   2
 
#define WINDOW_CLS_ICON   3
 
#define WINDOW_CLS_LIST   4
 
#define WINDOW_CLS_EDIT   5
 
#define WINDOW_CLS_SPIN   6
 
#define WINDOW_CLS_TXIC   7
 
#define WINDOW_CLS_TERM   8
 
#define WINDOW_CLS_MENU   9
 
#define WINDOW_CLS_MSGBOX   10
 
#define WINDOW_CLS_PROGRESS   11
 
#define WINDOW_CLS_USER   128
 
#define WINDOW_FLG_VISIBLE   0x00000001
 
#define WINDOW_FLG_ENABLED   0x00000002
 
#define WINDOW_FLG_INVALID   0x00000004
 
#define WINDOW_FLG_FOCUSED   0x00000008
 
#define WINDOW_FLG_CHECKED   0x00000010
 
#define WINDOW_FLG_CAPTURE   0x00000020
 
#define WINDOW_FLG_DISABLED   0x00000040
 
#define WINDOW_FLG_FREEMEM   0x00004000
 
#define WINDOW_FLG_PARENT   0x00008000
 
#define WINDOW_FLG_USER   0x00010000
 
#define WINDOW_EVENT_BTN_DN   0x01
 
#define WINDOW_EVENT_BTN_UP   0x02
 
#define WINDOW_EVENT_ENC_DN   0x03
 
#define WINDOW_EVENT_ENC_UP   0x04
 
#define WINDOW_EVENT_FOCUS0   0x05
 
#define WINDOW_EVENT_FOCUS1   0x06
 
#define WINDOW_EVENT_CAPT_0   0x07
 
#define WINDOW_EVENT_CAPT_1   0x08
 
#define WINDOW_EVENT_CLICK   0x09
 
#define WINDOW_EVENT_CHANGE   0x0a
 
#define WINDOW_EVENT_CHANGING   0x0b
 
#define WINDOW_EVENT_LOOP   0x0c
 
#define WINDOW_EVENT_TIMER   0x0d
 
#define WINDOW_EVENT_MESSAGE   0x0e
 

Typedefs

typedef struct _window_t window_t
 
typedef void() window_init_t(void *window)
 
typedef void() window_done_t(void *window)
 
typedef void() window_draw_t(void *window)
 
typedef void() window_event_t(void *window, uint8_t event, void *param)
 
typedef struct _window_list_t window_list_t
 
typedef void() window_list_item_t(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
 
typedef struct _window_class_t window_class_t
 

Functions

window_twindow_ptr (int16_t id)
 
int16_t window_id (window_t *ptr)
 
int16_t window_register_class (window_class_t *cls)
 
int16_t window_create (int16_t cls_id, int16_t id_parent, rect_ui16_t rect)
 
int16_t window_create_ptr (int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
 
void window_destroy (int16_t id)
 
void window_destroy_children (int16_t id)
 
int16_t window_focused (void)
 
int16_t window_capture (void)
 
int16_t window_parent (int16_t id)
 
int16_t window_prev (int16_t id)
 
int16_t window_next (int16_t id)
 
int16_t window_prev_enabled (int16_t id)
 
int16_t window_next_enabled (int16_t id)
 
int16_t window_first_child (int16_t id)
 
int window_child_count (int16_t id)
 
int window_enabled_child_count (int16_t id)
 
int window_is_visible (int16_t id)
 
int window_is_enabled (int16_t id)
 
int window_is_invalid (int16_t id)
 
int window_is_focused (int16_t id)
 
int window_is_capture (int16_t id)
 
void window_draw (int16_t id)
 
void window_draw_children (int16_t id)
 
void window_validate (int16_t id)
 
void window_invalidate (int16_t id)
 
void window_validate_children (int16_t id)
 
void window_invalidate_children (int16_t id)
 
void window_set_tag (int16_t id, uint8_t tag)
 
void _window_set_tag (window_t *wnd, uint8_t tg)
 
uint8_t window_get_tag (int16_t id)
 
int _window_get_tag (window_t *wnd)
 
void window_set_text (int16_t id, const char *text)
 
char * window_get_text (int16_t id)
 
void window_set_value (int16_t id, float value)
 
float window_get_value (int16_t id)
 
void window_set_format (int16_t id, const char *format)
 
char * window_get_format (int16_t id)
 
void window_set_color_back (int16_t id, color_t clr)
 
color_t window_get_color_back (int16_t id)
 
void window_set_color_text (int16_t id, color_t clr)
 
color_t window_get_color_text (int16_t id)
 
void window_set_focus (int16_t id)
 
void window_set_capture (int16_t id)
 
void window_enable (int16_t id)
 
void window_disable (int16_t id)
 
void window_show (int16_t id)
 
void window_hide (int16_t id)
 
void window_set_padding (int16_t id, padding_ui8_t padding)
 
void window_set_alignment (int16_t id, uint8_t alignment)
 
void window_set_item_count (int16_t id, int count)
 
int window_get_item_count (int16_t id)
 
void window_set_item_index (int16_t id, int index)
 
int window_get_item_index (int16_t id)
 
void window_set_top_index (int16_t id, int index)
 
int window_get_top_index (int16_t id)
 
void window_set_icon_id (int16_t id, uint16_t id_res)
 
uint16_t window_get_icon_id (int16_t id)
 
void window_set_min (int16_t id, float min)
 
float window_get_min (int16_t id)
 
void window_set_max (int16_t id, float max)
 
float window_get_max (int16_t id)
 
void window_set_step (int16_t id, float step)
 
float window_get_step (int16_t id)
 
void window_set_min_max (int16_t id, float min, float max)
 
void window_set_min_max_step (int16_t id, float min, float max, float step)
 
void window_dispatch_event (window_t *window, uint8_t event, void *param)
 
void window_set_item_callback (int16_t id, window_list_item_t *fnc)
 
void gui_invalidate (void)
 
static void _window_invalidate (window_t *window)
 

Variables

window_twindow_focused_ptr
 
window_twindow_capture_ptr
 

Macro Definition Documentation

◆ WINDOW_CLS_FRAME

#define WINDOW_CLS_FRAME   0

◆ WINDOW_CLS_TEXT

#define WINDOW_CLS_TEXT   1

◆ WINDOW_CLS_NUMB

#define WINDOW_CLS_NUMB   2

◆ WINDOW_CLS_ICON

#define WINDOW_CLS_ICON   3

◆ WINDOW_CLS_LIST

#define WINDOW_CLS_LIST   4

◆ WINDOW_CLS_EDIT

#define WINDOW_CLS_EDIT   5

◆ WINDOW_CLS_SPIN

#define WINDOW_CLS_SPIN   6

◆ WINDOW_CLS_TXIC

#define WINDOW_CLS_TXIC   7

◆ WINDOW_CLS_TERM

#define WINDOW_CLS_TERM   8

◆ WINDOW_CLS_MENU

#define WINDOW_CLS_MENU   9

◆ WINDOW_CLS_MSGBOX

#define WINDOW_CLS_MSGBOX   10

◆ WINDOW_CLS_PROGRESS

#define WINDOW_CLS_PROGRESS   11

◆ WINDOW_CLS_USER

#define WINDOW_CLS_USER   128

◆ WINDOW_FLG_VISIBLE

#define WINDOW_FLG_VISIBLE   0x00000001

◆ WINDOW_FLG_ENABLED

#define WINDOW_FLG_ENABLED   0x00000002

◆ WINDOW_FLG_INVALID

#define WINDOW_FLG_INVALID   0x00000004

◆ WINDOW_FLG_FOCUSED

#define WINDOW_FLG_FOCUSED   0x00000008

◆ WINDOW_FLG_CHECKED

#define WINDOW_FLG_CHECKED   0x00000010

◆ WINDOW_FLG_CAPTURE

#define WINDOW_FLG_CAPTURE   0x00000020

◆ WINDOW_FLG_DISABLED

#define WINDOW_FLG_DISABLED   0x00000040

◆ WINDOW_FLG_FREEMEM

#define WINDOW_FLG_FREEMEM   0x00004000

◆ WINDOW_FLG_PARENT

#define WINDOW_FLG_PARENT   0x00008000

◆ WINDOW_FLG_USER

#define WINDOW_FLG_USER   0x00010000

◆ WINDOW_EVENT_BTN_DN

#define WINDOW_EVENT_BTN_DN   0x01

◆ WINDOW_EVENT_BTN_UP

#define WINDOW_EVENT_BTN_UP   0x02

◆ WINDOW_EVENT_ENC_DN

#define WINDOW_EVENT_ENC_DN   0x03

◆ WINDOW_EVENT_ENC_UP

#define WINDOW_EVENT_ENC_UP   0x04

◆ WINDOW_EVENT_FOCUS0

#define WINDOW_EVENT_FOCUS0   0x05

◆ WINDOW_EVENT_FOCUS1

#define WINDOW_EVENT_FOCUS1   0x06

◆ WINDOW_EVENT_CAPT_0

#define WINDOW_EVENT_CAPT_0   0x07

◆ WINDOW_EVENT_CAPT_1

#define WINDOW_EVENT_CAPT_1   0x08

◆ WINDOW_EVENT_CLICK

#define WINDOW_EVENT_CLICK   0x09

◆ WINDOW_EVENT_CHANGE

#define WINDOW_EVENT_CHANGE   0x0a

◆ WINDOW_EVENT_CHANGING

#define WINDOW_EVENT_CHANGING   0x0b

◆ WINDOW_EVENT_LOOP

#define WINDOW_EVENT_LOOP   0x0c

◆ WINDOW_EVENT_TIMER

#define WINDOW_EVENT_TIMER   0x0d

◆ WINDOW_EVENT_MESSAGE

#define WINDOW_EVENT_MESSAGE   0x0e

Typedef Documentation

◆ window_t

typedef struct _window_t window_t

◆ window_init_t

typedef void() window_init_t(void *window)

◆ window_done_t

typedef void() window_done_t(void *window)

◆ window_draw_t

typedef void() window_draw_t(void *window)

◆ window_event_t

typedef void() window_event_t(void *window, uint8_t event, void *param)

◆ window_list_t

typedef struct _window_list_t window_list_t

◆ window_list_item_t

typedef void() window_list_item_t(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)

◆ window_class_t

Function Documentation

◆ window_ptr()

window_t* window_ptr ( int16_t  id)
82  {
83  return ((id >= 0) && (id < WINDOW_MAX_WINDOWS)) ? windows[id] : 0;
84 }
Here is the caller graph for this function:

◆ window_id()

int16_t window_id ( window_t ptr)
86  {
87  return (ptr) ? ptr->id : -1;
88 }
Here is the caller graph for this function:

◆ window_register_class()

int16_t window_register_class ( window_class_t cls)
90  {
94  }
95  return -1;
96 }
Here is the caller graph for this function:

◆ window_create()

int16_t window_create ( int16_t  cls_id,
int16_t  id_parent,
rect_ui16_t  rect 
)
98  {
99  return window_create_ptr(cls_id, id_parent, rect, 0);
100 }
Here is the call graph for this function:

◆ window_create_ptr()

int16_t window_create_ptr ( int16_t  cls_id,
int16_t  id_parent,
rect_ui16_t  rect,
void ptr 
)
102  {
103  window_class_t *cls = class_ptr(cls_id);
104  if (cls) {
105  uint32_t flg = WINDOW_FLG_VISIBLE | WINDOW_FLG_INVALID;
106  window_t *win = (window_t *)ptr;
107  if (win == 0) {
108  win = (window_t *)gui_malloc(cls->size);
109  flg |= WINDOW_FLG_FREEMEM;
110  }
111  if (win == 0)
112  return -1;
113  int16_t id = window_new_id(win);
114  if (id >= 0) {
115  win->id = id;
116  win->id_parent = id_parent;
117  win->cls = cls;
118  win->flg = flg;
119  win->rect = rect;
120  win->event = cls->event;
121  win->f_tag = 0;
122  if (cls->init)
123  cls->init(win);
124  return id;
125  }
126  if (win && (ptr == 0))
127  gui_free(win);
128  }
129  return -1;
130 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_destroy()

void window_destroy ( int16_t  id)
132  {
133  window_t *window = window_free_id(id);
134  uint16_t count = window_count;
135  if (window != 0) {
136  if (window->f_timer)
138  window->id = -1;
139  if (window->f_parent)
141  if (window->cls->done)
142  window->cls->done(window);
143  if (window->f_freemem)
144  gui_free(window);
145  if (window == window_capture_ptr)
146  window_capture_ptr = 0;
147  if (window == window_focused_ptr)
148  window_focused_ptr = 0;
149  if (window == window_1)
150  window_1 = 0;
151  //if (window == window_0) window_0 = 0;
152  if (count == 0)
153  window_0 = 0;
154  }
155 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_destroy_children()

void window_destroy_children ( int16_t  id)
157  {
158  window_t *window;
159  int16_t id_child;
160  for (id_child = 0; id_child < WINDOW_MAX_WINDOWS; id_child++)
161  if (((window = windows[id_child]) != 0) && (window->id_parent == id))
162  window_destroy(id_child);
163 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_focused()

int16_t window_focused ( void  )
165  {
167 }
Here is the caller graph for this function:

◆ window_capture()

int16_t window_capture ( void  )
169  {
171 }
Here is the caller graph for this function:

◆ window_parent()

int16_t window_parent ( int16_t  id)
173  {
174  window_t *win;
175  if ((id >= 0) && (id < WINDOW_MAX_WINDOWS) && ((win = windows[id]) != 0))
176  return win->id_parent;
177  return -1;
178 }
Here is the caller graph for this function:

◆ window_prev()

int16_t window_prev ( int16_t  id)
180  {
181  window_t *win;
182  if ((id >= 0) && (id < WINDOW_MAX_WINDOWS) && ((win = windows[id]) != 0)) {
183  int16_t id_parent = win->id_parent;
184  while (--id >= 0)
185  if ((win = windows[id]) != 0)
186  if (win->id_parent == id_parent)
187  return id;
188  }
189  return -1;
190 }
Here is the caller graph for this function:

◆ window_next()

int16_t window_next ( int16_t  id)
192  {
193  window_t *win;
194  if ((id >= 0) && (id < WINDOW_MAX_WINDOWS) && ((win = windows[id]) != 0)) {
195  int16_t id_parent = win->id_parent;
196  while (++id < WINDOW_MAX_WINDOWS)
197  if ((win = windows[id]) != 0)
198  if (win->id_parent == id_parent)
199  return id;
200  }
201  return -1;
202 }
Here is the caller graph for this function:

◆ window_prev_enabled()

int16_t window_prev_enabled ( int16_t  id)
204  {
205  while ((id = window_prev(id)) >= 0)
206  if (window_is_enabled(id))
207  return id;
208  return -1;
209 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_next_enabled()

int16_t window_next_enabled ( int16_t  id)
211  {
212  while ((id = window_next(id)) >= 0)
213  if (window_is_enabled(id))
214  return id;
215  return -1;
216 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_first_child()

int16_t window_first_child ( int16_t  id)
218  {
219  int16_t id_parent = id;
220  window_t *win;
221  if ((id >= 0) && (id < WINDOW_MAX_WINDOWS) && ((win = windows[id]) != 0)) {
222  while (++id < WINDOW_MAX_WINDOWS)
223  if ((win = windows[id]) != 0)
224  if (win->id_parent == id_parent)
225  return id;
226  }
227  return -1;
228 }
Here is the caller graph for this function:

◆ window_child_count()

int window_child_count ( int16_t  id)
230  {
231  int count = 0;
232  if ((id = window_first_child(id)) >= 0) {
233  count++;
234  while ((id = window_next(id)) >= 0)
235  count++;
236  }
237  return count;
238 }
Here is the call graph for this function:

◆ window_enabled_child_count()

int window_enabled_child_count ( int16_t  id)
240  {
241  int count = 0;
242  if ((id = window_first_child(id)) >= 0) {
243  if (window_is_enabled(id))
244  count++;
245  while ((id = window_next(id)) >= 0)
246  if (window_is_enabled(id))
247  count++;
248  }
249  return count;
250 }
Here is the call graph for this function:

◆ window_is_visible()

int window_is_visible ( int16_t  id)
252  {
253  window_t *window;
254  return ((window = window_ptr(id)) != 0) ? window->f_visible : 0;
255 }
Here is the call graph for this function:

◆ window_is_enabled()

int window_is_enabled ( int16_t  id)
257  {
258  window_t *window;
259  return ((window = window_ptr(id)) != 0) ? window->f_enabled : 0;
260 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_is_invalid()

int window_is_invalid ( int16_t  id)
262  {
263  window_t *window;
264  return ((window = window_ptr(id)) != 0) ? window->f_invalid : 0;
265 }
Here is the call graph for this function:

◆ window_is_focused()

int window_is_focused ( int16_t  id)
267  {
268  window_t *window;
269  return ((window = window_ptr(id)) != 0) ? window->f_focused : 0;
270 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_is_capture()

int window_is_capture ( int16_t  id)
272  {
273  window_t *window;
274  return ((window = window_ptr(id)) != 0) ? window->f_capture : 0;
275 }
Here is the call graph for this function:

◆ window_draw()

void window_draw ( int16_t  id)
277  {
278  window_t *window;
279  if ((window = window_ptr(id)) != 0)
280  if (window->cls->draw)
281  window->cls->draw(window);
282 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_draw_children()

void window_draw_children ( int16_t  id)
284  {
285  window_t *window;
286  int16_t id_child;
287  for (id_child = 0; id_child < WINDOW_MAX_WINDOWS; id_child++)
288  if (((window = windows[id_child]) != 0) && (window->id_parent == id)) {
289  if (window_1 && window_1->id != window->id_parent) {
291  if (window->cls->draw)
292  window->cls->draw(window);
293  } else if (window->cls->draw)
294  window->cls->draw(window);
295  }
296 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_validate()

void window_validate ( int16_t  id)
298  {
299  window_t *window;
300  if ((window = window_ptr(id)) != 0)
301  window->f_invalid = 0;
302 }
Here is the call graph for this function:

◆ window_invalidate()

void window_invalidate ( int16_t  id)
304  {
305  window_t *window;
306  if ((window = window_ptr(id)) != 0) {
307  window->f_invalid = 1;
308  gui_invalidate();
309  }
310 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_validate_children()

void window_validate_children ( int16_t  id)
312  {
313  window_t *window;
314  int16_t id_child;
315  for (id_child = 0; id_child < WINDOW_MAX_WINDOWS; id_child++)
316  if (((window = windows[id_child]) != 0) && (window->id_parent == id))
317  window->f_invalid = 0;
318 }

◆ window_invalidate_children()

void window_invalidate_children ( int16_t  id)
320  {
321  window_t *window;
322  int16_t id_child;
323  for (id_child = 0; id_child < WINDOW_MAX_WINDOWS; id_child++)
324  if (((window = windows[id_child]) != 0) && (window->id_parent == id))
325  window->f_invalid = 1;
326  gui_invalidate();
327 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_tag()

void window_set_tag ( int16_t  id,
uint8_t  tag 
)
329  {
330  window_t *window;
331  if ((window = window_ptr(id)) != 0)
332  window->f_tag = tag;
333 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _window_set_tag()

void _window_set_tag ( window_t wnd,
uint8_t  tg 
)

◆ window_get_tag()

uint8_t window_get_tag ( int16_t  id)
335  {
336  window_t *window;
337  return ((window = window_ptr(id)) != 0) ? window->f_tag : 0;
338 }
Here is the call graph for this function:

◆ _window_get_tag()

int _window_get_tag ( window_t wnd)

◆ window_set_text()

void window_set_text ( int16_t  id,
const char *  text 
)
340  {
341  window_t *window;
342  if ((window = window_ptr(id)) != 0) {
343  switch (window->cls->cls_id) {
344  case WINDOW_CLS_TEXT:
345  ((window_text_t *)window)->text = (char *)text;
346  break;
347  }
348  _window_invalidate((window_t *)window);
349  }
350 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_text()

char* window_get_text ( int16_t  id)
352  {
353  window_t *window;
354  if ((window = window_ptr(id)) != 0) {
355  switch (window->cls->cls_id) {
356  case WINDOW_CLS_TEXT:
357  return ((window_text_t *)window)->text;
358  }
359  }
360  return 0;
361 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_value()

void window_set_value ( int16_t  id,
float  value 
)
363  {
364  window_t *window;
365  if ((window = window_ptr(id)) != 0) {
366  switch (window->cls->cls_id) {
367  case WINDOW_CLS_NUMB:
368  ((window_numb_t *)window)->value = value;
369  break;
370  case WINDOW_CLS_SPIN:
371  if (value < ((window_spin_t *)window)->min)
372  value = ((window_spin_t *)window)->min;
373  if (value > ((window_spin_t *)window)->max)
374  value = ((window_spin_t *)window)->max;
375  ((window_spin_t *)window)->window.value = value;
376  ((window_spin_t *)window)->index = (int)((((window_spin_t *)window)->window.value - ((window_spin_t *)window)->min) / ((window_spin_t *)window)->step);
377  break;
378  case WINDOW_CLS_PROGRESS:
379  if (value < ((window_progress_t *)window)->min)
380  value = ((window_progress_t *)window)->min;
381  if (value > ((window_progress_t *)window)->max)
382  value = ((window_progress_t *)window)->max;
383  ((window_progress_t *)window)->value = value;
384  break;
385  }
386  _window_invalidate((window_t *)window);
387  }
388 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_value()

float window_get_value ( int16_t  id)
390  {
391  window_t *window;
392  if ((window = window_ptr(id)) != 0) {
393  switch (window->cls->cls_id) {
394  case WINDOW_CLS_NUMB:
395  return ((window_numb_t *)window)->value;
396  case WINDOW_CLS_SPIN:
397  return ((window_spin_t *)window)->window.value;
398  }
399  }
400  return 0;
401 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_format()

void window_set_format ( int16_t  id,
const char *  format 
)
403  {
404  window_t *window;
405  if ((window = window_ptr(id)) != 0) {
406  switch (window->cls->cls_id) {
407  case WINDOW_CLS_NUMB:
408  ((window_numb_t *)window)->format = (char *)format;
409  break;
410  case WINDOW_CLS_SPIN:
411  ((window_spin_t *)window)->window.format = (char *)format;
412  break;
413  }
414  _window_invalidate((window_t *)window);
415  }
416 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_format()

char* window_get_format ( int16_t  id)
418  {
419  window_t *window;
420  if ((window = window_ptr(id)) != 0) {
421  switch (window->cls->cls_id) {
422  case WINDOW_CLS_NUMB:
423  return ((window_numb_t *)window)->format;
424  case WINDOW_CLS_SPIN:
425  return ((window_spin_t *)window)->window.format;
426  }
427  }
428  return 0;
429 }
Here is the call graph for this function:

◆ window_set_color_back()

void window_set_color_back ( int16_t  id,
color_t  clr 
)
431  {
432  window_t *window;
433  if ((window = window_ptr(id)) != 0) {
434  switch (window->cls->cls_id) {
435  case WINDOW_CLS_FRAME:
436  ((window_frame_t *)window)->color_back = clr;
437  break;
438  case WINDOW_CLS_TEXT:
439  ((window_text_t *)window)->color_back = clr;
440  break;
441  }
442  _window_invalidate((window_t *)window);
443  }
444 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_color_back()

color_t window_get_color_back ( int16_t  id)
446  {
447  window_t *window;
448  if ((window = window_ptr(id)) != 0) {
449  switch (window->cls->cls_id) {
450  case WINDOW_CLS_TEXT:
451  return ((window_text_t *)window)->color_back;
452  }
453  }
454  return COLOR_BLACK;
455 }
Here is the call graph for this function:

◆ window_set_color_text()

void window_set_color_text ( int16_t  id,
color_t  clr 
)
457  {
458  window_t *window;
459  if ((window = window_ptr(id)) != 0) {
460  switch (window->cls->cls_id) {
461  case WINDOW_CLS_TEXT:
462  ((window_text_t *)window)->color_text = clr;
463  break;
464  }
465  _window_invalidate((window_t *)window);
466  }
467 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_color_text()

color_t window_get_color_text ( int16_t  id)
469  {
470  window_t *window;
471  if ((window = window_ptr(id)) != 0) {
472  switch (window->cls->cls_id) {
473  case WINDOW_CLS_TEXT:
474  return ((window_text_t *)window)->color_text;
475  }
476  }
477  return COLOR_BLACK;
478 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_focus()

void window_set_focus ( int16_t  id)
480  {
481  window_t *window;
482  if ((window = window_ptr(id)) != 0) {
483  if (window->f_visible && window->f_enabled) {
484  if (window_focused_ptr) {
489  }
490  window_focused_ptr = window;
491  window->f_focused = 1;
492  window->f_invalid = 1;
493  if (window->event)
494  window->event(window, WINDOW_EVENT_FOCUS1, 0);
495  gui_invalidate();
496  }
497  }
498 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_capture()

void window_set_capture ( int16_t  id)
500  {
501  window_t *window;
502  if ((window = window_ptr(id)) != 0) {
503  if (window->f_visible && window->f_enabled && window->event) {
504  if (window_capture_ptr) {
508  }
509  window_capture_ptr = window;
510  window->f_capture = 1;
511  window->event(window, WINDOW_EVENT_CAPT_1, 0);
512  gui_invalidate();
513  }
514  }
515 }
Here is the call graph for this function:

◆ window_enable()

void window_enable ( int16_t  id)
517  {
518  window_t *window;
519  if ((window = window_ptr(id)) != 0)
520  window->f_enabled = 1;
521 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_disable()

void window_disable ( int16_t  id)
523  {
524  window_t *window;
525  if ((window = window_ptr(id)) != 0)
526  window->f_enabled = 0;
527 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_show()

void window_show ( int16_t  id)
529  {
530  window_t *window;
531  if ((window = window_ptr(id)) != 0) {
532  if ((window->f_visible) == 0) {
533  window->f_visible = 1;
534  _window_invalidate((window_t *)window);
535  }
536  }
537 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_hide()

void window_hide ( int16_t  id)
539  {
540  window_t *window;
541  if ((window = window_ptr(id)) != 0) {
542  if (window->f_visible) {
543  window->f_visible = 0;
544  _window_invalidate((window_t *)window);
545  }
546  }
547 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_padding()

void window_set_padding ( int16_t  id,
padding_ui8_t  padding 
)
549  {
550  window_t *window;
551  if ((window = window_ptr(id)) != 0) {
552  switch (window->cls->cls_id) {
553  case WINDOW_CLS_TEXT:
554  ((window_text_t *)window)->padding = padding;
555  break;
556  }
557  _window_invalidate((window_t *)window);
558  }
559 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_alignment()

void window_set_alignment ( int16_t  id,
uint8_t  alignment 
)
561  {
562  window_t *window;
563  if ((window = window_ptr(id)) != 0) {
564  switch (window->cls->cls_id) {
565  case WINDOW_CLS_TEXT:
566  ((window_text_t *)window)->alignment = alignment;
567  break;
568  }
569  _window_invalidate((window_t *)window);
570  }
571 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_item_count()

void window_set_item_count ( int16_t  id,
int  count 
)
573  {
574  window_t *window;
575  if ((window = window_ptr(id)) != 0) {
576  switch (window->cls->cls_id) {
577  case WINDOW_CLS_LIST:
578  ((window_list_t *)window)->count = count;
579  break;
580  }
581  _window_invalidate((window_t *)window);
582  }
583 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_item_count()

int window_get_item_count ( int16_t  id)
585  {
586  window_t *window;
587  if ((window = window_ptr(id)) != 0) {
588  switch (window->cls->cls_id) {
589  case WINDOW_CLS_LIST:
590  return ((window_list_t *)window)->count;
591  case WINDOW_CLS_SPIN:
592  return ((window_spin_t *)window)->count;
593  }
594  }
595  return -1;
596 }
Here is the call graph for this function:

◆ window_set_item_index()

void window_set_item_index ( int16_t  id,
int  index 
)
598  {
599  window_t *window;
600  if ((window = window_ptr(id)) != 0) {
601  switch (window->cls->cls_id) {
602  case WINDOW_CLS_MENU:
603  if (((window_menu_t *)window)->count > index) {
604  ((window_menu_t *)window)->index = index;
605  }
606  break;
607  case WINDOW_CLS_LIST:
608  if (((window_list_t *)window)->count > index) {
609  ((window_list_t *)window)->index = index;
610  }
611  break;
612  case WINDOW_CLS_SPIN:
613  if (((window_spin_t *)window)->count > index) {
614  ((window_spin_t *)window)->index = index;
615  ((window_spin_t *)window)->window.value = ((window_spin_t *)window)->min + ((window_spin_t *)window)->step * ((window_spin_t *)window)->index;
616  }
617  break;
618  }
619  _window_invalidate((window_t *)window);
620  }
621 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_item_index()

int window_get_item_index ( int16_t  id)
623  {
624  window_t *window;
625  if ((window = window_ptr(id)) != 0) {
626  switch (window->cls->cls_id) {
627  case WINDOW_CLS_LIST:
628  return ((window_list_t *)window)->index;
629  case WINDOW_CLS_SPIN:
630  return ((window_spin_t *)window)->index;
631  }
632  }
633  return -1;
634 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_top_index()

void window_set_top_index ( int16_t  id,
int  index 
)
636  {
637  window_t *window;
638  if ((window = window_ptr(id)) != 0) {
639  switch (window->cls->cls_id) {
640  case WINDOW_CLS_LIST:
641  ((window_list_t *)window)->top_index = top_index;
642  break;
643  }
644  _window_invalidate((window_t *)window);
645  }
646 }
Here is the call graph for this function:

◆ window_get_top_index()

int window_get_top_index ( int16_t  id)
648  {
649  window_t *window;
650  if ((window = window_ptr(id)) != 0) {
651  switch (window->cls->cls_id) {
652  case WINDOW_CLS_LIST:
653  return ((window_list_t *)window)->top_index;
654  }
655  }
656  return -1;
657 }
Here is the call graph for this function:

◆ window_set_icon_id()

void window_set_icon_id ( int16_t  id,
uint16_t  id_res 
)
659  {
660  window_t *window;
661  if ((window = window_ptr(id)) != 0) {
662  switch (window->cls->cls_id) {
663  case WINDOW_CLS_ICON:
664  ((window_icon_t *)window)->id_res = id_res;
665  break;
666  }
667  _window_invalidate((window_t *)window);
668  }
669 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_get_icon_id()

uint16_t window_get_icon_id ( int16_t  id)
671  {
672  window_t *window;
673  if ((window = window_ptr(id)) != 0) {
674  switch (window->cls->cls_id) {
675  case WINDOW_CLS_ICON:
676  return ((window_icon_t *)window)->id_res;
677  }
678  }
679  return 0;
680 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_set_min()

void window_set_min ( int16_t  id,
float  min 
)
682  {
683  window_t *window;
684  if ((window = window_ptr(id)) != 0) {
685  switch (window->cls->cls_id) {
686  case WINDOW_CLS_SPIN:
687  ((window_spin_t *)window)->min = min;
688  break;
689  }
690  _window_invalidate((window_t *)window);
691  }
692 }
Here is the call graph for this function:

◆ window_get_min()

float window_get_min ( int16_t  id)
694  {
695  window_t *window;
696  if ((window = window_ptr(id)) != 0)
697  switch (window->cls->cls_id) {
698  case WINDOW_CLS_SPIN:
699  return ((window_spin_t *)window)->min;
700  }
701  return 0;
702 }
Here is the call graph for this function:

◆ window_set_max()

void window_set_max ( int16_t  id,
float  max 
)
704  {
705  window_t *window;
706  if ((window = window_ptr(id)) != 0) {
707  switch (window->cls->cls_id) {
708  case WINDOW_CLS_SPIN:
709  ((window_spin_t *)window)->max = max;
710  break;
711  }
712  _window_invalidate((window_t *)window);
713  }
714 }
Here is the call graph for this function:

◆ window_get_max()

float window_get_max ( int16_t  id)
716  {
717  window_t *window;
718  if ((window = window_ptr(id)) != 0)
719  switch (window->cls->cls_id) {
720  case WINDOW_CLS_SPIN:
721  return ((window_spin_t *)window)->max;
722  }
723  return 0;
724 }
Here is the call graph for this function:

◆ window_set_step()

void window_set_step ( int16_t  id,
float  step 
)
726  {
727  window_t *window;
728  if ((window = window_ptr(id)) != 0) {
729  switch (window->cls->cls_id) {
730  case WINDOW_CLS_SPIN:
731  ((window_spin_t *)window)->step = step;
732  break;
733  }
734  _window_invalidate((window_t *)window);
735  }
736 }
Here is the call graph for this function:

◆ window_get_step()

float window_get_step ( int16_t  id)
738  {
739  window_t *window;
740  if ((window = window_ptr(id)) != 0)
741  switch (window->cls->cls_id) {
742  case WINDOW_CLS_SPIN:
743  return ((window_spin_t *)window)->step;
744  }
745  return 0;
746 }
Here is the call graph for this function:

◆ window_set_min_max()

void window_set_min_max ( int16_t  id,
float  min,
float  max 
)
748  {
749  window_t *window;
750  if ((window = window_ptr(id)) != 0) {
751  switch (window->cls->cls_id) {
752  case WINDOW_CLS_SPIN:
753  if (((window_spin_t *)window)->window.value < min)
754  ((window_spin_t *)window)->window.value = min;
755  if (((window_spin_t *)window)->window.value > max)
756  ((window_spin_t *)window)->window.value = max;
757  ((window_spin_t *)window)->min = min;
758  ((window_spin_t *)window)->max = max;
759  ((window_spin_t *)window)->count = (int)((max - min) / ((window_spin_t *)window)->step + 1.5F);
760  ((window_spin_t *)window)->index = (int)((((window_spin_t *)window)->window.value - min) / ((window_spin_t *)window)->step);
761  break;
762  }
763  _window_invalidate((window_t *)window);
764  }
765 }
Here is the call graph for this function:

◆ window_set_min_max_step()

void window_set_min_max_step ( int16_t  id,
float  min,
float  max,
float  step 
)
767  {
768  window_t *window;
769  if ((window = window_ptr(id)) != 0) {
770  switch (window->cls->cls_id) {
771  case WINDOW_CLS_SPIN:
772  if (((window_spin_t *)window)->window.value < min)
773  ((window_spin_t *)window)->window.value = min;
774  if (((window_spin_t *)window)->window.value > max)
775  ((window_spin_t *)window)->window.value = max;
776  ((window_spin_t *)window)->min = min;
777  ((window_spin_t *)window)->max = max;
778  ((window_spin_t *)window)->step = step;
779  ((window_spin_t *)window)->count = (int)((max - min) / step + 1.5F);
780  ((window_spin_t *)window)->index = (int)((((window_spin_t *)window)->window.value - min) / step);
781  break;
782  }
783  _window_invalidate((window_t *)window);
784  }
785 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_dispatch_event()

void window_dispatch_event ( window_t window,
uint8_t  event,
void param 
)
797  {
798  if (window && window->event)
799  window->event(window, event, param);
800 }
Here is the caller graph for this function:

◆ window_set_item_callback()

void window_set_item_callback ( int16_t  id,
window_list_item_t fnc 
)
787  {
788  window_t *window;
789  if ((window = window_ptr(id)) != 0) {
790  switch (window->cls->cls_id) {
791  case WINDOW_CLS_LIST:
792  ((window_list_t *)window)->list_item = fnc;
793  }
794  }
795 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_invalidate()

void gui_invalidate ( void  )
66  {
68 #ifdef GUI_USE_RTOS
69  osSignalSet(gui_task_handle, GUI_SIG_REDRAW);
70 #endif //GUI_USE_RTOS
71 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _window_invalidate()

static void _window_invalidate ( window_t window)
static
257  {
258  if (window) {
259  window->flg |= WINDOW_FLG_INVALID;
260  gui_invalidate();
261  }
262 }
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ window_focused_ptr

window_t* window_focused_ptr

◆ window_capture_ptr

window_t* window_capture_ptr
gui_timers_delete_by_window_id
void gui_timers_delete_by_window_id(int16_t win_id)
Definition: gui_timer.c:91
WINDOW_MAX_USERCLS
#define WINDOW_MAX_USERCLS
Definition: window.c:8
WINDOW_EVENT_CAPT_0
#define WINDOW_EVENT_CAPT_0
Definition: window.h:44
window_ptr
window_t * window_ptr(int16_t id)
Definition: window.c:82
_window_text_t
Definition: window_text.h:15
window_is_enabled
int window_is_enabled(int16_t id)
Definition: window.c:257
WINDOW_EVENT_CAPT_1
#define WINDOW_EVENT_CAPT_1
Definition: window.h:45
_window_class_t::size
uint16_t size
Definition: window.h:69
_window_t::id_parent
int16_t id_parent
Definition: window.h:78
gui_free
void gui_free(void *ptr)
Definition: gui.c:39
_window_class_t::cls_id
int16_t cls_id
Definition: window.h:68
_window_t::f_enabled
uint32_t f_enabled
Definition: window.h:86
_window_frame_t
Definition: window_frame.h:18
_window_spin_t
Definition: window_spin.h:12
_window_t::f_timer
uint32_t f_timer
Definition: window.h:94
WINDOW_CLS_NUMB
#define WINDOW_CLS_NUMB
Definition: window.h:11
gui_malloc
void * gui_malloc(unsigned int size)
Definition: gui.c:35
window_free_id
window_t * window_free_id(int16_t id)
Definition: window.c:64
WINDOW_CLS_USER
#define WINDOW_CLS_USER
Definition: window.h:21
WINDOW_FLG_VISIBLE
#define WINDOW_FLG_VISIBLE
Definition: window.h:24
max
#define max(a, b)
Definition: wiring_constants.h:40
_window_class_t::draw
window_draw_t * draw
Definition: window.h:72
gui_flags
uint16_t gui_flags
Definition: gui.c:9
osSignalSet
int32_t osSignalSet(osThreadId thread_id, int32_t signal)
Set the specified Signal Flags of an active thread.
Definition: cmsis_os.c:545
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
window_0
window_t * window_0
Definition: window.c:12
_window_icon_t
Definition: window_icon.h:11
window_destroy_children
void window_destroy_children(int16_t id)
Definition: window.c:157
window_first_child
int16_t window_first_child(int16_t id)
Definition: window.c:218
GUI_FLG_INVALID
#define GUI_FLG_INVALID
Definition: gui.c:7
_window_class_t::done
window_done_t * done
Definition: window.h:71
window_focused_ptr
window_t * window_focused_ptr
Definition: window.c:19
_window_t::id
int16_t id
Definition: window.h:79
_window_t::f_invalid
uint32_t f_invalid
Definition: window.h:87
WINDOW_CLS_LIST
#define WINDOW_CLS_LIST
Definition: window.h:13
_window_numb_t
Definition: window_numb.h:17
_window_t::f_parent
uint32_t f_parent
Definition: window.h:95
gui_invalidate
void gui_invalidate(void)
Definition: gui.c:66
min
#define min(a, b)
Definition: wiring_constants.h:36
WINDOW_CLS_SPIN
#define WINDOW_CLS_SPIN
Definition: window.h:15
window_user_classes
window_class_t * window_user_classes[WINDOW_MAX_USERCLS]
Definition: window.c:40
WINDOW_CLS_PROGRESS
#define WINDOW_CLS_PROGRESS
Definition: window.h:20
rect_empty_ui16
static int rect_empty_ui16(rect_ui16_t rc)
Definition: guitypes.h:177
rect_intersect_ui16
rect_ui16_t rect_intersect_ui16(rect_ui16_t rc, rect_ui16_t rc1)
Definition: guitypes.c:37
_window_t
Definition: window.h:76
WINDOW_EVENT_FOCUS0
#define WINDOW_EVENT_FOCUS0
Definition: window.h:42
_window_class_t::event
window_event_t * event
Definition: window.h:73
window_create_ptr
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
WINDOW_CLS_FRAME
#define WINDOW_CLS_FRAME
Definition: window.h:9
WINDOW_CLS_MENU
#define WINDOW_CLS_MENU
Definition: window.h:18
WINDOW_EVENT_FOCUS1
#define WINDOW_EVENT_FOCUS1
Definition: window.h:43
_window_class_t::init
window_init_t * init
Definition: window.h:70
gui_invalidate
void gui_invalidate(void)
Definition: gui.c:66
window_prev
int16_t window_prev(int16_t id)
Definition: window.c:180
window_count
uint16_t window_count
Definition: window.c:17
_window_class_t
Definition: window.h:67
_window_t::rect
rect_ui16_t rect
Definition: window.h:101
window_user_class_count
uint16_t window_user_class_count
Definition: window.c:42
WINDOW_CLS_ICON
#define WINDOW_CLS_ICON
Definition: window.h:12
_window_t::f_capture
uint32_t f_capture
Definition: window.h:90
WINDOW_CLS_TEXT
#define WINDOW_CLS_TEXT
Definition: window.h:10
_window_t::f_visible
uint32_t f_visible
Definition: window.h:85
window_next
int16_t window_next(int16_t id)
Definition: window.c:192
WINDOW_MAX_WINDOWS
#define WINDOW_MAX_WINDOWS
Definition: window.c:6
_window_t::event
window_event_t * event
Definition: window.h:102
COLOR_BLACK
#define COLOR_BLACK
Definition: guitypes.h:40
window_new_id
int16_t window_new_id(window_t *window)
Definition: window.c:44
window_capture_ptr
window_t * window_capture_ptr
Definition: window.c:21
_window_t::f_focused
uint32_t f_focused
Definition: window.h:88
class_ptr
window_class_t * class_ptr(int16_t cls_id)
Definition: window.c:73
createSpeedLookupTable.int
int
Definition: createSpeedLookupTable.py:15
window_1
window_t * window_1
Definition: window.c:14
_window_menu_t
Definition: window_menu.h:83
windows
window_t * windows[WINDOW_MAX_WINDOWS]
Definition: window.c:16
WINDOW_FLG_FREEMEM
#define WINDOW_FLG_FREEMEM
Definition: window.h:31
_window_list_t
Definition: window_list.h:15
_window_t::flg
uint32_t flg
Definition: window.h:81
_window_progress_t
Definition: window_progress.h:15
_window_t::cls
window_class_t * cls
Definition: window.h:77
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26
_window_t::f_tag
uint32_t f_tag
Definition: window.h:98
_window_invalidate
static void _window_invalidate(window_t *window)
Definition: window.h:257
GUI_SIG_REDRAW
#define GUI_SIG_REDRAW
Definition: guiconfig.h:15
_window_t::f_freemem
uint32_t f_freemem
Definition: window.h:93