00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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
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
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
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