folderview.cpp

00001 
00002 /***************************************************************************
00003                           folderview.cpp  -  description
00004                              -------------------
00005     begin                : Sun Feb 8 2004
00006     copyright            : (C) 2004 by Dynacube Team
00007     email                : 
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019  #include "gui/components/folderview.h"
00020  
00021 
00022    void folderview::folderview_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 *_dirname)
00023    {
00024     strcpy(dirname,_dirname);
00025     
00026     if(_width < MIN_FV_WIDTH)
00027       _width = MIN_FV_WIDTH;
00028       
00029     if(_height < MIN_FV_HEIGHT)
00030       _height = MIN_FV_HEIGHT;
00031 
00032     comp_init(FOLDERVIEW_TYPE,_id,_parent_id,_cnt_type,_cnt_ptr,_alias_id,_x,_y,_width,_height,_style);
00033    }
00034    
00035    void folderview::paint()
00036    {
00037     window *win_ptr;
00038     frame *frm_ptr;
00039     DW _x,_y,_width,_height;
00040     DB tmp[255];
00041 
00042     switch(cnt_type)
00043     {
00044       case WIND_TYPE :
00045                       win_ptr = (window *) cnt_ptr;
00046                       if(win_ptr->style & W_MAXIMIZE)
00047                        {
00048                          _x = BORDER_WIDTH;
00049                          _y = TITLE_HEIGHT + BORDER_HEIGHT ;
00050                          _width  = SCREEN_WIDTH;
00051                          _height = SCREEN_HEIGHT;
00052                        }
00053                       else
00054                        {
00055                          _x = win_ptr->x + BORDER_WIDTH;
00056                          _y = win_ptr->y + TITLE_HEIGHT + BORDER_HEIGHT ;
00057                          _width = win_ptr->width;
00058                          _height = win_ptr->height;
00059                        }
00060 
00061                       if((x + width < _width) && (y + height < _height))
00062                       {
00063                          fillrect(x+_x, y+_y, width, height,FV_BASE);
00064                          emboss3D(x+_x, y+_y, width, height,0,_true,1);
00065                          drawFiles(x+_x,y+_y);
00066                       }
00067                       break;
00068     }
00069 
00070    }
00071 
00072    void folderview::drawFiles(DW x, DW y)
00073    {
00074     SDW p,res;
00075     DIRENT ds;
00076     DW curx, cury;
00077 
00078     curx = x;
00079     cury = y;
00080 
00081     p = opendir(dirname);
00082     
00083     if(p != -1)
00084     {
00085 
00086      while((res = readdir(p,&ds)) == 0)
00087      {
00088         drawIcon(curx + X_OFFSET, cury + Y_OFFSET, &folder[0][0]);
00089         drawstring(curx + X_OFFSET,cury + 2*Y_OFFSET + ICON_HEIGHT,ds.name);
00090         cury += 3*Y_OFFSET + ICON_HEIGHT;        
00091      }
00092      closedir(p);
00093     }
00094      
00095    }
00096 
00097    
00098    void folderview::react(DW _x,DW _y)
00099    {
00100    }
00101 

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