memory fixes
This commit is contained in:
parent
69ce38cb2d
commit
15fcacda56
@ -13,7 +13,7 @@
|
||||
\brief Definition file for GContainer.
|
||||
|
||||
Definition file for GContainer, a barebones widget that can contain child widgets.
|
||||
<br>$Id: GewiContainer.h,v 1.5 2003/06/07 05:41:18 cozman Exp $<br>
|
||||
<br>$Id: GewiContainer.h,v 1.6 2003/06/09 03:28:59 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -79,12 +79,7 @@ class GContainer : public GWidget
|
||||
**/
|
||||
GContainer(GContainer *parent=NULL);
|
||||
|
||||
/*!
|
||||
\brief Destroy container and children.
|
||||
|
||||
Deletes container and releases children, overloaded to free children.
|
||||
**/
|
||||
virtual void Kill();
|
||||
~GContainer();
|
||||
|
||||
/*!
|
||||
\brief Move container and children.
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Definition file for GewiEngine.
|
||||
|
||||
Definition file for GewiEngine, core engine for Gewi GUI control.
|
||||
<br>$Id: GewiEngine.h,v 1.4 2003/06/07 05:41:18 cozman Exp $<br>
|
||||
<br>$Id: GewiEngine.h,v 1.5 2003/06/09 03:28:59 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -43,8 +43,6 @@ class GewiEngine
|
||||
private:
|
||||
//! Singleton static instance of GewiEngine.
|
||||
static GewiEngine *sInstance;
|
||||
//! SDL_EventFilter to store old event filter, GewiEngine sets it's own.
|
||||
static SDL_EventFilter sOldFilter;
|
||||
//! Vector of pointers to ZImages, used by resource management system.
|
||||
vector<ZImage*> mImageVec;
|
||||
//! Vector of pointers to ZFonts, used by resource management system.
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Definition file for GWidget.
|
||||
|
||||
Definition file for GWidget, virtual widget base class.
|
||||
<br>$Id: GewiWidget.h,v 1.4 2003/06/07 05:41:18 cozman Exp $<br>
|
||||
<br>$Id: GewiWidget.h,v 1.5 2003/06/09 03:28:59 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -50,8 +50,6 @@ class GWidget
|
||||
float rRelY;
|
||||
//! Stores if widget is currently visible.
|
||||
bool rVisible;
|
||||
//! Stores if widget is currently 'alive.'
|
||||
bool rAlive;
|
||||
|
||||
public:
|
||||
/*!
|
||||
@ -76,14 +74,6 @@ class GWidget
|
||||
**/
|
||||
void ToggleVisible();
|
||||
|
||||
/*!
|
||||
\brief Kill widget, and all data associated with it.
|
||||
|
||||
Widget frees itself from parent, and sets it's internal state to dead.
|
||||
Virtual in case other things need to be freed.
|
||||
**/
|
||||
virtual void Kill();
|
||||
|
||||
/*!
|
||||
\brief Reposition widget within parent.
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Implementation of GContainer.
|
||||
|
||||
Implementation of GContainer, a barebones widget that can contain child widgets.
|
||||
<br>$Id: GewiContainer.cpp,v 1.4 2003/05/21 02:47:56 cozman Exp $<br>
|
||||
<br>$Id: GewiContainer.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -43,10 +43,9 @@ GContainer::GContainer(GContainer *parent)
|
||||
{
|
||||
}
|
||||
|
||||
void GContainer::Kill()
|
||||
GContainer::~GContainer()
|
||||
{
|
||||
rChildList.DeleteWidgets();
|
||||
GWidget::Kill();
|
||||
}
|
||||
|
||||
void GContainer::Move(float x, float y)
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Implementation of GewiEngine.
|
||||
|
||||
Implementation of GewiEngine, core engine for Gewi GUI control.
|
||||
<br>$Id: GewiEngine.cpp,v 1.4 2003/06/07 05:42:33 cozman Exp $<br>
|
||||
<br>$Id: GewiEngine.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -24,12 +24,10 @@ namespace Gewi
|
||||
{
|
||||
|
||||
GewiEngine *GewiEngine::sInstance=NULL;
|
||||
SDL_EventFilter GewiEngine::sOldFilter=NULL;
|
||||
|
||||
GewiEngine::GewiEngine()
|
||||
{
|
||||
sOldFilter = SDL_GetEventFilter(); //store event filter and set the new one
|
||||
SDL_SetEventFilter((SDL_EventFilter)GewiEngine::EventFilter);
|
||||
ZEngine::GetInstance()->SetEventFilter((SDL_EventFilter)GewiEngine::EventFilter);
|
||||
SDL_EnableUNICODE(1); //needed for the key translation
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
}
|
||||
@ -39,7 +37,6 @@ GewiEngine* GewiEngine::GetInstance()
|
||||
{
|
||||
if(!sInstance)
|
||||
sInstance = new GewiEngine;
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@ -54,7 +51,7 @@ void GewiEngine::ReleaseInstance()
|
||||
//set everything back to default
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_INTERVAL,SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
SDL_EnableUNICODE(0);
|
||||
SDL_SetEventFilter(sOldFilter);
|
||||
ZEngine::GetInstance()->SetEventFilter(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +84,7 @@ int GewiEngine::EventFilter(SDL_Event *event)
|
||||
gewi->SendMessage(event,GE_KUP,0,0,ch);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
//.
|
||||
GewiEngine::ReleaseInstance();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Implementation of GWidget.
|
||||
|
||||
Implementation of GWidget, virtual widget base class.
|
||||
<br>$Id: GewiWidget.cpp,v 1.4 2003/05/21 02:47:56 cozman Exp $<br>
|
||||
<br>$Id: GewiWidget.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -38,8 +38,7 @@ GWidget::GWidget(GContainer *parent) :
|
||||
rParent(parent),
|
||||
rRelX(0),
|
||||
rRelY(0),
|
||||
rVisible(true),
|
||||
rAlive(true)
|
||||
rVisible(true)
|
||||
{
|
||||
if(rParent)
|
||||
rParent->AddChild(this);
|
||||
@ -56,19 +55,6 @@ void GWidget::ToggleVisible()
|
||||
rVisible = !rVisible;
|
||||
}
|
||||
|
||||
void GWidget::Kill()
|
||||
{
|
||||
if(rParent)
|
||||
{
|
||||
rParent->ReleaseChild(this);
|
||||
rParent = NULL;
|
||||
}
|
||||
else
|
||||
rGewi->DeleteWidget(this);
|
||||
|
||||
rAlive = rVisible = false;
|
||||
}
|
||||
|
||||
void GWidget::Create(float x, float y, float width, float height)
|
||||
{
|
||||
Move(x,y);
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief Implementation of WidgetList.
|
||||
|
||||
Implementation of WidgetList, a list of widgets used by GewiEngine and GContainers.
|
||||
<br>$Id: GewiWidgetList.cpp,v 1.3 2003/05/20 00:08:55 cozman Exp $<br>
|
||||
<br>$Id: GewiWidgetList.cpp,v 1.4 2003/06/09 03:28:43 cozman Exp $<br>
|
||||
\author James Turk
|
||||
**/
|
||||
|
||||
@ -83,7 +83,9 @@ void WidgetList::DeleteWidget(GWidget *widget)
|
||||
} while(cur != mWidgetList && !found);
|
||||
|
||||
if(found)
|
||||
{
|
||||
DeleteWidgetMem(found);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +95,7 @@ void WidgetList::DeleteWidgets()
|
||||
while(mWidgetList)
|
||||
{
|
||||
cur = cur->next;
|
||||
cur->prev->widget->Kill();
|
||||
DeleteWidgetMem(cur->prev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,12 +167,15 @@ void WidgetList::FitParent()
|
||||
void WidgetList::ShowWidgets()
|
||||
{
|
||||
WidgetNode *cur = mWidgetList;
|
||||
do
|
||||
if(mWidgetList)
|
||||
{
|
||||
cur = cur->prev; //draw from back to front, through list in reverse
|
||||
if(cur->widget->Visible())
|
||||
cur->widget->Show();
|
||||
}while(cur != mWidgetList);
|
||||
do
|
||||
{
|
||||
cur = cur->prev; //draw from back to front, through list in reverse
|
||||
if(cur->widget->Visible())
|
||||
cur->widget->Show();
|
||||
}while(cur != mWidgetList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user