00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "gui/components/label.h"
00018
00019 void label::label_init(DW _id,DW _parent_id,DW _cnt_type,void *_cnt_ptr,DW _alias_id,DW _x,DW _y,DW _width,DW _height,DD _style,char *_lbl)
00020 {
00021 memcpy(lbl,_lbl,strlen(_lbl));
00022 comp_init(LABEL_TYPE,_id,_parent_id,_cnt_type,_cnt_ptr,_alias_id,_x,_y,_width,_height,_style);
00023 }
00024
00025 void label::paint()
00026 {
00027 window *win_ptr;
00028 frame *frm_ptr;
00029 DW _x,_y,_width,_height;
00030
00031 switch(cnt_type)
00032 {
00033 case WIND_TYPE :
00034 win_ptr = (window *) cnt_ptr;
00035 if(win_ptr->style & W_MAXIMIZE)
00036 {
00037 _x = BORDER_WIDTH;
00038 _y = TITLE_HEIGHT + BORDER_HEIGHT + ((win_ptr->hasMenu) ? MENUBAR_HEIGHT : 0);
00039 _width = SCREEN_WIDTH;
00040 _height = SCREEN_HEIGHT;
00041 }
00042 else
00043 {
00044 _x = win_ptr->x + BORDER_WIDTH;
00045 _y = win_ptr->y + TITLE_HEIGHT + BORDER_HEIGHT + ((win_ptr->hasMenu) ? MENUBAR_HEIGHT : 0);
00046 _width = win_ptr->width;
00047 _height = win_ptr->height;
00048 }
00049
00050 if((x + width < _width) && (y + height < _height))
00051 {
00052 drawstring(x+_x+width/8,y+_y+height/4,lbl);
00053 }
00054 else
00055 {
00056 drawstring(x+_x+width/8,y+_y+height/4,lbl);
00057 }
00058 break;
00059
00060 }
00061 }
00062