khanat-opennel-code/code/ryzom/client/src/interface_v3/chat_text_manager.h
2012-09-11 20:26:36 +02:00

74 lines
2.2 KiB
C++

// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CHAT_TEXT_MANAGER_H
#define CHAT_TEXT_MANAGER_H
#include "nel/misc/rgba.h"
class CViewBase;
class ucstring;
/** Class to get chat text parameters, and to build new text lines
* \author Nicolas Vizerie
* \author Nevrax France
* \date 2003
*/
class CChatTextManager
{
public:
//\name Text parameters. They are read from the interface database (the configuration of text is doned in config.xml)
//@{
uint getTextFontSize() const;
uint getTextMultiLineSpace() const;
bool isTextShadowed() const;
//@}
/** Build a new text multiline using the current chat text settings
* \param msg the actual text
* \param col the color of the text
* \param justified Should be true for justified text (stretch spaces of line to fill the full width)
*/
CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false);
// Singleton access
static CChatTextManager &getInstance();
// release memory
static void releaseInstance();
// Reset the manager
void reset();
private:
static CChatTextManager *_Instance;
mutable class CCDBNodeLeaf *_TextFontSize;
mutable CCDBNodeLeaf *_TextMultilineSpace;
mutable CCDBNodeLeaf *_TextShadowed;
mutable CCDBNodeLeaf *_ShowTimestamps;
// ctor, private because of singleton
CChatTextManager();
~CChatTextManager();
bool showTimestamps() const;
};
// shortcut to get text manager instance
inline CChatTextManager &getChatTextMngr() { return CChatTextManager::getInstance(); }
#endif