aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/gui.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-07-19 17:57:30 +0200
committerBorja Lorente2016-08-14 18:57:26 +0200
commit91493aaeb860edbdc991bca679ad6cf8a9d513eb (patch)
treeea2c70b377cd89f9eee797f1b339e828f5c6701d /engines/macventure/gui.cpp
parent49a2efe408575dbbbdd4e7fc060df843dd8ecd1f (diff)
downloadscummvm-rg350-91493aaeb860edbdc991bca679ad6cf8a9d513eb.tar.gz
scummvm-rg350-91493aaeb860edbdc991bca679ad6cf8a9d513eb.tar.bz2
scummvm-rg350-91493aaeb860edbdc991bca679ad6cf8a9d513eb.zip
MACVENTURE: Add closeable inventory windows
Diffstat (limited to 'engines/macventure/gui.cpp')
-rw-r--r--engines/macventure/gui.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index c1582988cf..d38a7a5c3d 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -223,8 +223,8 @@ void Gui::initWindows() {
_mainGameWindow->setDimensions(getWindowData(kMainGameWindow).bounds);
_mainGameWindow->setActive(false);
_mainGameWindow->setCallback(mainGameWindowCallback, this);
- loadBorder(_mainGameWindow, "border_no_scroll_inac.bmp", false);
- loadBorder(_mainGameWindow, "border_no_scroll_act.bmp", true);
+ //loadBorder(_mainGameWindow, "border_no_scroll_inac.bmp", false);
+ //loadBorder(_mainGameWindow, "border_no_scroll_act.bmp", true);
// In-game Output Console
_outConsoleWindow = _wm.addWindow(false, true, true);
@@ -335,8 +335,9 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) {
newWindow->setDimensions(newData.bounds);
newWindow->setCallback(inventoryWindowCallback, this);
- loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
- loadBorder(newWindow, "border_no_scroll_act.bmp", true);
+ newWindow->setCloseable(true);
+ //loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
+ //loadBorder(newWindow, "border_no_scroll_act.bmp", true);
_inventoryWindows.push_back(newWindow);
debug("Create new inventory window. Reference: %d", newData.refcon);
@@ -1283,14 +1284,32 @@ bool MacVenture::Gui::processDiplomaEvents(WindowClick click, Common::Event & ev
}
bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
+ if (event.type == Common::EVENT_LBUTTONDOWN && click == kBorderCloseButton) {
+ WindowReference ref = findWindowAtPoint(event.mouse);
+ if (ref == kNoWindow) return false;
+
+ if (click == kBorderCloseButton) {
+ _inventoryWindows.remove_at(ref - kInventoryStart);
+ bool found = false;
+ Common::List<WindowData>::iterator it;
+ for (it = _windowData->begin(); it != _windowData->end() && !found; it++) {
+ if (it->refcon == ref) {
+ _windowData->erase(it);
+ found = true;
+ }
+ }
+ return true;
+ }
+ }
+
if (_engine->needsClickToContinue())
return true;
if (event.type == Common::EVENT_LBUTTONDOWN) {
-
// Find the appropriate window
WindowReference ref = findWindowAtPoint(event.mouse);
if (ref == kNoWindow) return false;
+
Graphics::MacWindow *win = findWindow(ref);
WindowData &data = findWindowData((WindowReference) ref);
Common::Point pos;