GRAPHICS: Skeleton of MacTextWindow

Needed to add 2 helper methods to MacWindowManager to make it cleaner
This commit is contained in:
VelocityRa 2017-04-02 01:34:15 +03:00 committed by Eugene Sandulenko
parent b28a4a8c3d
commit f2f420e15f
5 changed files with 95 additions and 6 deletions

View file

@ -0,0 +1,36 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/macgui/mactextwindow.h"
namespace Graphics {
MacTextWindow::MacTextWindow(MacWindowManager *wm) :
MacWindow(wm->getNextId(), true, true, true, wm) {
wm->addWindowInitialized(this);
}
MacTextWindow::~MacTextWindow() {
}
} // End of namespace Graphics

View file

@ -0,0 +1,36 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GRAPHICS_MACGUI_MACTEXTWINDOW_H
#define GRAPHICS_MACGUI_MACTEXTWINDOW_H
namespace Graphics {
class MacTextWindow : public MacWindow {
public:
MacTextWindow(MacWindowManager *wm);
~MacTextWindow();
};
} // End of namespace Graphics
#endif

View file

@ -178,20 +178,25 @@ MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable, bool edi
_windows.push_back(w);
_windowStack.push_back(w);
setActive(_lastId);
_lastId++;
setActive(getNextId());
return w;
}
void MacWindowManager::addWindowInitialized(MacWindow *macwindow) {
_windows.push_back(macwindow);
_windowStack.push_back(macwindow);
}
int MacWindowManager::getNextId() {
return _lastId++;
}
MacMenu *MacWindowManager::addMenu() {
_menu = new MacMenu(_lastId, _screen->getBounds(), this);
_menu = new MacMenu(getNextId(), _screen->getBounds(), this);
_windows.push_back(_menu);
_lastId++;
return _menu;
}

View file

@ -103,6 +103,17 @@ public:
* @return Pointer to the newly created window.
*/
MacWindow *addWindow(bool scrollable, bool resizable, bool editable);
/**
* Adds a window that has already been initialized to the registry.
* Like addWindow, but this doesn't create/allocate the Window.
* @param macWindow the window to be added to the registry
*/
void addWindowInitialized(MacWindow *macwindow);
/**
* Returns the next available id and the increments the internal counter.
* @return next (new) window id that can be used
*/
int getNextId();
/**
* Add the menu to the desktop.
* Note that the returned menu is empty, and therefore must be filled

View file

@ -16,6 +16,7 @@ MODULE_OBJS := \
macgui/macfontmanager.o \
macgui/macmenu.o \
macgui/mactext.o \
macgui/mactextwindow.o \
macgui/macwindow.o \
macgui/macwindowborder.o \
macgui/macwindowmanager.o \