Subversion Repositories Kolibri OS

Rev

Rev 3068 | 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
 
142
    y = ((pos_t)arg2).y;
143
144
 
145
 
146
//    if(child)
147
//    {
148
//        return send_message(child, msg, 0, arg2);
149
//    };
150
151
 
152
        (msg == MSG_MOUSEMOVE) )
153
    {
154
        x = ((pos_t)arg2).x;
155
        y = ((pos_t)arg2).y;
156
157
 
158
        {
159
            rc = &fr->left;
160
            if( (y+24) > win->h)
161
                 cursor = cursor_nesw;
162
            else
163
                cursor = cursor_we;
164
            set_cursor(cursor);
165
            main_cursor = cursor;
166
        }
167
        else if( pt_in_rect(&fr->right, x, y))
168
        {
169
//            printf("pos x%d y%d\n", x, y);
170
171
 
172
            if( (y+24) > win->h)
173
                 cursor = cursor_nwse;
174
            else
175
                 cursor = cursor_we;
176
//            printf("Set cursor %x\n", cursor);
177
            set_cursor(cursor);
178
            main_cursor = cursor;
179
        }
180
        else if( pt_in_rect(&fr->bottom, x, y))
181
        {
182
            rc = &fr->bottom;
183
            cursor = cursor_ns;
184
            if(x+24 > win->w)
185
                cursor = cursor_nwse;
186
            else if(x < rc->l+24)
187
                cursor = cursor_nesw;
188
            set_cursor(cursor);
189
            main_cursor = cursor;
190
        }
191
    };
192
193
 
194
    {
195
        case MSG_LBTNDOWN:
196
            if( rc != NULL)
197
            {
198
                int relx, rely;
199
200
 
201
                spos = get_cursor_pos();
202
                fr->track = rc;
203
204
 
205
                rely = spos.y - win->rc.t;
206
//                printf("relx %d rely %d\n", relx, rely);
207
208
 
209
                   fr->track == &fr->right)
210
                {
211
                    if(rely+24 > win->h)
212
                        track_mode = 1;
213
                };
214
                if(fr->track == &fr->bottom)
215
                {
216
                    if(relx < 24)
217
                        track_mode = 2;
218
                    else if(relx+24 > win->w)
219
                       track_mode = 3;
220
                }
221
222
 
223
            };
224
225
 
226
            release_mouse();
227
            fr->track     = NULL;
228
            track_mode    = 0;
229
            break;
230
231
 
232
            if(mouse_capture == ctrl)
233
            {
234
                pos_t npos;
235
                npos = get_cursor_pos();
236
//                printf("cursor pos %dx%d\n", npos.x, npos.y);
237
238
 
239
                {
240
                    int w, h;
241
242
 
243
                    spos = npos;
244
245
 
246
                    {
247
                        nrc.l = npos.x-2;
248
                        if(nrc.l < 0)
249
                            nrc.l = 0;
250
                        if(track_mode==1)
251
                            nrc.b = npos.y+2;
252
                    }
253
                    else if(fr->track == &fr->right)
254
                    {
255
                        nrc.r = npos.x+2;
256
                        if(track_mode==1)
257
                            nrc.b = npos.y+2;
258
                    }
259
                    else if(fr->track == &fr->bottom)
260
                    {
261
                        nrc.b = npos.y+2;
262
                        if(track_mode==2)
263
                            nrc.l = npos.x-2;
264
                        else if (track_mode==3)
265
                            nrc.r = npos.x+2;
266
                    };
267
268
 
269
                    h = nrc.b - nrc.t;
270
271
 
3068 serge 272
                        w = 310;
273
                    if(h < 120)
2693 Serge 274
                        h = 120;
275
276
 
277
                    "int $0x40"
278
                    ::"a"(67), "b"(nrc.l), "c"(nrc.t),
279
                    "d"(w-1),"S"(h-1) );
280
                };
281
            }
282
    };
283
284
 
285
}
286
>
287