Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
2693 Serge 1
 
2
#include 
3
#include 
4
#include 
5
#include "winlib.h"
6
7
 
8
#define FRAME_WIDTH         7
9
10
 
11
12
 
13
extern uint32_t  cursor_we;
14
extern uint32_t  cursor_nwse;
15
extern uint32_t  cursor_nesw;
16
17
 
18
19
 
20
                      uint32_t arg1, uint32_t arg2);
21
22
 
23
{
24
    frame_t *fr = &win->frame;
25
26
 
27
    fr->left.t  = win->client.t;
28
    fr->left.r  = FRAME_WIDTH;
29
    fr->left.b  = win->h-FRAME_WIDTH;
30
31
 
32
    fr->right.t = win->client.t;
33
    fr->right.r = win->w;
34
    fr->right.b = win->h-FRAME_WIDTH;
35
36
 
37
    fr->bottom.t = win->h - FRAME_WIDTH;
38
    fr->bottom.r = win->w;
39
    fr->bottom.b = win->h;
40
41
 
42
    win->client.r = win->w - FRAME_WIDTH;
43
//    win->client.b = win->h - FRAME_WIDTH;
44
//    printf("Left: l:%d t:%d r:%d b:%d\n",
45
//            fr->left.l,fr->left.t,fr->left.r,fr->left.b);
46
//    printf("Left: l:%d t:%d r:%d b:%d\n",
47
//            fr->right.l,fr->right.t,fr->right.r,fr->right.b);
48
//    printf("Left: l:%d t:%d r:%d b:%d\n",
49
//            fr->bottom.l,fr->bottom.t,fr->bottom.r,fr->bottom.b);
50
51
 
52
53
 
54
{
55
    frame_t *fr = &win->frame;
56
57
 
58
    list_initialize(&fr->child);
59
60
 
61
    fr->parent  = (ctrl_t*)win;
62
63
 
64
};
65
66
 
67
 
68
extern int res_border_right[];
69
70
 
71
{
72
    int *pixmap, *src;
73
    int  i, j;
74
75
 
76
77
 
78
79
 
3248 Serge 80
    pixmap+= CAPTION_HEIGHT*win->w;
2693 Serge 81
    src = res_border_left;
82
83
 
84
    {
85
        for(j = 0; j < FRAME_WIDTH; j++)
86
            pixmap[j] = src[j];
87
88
 
3248 Serge 89
    };
2693 Serge 90
91
 
92
 
3248 Serge 93
    pixmap+= (CAPTION_HEIGHT+1)*win->w - FRAME_WIDTH;
2693 Serge 94
    src = res_border_right;
95
96
 
97
    {
98
        for(j = 0; j < FRAME_WIDTH; j++)
99
            pixmap[j] = src[j];
100
101
 
3248 Serge 102
    };
2693 Serge 103
104
 
3248 Serge 105
2693 Serge 106
 
107
108
 
109
    {
110
        for(j = 0; j < win->w; j++)
111
            pixmap[j] = 0x808080;
112
113
 
3248 Serge 114
    };
2693 Serge 115
116
 
117
    child  = (ctrl_t*)fr->child.next;
118
119
 
120
    {
121
        send_message(child, 1, 0, 0);
122
        child = (ctrl_t*)child->link.next;
123
    };
124
125
 
126
};
127
128
 
129
{
130
    static  pos_t spos;
131
    static  track_mode;
132
133
 
134
    ctrl_t   *child;
135
136
 
137
    window_t *win = (window_t*)fr->parent;
138
    rect_t  *rc = NULL;
139
    int  x, y;
140
141
 
3334 Serge 142
        return 0;
143
144
 
2693 Serge 145
    y = ((pos_t)arg2).y;
146
147
 
148
 
149
//    if(child)
150
//    {
151
//        return send_message(child, msg, 0, arg2);
152
//    };
153
154
 
155
        (msg == MSG_MOUSEMOVE) )
156
    {
157
        x = ((pos_t)arg2).x;
158
        y = ((pos_t)arg2).y;
159
160
 
161
        {
162
            rc = &fr->left;
163
            if( (y+24) > win->h)
164
                 cursor = cursor_nesw;
165
            else
166
                cursor = cursor_we;
167
            set_cursor(cursor);
168
            main_cursor = cursor;
169
        }
170
        else if( pt_in_rect(&fr->right, x, y))
171
        {
172
//            printf("pos x%d y%d\n", x, y);
173
174
 
175
            if( (y+24) > win->h)
176
                 cursor = cursor_nwse;
177
            else
178
                 cursor = cursor_we;
179
//            printf("Set cursor %x\n", cursor);
180
            set_cursor(cursor);
181
            main_cursor = cursor;
182
        }
183
        else if( pt_in_rect(&fr->bottom, x, y))
184
        {
185
            rc = &fr->bottom;
186
            cursor = cursor_ns;
187
            if(x+24 > win->w)
188
                cursor = cursor_nwse;
189
            else if(x < rc->l+24)
190
                cursor = cursor_nesw;
191
            set_cursor(cursor);
192
            main_cursor = cursor;
193
        }
194
    };
195
196
 
197
    {
198
        case MSG_LBTNDOWN:
199
            if( rc != NULL)
200
            {
201
                int relx, rely;
202
203
 
204
                spos = get_cursor_pos();
205
                fr->track = rc;
206
207
 
208
                rely = spos.y - win->rc.t;
209
//                printf("relx %d rely %d\n", relx, rely);
210
211
 
212
                   fr->track == &fr->right)
213
                {
214
                    if(rely+24 > win->h)
215
                        track_mode = 1;
216
                };
217
                if(fr->track == &fr->bottom)
218
                {
219
                    if(relx < 24)
220
                        track_mode = 2;
221
                    else if(relx+24 > win->w)
222
                       track_mode = 3;
223
                }
224
225
 
226
            };
227
228
 
229
            release_mouse();
230
            fr->track     = NULL;
231
            track_mode    = 0;
232
            break;
233
234
 
235
            if(mouse_capture == ctrl)
236
            {
237
                pos_t npos;
238
                npos = get_cursor_pos();
239
//                printf("cursor pos %dx%d\n", npos.x, npos.y);
240
241
 
242
                {
243
                    int w, h;
244
245
 
246
                    spos = npos;
247
248
 
249
                    {
250
                        nrc.l = npos.x-2;
251
                        if(nrc.l < 0)
252
                            nrc.l = 0;
253
                        if(track_mode==1)
254
                            nrc.b = npos.y+2;
255
                    }
256
                    else if(fr->track == &fr->right)
257
                    {
258
                        nrc.r = npos.x+2;
259
                        if(track_mode==1)
260
                            nrc.b = npos.y+2;
261
                    }
262
                    else if(fr->track == &fr->bottom)
263
                    {
264
                        nrc.b = npos.y+2;
265
                        if(track_mode==2)
266
                            nrc.l = npos.x-2;
267
                        else if (track_mode==3)
268
                            nrc.r = npos.x+2;
269
                    };
270
271
 
272
                    h = nrc.b - nrc.t;
273
274
 
3068 serge 275
                        w = 310;
276
                    if(h < 120)
2693 Serge 277
                        h = 120;
278
279
 
280
                    "int $0x40"
281
                    ::"a"(67), "b"(nrc.l), "c"(nrc.t),
282
                    "d"(w-1),"S"(h-1) );
283
                };
284
            }
285
    };
286
287
 
288
}
289
>
290