Subversion Repositories Kolibri OS

Rev

Rev 4813 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4813 Akyltist 1
struct new_button
2
    x       dw ?
3
    y       dw ?
4
    w       dw ?
5
    h       dw ?
6
    f       dw ?
7
    face    dd ?
8
    frame   dd ?
9
    event   dd ?
10
ends
11
 
12
button_event_next:
13
    pusha
14
    mov    eax,[edit_cnt]
15
    cmp    eax,4
16
    je     @f
17
    inc    eax
18
    jmp    ben_exit
19
  @@:
20
    mov    eax,1
21
  ben_exit:
22
    mov    [edit_cnt],eax
23
    call    draw_edit
24
    call    list_draw
25
    popa
26
    ret
27
 
28
button_event_back:
29
    pusha
30
    mov    eax,[edit_cnt]
31
    cmp    eax,1
32
    je     @f
33
    dec    eax
34
    jmp    ben_exit
35
  @@:
36
    mov    eax,4
37
  beb_exit:
38
    mov    [edit_cnt],eax
39
    call    draw_edit
40
    call    list_draw
41
    popa
42
    ret
43
 
44
 
45
button_init:
46
    ;;  nex init ------------
47
    mov     ax, 36
48
    mov     [bnext.x],ax
49
    mov     ax, 8
50
    mov     [bnext.y],ax
51
    mov     ax, 26
52
    mov     [bnext.w],ax
53
    mov     ax, 19
54
    mov     [bnext.h],ax
55
    mov     ax, 0
56
    mov     [bnext.f],ax
57
    mov     eax,[sc.btn_face]
58
    mov     [bnext.face],eax
59
    mov     eax,[sc.btn_frame]
60
    mov     [bnext.frame],eax
61
    mov     eax,button_event_next
62
    mov     [bnext.event],eax
63
 
64
    mov     ax, 7
65
    mov     [bback.x],ax
66
    mov     ax, 8
67
    mov     [bback.y],ax
68
    mov     ax, 26
69
    mov     [bback.w],ax
70
    mov     ax, 19
71
    mov     [bback.h],ax
72
    mov     ax, 0
73
    mov     [bback.f],ax
74
    mov     eax,[sc.btn_face]
75
    mov     [bback.face],eax
76
    mov     eax,[sc.btn_frame]
77
    mov     [bback.frame],eax
78
    mov     eax,button_event_back
79
    mov     [bback.event],eax
80
    ret
81
 
82
button_calc:
83
    mov     eax, bnext
84
    call    button_focus
85
    mov     eax, bback
86
    call    button_focus
87
    ret
88
 
89
button_focus:
90
    pusha
91
    xor     ecx,ecx
92
    xor     ebx,ebx
93
    mov     edi,[mouse_x]
94
    mov     bx, word [eax]
95
    cmp     ebx,edi
96
    jg      button_focus_out
97
    add     bx, word [eax + 4]
98
    cmp     ebx,edi
99
    jb      button_focus_out
100
    mov     edi,[mouse_y]
101
    mov     bx,[eax + 2]
102
    cmp     ebx,edi
103
    jg      button_focus_out
104
    add     bx,[eax + 6]
105
    cmp     ebx,edi
106
    jb      button_focus_out
107
    ;----
108
    push    eax
109
    call    mouse_left
110
    mov     ecx,[mouse_l]
111
    cmp     ecx,0
112
    je      button_focus_set
113
    xor     ecx,ecx
114
    mov     [mouse_l],ecx
115
    call    dword [eax+18]
116
 
117
  button_focus_set:
118
    pop     eax
119
    ;----
120
    mov     ecx,1
121
  button_focus_out:
122
    mov     word [eax + 8],cx
123
    popa
124
    ret
125
 
126
button_draw:
127
    mov     eax, bnext
128
    call    button_draw_all
129
    mov     eax, bback
130
    call    button_draw_all
131
    ; arrow
132
    pusha
6253 leency 133
    mov	ecx,[sc.btn_text]
134
    or	ecx,0x90000000
135
    mcall	4,<15,11>, ,arrowa
136
    mcall	 ,<45,11>, ,arrowb
4813 Akyltist 137
    popa
138
    ret
139
 
140
button_draw_all:
141
    pusha
142
    mov     ebx,[win_slot]
143
    cmp     ebx,1
144
    je      @f
145
    mov     ebx,[sc.btn_inface]
146
    mov     dword [eax + 10],ebx
147
    mov     ebx,[sc.btn_inframe]
