#include <macwindow.h>
Public Member Functions | |
MacWindow (int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) | |
void | move (int x, int y) |
virtual void | resize (int w, int h) |
virtual void | resizeInner (int w, int h) |
void | setDimensions (const Common::Rect &r) override |
void | setInnerDimensions (const Common::Rect &r) |
void | setBackgroundPattern (int pattern) |
bool | draw (ManagedSurface *g, bool forceRedraw=false) override |
bool | draw (bool forceRedraw=false) override |
void | blit (ManagedSurface *g, Common::Rect &dest) override |
const Common::Rect & | getInnerDimensions () override |
ManagedSurface * | getBorderSurface () override |
void | center (bool toCenter=true) |
void | setActive (bool active) override |
bool | isActive () const |
void | setTitle (const Common::String &title) |
virtual void | setTitleVisible (bool visible) |
bool | isTitleVisible () |
const Common::String & | getTitle () const |
void | setHighlight (WindowClick highlightedPart) |
void | setScroll (float scrollPos, float scrollSize) |
bool | processEvent (Common::Event &event) override |
bool | hasAllFocus () override |
void | loadBorder (Common::SeekableReadStream &file, uint32 flags, int lo=-1, int ro=-1, int to=-1, int bo=-1) |
void | loadBorder (Common::SeekableReadStream &file, uint32 flags, BorderOffsets offsets) |
void | setBorder (Graphics::ManagedSurface *surface, uint32 flags, BorderOffsets offsets) |
void | disableBorder () |
void | loadInternalBorder (uint32 flags) |
void | enableScrollbar (bool active) |
void | setCloseable (bool closeable) |
void | setBorderType (int borderType) |
int | getBorderType () const |
uint32 | getBorderFlags () const |
void | addDirtyRect (const Common::Rect &r) |
void | markAllDirty () |
void | mergeDirtyRects () |
bool | isDirty () override |
void | setBorderDirty (bool dirty) |
void | resizeBorderSurface () |
void | setMode (uint32 mode) |
void | setBorderOffsets (BorderOffsets &offsets) |
void | updateInnerDims () |
Public Member Functions inherited from Graphics::BaseMacWindow | |
BaseMacWindow (int id, bool editable, MacWindowManager *wm) | |
int | getId () |
WindowType | getType () |
bool | isEditable () |
virtual void | setVisible (bool visible, bool silent=false) |
bool | isVisible () |
ManagedSurface * | getWindowSurface () |
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::Rect & | getDimensions () |
void | setDirty (bool dirty) |
virtual bool | needsRedraw () |
virtual void | setColors (uint32 fg, uint32 bg) |
Common::Point | getAbsolutePos () |
MacWidget * | findEventHandler (Common::Event &event, int dx, int dy) |
void | removeWidget (MacWidget *child, bool del=true) |
Graphics::ManagedSurface * | getSurface () |
Protected Member Functions | |
void | drawBorder () |
WindowClick | isInBorder (int x, int y) const |
BorderOffsets | getBorderOffsets () const |
Protected Attributes | |
ManagedSurface | _borderSurface |
bool | _borderIsDirty |
Common::Rect | _innerDims |
Common::List< Common::Rect > | _dirtyRects |
bool | _hasScrollBar |
uint32 | _mode |
Protected Attributes inherited from Graphics::BaseMacWindow | |
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 |
An implementation of an ordinary window in the Mac interface. It supports custom resizing, scrolling, borders, etc.
Graphics::MacWindow::MacWindow | ( | int | id, |
bool | scrollable, | ||
bool | resizable, | ||
bool | editable, | ||
MacWindowManager * | wm | ||
) |
Construct a simple window, with the default settings. Note that the scroll must be implemented in the event handling, even if the scrollable flag is set to true.
id | See BaseMacWindow. |
scrollable | True if the window can be scrolled. |
resizable | True if the window can be resized. |
editable | See BaseMacWindow. |
wm | See BaseMacWindow. |
void Graphics::MacWindow::move | ( | int | x, |
int | y | ||
) |
Change the window's location to fixed coordinates (not delta).
x | New left position of the window relative to the WM's screen. |
y | New top position of the window relative to the WM's screen. |
|
overridevirtual |
Change the dimensions of the window ([0, 0, 0, 0] by default). Note that this can be used to update both the position and the size of the window, although move() and resize() might be more comfortable.
r | The desired dimensions of the window. |
Reimplemented from Graphics::MacWidget.
void Graphics::MacWindow::setInnerDimensions | ( | const Common::Rect & | r | ) |
Change the inner dimension of the window. Note that this changes the window inner dimension and calculates outer dimension (ie with border, etc)
r | The desired dimensions of the window. |
void Graphics::MacWindow::setBackgroundPattern | ( | int | pattern | ) |
Set a background pattern for the window.
pattern |
|
overridevirtual |
Similar to that described in BaseMacWindow.
g | See BaseMacWindow. |
forceRedraw | If true, the borders are guarranteed to redraw. |
Implements Graphics::BaseMacWindow.
|
overridevirtual |
Method called to internally draw the window. This relies on the window being marked as dirty unless otherwise specified.
forceRedraw | Its behavior depends on the subclass. |
Implements Graphics::BaseMacWindow.
|
inlineoverridevirtual |
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().
Implements Graphics::BaseMacWindow.
|
inlineoverridevirtual |
Method to access the border surface of the window.
Implements Graphics::BaseMacWindow.
void Graphics::MacWindow::center | ( | bool | toCenter = true | ) |
Centers the window using the dimensions of the parent window manager, or undoes this; does nothing if WM is null.
|
overridevirtual |
Mutator to change the active state of the window. Most often called from the WM.
active | Target state. |
Reimplemented from Graphics::MacWidget.
bool Graphics::MacWindow::isActive | ( | ) | const |
Accessor to determine whether a window is active.
void Graphics::MacWindow::setTitle | ( | const Common::String & | title | ) |
Mutator to change the title of the window.
title | Target title. |
|
virtual |
Set visibility of window title.
visible | visibility of window. |
Reimplemented in Director::Window.
bool Graphics::MacWindow::isTitleVisible | ( | ) |
Get visibility of window title.
|
inline |
Accessor to get the title of the window.
void Graphics::MacWindow::setHighlight | ( | WindowClick | highlightedPart | ) |
Highlight the target part of the window. Used for the default borders.
highlightedPart | Part to be highlighted. |
void Graphics::MacWindow::setScroll | ( | float | scrollPos, |
float | scrollSize | ||
) |
Set the scroll poisition.
scrollPos | Target scroll position. |
scrollSize | Size of the scrolling bar. |
|
overridevirtual |
See BaseMacWindow.
Implements Graphics::BaseMacWindow.
void Graphics::MacWindow::loadBorder | ( | Common::SeekableReadStream & | file, |
uint32 | flags, | ||
int | lo = -1 , |
||
int | ro = -1 , |
||
int | to = -1 , |
||
int | bo = -1 |
||
) |
Set arbitrary border from a BMP data stream, with custom border offsets. Note that the BMP has to be 9patch compliant. For examples, go to: https://github.com/blorente/MacVenture-Extract-Guide/tree/master/borders
file | The BMP data stream with the desired border. |
active | Whether the border corresponds with the active state of the window. |
lo | Width of the left side of the border, in pixels. |
ro | Width of the right side of the border, in pixels. |
to | Width of the top side of the border, in pixels. |
bo | Width of the bottom side of the border, in pixels. |
|
inline |
we better set this before we load the border
scrollbar | state |
void Graphics::MacWindow::setCloseable | ( | bool | closeable | ) |
Indicate whether the window can be closed (false by default).
closeable | True if the window can be closed. |
void Graphics::MacWindow::setBorderType | ( | int | borderType | ) |
Mutator to change the border type.
borderType | Border type. |
|
inline |
Accessor to get the border type.
uint32 Graphics::MacWindow::getBorderFlags | ( | ) | const |
We should call this method whenever we need border flags don't calc border flags yourself
|
inlineoverridevirtual |
Method that checks if the window is needs redrawing.
Implements Graphics::BaseMacWindow.