2011-12-14 00:23:17 +03:00
# pragma once
2009-04-16 14:14:13 +03:00
2010-02-04 17:50:59 +02:00
# include "FontBase.h"
2012-05-13 18:04:21 +03:00
# include "UIFramework/Geometries.h"
2011-12-14 00:23:17 +03:00
2009-04-16 14:14:13 +03:00
2009-04-15 17:03:31 +03:00
/*
* CMessage . h , part of VCMI engine
*
* Authors : listed in file AUTHORS in main folder
*
* License : GNU General Public License v2 .0 or later
* Full text of license available in license . txt file , in main folder
*
2009-04-16 14:14:13 +03:00
*/
2011-02-06 19:26:27 +02:00
struct SDL_Surface ;
2009-04-16 14:14:13 +03:00
enum EWindowType { infoOnly , infoOK , yesOrNO } ;
class CInfoWindow ;
class CDefHandler ;
2011-12-22 16:05:19 +03:00
class CComponent ;
2009-04-16 14:14:13 +03:00
class CSelWindow ;
2012-05-13 18:04:21 +03:00
class ComponentResolved ;
2009-04-16 14:14:13 +03:00
2011-02-22 13:52:36 +02:00
/// Class which draws formatted text messages and generates chat windows
2009-04-16 14:14:13 +03:00
class CMessage
{
public :
2012-05-13 18:04:21 +03:00
//Function usd only in CMessage.cpp
2009-06-01 08:40:54 +03:00
static std : : pair < int , int > getMaxSizes ( std : : vector < std : : vector < SDL_Surface * > > * txtg , int fontHeight ) ;
2010-02-04 17:50:59 +02:00
static std : : vector < std : : vector < SDL_Surface * > > * drawText ( std : : vector < std : : string > * brtext , int & fontHeigh , EFonts font = FONT_MEDIUM ) ;
2009-06-01 08:40:54 +03:00
static SDL_Surface * blitTextOnSur ( std : : vector < std : : vector < SDL_Surface * > > * txtg , int fontHeight , int & curh , SDL_Surface * ret , int xCenterPos = - 1 ) ; //xPos==-1 works as if ret->w/2
2012-05-13 18:04:21 +03:00
/// Draw border on exiting surface
2009-04-16 14:14:13 +03:00
static void drawBorder ( int playerColor , SDL_Surface * ret , int w , int h , int x = 0 , int y = 0 ) ;
2012-05-13 18:04:21 +03:00
/// Draw simple dialog box (borders and background only)
static SDL_Surface * drawDialogBox ( int w , int h , int playerColor = 1 ) ;
/// Draw simple dialog box and blit bitmap with text on it
static SDL_Surface * drawBoxTextBitmapSub ( int player , std : : string text , SDL_Surface * bitmap , std : : string sub , int charPerline = 30 , int imgToBmp = 55 ) ;
static void drawIWindow ( CInfoWindow * ret , std : : string text , int player ) ;
/// split text in lines
2010-07-06 05:10:26 +03:00
static std : : vector < std : : string > breakText ( std : : string text , size_t maxLineSize = 30 , const boost : : function < int ( char ) > & charMetric = boost : : function < int ( char ) > ( ) , bool allowLeadingWhitespace = false ) ;
static std : : vector < std : : string > breakText ( std : : string text , size_t maxLineWidth , EFonts font ) ;
2012-05-13 18:04:21 +03:00
/// constructor
2009-04-16 14:14:13 +03:00
static void init ( ) ;
2012-05-13 18:04:21 +03:00
/// destructor
2009-04-16 14:14:13 +03:00
static void dispose ( ) ;
} ;