30 #ifndef MACVENTURE_GUI_H 31 #define MACVENTURE_GUI_H 33 #include "graphics/macgui/macwindowmanager.h" 34 #include "graphics/macgui/macwindow.h" 35 #include "graphics/macgui/macmenu.h" 37 #include "graphics/font.h" 39 #include "common/timer.h" 41 #include "macventure/macventure.h" 42 #include "macventure/container.h" 43 #include "macventure/image.h" 44 #include "macventure/prebuilt_dialogs.h" 45 #include "macventure/dialog.h" 46 #include "macventure/controls.h" 47 #include "macventure/windows.h" 53 class MacVentureEngine;
61 struct InventoryCallbackStruct;
63 BorderBounds borderBounds(MVWindowType type);
89 WindowReference startWin;
99 void reloadInternals();
108 void clearControls();
110 void handleMenuAction(MenuAction action);
111 void updateWindow(WindowReference winID,
bool containerOpen);
112 void invertWindowColors(WindowReference winID);
114 WindowReference createInventoryWindow(ObjID objRef);
115 bool tryCloseWindow(WindowReference winID);
116 bool tryCloseWindowRec(WindowReference winID,
bool runControl =
false);
118 void closeAllWindows();
120 void highlightExitButton(ObjID objID);
124 WindowReference getObjWindow(ObjID objID);
125 WindowReference findObjWindow(ObjID objID);
128 bool processCommandEvents(WindowClick click,
Common::Event &event);
129 bool processMainGameEvents(WindowClick click,
Common::Event &event);
130 bool processOutConsoleEvents(WindowClick click,
Common::Event &event);
131 bool processSelfEvents(WindowClick click,
Common::Event &event);
132 bool processExitsEvents(WindowClick click,
Common::Event &event);
133 bool processDiplomaEvents(WindowClick click,
Common::Event &event);
136 bool processInventoryEvents(WindowReference ref, WindowClick click,
Common::Event &event);
138 const WindowData& getWindowData(WindowReference reference);
145 void select(
Common::Point cursorPosition,
bool shiftPressed,
bool isDoubleClick);
146 void handleSingleClick();
147 void handleDoubleClick();
150 void bringToFront(WindowReference window);
151 void setWindowTitle(WindowReference winID,
const Common::String &
string);
153 void ensureInventoryOpen(WindowReference reference, ObjID
id);
155 void addChild(WindowReference target, ObjID child);
156 void removeChild(WindowReference target, ObjID child);
158 void clearDraggedObjects();
161 void unselectExits();
162 void updateExit(ObjID
id);
163 void resetExitBackgroundPattern();
169 void scrollConsoleToRow(uint row);
170 uint getConsoleRowCount();
171 uint getConsoleVisibleRows();
173 void setWaitCursor(
bool wait);
176 void showPrebuiltDialog(PrebuiltDialogs type,
const Common::String &title =
"");
191 bool decodeStartupScreen();
192 bool decodeTitleScreen();
193 bool displayTitleScreenAndWait(uint32 ms);
203 WindowReference _activeWinRef;
216 struct InventoryWindowData {
232 uint16 _diplomaFontId;
233 uint16 _diplomaFontSize;
244 WindowReference _lassoWinRef;
247 bool _lassoBeingDrawn;
254 void assignObjReferences();
267 void drawCommandsWindow();
268 void drawDiplomaWindow();
269 void drawMainGameWindow();
270 void drawSelfWindow();
271 void drawInventories();
272 void drawExitsWindow();
273 void drawConsoleWindow();
275 void drawDraggedObjects();
284 Common::Point getGlobalScrolledSurfacePosition(WindowReference reference);
285 WindowData& findWindowData(WindowReference reference);
289 bool canBeSelected(ObjID obj,
const Common::Rect &clickRect, WindowReference ref);
290 bool isRectInsideObject(
Common::Rect target, ObjID obj);
291 void selectDraggable(ObjID child, WindowReference origin,
Common::Point startPos);
292 void handleDragRelease(
bool shiftPressed,
bool isDoubleClick);
296 void removeInventoryWindow(WindowReference ref);
298 void ensureAssetLoaded(ObjID obj);
333 bool canSelectDraggable();
337 void changeState(CursorInput input);
338 void executeStateIn();
339 void executeStateOut();
353 kConsoleLeftOffset = 2
362 _lines.push_back(
"");
377 if (wrappedLines.
empty())
378 _lines.push_back(
"");
381 _lines.push_back(*j);
391 _gui->createInnerSurface(composeSurface, target, borders);
392 composeSurface->
clear(kColorGreen);
396 for (uint i = _scrollPos; i != 0; i--) {
399 if (y < font->getFontHeight())
406 target->
transBlitFrom(*composeSurface, composePosition, kColorGreen);
407 delete composeSurface;
410 void updateScroll() {
411 _scrollPos = _lines.size() - 1;
415 if (_scrollPos < (
int)(_lines.size() - 1)) {
421 if (_scrollPos > 0) {
void clear(uint32 color=0)
Definition: managed_surface.h:51
void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false, bool allowCharClipping=false) const
Definition: macresman.h:126
const Common::Rect getBounds() const
Definition: managed_surface.h:328
Definition: macwindow.h:40
int wordWrapText(const Common::String &str, int maxWidth, Common::Array< Common::String > &lines, int initWidth=0, uint32 mode=kWordWrapOnExplicitNewLines) const
Definition: macwindow.h:205
iterator end()
Definition: array.h:380
iterator begin()
Definition: array.h:375
Definition: mactextwindow.h:30
Definition: macwindowmanager.h:45
int getStringWidth(const Common::String &str) const
void fillRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:954
Definition: macwindowmanager.h:149
Definition: macwindowborder.h:57
int16 & h
Definition: managed_surface.h:135
bool empty() const
Definition: array.h:352
Definition: container.h:48
Definition: atari-cursor.h:35
Definition: macventure.h:218
Definition: container.h:38
void transBlitFrom(const Surface &src, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
virtual int getFontHeight() const =0