DesktopGump.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2003-2007  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 
00019 #include "pent_include.h"
00020 #include "DesktopGump.h"
00021 #include "RenderSurface.h"
00022 #include "GUIApp.h"
00023 #include "IDataSource.h"
00024 #include "ODataSource.h"
00025 #include "ConsoleGump.h"
00026 
00027 DEFINE_RUNTIME_CLASSTYPE_CODE(DesktopGump,Gump);
00028 
00029 DesktopGump::DesktopGump()
00030         : Gump()
00031 {
00032 }
00033 
00034 DesktopGump::DesktopGump(sint32 _x, sint32 _y, sint32 _width, sint32 _height) :
00035         Gump(_x, _y, _width, _height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP,
00036                  LAYER_DESKTOP)
00037 {
00038 }
00039 
00040 DesktopGump::~DesktopGump(void)
00041 {
00042 }
00043 
00044 void DesktopGump::PaintThis(RenderSurface *surf, sint32 lerp_factor, bool scaled)
00045 {
00046         // Just fill it (only if console showing, or in debug mode)
00047 
00048 #ifndef DEBUG
00049         ConsoleGump *console = GUIApp::get_instance()->getConsoleGump();
00050         if (console->ConsoleIsVisible() || children.front()->IsOfType<ConsoleGump>())
00051 #endif
00052                 surf->Fill32(0x000000, 0, 0, dims.w, dims.h);
00053                 //surf->Fill32(0x3f3f3f, 0, 0, dims.w, dims.h);
00054 }
00055 
00056 bool DesktopGump::StartDraggingChild(Gump* gump, int mx, int my)
00057 {
00058         gump->ParentToGump(mx, my);
00059         GUIApp::get_instance()->setDraggingOffset(mx, my);
00060         MoveChildToFront(gump);
00061         return true;
00062 }
00063 
00064 void DesktopGump::DraggingChild(Gump* gump, int mx, int my)
00065 {
00066         int dx, dy;
00067         GUIApp::get_instance()->getDraggingOffset(dx, dy);
00068         gump->Move(mx - dx, my - dy);
00069 }
00070 
00071 void DesktopGump::StopDraggingChild(Gump* gump)
00072 {
00073 
00074 }
00075 
00076 void DesktopGump::RenderSurfaceChanged(RenderSurface *surf)
00077 {
00078         // Resize the desktop gump to match the RenderSurface 
00079         Pentagram::Rect new_dims;
00080         surf->GetSurfaceDims(new_dims);
00081         dims.w = new_dims.w;
00082         dims.h = new_dims.h;
00083 
00084         Gump::RenderSurfaceChanged();
00085 }
00086 
00087 void DesktopGump::RenderSurfaceChanged()
00088 {
00089         // Resize the desktop gump to match the parent
00090         Pentagram::Rect new_dims;
00091         parent->GetDims(new_dims);
00092         dims.w = new_dims.w;
00093         dims.h = new_dims.h;
00094 
00095         Gump::RenderSurfaceChanged();
00096 }
00097 
00098 void DesktopGump::saveData(ODataSource* ods)
00099 {
00100         CANT_HAPPEN_MSG("Trying to save DesktopGump");
00101 }
00102 
00103 bool DesktopGump::loadData(IDataSource* ids, uint32 version)
00104 {
00105         CANT_HAPPEN_MSG("Trying to save DesktopGump");
00106 
00107         return false;
00108 }
00109 
00110 // Colourless Protection

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