label.cpp

00001 /***************************************************************************
00002                           label.cpp  -  description
00003                              -------------------
00004     begin                : Mon Mar 1 2004
00005     copyright            : (C) 2004 by Dynacube Team
00006     email                : 
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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 

Generated on Thu Jul 27 23:52:27 2006 for Dynacube by  doxygen 1.4.7