Box_Lib - Component Frame

git-svn-id: svn://kolibrios.org@3470 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2013-04-16 00:18:51 +00:00
parent db28a61d3b
commit ca59e42ce1
3 changed files with 213 additions and 2 deletions

View File

@ -8,3 +8,4 @@ include 'filebrowser.mac' ;macro implements filebrowser
include 'tree_list.mac' ;macro implements tree_list, image_list, list_box
include 'pathshow.mac' ;macro implements pathshow
include 't_edit.mac' ;macro implements text_editor
include 'frame.mac' ;macro implements frame

View File

@ -1,5 +1,6 @@
;*****************************************************************************
; Box_Lib - library of graphical components
; Copyright (C) KolibriOS team 2008-2013. All rights reserved.
;
; Authors:
; Alexey Teplov aka <Lrz>
@ -101,6 +102,11 @@ use_path_show
;--------------------------------------------------
align 16
use_text_edit
;--------------------------------------------------
;Frame Group
;--------------------------------------------------
align 16
use_frame
;input:
; eax = óêàçàòåëü íà ôóíêöèþ âûäåëåíèÿ ïàìÿòè
@ -327,6 +333,9 @@ dd sz_ted_but_find_next, ted_but_find_next
dd sz_ted_text_colored, ted_text_colored
dd sz_ted_version, 0x00000003
dd sz_Frame_draw, frame.draw
dd szVersion_frame, 0x00010001
dd 0,0
@ -425,3 +434,6 @@ sz_ted_but_reverse db 'ted_but_reverse',0
sz_ted_but_find_next db 'ted_but_find_next',0
sz_ted_text_colored db 'ted_text_colored',0
sz_ted_version db 'version_text_edit',0
sz_Frame_draw db 'frame_draw',0
szVersion_frame db 'version_frame',0

View File

@ -0,0 +1,198 @@
;**************************************************************
; Frame Macro for Kolibri OS
; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
macro frame_start
{
pusha
mov edi,dword [esp+36]
}
;*****************************************************************************
macro frame_exit
{
popa
ret 4
}
;*****************************************************************************
macro use_frame
{
frame:
fr_type equ [edi] ;dword
fr_size_x equ [edi+4] ;word
fr_start_x equ [edi+6] ;word
fr_size_y equ [edi+8] ;word
fr_start_y equ [edi+10] ;word
fr_ext_fr_col equ [edi+12] ;dword
fr_int_fr_col equ [edi+16] ;dword
fr_draw_text_flag equ [edi+20] ;dword 0-not,1-yes
fr_text_pointer equ [edi+24] ;dword
fr_text_position equ [edi+28] ;dword 0-up,1-bottom
fr_font_number equ [edi+32] ;dword 0-monospace,1-variable
fr_font_size_y equ [edi+36] ;dword
fr_font_color equ [edi+40] ;dword
fr_font_backgr_color equ [edi+44] ;dword
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
align 4
.draw:
frame_start
;-------------------------------------
; in
; ebx = [coordinate on axis x]*65536 + [size on axis x]
; ecx = [coordinate on axis y]*65536 + [size on axis y]
;--------------------------------------
; top
mov bx,fr_start_x
shl ebx,16
mov bx,fr_start_x
add bx,fr_size_x
mov cx,fr_start_y
shl ecx,16
mov cx,fr_start_y
mcall 38,,,fr_ext_fr_col
add ecx,1 shl 16 +1
add ebx,1 shl 16
dec ebx
mcall ,,,fr_int_fr_col
;--------------------------------------
; bottom
mov bx,fr_start_x
shl ebx,16
mov bx,fr_start_x
add bx,fr_size_x
mov cx,fr_start_y
add cx,fr_size_y
shl ecx,16
mov cx,fr_start_y
add cx,fr_size_y
mcall ,,,fr_ext_fr_col
sub ecx,1 shl 16 +1
add ebx,1 shl 16
dec ebx
mcall ,,,fr_int_fr_col
;--------------------------------------
; left
mov bx,fr_start_x
shl ebx,16
mov bx,fr_start_x
mov cx,fr_start_y
shl ecx,16
mov cx,fr_start_y
add cx,fr_size_y
mcall ,,,fr_ext_fr_col
add ebx,1 shl 16 +1
add ecx,1 shl 16
dec ecx
mcall ,,,fr_int_fr_col
;--------------------------------------
; right
mov bx,fr_start_x
add bx,fr_size_x
shl ebx,16
mov bx,fr_start_x
add bx,fr_size_x
mov cx,fr_start_y
shl ecx,16
mov cx,fr_start_y
add cx,fr_size_y
mcall ,,,fr_ext_fr_col
sub ebx,1 shl 16 +1
add ecx,1 shl 16
dec ecx
mcall ,,,fr_int_fr_col
;----------------------------------------------------------------------
cmp fr_draw_text_flag,dword 0
je .exit
mov ecx,0xC0000000
mov eax,fr_font_number
and eax,11b
shl eax,28
add ecx,eax
mov eax,fr_font_color
and eax,0xffffff
add ecx,eax
mov edx,fr_text_pointer
mov eax,fr_font_backgr_color
and eax,0xffffff
xor esi,esi
mov bx,fr_start_x
add bx,10
shl ebx,16
mov bx,fr_font_size_y
shr bx,1
not bx
add bx,fr_start_y
test fr_font_size_y,word 1b
jz @f
inc bx
;--------------------------------------
align 4
@@:
cmp fr_text_position,dword 0
je .draw_1
add bx,fr_size_y
;--------------------------------------
align 4
.draw_1:
push edi
mov edi,eax
mcall 4
pop edi
;----------------------------------------------------------------------
align 4
.exit:
frame_exit
}
;*****************************************************************************