home *** CD-ROM | disk | FTP | other *** search
- /* PedAgent.cc */
-
- #include "PedAgent.hh"
- #include "PedWindow.hh"
-
- PedAgent::PedAgent(PedTask *inParent)
- : PedTask(inParent), mWindow(NULL), mPersistent(false)
- {
- }
-
- PedAgent::~PedAgent()
- {
- if (mWindow)
- mWindow->release();
- }
-
- void
- PedAgent::InitWindow()
- {
- if (!mWindow) {
- // Note that at the moment, PedWindow() calls SetWindow(),
- // which sets mWindow, so this is redundant (but harmless).
- mWindow = new PedWindow(this);
- // Counterbalance the implicit retain. (SetWindow will retain for us.)
- mWindow->release();
- //PedPaneTE *pane = new PedPaneTE(*mWindow);
- //mWindow->SetPane(pane);
- }
- }
-
- PedWindow *
- PedAgent::Window()
- {
- return mWindow;
- }
-
- void
- PedAgent::SetWindow(PedWindow *inWindow)
- {
- if (inWindow)
- inWindow->retain();
- PedWindow *oldWindow = mWindow;
- mWindow = inWindow;
- if (oldWindow)
- oldWindow->release();
- }
-
- bool
- PedAgent::OpenWindow()
- {
- if (!mWindow)
- InitWindow();
- mWindow->Open();
- return true;
- }
-
- bool
- PedAgent::CloseWindow()
- {
- if (mWindow) {
- if (mPersistent) {
- mWindow->Close();
- } else {
- retain();
- mWindow->Dispose();
- mWindow->release();
- mWindow = NULL;
- release();
- }
- }
- return true;
- }
-