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
 
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
 
80
 
81
    pixmap+= CAPTION_HEIGHT*win->w;
82
    src = res_border_left;
83
84
 
85
    {
86
        for(j = 0; j < FRAME_WIDTH; j++)
87
            pixmap[j] = src[j];
88
89
 
90
    };
91
92
 
93
 
94
    pixmap+= (CAPTION_HEIGHT+1)*win->w - FRAME_WIDTH;
95
    src = res_border_right;
96
97
 
98
    {
99
        for(j = 0; j < FRAME_WIDTH; j++)
100
            pixmap[j] = src[j];
101
102
 
103
    };
104
105
 
106
107
 
108
109
 
110
    {
111
        for(j = 0; j < win->w; j++)
112
            pixmap[j] = 0x808080;
113
114
 
115
    };
116
117
 
118
    child  = (ctrl_t*)fr->child.next;
119
120
 
121
    {
122
        send_message(child, 1, 0, 0);
123
        child = (ctrl_t*)child->link.next;
124
    };
125
126
 
127
};
128
129
 
130
{
131
    static  pos_t spos;
132
    static  track_mode;
133
134
 
135
    ctrl_t   *child;
136
137
 
138
    window_t *win = (window_t*)fr->parent;
139
    rect_t  *rc = NULL;
140
    int  x, y;
141
142
 
143
    y = ((pos_t)arg2).y;
144
145
 
146
 
147
//    if(child)
148
//    {
149
//        return send_message(child, msg, 0, arg2);
150
//    };
151
152
 
153
        (msg == MSG_MOUSEMOVE) )
154
    {
155
        x = ((pos_t)arg2).x;
156
        y = ((pos_t)arg2).y;
157
158
 
159
        {
160
            rc = &fr->left;
161
            if( (y+24) > win->h)
162
                 cursor = cursor_nesw;
163
            else
164
                cursor = cursor_we;
165
            set_cursor(cursor);
166
            main_cursor = cursor;
167
        }
168
        else if( pt_in_rect(&fr->right, x, y))
169
        {
170
//            printf("pos x%d y%d\n", x, y);
171
172
 
173
            if( (y+24) > win->h)
174
                 cursor = cursor_nwse;
175
            else
176
                 cursor = cursor_we;
177
//            printf("Set cursor %x\n", cursor);
178
            set_cursor(cursor);
179
            main_cursor = cursor;
180
        }
181
        else if( pt_in_rect(&fr->bottom, x, y))
182
        {
183
            rc = &fr->bottom;
184
            cursor = cursor_ns;
185
            if(x+24 > win->w)
186
                cursor = cursor_nwse;
187
            else if(x < rc->l+24)
188
                cursor = cursor_nesw;
189
            set_cursor(cursor);
190
            main_cursor = cursor;
191
        }
192
    };
193
194
 
195
    {
196
        case MSG_LBTNDOWN:
197
            if( rc != NULL)
198
            {
199
                int relx, rely;
200
201
 
202
                spos = get_cursor_pos();
203
                fr->track = rc;
204
205
 
206
                rely = spos.y - win->rc.t;
207
//                printf("relx %d rely %d\n", relx, rely);
208
209
 
210
                   fr->track == &fr->right)
211
                {
212
                    if(rely+24 > win->h)
213
                        track_mode = 1;
214
                };
215
                if(fr->track == &fr->bottom)
216
                {
217
                    if(relx < 24)
218
                        track_mode = 2;
219
                    else if(relx+24 > win->w)
220
                       track_mode = 3;
221
                }
222
223
 
224
            };
225
226
 
227
            release_mouse();
228
            fr->track     = NULL;
229
            track_mode    = 0;
230
            break;
231
232
 
233
            if(mouse_capture == ctrl)
234
            {
235
                pos_t npos;
236
                npos = get_cursor_pos();
237
//                printf("cursor pos %dx%d\n", npos.x, npos.y);
238
239
 
240
                {
241
                    int w, h;
242
243
 
244
                    spos = npos;
245
246
 
247
                    {
248
                        nrc.l = npos.x-2;
249
                        if(nrc.l < 0)
250
                            nrc.l = 0;
251
                        if(track_mode==1)
252
                            nrc.b = npos.y+2;
253
                    }
254
                    else if(fr->track == &fr->right)
255
                    {
256
                        nrc.r = npos.x+2;
257
                        if(track_mode==1)
258
                            nrc.b = npos.y+2;
259
                    }
260
                    else if(fr->track == &fr->bottom)
261
                    {
262
                        nrc.b = npos.y+2;
263
                        if(track_mode==2)
264
                            nrc.l = npos.x-2;
265
                        else if (track_mode==3)
266
                            nrc.r = npos.x+2;
267
                    };
268
269
 
270
                    h = nrc.b - nrc.t;
271
272
 
3068 serge 273
                        w = 310;
274
                    if(h < 120)
2693 Serge 275
                        h = 120;
276
277
 
278
                    "int $0x40"
279
                    ::"a"(67), "b"(nrc.l), "c"(nrc.t),
280
                    "d"(w-1),"S"(h-1) );
281
                };
282
            }
283
    };
284
285
 
286
}
287
>
288