ScummVM API documentation
Graphics::MacWindowManager Class Reference

#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 ()
 
MacWindowaddWindow (bool scrollable, bool resizable, bool editable)
 
MacTextWindowaddTextWindow (const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, MacMenu *menu, bool cursorHandler=true)
 
MacTextWindowaddTextWindow (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 ()
 
MacMenuaddMenu ()
 
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)
 
MacWindowfindWindowAtPoint (int16 x, int16 y)
 
MacWindowfindWindowAtPoint (Common::Point point)
 
void removeWindow (MacWindow *target)
 
void setFullRefresh (bool redraw)
 
void draw ()
 
bool processEvent (Common::Event &event)
 
BaseMacWindowgetWindow (int id)
 
MacPatternsgetPatterns ()
 
void setActiveWidget (MacWidget *widget)
 
void setLockedWidget (MacWidget *widget)
 
void setBackgroundWindow (MacWindow *window)
 
MacPatternsgetBuiltinPatterns ()
 
MacWidgetgetActiveWidget ()
 
MacWidgetgetLockedWidget ()
 
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::SeekableReadStreamgetBorderFile (uint32 windowType, uint32 flags)
 
Common::SeekableReadStreamgetFile (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)
 
MacMenugetMenu ()
 
MacMenugetMenu (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
 

Detailed Description

A manager class to handle window creation, destruction, drawing, moving and event handling.

Member Function Documentation

◆ setScreen() [1/2]

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.

Parameters
screenSurface on which the desktop will be drawn.

◆ setScreen() [2/2]

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.

Parameters
screenSurface on which the desktop will be drawn.

◆ addWindow()

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.

Parameters
scrollableTrue if the window has to be scrollable.
resizableTrue if the window can be resized.
editableTrue if the window can be edited.
Returns
Pointer to the newly created window.

◆ addWindowInitialized()

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.

Parameters
macWindowthe window to be added to the registry

◆ getLastId()

int Graphics::MacWindowManager::getLastId ( )
inline

Returns the last allocated id

Returns
last allocated window id

◆ getNextId()

int Graphics::MacWindowManager::getNextId ( )
inline

Returns the next available id and the increments the internal counter.

Returns
next (new) window id that can be used

◆ addMenu()

MacMenu* Graphics::MacWindowManager::addMenu ( )

Add the menu to the desktop. Note that the returned menu is empty, and therefore must be filled afterwards.

Returns
Pointer to a new empty menu.

◆ setMenuHotzone()

void Graphics::MacWindowManager::setMenuHotzone ( const Common::Rect rect)
inline

Set hot zone where menu appears (works only with autohide menu)

◆ setMenuDelay()

void Graphics::MacWindowManager::setMenuDelay ( int  delay)
inline

Set delay in milliseconds when menu appears (works only with autohide menu)

◆ setActiveWindow()

void Graphics::MacWindowManager::setActiveWindow ( int  id)

Set the desired window state to active.

Parameters
idID of the window that has to be set to active.

◆ findWindowAtPoint() [1/2]

MacWindow* Graphics::MacWindowManager::findWindowAtPoint ( int16  x,
int16  y 
)

Return Top Window containing a point

Parameters
xx coordinate of point
yy coordiante of point

◆ findWindowAtPoint() [2/2]

MacWindow* Graphics::MacWindowManager::findWindowAtPoint ( Common::Point  point)

Return Top Window containing a point

Parameters
pointPoint

◆ removeWindow()

void Graphics::MacWindowManager::removeWindow ( MacWindow target)

Mark a window for removal. Note that the window data will be destroyed.

Parameters
targetWindow to be removed.

◆ setFullRefresh()

void Graphics::MacWindowManager::setFullRefresh ( bool  redraw)
inline

Mutator to indicate that the entire desktop must be refreshed.

Parameters
redrawCurrently unused.

◆ draw()

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.

◆ processEvent()

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.

Parameters
eventThe event to be processed.
Returns
True if the event was processed.

◆ getWindow()

BaseMacWindow* Graphics::MacWindowManager::getWindow ( int  id)
inline

Accessor to retrieve an arbitrary window.

Parameters
idThe id of the desired window.
Returns
Pointer to the requested window, if it exists.

◆ getPatterns()

MacPatterns& Graphics::MacWindowManager::getPatterns ( )
inline

Retrieve the patterns used to fill surfaces.

Returns
A MacPatterns object reference with the patterns.

◆ setActiveWidget()

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

Parameters
widgetPointer to the widget to activate, nullptr for no widget

◆ setLockedWidget()

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.

Parameters
widgetPointer to the widget to lock, nullptr for no widget

◆ setBackgroundWindow()

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.

Parameters
windowPointer to the widget to background, nullptr for no widget

◆ getTextFromClipboard()

Common::U32String Graphics::MacWindowManager::getTextFromClipboard ( const Common::U32String format = Common::U32String(),
int *  size = nullptr 
)

get text from WM clipboard or the global clipboard

Parameters
sizewill change to the length of real text in clipboard
Returns
the text in clipboard, which may contained the format

◆ clearHandlingWidgets()

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.


The documentation for this class was generated from the following file: