diff --git a/include/GewiContainer.h b/include/GewiContainer.h
index 4d145c5..a6a8463 100755
--- a/include/GewiContainer.h
+++ b/include/GewiContainer.h
@@ -13,7 +13,7 @@
\brief Definition file for GContainer.
Definition file for GContainer, a barebones widget that can contain child widgets.
-
$Id: GewiContainer.h,v 1.5 2003/06/07 05:41:18 cozman Exp $
+
$Id: GewiContainer.h,v 1.6 2003/06/09 03:28:59 cozman Exp $
\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.
diff --git a/include/GewiEngine.h b/include/GewiEngine.h
index ab17b60..3fba848 100755
--- a/include/GewiEngine.h
+++ b/include/GewiEngine.h
@@ -13,7 +13,7 @@
\brief Definition file for GewiEngine.
Definition file for GewiEngine, core engine for Gewi GUI control.
-
$Id: GewiEngine.h,v 1.4 2003/06/07 05:41:18 cozman Exp $
+
$Id: GewiEngine.h,v 1.5 2003/06/09 03:28:59 cozman Exp $
\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 mImageVec;
//! Vector of pointers to ZFonts, used by resource management system.
diff --git a/include/GewiWidget.h b/include/GewiWidget.h
index 31bb062..6d632b8 100755
--- a/include/GewiWidget.h
+++ b/include/GewiWidget.h
@@ -13,7 +13,7 @@
\brief Definition file for GWidget.
Definition file for GWidget, virtual widget base class.
-
$Id: GewiWidget.h,v 1.4 2003/06/07 05:41:18 cozman Exp $
+
$Id: GewiWidget.h,v 1.5 2003/06/09 03:28:59 cozman Exp $
\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.
diff --git a/src/GewiContainer.cpp b/src/GewiContainer.cpp
index b18ab13..20950b5 100755
--- a/src/GewiContainer.cpp
+++ b/src/GewiContainer.cpp
@@ -13,7 +13,7 @@
\brief Implementation of GContainer.
Implementation of GContainer, a barebones widget that can contain child widgets.
-
$Id: GewiContainer.cpp,v 1.4 2003/05/21 02:47:56 cozman Exp $
+
$Id: GewiContainer.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $
\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)
diff --git a/src/GewiEngine.cpp b/src/GewiEngine.cpp
index 0de07c0..a543200 100755
--- a/src/GewiEngine.cpp
+++ b/src/GewiEngine.cpp
@@ -13,7 +13,7 @@
\brief Implementation of GewiEngine.
Implementation of GewiEngine, core engine for Gewi GUI control.
-
$Id: GewiEngine.cpp,v 1.4 2003/06/07 05:42:33 cozman Exp $
+
$Id: GewiEngine.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $
\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;
diff --git a/src/GewiWidget.cpp b/src/GewiWidget.cpp
index 65ff8fd..e0fe398 100755
--- a/src/GewiWidget.cpp
+++ b/src/GewiWidget.cpp
@@ -13,7 +13,7 @@
\brief Implementation of GWidget.
Implementation of GWidget, virtual widget base class.
-
$Id: GewiWidget.cpp,v 1.4 2003/05/21 02:47:56 cozman Exp $
+
$Id: GewiWidget.cpp,v 1.5 2003/06/09 03:28:43 cozman Exp $
\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);
diff --git a/src/GewiWidgetList.cpp b/src/GewiWidgetList.cpp
index 3fd71e8..81d57b9 100755
--- a/src/GewiWidgetList.cpp
+++ b/src/GewiWidgetList.cpp
@@ -13,7 +13,7 @@
\brief Implementation of WidgetList.
Implementation of WidgetList, a list of widgets used by GewiEngine and GContainers.
-
$Id: GewiWidgetList.cpp,v 1.3 2003/05/20 00:08:55 cozman Exp $
+
$Id: GewiWidgetList.cpp,v 1.4 2003/06/09 03:28:43 cozman Exp $
\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);
+ }
}
}