Subversion Repositories Kolibri OS

Rev

Rev 2693 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2693 Serge 1
#ifndef __WINLIB_H__
2
#define __WINLIB_H__
3
 
4
#include "control.h"
5
 
3068 serge 6
#define CAPTION_HEIGHT      24
7
#define PANEL_HEIGHT        55
8
 
2693 Serge 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;
3068 serge 37
    char      *text;
2693 Serge 38
    ctrl_t    *child_over;
39
    button_t  *close_btn;
40
    button_t  *minimize_btn;
41
 
42
}caption_t;
43
 
44
typedef struct
45
{
46
    ctrl_t      ctrl;
47
    ctx_t       ctx;
48
    rect_t      draw;
49
    ctrl_t     *child_over;
3068 serge 50
    int         layout;
2693 Serge 51
    progress_t *prg;
3068 serge 52
    level_t    *lvl;
53
    slider_t   *sld;
2693 Serge 54
    button_t   *play_btn;
3068 serge 55
    button_t   *stop_btn;
2693 Serge 56
}panel_t;
57
 
58
typedef struct
59
{
60
    link_t       link;
61
    link_t       child;
62
 
63
    handler_t   *handler;
64
    ctrl_t      *parent;
65
 
66
    ctx_t       *ctx;
67
    uint32_t     id;
68
    uint32_t     style;
69
 
70
    rect_t       rc;
71
    int          w;
72
    int          h;
73
 
74
    rect_t       client;
75
 
76
    ctx_t        client_ctx;
77
 
78
    char        *caption_txt;
79
    ctrl_t      *child_over;
80
    ctrl_t      *child_focus;
81
 
82
    caption_t    caption;
83
    panel_t      panel;
84
    frame_t      frame;
85
 
86
    enum win_state{
87
      NORMAL, MINIMIZED, ROLLED, MAXIMIZED
88
    }win_state;
89
    enum win_command{
90
        WIN_CLOSED=1
91
    }win_command;
92
 
93
}window_t;
94
 
95
#define get_parent_window(x) ((window_t*)((x)->parent))
96
 
97
ctrl_t *win_get_child(window_t *win, int x, int y);
98
 
99
void init_winlib(void);
100
 
101
void draw_caption(caption_t *cpt);
102
void draw_panel(panel_t *panel);
103
void blit_caption(caption_t *cpt);
104
int  init_caption(window_t *win);
105
int  init_panel(window_t *win);
106
 
107
 
108
 
109
window_t  *create_window(char *caption, int style, int x, int y,
110
                            int w, int h, handler_t handler);
111
 
112
int show_window(window_t *win, int state);
113
 
114
int def_window_proc(ctrl_t  *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2);
115
 
116
void frame_run(window_t *win);
117
 
118
button_t *create_button(char *caption, int id, int x, int y,
3068 serge 119
                        int w, int h, ctrl_t *parent);
120
progress_t *create_progress(char *caption, int id, int x, int y,
2693 Serge 121
                            int w, int h, ctrl_t *parent);
3068 serge 122
level_t    *create_level(char *caption, int id, int x, int y,
123
                         int w, int h, ctrl_t *parent);
2693 Serge 124
scroller_t *create_scroller(uint32_t style, int id, int x, int y,
3068 serge 125
                            int w, int h, ctrl_t *parent);
2693 Serge 126
 
127
//static uint32_t update_timers(uint32_t realtime);
128
 
129
int set_timer(ctrl_t *ctrl, ostimer_t *timer, uint32_t delay);
130
 
131
void update_rect(ctrl_t *ctrl);
132
 
133
 
134
#endif