Subversion Repositories Kolibri OS

Rev

Rev 6466 | Rev 6589 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #ifndef KOLIBRI_FRAME_H
  2. #define KOLIBRI_FRAME_H
  3.  
  4. enum {
  5.         TOP,
  6.         BOTTON
  7. };
  8.  
  9. typedef struct {
  10.         uint32_t type;
  11.         uint32_t x_w;
  12.         uint32_t y_h;
  13.         color_t ext_col;
  14.         color_t int_col;
  15.         uint32_t draw_text_flag;
  16.         char *text_pointer;
  17.         uint32_t text_position;
  18.         uint32_t font_number;
  19.         uint32_t font_size_y;
  20.         color_t font_color;
  21.         color_t font_bg_color;
  22. }frame;
  23.  
  24. inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, uint32_t text_position, color_t font_color, color_t font_bgcolor)
  25. {
  26.     f->type = 0;
  27.     f->x_w = x_w;
  28.     f->y_h = y_h;
  29.     f->ext_col = ext_col;
  30.     f->int_col = int_col;
  31.     f->draw_text_flag = text != NULL;
  32.     f->text_pointer = text;
  33.     f->text_position = text_position;
  34.     f->font_number = 0;  // 0 == font 6x9, 1==8x16
  35.     f->font_size_y = 9;
  36.     f->font_color = font_color | 0x80000000;
  37.     f->font_bg_color = font_bgcolor;
  38.  
  39.     return f;
  40. }
  41.  
  42. inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, uint32_t text_position, color_t font_color, color_t font_bgcolor)
  43. {
  44.     frame *new_frame = (frame *)malloc(sizeof(frame));
  45.     return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor);
  46. }
  47.  
  48. inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text)
  49. {
  50.     return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area);
  51. }
  52.  
  53. inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text)
  54. {
  55.     return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area);
  56. }
  57.  
  58. inline void gui_add_frame(kolibri_window *wnd, frame* f)
  59. {
  60.     kolibri_window_add_element(wnd, KOLIBRI_FRAME, f);
  61. }
  62.  
  63.  
  64. extern void (*frame_draw)(frame *) __attribute__((__stdcall__));
  65.  
  66. #endif /* KOLIBRI_FRAME_H */
  67.