GRAPHICS: MACGUI: Add title functions

This commit is contained in:
djsrv 2020-07-24 00:32:02 -04:00
parent dc3216dab8
commit d7b1d27ccd
2 changed files with 22 additions and 3 deletions

View File

@ -68,6 +68,8 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac
_closeable = false;
_borderWidth = kBorderWidth;
_titleVisible = true;
}
static const byte noborderData[3][3] = {
@ -258,7 +260,7 @@ void MacWindow::drawBorderFromSurface(ManagedSurface *g) {
void MacWindow::drawSimpleBorder(ManagedSurface *g) {
bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = !_title.empty();
bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = _titleVisible && !_title.empty();
const int size = kBorderWidth;
int x = 0;
int y = 0;

View File

@ -235,9 +235,25 @@ public:
/**
* Mutator to change the title of the window.
* @param title Target title of the window.
* @param title Target title.
*/
void setTitle(Common::String &title) { _title = title; }
void setTitle(const Common::String &title) { _title = title; _borderIsDirty = true; }
/**
* Accessor to get the title of the window.
* @return Title.
*/
Common::String getTitle() { return _title; };
/**
* Mutator to change the visible state of the title.
* @param active Target state.
*/
void setTitleVisible(bool titleVisible) { _titleVisible = titleVisible; _borderIsDirty = true; };
/**
* Accessor to determine whether the title is visible.
* @return True if the title is visible.
*/
bool isTitleVisible() { return _titleVisible; };
/**
* Highlight the target part of the window.
* Used for the default borders.
@ -322,6 +338,7 @@ private:
float _scrollPos, _scrollSize;
Common::String _title;
bool _titleVisible;
};