aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
authorMartin Kiewitz2009-11-11 20:08:55 +0000
committerMartin Kiewitz2009-11-11 20:08:55 +0000
commite035ef032bda4697ecd3410698e5b69ed9ce8d2b (patch)
treeb60b9ceebff05e571db7815c14fb1b6a81b29cc8 /engines/sci/gui
parent429d8be2dc86b93416adf387353a30e3c0bd97dd (diff)
downloadscummvm-rg350-e035ef032bda4697ecd3410698e5b69ed9ce8d2b.tar.gz
scummvm-rg350-e035ef032bda4697ecd3410698e5b69ed9ce8d2b.tar.bz2
scummvm-rg350-e035ef032bda4697ecd3410698e5b69ed9ce8d2b.zip
SCI/newgui: menu now only missing: menu invert, separators
svn-id: r45839
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui_menu.cpp29
-rw-r--r--engines/sci/gui/gui_menu.h1
2 files changed, 26 insertions, 4 deletions
diff --git a/engines/sci/gui/gui_menu.cpp b/engines/sci/gui/gui_menu.cpp
index 130c42f0d0..088b48853c 100644
--- a/engines/sci/gui/gui_menu.cpp
+++ b/engines/sci/gui/gui_menu.cpp
@@ -400,6 +400,7 @@ GuiMenuItemEntry *SciGuiMenu::interactiveGetItem(uint16 menuId, uint16 itemId) {
GuiMenuItemList::iterator itemIterator = _itemList.begin();
GuiMenuItemList::iterator itemEnd = _itemList.end();
GuiMenuItemEntry *itemEntry;
+ GuiMenuItemEntry *firstItemEntry = NULL;
GuiMenuItemEntry *lastItemEntry = NULL;
// Fixup menuId if needed
@@ -407,20 +408,21 @@ GuiMenuItemEntry *SciGuiMenu::interactiveGetItem(uint16 menuId, uint16 itemId) {
menuId = 1;
if (menuId == 0)
menuId = _listCount;
- // Fixup itemId as well
- if (itemId == 0)
- itemId = 32678;
while (itemIterator != itemEnd) {
itemEntry = *itemIterator;
if (itemEntry->menuId == menuId) {
if (itemEntry->id == itemId)
return itemEntry;
+ if (!firstItemEntry)
+ firstItemEntry = itemEntry;
if ((!lastItemEntry) || (itemEntry->id > lastItemEntry->id))
lastItemEntry = itemEntry;
}
itemIterator++;
}
- return lastItemEntry;
+ if (itemId == 0)
+ return lastItemEntry;
+ return firstItemEntry;
}
void SciGuiMenu::drawMenu(uint16 menuId) {
@@ -496,6 +498,17 @@ void SciGuiMenu::drawMenu(uint16 menuId) {
_gfx->BitsShow(_menuRect);
}
+void SciGuiMenu::invertMenuSelection(uint16 itemId) {
+ Common::Rect itemRect = _menuRect;
+
+ itemRect.top += (itemId - 1) * _gfx->_curPort->fontHeight;
+ itemRect.bottom = itemRect.top + _gfx->_curPort->fontHeight + 1;
+ itemRect.left++; itemRect.right--;
+
+ _gfx->InvertRect(itemRect);
+ _gfx->BitsShow(itemRect);
+}
+
GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
sci_event_t curEvent;
uint16 newMenuId = _curMenuId;
@@ -506,8 +519,13 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
calculateTextWidth();
_oldPort = _gfx->SetPort(_gfx->_menuPort);
_barSaveHandle = _gfx->BitsSave(_gfx->_menuBarRect, SCI_SCREEN_MASK_VISUAL);
+
+ _gfx->PenColor(0);
+ _gfx->BackColor(_screen->_colorWhite);
+
drawBar();
drawMenu(curItemEntry->menuId);
+ invertMenuSelection(curItemEntry->id);
_gfx->BitsShow(_gfx->_menuBarRect);
_gfx->BitsShow(_menuRect);
@@ -544,7 +562,10 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
if (newMenuId != curItemEntry->menuId) {
// Menu changed, remove cur menu and paint new menu
drawMenu(newMenuId);
+ } else {
+ invertMenuSelection(curItemEntry->id);
}
+ invertMenuSelection(newItemId);
curItemEntry = newItemEntry;
}
diff --git a/engines/sci/gui/gui_menu.h b/engines/sci/gui/gui_menu.h
index 66d0c3d7e0..c11b84a0ce 100644
--- a/engines/sci/gui/gui_menu.h
+++ b/engines/sci/gui/gui_menu.h
@@ -94,6 +94,7 @@ private:
GuiMenuItemEntry *findItem(uint16 menuId, uint16 itemId);
void calculateTextWidth();
void drawMenu(uint16 menuId);
+ void invertMenuSelection(uint16 itemId);
GuiMenuItemEntry *interactiveWithKeyboard();
GuiMenuItemEntry *interactiveWithMouse();
GuiMenuItemEntry *interactiveGetItem(uint16 menuId, uint16 itemId);