148
    mov     dword [eax + 14],ebx
149
    jmp     button_draw_run
150
  @@: ;act
151
    xor     ebx,ebx
152
    mov     bx,word [eax + 8]
153
    cmp     ebx,1
154
    je      @f
155
    mov     ebx,[sc.btn_face]
156
    mov     dword [eax + 10],ebx
157
    mov     ebx,[sc.btn_frame]
158
    mov     dword [eax + 14],ebx
159
    jmp     button_draw_run
160
  @@: ; foc
161
    mov     ebx,[sc.btn_fcface]
162
    mov     dword [eax + 10],ebx
163
    mov     ebx,[sc.btn_fcframe]
164
    mov     dword [eax + 14],ebx
165
 
166
  button_draw_run:
167
 
168
    ; прямоугольный фон
169
    mov     bx, word [eax]         ; x
170
    add     bx, 2                  ; x+2
171
    shl     ebx,16
172
    mov     bx, word [eax+4]       ; w
173
    sub     bx, 4                  ; w-4
174
    mov     cx, word [eax+2]       ; y
175
    add     cx,2                   ; y+2
176
    shl     ecx,16
177
    mov     cx, word [eax+6]       ; h
178
    sub     cx, 4                  ; h-4
179
    mov     edx, dword [eax + 10]  ; color
180
    push    eax
181
    mov     eax, 13                ; rect
182
    int     0x40                   ; draw
183
    pop     eax
184
 
185
    ; верхняя линия [frame]
186
    mov     edx, dword [eax + 14]  ; color
187
    mov     bx, word [eax]         ; x
188
    inc     bx                     ; x+1
189
    shl     ebx,16
190
    mov     bx, word [eax]         ; x2=x
191
    add     bx, word [eax + 4]     ; x2=x+w
192
    sub     bx,2                   ; x2=x2-2
193
    mov     cx, word [eax + 2]     ; y
194
    shl     ecx,16
195
    mov     cx, word [eax + 2]     ; y2=y
196
    push    eax
197
    mov     eax, 38                ; line
198
    int     0x40                   ; draw
199
    ; верхняя линия [3d]
200
    mov     edx, [sc.3d_light]     ; color
201
    add     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
202
    int     0x40                   ; draw
203
    pop     eax
204
 
205
    ; нижняя линия [frame]
206
 
207
    mov     cx, word [eax + 2]     ; y
208
    add     cx, word [eax + 6]     ; y = y+h
209
    push    cx
210
    shl     ecx,16
211
    pop     cx
212
    sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
213
    mov     edx, dword [eax + 14]  ; color
214
    push    eax
215
    mov     eax, 38                ; line
216
    int     0x40                   ; draw
217
    ; нижняя линия [3d]
218
    sub     ebx, 1 shl 16          ; x = x-1
219
    mov     edx, [sc.3d_dark]      ; color
220
    sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
221
    int     0x40                   ; draw
222
    pop     eax
223
 
224
 
225
    ; передняя боковая [frame]
226
    mov     edx, dword [eax + 14]  ; color
227
    mov     bx, word [eax]         ; x
228
    shl     ebx,16
229
    mov     bx, word [eax]         ; x2=x
230
    mov     cx, word [eax + 2]     ; y
231
    inc     cx                     ; y=y+1
232
    shl     ecx,16
233
    mov     cx, word [eax + 2]     ; y2=y
234
    add     cx, word [eax + 6]     ; y2=y+h
235
    sub     cx,2                   ; y2=y2-2
236
    push    eax
237
    mov     eax, 38                ; line
238
    int     0x40                   ; draw
239
    ; передняя боковая [3d]
240
    mov     edx, [sc.3d_light]     ; color
241
    add     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
242
    sub     ecx,1                  ; y2=y2-1
243
    int     0x40                   ; draw
244
    pop     eax
245
 
246
    ; задняя боковая [frame]
247
    mov     edx, dword [eax + 14]  ; color
248
    mov     bx, word [eax]         ; x
249
    add     bx, word [eax + 4]     ; x=x+w
250
    dec     bx
251
    push    bx
252
    shl     ebx,16
253
    pop     bx
254
    inc     ecx
255
    push    eax
256
    mov     eax, 38                ; line
257
    int     0x40                   ; draw
258
    ; задняя боковая [3d]
259
    mov     edx, [sc.3d_dark]     ; color
260
    sub     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
261
    int     0x40                   ; draw
262
    pop     eax
263
 
264
    popa
265
    ret