Subversion Repositories Kolibri OS

Rev

Rev 6479 | 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 fr_text_position_t {
  5.         FR_TOP,
  6.         FR_BOTTON
  7. };
  8.  
  9. /*
  10. ; FR_FLAGS = [x][yyy][z]
  11. ; z        -  Caption
  12. ; yyy      -  BorderStyle
  13. ; x        -  BackStyle
  14. */
  15. enum fr_flags_t {
  16.     FR_CAPTION = 1,  // if text != null set auto
  17.     FR_DOUBLE = 0, // default
  18.     FR_RAISED = 2,
  19.     FR_SUNKEN = 4,
  20.     FR_ETCHED = 6,
  21.     FR_RINGED = 8,
  22.     FR_FILLED = 0x10
  23. };
  24.  
  25. typedef struct {
  26.         uint32_t type;
  27.         uint32_t x_w;
  28.         uint32_t y_h;
  29.         color_t ext_col;
  30.         color_t int_col;
  31.         uint32_t flags;
  32.         char *text_pointer;
  33.         uint32_t text_position;
  34.         uint32_t font_number;
  35.         uint32_t font_size_y;
  36.         color_t font_color;
  37.         color_t font_bg_color;
  38. }frame;
  39.  
  40. inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
  41.                             color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
  42. {
  43.     f->type = 0;
  44.     f->x_w = x_w;
  45.     f->y_h = y_h;
  46.     f->ext_col = ext_col;
  47.     f->int_col = int_col;
  48.     f->flags = flags;
  49.     if (text) f->flags |= FR_CAPTION;
  50.     f->text_pointer = text;
  51.     f->text_position = text_position;
  52.     f->font_number = 0;  // 0 == font 6x9, 1==8x16
  53.     f->font_size_y = 9;
  54.     f->font_color = font_color | 0x80000000;
  55.     f->font_bg_color = font_bgcolor;
  56.  
  57.  
  58.     return f;
  59. }
  60.  
  61. inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
  62.                                 color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
  63. {
  64.     frame *new_frame = (frame *)malloc(sizeof(frame));
  65.     return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags);
  66. }
  67.  
  68. inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text)
  69. {
  70.     return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
  71. }
  72.  
  73. inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text)
  74. {
  75.     return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
  76. }
  77.  
  78. inline void gui_add_frame(kolibri_window *wnd, frame* f)
  79. {
  80.     kolibri_window_add_element(wnd, KOLIBRI_FRAME, f);
  81. }
  82.  
  83.  
  84. extern void (*frame_draw)(frame *) __attribute__((__stdcall__));
  85.  
  86. #endif /* KOLIBRI_FRAME_H */
  87.