|
@@ -232,84 +232,6 @@ std::string CInfoWindow::genText(std::string title, std::string description)
|
|
|
return std::string("{") + title + "}" + "\n\n" + description;
|
|
|
}
|
|
|
|
|
|
-CInfoPopup::CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free)
|
|
|
- :free(Free),bitmap(Bitmap)
|
|
|
-{
|
|
|
- init(x, y);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-CInfoPopup::CInfoPopup(SDL_Surface * Bitmap, const Point &p, ETextAlignment alignment, bool Free)
|
|
|
- : free(Free),bitmap(Bitmap)
|
|
|
-{
|
|
|
- switch(alignment)
|
|
|
- {
|
|
|
- case ETextAlignment::BOTTOMRIGHT:
|
|
|
- init(p.x - Bitmap->w, p.y - Bitmap->h);
|
|
|
- break;
|
|
|
- case ETextAlignment::CENTER:
|
|
|
- init(p.x - Bitmap->w/2, p.y - Bitmap->h/2);
|
|
|
- break;
|
|
|
- case ETextAlignment::TOPLEFT:
|
|
|
- init(p.x, p.y);
|
|
|
- break;
|
|
|
- case ETextAlignment::TOPCENTER:
|
|
|
- init(p.x - Bitmap->w/2, p.y);
|
|
|
- break;
|
|
|
- default:
|
|
|
- assert(0); //not implemented
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-CInfoPopup::CInfoPopup(SDL_Surface *Bitmap, bool Free)
|
|
|
-{
|
|
|
- CCS->curh->hide();
|
|
|
-
|
|
|
- free=Free;
|
|
|
- bitmap=Bitmap;
|
|
|
-
|
|
|
- if(bitmap)
|
|
|
- {
|
|
|
- pos.x = GH.screenDimensions().x / 2 - bitmap->w / 2;
|
|
|
- pos.y = GH.screenDimensions().y / 2 - bitmap->h / 2;
|
|
|
- pos.h = bitmap->h;
|
|
|
- pos.w = bitmap->w;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void CInfoPopup::close()
|
|
|
-{
|
|
|
- if(free)
|
|
|
- SDL_FreeSurface(bitmap);
|
|
|
- WindowBase::close();
|
|
|
-}
|
|
|
-
|
|
|
-void CInfoPopup::show(Canvas & to)
|
|
|
-{
|
|
|
- CSDL_Ext::blitAt(bitmap,pos.x,pos.y,to.getInternalSurface());
|
|
|
-}
|
|
|
-
|
|
|
-CInfoPopup::~CInfoPopup()
|
|
|
-{
|
|
|
- CCS->curh->show();
|
|
|
-}
|
|
|
-
|
|
|
-void CInfoPopup::init(int x, int y)
|
|
|
-{
|
|
|
- CCS->curh->hide();
|
|
|
-
|
|
|
- pos.x = x;
|
|
|
- pos.y = y;
|
|
|
- pos.h = bitmap->h;
|
|
|
- pos.w = bitmap->w;
|
|
|
-
|
|
|
- // Put the window back on screen if necessary
|
|
|
- vstd::amax(pos.x, 0);
|
|
|
- vstd::amax(pos.y, 0);
|
|
|
- vstd::amin(pos.x, GH.screenDimensions().x - bitmap->w);
|
|
|
- vstd::amin(pos.y, GH.screenDimensions().y - bitmap->h);
|
|
|
-}
|
|
|
-
|
|
|
bool CRClickPopup::isPopupWindow() const
|
|
|
{
|
|
|
return true;
|