Files
bullet3/examples/ThirdPartyLibs/Gwen/Controls/RichLabel.h
erwincoumans ab8f16961e Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
2018-09-23 14:17:31 -07:00

60 lines
1.3 KiB
C++

/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#pragma once
#ifndef GWEN_CONTROLS_RICHLABEL_H
#define GWEN_CONTROLS_RICHLABEL_H
#include "Gwen/BaseRender.h"
#include "Gwen/Controls/Base.h"
#include "Gwen/Controls/Text.h"
#include "Gwen/TextObject.h"
namespace Gwen
{
namespace Controls
{
class GWEN_EXPORT RichLabel : public Controls::Base
{
public:
GWEN_CONTROL(RichLabel, Gwen::Controls::Base);
void AddLineBreak();
void AddText(const Gwen::TextObject& text, Gwen::Color color, Gwen::Font* font = NULL);
virtual bool SizeToChildren(bool w = true, bool h = true);
protected:
struct DividedText
{
typedef std::list<DividedText> List;
DividedText()
{
type = 0;
font = NULL;
}
unsigned char type;
Gwen::UnicodeString text;
Gwen::Color color;
Gwen::Font* font;
};
void Layout(Gwen::Skin::Base* skin);
void SplitLabel(const Gwen::UnicodeString& text, Gwen::Font* pFont, const DividedText& txt, int& x, int& y, int& lineheight);
void CreateNewline(int& x, int& y, int& lineheight);
void CreateLabel(const Gwen::UnicodeString& text, const DividedText& txt, int& x, int& y, int& lineheight, bool NoSplit);
void Rebuild();
void OnBoundsChanged(Gwen::Rect oldBounds);
DividedText::List m_TextBlocks;
bool m_bNeedsRebuild;
};
} // namespace Controls
} // namespace Gwen
#endif