ModalGump.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2003-2005  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 "ModalGump.h"
00021 
00022 #include "Kernel.h"
00023 #include "GUIApp.h"
00024 
00025 #include "IDataSource.h"
00026 #include "ODataSource.h"
00027 #include "AudioProcess.h"
00028 
00029 DEFINE_RUNTIME_CLASSTYPE_CODE(ModalGump,Gump);
00030 
00031 ModalGump::ModalGump() : Gump()
00032 {
00033 
00034 }
00035 
00036 
00037 ModalGump::ModalGump(int x, int y, int width, int height, uint16 owner,
00038                                          uint32 _Flags, sint32 layer)
00039         : Gump(x, y, width, height, owner, _Flags, layer)
00040 {
00041 
00042 }
00043 
00044 ModalGump::~ModalGump()
00045 {
00046 }
00047 
00048 void ModalGump::InitGump(Gump* newparent, bool take_focus)
00049 {
00050         Gump::InitGump(newparent, take_focus);
00051 
00052         // lock keyboard
00053         GUIApp::get_instance()->enterTextMode(this);
00054 
00055         Kernel::get_instance()->pause();
00056 
00057         AudioProcess *ap = AudioProcess::get_instance();
00058         if (ap) ap->pauseAllSamples();
00059 }
00060 
00061 Gump* ModalGump::FindGump(int mx, int my)
00062 {
00063         Gump* ret = Gump::FindGump(mx, my);
00064         if (!ret) ret = this; // we take all mouse input
00065 
00066         return ret;
00067 }
00068 
00069 bool ModalGump::PointOnGump(int mx, int my)
00070 {
00071         return true; // we take all mouse input
00072 }
00073 
00074 uint16 ModalGump::TraceObjId(int mx, int my)
00075 {
00076         uint16 objid = Gump::TraceObjId(mx, my);
00077         if (!objid) objid = getObjId();
00078 
00079         return objid;
00080 }
00081 
00082 void ModalGump::Close(bool no_del)
00083 {
00084         // free keyboard
00085         GUIApp::get_instance()->leaveTextMode(this);
00086 
00087         Kernel::get_instance()->unpause();
00088 
00089         AudioProcess *ap = AudioProcess::get_instance();
00090         if (ap) ap->unpauseAllSamples();
00091 
00092         Gump::Close(no_del);
00093 }
00094 
00095 Gump* ModalGump::OnMouseDown(int button, int mx, int my)
00096 {
00097         Gump* handled = Gump::OnMouseDown(button, mx, my);
00098         if (!handled) handled = this;
00099         return handled;
00100 }
00101 
00102 
00103 void ModalGump::saveData(ODataSource* ods)
00104 {
00105         CANT_HAPPEN_MSG("Trying to save ModalGump");
00106 }
00107 
00108 bool ModalGump::loadData(IDataSource* ids, uint32 version)
00109 {
00110         CANT_HAPPEN_MSG("Trying to load ModalGump");
00111         return false;
00112 }

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