tibia-client/src/otclient/core/statictext.h

60 lines
2.1 KiB
C
Raw Normal View History

2011-12-29 18:45:59 +01:00
/*
2012-01-02 17:58:37 +01:00
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
2011-12-29 18:45:59 +01:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef STATICTEXT_H
#define STATICTEXT_H
#include "thing.h"
#include <framework/graphics/fontmanager.h>
class StaticText : public Thing
{
public:
StaticText();
2012-01-30 01:00:12 +01:00
void draw(const Point& dest, const Rect& parentRect);
2011-12-29 18:45:59 +01:00
std::string getName() { return m_name; }
2012-02-03 01:25:18 +01:00
Otc::SpeakType getMessageType() { return m_messageType; }
2011-12-29 18:45:59 +01:00
std::string getFirstMessage() { return m_messages[0]; }
2012-02-03 01:25:18 +01:00
bool isYell() { return m_messageType == Otc::SpeakYell || m_messageType == Otc::SpeakMonsterYell; }
2012-01-30 01:00:12 +01:00
2012-02-03 01:25:18 +01:00
bool addMessage(const std::string& name, Otc::SpeakType type, const std::string& message);
2011-12-29 18:45:59 +01:00
void removeMessage();
StaticTextPtr asStaticText() { return std::static_pointer_cast<StaticText>(shared_from_this()); }
private:
void compose();
FontPtr m_font;
Size m_textSize;
2012-01-30 01:00:12 +01:00
Boolean<false> m_yell;
2011-12-29 18:45:59 +01:00
std::vector<std::string> m_messages;
std::string m_name, m_text;
2012-02-03 01:25:18 +01:00
Otc::SpeakType m_messageType;
2011-12-29 18:45:59 +01:00
Color m_color;
};
#endif