ScummVM API documentation
Graphics::BaseMacWindow Class Referenceabstract

#include <macwindow.h>

Inheritance diagram for Graphics::BaseMacWindow:
Graphics::MacWidget Graphics::MacMenu Graphics::MacWindow Graphics::MacPopUp Director::Window Graphics::MacTextWindow

Public Member Functions

 BaseMacWindow (int id, bool editable, MacWindowManager *wm)
 
int getId ()
 
WindowType getType ()
 
bool isEditable ()
 
virtual void setVisible (bool visible, bool silent=false)
 
bool isVisible ()
 
ManagedSurfacegetWindowSurface ()
 
virtual ManagedSurfacegetBorderSurface ()=0
 
virtual const Common::RectgetInnerDimensions ()=0
 
virtual bool draw (bool forceRedraw=false)=0
 
virtual bool draw (ManagedSurface *g, bool forceRedraw=false)=0
 
virtual bool processEvent (Common::Event &event)=0
 
virtual bool isDirty ()=0
 
void setCallback (bool(*callback)(WindowClick, Common::Event &, void *), void *data)
 
- Public Member Functions inherited from Graphics::MacWidget
 MacWidget (MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border=0, uint16 gutter=0, uint16 shadow=0, uint32 fgcolor=0, uint32 bgcolor=0xff)
 
const Common::RectgetDimensions ()
 
virtual void setActive (bool active)
 
void setDirty (bool dirty)
 
virtual bool needsRedraw ()
 
virtual void blit (ManagedSurface *g, Common::Rect &dest)
 
virtual bool hasAllFocus ()
 
virtual void setColors (uint32 fg, uint32 bg)
 
virtual void setDimensions (const Common::Rect &r)
 
Common::Point getAbsolutePos ()
 
MacWidgetfindEventHandler (Common::Event &event, int dx, int dy)
 
void removeWidget (MacWidget *child, bool del=true)
 
Graphics::ManagedSurfacegetSurface ()
 

Protected Attributes

int _id
 
WindowType _type
 
bool _editable
 
bool(* _callback )(WindowClick, Common::Event &, void *)
 
void * _dataPtr
 
bool _visible
 
bool _draggable
 
- Protected Attributes inherited from Graphics::MacWidget
uint16 _border
 
uint16 _gutter
 
uint16 _shadow
 
uint32 _fgcolor
 
uint32 _bgcolor
 
Graphics::ManagedSurface_composeSurface
 
bool _contentIsDirty
 

Additional Inherited Members

- Public Attributes inherited from Graphics::MacWidget
bool _focusable
 
bool _active
 
bool _editable
 
uint _priority
 
Common::Rect _dims
 
MacWindowManager_wm
 
MacWidget_parent
 
Common::Array< MacWidget * > _children
 

Detailed Description

Abstract class that defines common functionality for all window classes. It supports event callbacks and drawing.

Constructor & Destructor Documentation

◆ BaseMacWindow()

Graphics::BaseMacWindow::BaseMacWindow ( int  id,
bool  editable,
MacWindowManager wm 
)

Base constructor.

Parameters
idID of the window.
editableTrue if the window is editable.
wmPointer to the MacWindowManager that owns the window.

Member Function Documentation

◆ getId()

int Graphics::BaseMacWindow::getId ( )
inline

Accessor method to the id of the window.

Returns
The id set in the constructor.

◆ getType()

WindowType Graphics::BaseMacWindow::getType ( )
inline

Accessor method to the type of window. Each subclass must indicate it's type.

Returns
The type of the window.

◆ isEditable()

bool Graphics::BaseMacWindow::isEditable ( )
inlinevirtual

Accessor method to check whether the window is editable (e.g. for resizing).

Returns
True if the window is editable as indicated in the constructor.

Reimplemented from Graphics::MacWidget.

◆ setVisible()

virtual void Graphics::BaseMacWindow::setVisible ( bool  visible,
bool  silent = false 
)
virtual

Mutator to change the visible state of the window.

Parameters
visibleTarget state.

Reimplemented in Graphics::MacMenu, and Director::Window.

◆ isVisible()

bool Graphics::BaseMacWindow::isVisible ( )

Accessor to determine whether a window is active.

Returns
True if the window is active.

◆ getWindowSurface()

ManagedSurface* Graphics::BaseMacWindow::getWindowSurface ( )
inline

Method to access the entire interior surface of the window (e.g. to draw an image).

Returns
A pointer to the entire interior surface of the window.

◆ getBorderSurface()

virtual ManagedSurface* Graphics::BaseMacWindow::getBorderSurface ( )
pure virtual

Method to access the border surface of the window.

Returns
A pointer to the border surface of the window.

Implemented in Graphics::MacWindow, and Graphics::MacMenu.

◆ getInnerDimensions()

virtual const Common::Rect& Graphics::BaseMacWindow::getInnerDimensions ( )
pure virtual

Accessor to retrieve the dimensions of the inner surface of the window (i.e. without taking borders into account). Note that the returned dimensions' position is relative to the WM's screen, just like in getDimensions().

Returns
The inner dimensions of the window.

Implemented in Graphics::MacWindow, and Graphics::MacMenu.

◆ draw() [1/2]

virtual bool Graphics::BaseMacWindow::draw ( bool  forceRedraw = false)
pure virtual

Method called to internally draw the window. This relies on the window being marked as dirty unless otherwise specified.

Parameters
forceRedrawIts behavior depends on the subclass.

Reimplemented from Graphics::MacWidget.

Implemented in Graphics::MacWindow, Graphics::MacMenu, and Graphics::MacTextWindow.

◆ draw() [2/2]

virtual bool Graphics::BaseMacWindow::draw ( ManagedSurface g,
bool  forceRedraw = false 
)
pure virtual

Method called to draw the window into the target surface. This method is most often called by the WM, and relies on the window being marked as dirty unless otherwise specified.

Parameters
gSurface on which to draw the window.
forceRedrawIt's behavior depends on the subclass.

Reimplemented from Graphics::MacWidget.

Implemented in Graphics::MacWindow, Graphics::MacMenu, Graphics::MacTextWindow, and Graphics::MacPopUp.

◆ processEvent()

virtual bool Graphics::BaseMacWindow::processEvent ( Common::Event event)
pure virtual

Method called by the WM when there is an event concerning the window. Note that depending on the subclass of the window, it might not be called if the window is not active.

Parameters
eventEvent to be processed.
Returns
true If the event was successfully consumed and processed.

Reimplemented from Graphics::MacWidget.

Implemented in Graphics::MacWindow, Director::Window, Graphics::MacMenu, and Graphics::MacTextWindow.

◆ isDirty()

virtual bool Graphics::BaseMacWindow::isDirty ( )
pure virtual

Method that checks if the window is needs redrawing.

Implemented in Graphics::MacWindow, and Graphics::MacMenu.

◆ setCallback()

void Graphics::BaseMacWindow::setCallback ( bool(*)(WindowClick, Common::Event &, void *)  callback,
void *  data 
)
inline

Set the callback that will be used when an event needs to be processed.

Parameters
callbackA function pointer to a function that accepts:
  • A WindowClick, the pert of the window that was clicked.
  • The event to be processed.
  • Any additional required data (e.g. the engine's GUI).

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