#include <macwindowmanager.h>
Public Member Functions | |
MacWindowManager (uint32 mode=0, MacPatterns *patterns=nullptr, Common::Language language=Common::UNK_LANG) | |
MacDrawPixPtr | getDrawPixel () |
MacDrawPixPtr | getDrawInvertPixel () |
void | setScreen (ManagedSurface *screen) |
void | setScreen (int w, int h) |
int | getWidth () |
int | getHeight () |
MacWindow * | addWindow (bool scrollable, bool resizable, bool editable) |
MacTextWindow * | addTextWindow (const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, MacMenu *menu, bool cursorHandler=true) |
MacTextWindow * | addTextWindow (const Font *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, MacMenu *menu, bool cursorHandler=true) |
void | resizeScreen (int w, int h) |
void | addWindowInitialized (MacWindow *macwindow) |
int | getLastId () |
int | getNextId () |
MacMenu * | addMenu () |
void | addMenu (int id, MacMenu *menu) |
void | removeMenu () |
void | activateMenu () |
void | activateScreenCopy () |
void | disableScreenCopy () |
bool | isMenuActive () |
void | setDesktopMode (uint32 mode) |
void | setMenuHotzone (const Common::Rect &rect) |
void | setMenuDelay (int delay) |
void | setActiveWindow (int id) |
MacWindow * | findWindowAtPoint (int16 x, int16 y) |
MacWindow * | findWindowAtPoint (Common::Point point) |
void | removeWindow (MacWindow *target) |
void | setFullRefresh (bool redraw) |
void | draw () |
bool | processEvent (Common::Event &event) |
BaseMacWindow * | getWindow (int id) |
MacPatterns & | getPatterns () |
void | setActiveWidget (MacWidget *widget) |
void | setLockedWidget (MacWidget *widget) |
void | setBackgroundWindow (MacWindow *window) |
MacPatterns & | getBuiltinPatterns () |
MacWidget * | getActiveWidget () |
MacWidget * | getLockedWidget () |
Common::Rect | getScreenBounds () |
void | clearWidgetRefs (MacWidget *widget) |
void | printWMMode (int debuglevel=0) |
MacCursorType | getCursorType () const |
void | pushCursor (MacCursorType type, Cursor *cursor=nullptr) |
void | replaceCursor (MacCursorType type, Cursor *cursor=nullptr) |
void | pushCustomCursor (const byte *data, int w, int h, int hx, int hy, int transcolor) |
void | replaceCustomCursor (const byte *data, int w, int h, int hx, int hy, int transcolor) |
void | pushCustomCursor (const Graphics::Cursor *cursor) |
void | popCursor () |
PauseToken | pauseEngine () |
void | setMode (uint32 mode) |
void | setEngine (Engine *engine) |
void | setEngineRedrawCallback (void *engine, void(*redrawCallback)(void *engine)) |
void | passPalette (const byte *palette, uint size) |
template<typename T > | |
void | decomposeColor (uint32 color, byte &r, byte &g, byte &b) |
uint32 | findBestColor (byte cr, byte cg, byte cb) |
uint32 | findBestColor (uint32 color) |
void | setDesktopColor (byte, byte, byte) |
byte | inverter (byte src) |
const byte * | getPalette () |
uint | getPaletteSize () |
void | renderZoomBox (bool redraw=false) |
void | addZoomBox (ZoomBox *box) |
void | removeMarked () |
void | loadDataBundle () |
void | cleanupDataBundle () |
void | cleanupDesktopBmp () |
BorderOffsets | getBorderOffsets (uint32 windowType) |
Common::SeekableReadStream * | getBorderFile (uint32 windowType, uint32 flags) |
Common::SeekableReadStream * | getFile (const Common::Path &filename) |
void | setTextInClipboard (const Common::U32String &str) |
Common::U32String | getTextFromClipboard (const Common::U32String &format=Common::U32String(), int *size=nullptr) |
void | clearHandlingWidgets () |
void | setMenuItemCheckMark (MacMenuItem *menuItem, bool checkMark) |
void | setMenuItemEnabled (MacMenuItem *menuItem, bool enabled) |
void | setMenuItemName (MacMenuItem *menuItem, const Common::String &name) |
void | setMenuItemAction (MacMenuItem *menuItem, int actionId) |
bool | getMenuItemCheckMark (MacMenuItem *menuItem) |
bool | getMenuItemEnabled (MacMenuItem *menuItem) |
Common::String | getMenuItemName (MacMenuItem *menuItem) |
int | getMenuItemAction (MacMenuItem *menuItem) |
MacMenu * | getMenu () |
MacMenu * | getMenu (int id) |
Public Attributes | |
MacFontManager * | _fontMan |
uint32 | _mode |
Common::Language | _language |
Common::Point | _lastClickPos |
Common::Point | _lastMousePos |
Common::Rect | _menuHotzone |
uint32 | _menuTimer |
bool | _mouseDown |
uint32 | _colorBlack |
uint32 | _colorGray80 |
uint32 | _colorGray88 |
uint32 | _colorGrayEE |
uint32 | _colorWhite |
uint32 | _colorGreen |
uint32 | _colorGreen2 |
MacWidget * | _hoveredWidget |
bool | _hilitingWidget |
Surface * | _desktopBmp |
ManagedSurface * | _desktop |
PixelFormat | _pixelformat |
ManagedSurface * | _screen |
ManagedSurface * | _screenCopy |
Common::Rect | _screenDims |
A manager class to handle window creation, destruction, drawing, moving and event handling.
void Graphics::MacWindowManager::setScreen | ( | ManagedSurface * | screen | ) |
Mutator to indicate the surface onto which the desktop will be drawn. Note that this method should be called as soon as the WM is created.
screen | Surface on which the desktop will be drawn. |
void Graphics::MacWindowManager::setScreen | ( | int | w, |
int | h | ||
) |
Mutator to indicate the dimensions of the desktop, when a backing surface is not used. Note that this method should be called as soon as the WM is created.
screen | Surface on which the desktop will be drawn. |
MacWindow* Graphics::MacWindowManager::addWindow | ( | bool | scrollable, |
bool | resizable, | ||
bool | editable | ||
) |
Create a window with the given parameters. Note that this method allocates the necessary memory for the window.
scrollable | True if the window has to be scrollable. |
resizable | True if the window can be resized. |
editable | True if the window can be edited. |
void Graphics::MacWindowManager::addWindowInitialized | ( | MacWindow * | macwindow | ) |
Adds a window that has already been initialized to the registry. Like addWindow, but this doesn't create/allocate the Window.
macWindow | the window to be added to the registry |
|
inline |
Returns the last allocated id
|
inline |
Returns the next available id and the increments the internal counter.
MacMenu* Graphics::MacWindowManager::addMenu | ( | ) |
Add the menu to the desktop. Note that the returned menu is empty, and therefore must be filled afterwards.
|
inline |
Set hot zone where menu appears (works only with autohide menu)
|
inline |
Set delay in milliseconds when menu appears (works only with autohide menu)
void Graphics::MacWindowManager::setActiveWindow | ( | int | id | ) |
Set the desired window state to active.
id | ID of the window that has to be set to active. |
MacWindow* Graphics::MacWindowManager::findWindowAtPoint | ( | int16 | x, |
int16 | y | ||
) |
Return Top Window containing a point
x | x coordinate of point |
y | y coordiante of point |
MacWindow* Graphics::MacWindowManager::findWindowAtPoint | ( | Common::Point | point | ) |
Return Top Window containing a point
point | Point |
void Graphics::MacWindowManager::removeWindow | ( | MacWindow * | target | ) |
Mark a window for removal. Note that the window data will be destroyed.
target | Window to be removed. |
|
inline |
Mutator to indicate that the entire desktop must be refreshed.
redraw | Currently unused. |
void Graphics::MacWindowManager::draw | ( | ) |
Method to draw the desktop into the screen, It will take into accout the contents set as dirty. Note that this method does not refresh the screen, g_system must be called separately.
bool Graphics::MacWindowManager::processEvent | ( | Common::Event & | event | ) |
Method to process the events from the engine. Most often this method will be called from the engine's GUI, and will send the event to the relevant windows for them to process.
event | The event to be processed. |
|
inline |
Accessor to retrieve an arbitrary window.
id | The id of the desired window. |
|
inline |
Retrieve the patterns used to fill surfaces.
void Graphics::MacWindowManager::setActiveWidget | ( | MacWidget * | widget | ) |
Sets an active widget, typically the one which steals the input It also sends deactivation message to the previous one
widget | Pointer to the widget to activate, nullptr for no widget |
void Graphics::MacWindowManager::setLockedWidget | ( | MacWidget * | widget | ) |
Similar to setActiveWidget but in this case no action including animation hover, etc can work until a window is locked. Anything outside this window will not respond to user.
widget | Pointer to the widget to lock, nullptr for no widget |
void Graphics::MacWindowManager::setBackgroundWindow | ( | MacWindow * | window | ) |
Sets a background window, which is always active, this window cannot be deactivated by clicking outside it, ie it is always in background.
window | Pointer to the widget to background, nullptr for no widget |
Common::U32String Graphics::MacWindowManager::getTextFromClipboard | ( | const Common::U32String & | format = Common::U32String() , |
int * | size = nullptr |
||
) |
get text from WM clipboard or the global clipboard
size | will change to the length of real text in clipboard |
void Graphics::MacWindowManager::clearHandlingWidgets | ( | ) |
reset events for current widgets. i.e. we reset those variables which are used for handling events for macwidgets. e.g. we clear the active widget, set mouse down false, clear the hoveredWidget this function should be called when we are going to other level to handling events. thus wm may not handle events correctly.