diff options
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/maceditabletext.cpp | 15 | ||||
-rw-r--r-- | graphics/macgui/maceditabletext.h | 8 | ||||
-rw-r--r-- | graphics/macgui/macwidget.cpp | 9 | ||||
-rw-r--r-- | graphics/macgui/macwidget.h | 14 |
4 files changed, 27 insertions, 19 deletions
diff --git a/graphics/macgui/maceditabletext.cpp b/graphics/macgui/maceditabletext.cpp index 5295566b11..b5aa7ecbc9 100644 --- a/graphics/macgui/maceditabletext.cpp +++ b/graphics/macgui/maceditabletext.cpp @@ -45,8 +45,8 @@ enum { static void cursorTimerHandler(void *refCon); -MacEditableText::MacEditableText(Common::U32String s, MacWindow *parent, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear) : - MacText(s, parent->_wm, macFont, fgcolor, bgcolor, maxWidth, textAlignment, interlinear), MacWidget(0, true, parent) { +MacEditableText::MacEditableText(MacWindow *parent, int x, int y, int w, int h, Common::U32String s, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear) : + MacWidget(parent, x, y, w, h, true), MacText(s, parent->_wm, macFont, fgcolor, bgcolor, maxWidth, textAlignment, interlinear) { _parent = parent; _maxWidth = maxWidth; @@ -54,8 +54,8 @@ MacEditableText::MacEditableText(Common::U32String s, MacWindow *parent, const M init(); } -MacEditableText::MacEditableText(const Common::String &s, MacWindow *parent, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear) : - MacText(s, parent->_wm, macFont, fgcolor, bgcolor, maxWidth, textAlignment, interlinear), MacWidget(0, true, parent) { +MacEditableText::MacEditableText(MacWindow *parent, int x, int y, int w, int h, const Common::String &s, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear) : + MacWidget(parent, x, y, w, h, true), MacText(s, parent->_wm, macFont, fgcolor, bgcolor, maxWidth, textAlignment, interlinear) { _parent = parent; _maxWidth = maxWidth; @@ -132,7 +132,7 @@ void MacEditableText::clearText() { updateCursorPos(); } -void MacEditableText::setTextWindowFont(const MacFont *font) { +void MacEditableText::setTextFont(const MacFont *font) { _font = font; _fontRef = _wm->_fontMan->getFont(*font); @@ -140,7 +140,7 @@ void MacEditableText::setTextWindowFont(const MacFont *font) { MacText::setDefaultFormatting(font->getId(), font->getSlant(), font->getSize(), 0, 0, 0); } -const MacFont *MacEditableText::getTextWindowFont() { +const MacFont *MacEditableText::getTextFont() { return _font; } @@ -299,7 +299,8 @@ bool MacEditableText::processEvent(Common::Event &event) { if (!_editable) return false; - _wm->setActive(getId()); + // Make the parent window active + _wm->setActive(_parent->getId()); if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_CTRL | Common::KBD_META)) { return false; diff --git a/graphics/macgui/maceditabletext.h b/graphics/macgui/maceditabletext.h index e81c497dfd..519052893f 100644 --- a/graphics/macgui/maceditabletext.h +++ b/graphics/macgui/maceditabletext.h @@ -52,9 +52,9 @@ struct SelectedText { class MacEditableText : public MacText, public MacWidget { public: - MacEditableText(Common::U32String s, MacWindow *parent, const MacFont *font, int fgcolor, int bgcolor, + MacEditableText(MacWindow *parent, int x, int y, int w, int h, Common::U32String s, const MacFont *font, int fgcolor, int bgcolor, int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft, int interlinear = 0); - MacEditableText(const Common::String &s, MacWindow *parent, const MacFont *font, int fgcolor, int bgcolor, + MacEditableText(MacWindow *parent, int x, int y, int w, int h, const Common::String &s, const MacFont *font, int fgcolor, int bgcolor, int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft, int interlinear = 0); // 0 pixels between the lines by default virtual ~MacEditableText(); @@ -65,8 +65,8 @@ public: virtual bool draw(ManagedSurface *g, bool forceRedraw = false); - void setTextWindowFont(const MacFont *macFont); - const MacFont *getTextWindowFont(); + void setTextFont(const MacFont *macFont); + const MacFont *getTextFont(); void appendText(Common::U32String str, const MacFont *macFont, bool skipAdd = false); void appendText(const Common::String &str, const MacFont *macFont, bool skipAdd = false); diff --git a/graphics/macgui/macwidget.cpp b/graphics/macgui/macwidget.cpp index 2ff7720019..56fa13c5fc 100644 --- a/graphics/macgui/macwidget.cpp +++ b/graphics/macgui/macwidget.cpp @@ -24,9 +24,14 @@ namespace Graphics { -MacWidget::MacWidget(int id, bool focusable, MacWindow *parent) : - _id(id), _focusable(focusable), _parent(parent) { +MacWidget::MacWidget(MacWindow *parent, int x, int y, int w, int h, bool focusable) : + _focusable(focusable), _parent(parent) { _contentIsDirty = true; + + _dims.left = x; + _dims.right = x + w; + _dims.top = y; + _dims.bottom = y + h; } } // End of namespace Graphics diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h index a6edef1f42..b5a4cd9217 100644 --- a/graphics/macgui/macwidget.h +++ b/graphics/macgui/macwidget.h @@ -25,29 +25,31 @@ #include "common/rect.h" +namespace Common { + struct Event; +} + namespace Graphics { class MacWindow; +class ManagedSurface; class MacWidget { friend class MacEditableText; public: - MacWidget(int id, bool focusable, MacWindow *parent); + MacWidget(MacWindow *parent, int x, int y, int w, int h, bool focusable); virtual ~MacWidget() {} const Common::Rect &getDimensions() { return _dims; } - int getId() { return _id; } bool isFocusable() { return _focusable; } virtual void setActive(bool active) = 0; void setDirty(bool dirty) { _contentIsDirty = dirty; } - //virtual bool draw(ManagedSurface *g, bool forceRedraw = false) = 0; - //virtual bool processEvent(Common::Event &event) = 0; + virtual bool draw(ManagedSurface *g, bool forceRedraw = false) = 0; + virtual bool processEvent(Common::Event &event) = 0; virtual bool hasAllFocus() = 0; protected: - int _id; - bool _focusable; bool _contentIsDirty; |