Subversion Repositories Kolibri OS

Rev

Rev 3068 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef __WINLIB_H__
  2. #define __WINLIB_H__
  3.  
  4. #include "control.h"
  5.  
  6. #define CAPTION_HEIGHT      24
  7. #define PANEL_HEIGHT        55
  8.  
  9. typedef struct
  10. {
  11.     link_t      link;
  12.     link_t      child;
  13.  
  14.     handler_t  *handler;
  15.     ctrl_t     *parent;
  16.  
  17.     ctx_t      *ctx;
  18.     uint32_t    id;
  19.     uint32_t    style;
  20.  
  21.     rect_t      rc;
  22.     int         w;
  23.     int         h;
  24.  
  25.     rect_t      left;    /*  left  border            */
  26.     rect_t      right;   /*  right border            */
  27.     rect_t      bottom;  /*  bottom border           */
  28.  
  29.     button_t   *close_btn;
  30.     rect_t     *track;
  31. }frame_t;
  32.  
  33. typedef struct
  34. {
  35.     ctrl_t     ctrl;
  36.     ctx_t      ctx;
  37.     bitmap_t   bitmap;
  38.     char      *text;
  39.     ctrl_t    *child_over;
  40.     button_t  *close_btn;
  41.     button_t  *minimize_btn;
  42.  
  43. }caption_t;
  44.  
  45. typedef struct
  46. {
  47.     ctrl_t      ctrl;
  48.     ctx_t       ctx;
  49.     bitmap_t    bitmap;
  50.     rect_t      draw;
  51.     ctrl_t     *child_over;
  52.     int         layout;
  53.     progress_t *prg;
  54.     level_t    *lvl;
  55.     slider_t   *sld;
  56.     button_t   *play_btn;
  57.     button_t   *stop_btn;
  58. }panel_t;
  59.  
  60. typedef struct
  61. {
  62.     link_t       link;
  63.     link_t       child;
  64.  
  65.     handler_t   *handler;
  66.     ctrl_t      *parent;
  67.  
  68.     ctx_t       *ctx;
  69.     uint32_t     id;
  70.     uint32_t     style;
  71.  
  72.     rect_t       rc;
  73.     int          w;
  74.     int          h;
  75.  
  76.     rect_t       client;
  77.  
  78.     ctx_t        client_ctx;
  79.     bitmap_t     bitmap;
  80.  
  81.     char        *caption_txt;
  82.     ctrl_t      *child_over;
  83.     ctrl_t      *child_focus;
  84.  
  85.     caption_t    caption;
  86.     panel_t      panel;
  87.     frame_t      frame;
  88.  
  89.     enum win_state{
  90.       NORMAL, MINIMIZED, ROLLED, MAXIMIZED
  91.     }win_state;
  92.     enum win_command{
  93.         WIN_CLOSED=1
  94.     }win_command;
  95.  
  96. }window_t;
  97.  
  98. #define get_parent_window(x) ((window_t*)((x)->parent))
  99.  
  100. ctrl_t *win_get_child(window_t *win, int x, int y);
  101.  
  102. void init_winlib(void);
  103.  
  104. void draw_caption(caption_t *cpt);
  105. void draw_panel(panel_t *panel);
  106. void blit_caption(caption_t *cpt);
  107. int  init_caption(window_t *win);
  108. int  init_panel(window_t *win);
  109.  
  110.  
  111.  
  112. window_t  *create_window(char *caption, int style, int x, int y,
  113.                             int w, int h, handler_t handler);
  114.  
  115. int show_window(window_t *win, int state);
  116.  
  117. int def_window_proc(ctrl_t  *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2);
  118.  
  119. void frame_run(window_t *win);
  120.  
  121. button_t *create_button(char *caption, int id, int x, int y,
  122.                         int w, int h, ctrl_t *parent);
  123. progress_t *create_progress(char *caption, int id, int x, int y,
  124.                             int w, int h, ctrl_t *parent);
  125. level_t    *create_level(char *caption, int id, int x, int y,
  126.                          int w, int h, ctrl_t *parent);
  127. scroller_t *create_scroller(uint32_t style, int id, int x, int y,
  128.                             int w, int h, ctrl_t *parent);
  129. slider_t  *create_slider(char *caption, int id, int x, int y,
  130.                          int w, int h, ctrl_t *parent);
  131.  
  132.  
  133. //static uint32_t update_timers(uint32_t realtime);
  134.  
  135. int set_timer(ctrl_t *ctrl, ostimer_t *timer, uint32_t delay);
  136.  
  137. void update_rect(ctrl_t *ctrl);
  138.  
  139.  
  140. #endif
  141.