SlidingWidget.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2003-2004  The Pentagram Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 #include "pent_include.h"
00019 #include "SlidingWidget.h"
00020 #include "ShapeFrame.h"
00021 #include "Shape.h"
00022 
00023 #include "IDataSource.h"
00024 #include "ODataSource.h"
00025 
00026 DEFINE_RUNTIME_CLASSTYPE_CODE(SlidingWidget,Gump);
00027 
00028 SlidingWidget::SlidingWidget()
00029         : Gump()
00030 {
00031 }
00032 
00033 SlidingWidget::SlidingWidget(int x, int y, Shape* shape_, uint32 framenum_)
00034         : Gump(x, y, 5, 5, 0, FLAG_DRAGGABLE)
00035 {
00036         shape = shape_;
00037         framenum = framenum_;
00038 }
00039 
00040 SlidingWidget::~SlidingWidget()
00041 {
00042 }
00043 
00044 void SlidingWidget::InitGump(Gump* newparent, bool take_focus)
00045 {
00046         Gump::InitGump(newparent, take_focus);
00047 
00048         ShapeFrame* sf = shape->getFrame(framenum);
00049         assert(sf);
00050 
00051         dims.w = sf->width;
00052         dims.h = sf->height;
00053 }
00054 
00055 uint16 SlidingWidget::TraceObjId(int mx, int my)
00056 {
00057         if (PointOnGump(mx, my))
00058                 return getObjId();
00059         else
00060                 return 0;
00061 }
00062 
00063 void SlidingWidget::saveData(ODataSource* ods)
00064 {
00065         Gump::saveData(ods);
00066 }
00067 
00068 bool SlidingWidget::loadData(IDataSource* ids, uint32 version)
00069 {
00070         if (!Gump::loadData(ids, version)) return false;
00071 
00072         return true;
00073 }

Generated on Fri Jul 27 22:27:38 2007 for pentagram by  doxygen 1.4.7