GLICT/list.cpp

00001 /*
00002         GLICT - Graphics Library Interface Creation Toolkit
00003         Copyright (C) 2006-2007 OBJECT Networks
00004 
00005         This library is free software; you can redistribute it and/or
00006         modify it under the terms of the GNU Library General Public
00007         License as published by the Free Software Foundation; either
00008         version 2 of the License, or (at your option) any later version.
00009 
00010         This library is distributed in the hope that it will be useful,
00011         but WITHOUT ANY WARRANTY; without even the implied warranty of
00012         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013         Library General Public License for more details.
00014 
00015         You should have received a copy of the GNU Library General Public
00016         License along with this library; if not, write to the Free
00017         Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 #include <GLICT/list.h>
00020 
00021 glictList::glictList() {
00022 
00023 }
00024 glictList::~glictList() {
00025 }
00026 
00027 void glictList::AddObject(glictContainer* object) {
00028     object->SetPos(0, objects.size()*14 - 14 );
00029     object->SetHeight(14);
00030 
00031     glictContainer::AddObject(object);
00032         object->SetFocusable(false);
00033     SetVirtualSize(width, objects.size() * 14 - 14);
00034     SetWidth(width);
00035 
00036 }
00037 
00038 void glictList::RemoveObject(glictContainer *object) {
00039     printf("...\n");
00040 
00041     float currentheight = 0;
00042     for (std::vector<glictContainer*>::iterator it = objects.begin() ; it != objects.end() ; it++) {
00043         printf("?");
00044         if ((*it)!=object) {
00045             printf("!");
00046             (*it)->SetPos(0, currentheight);
00047             currentheight += 14;
00048         }
00049         printf("\n");
00050     }
00051     glictContainer::RemoveObject(object);
00052     SetHeight(currentheight);
00053 }
00054 
00055 void glictList::SetWidth(float width) {
00056     for (std::vector<glictContainer*>::iterator it = objects.begin() ; it != objects.end() ; it++) {
00057         (*it)->SetWidth(width-(virtualsize.h > height ? 10 : 0));
00058     }
00059     glictContainer::SetWidth(width);
00060 }
00061 

SourceForge.net Logo
generated with doxygen 1.5.3 on Mon Oct 29 18:09:26 2007