Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSPictureArea Class Reference

#include <CSArea.h>

Inheritance diagram for CSPictureArea:

CSArea

Public Member Functions

virtual std::string getType ()
 CSPictureArea ()
virtual void paint (SDL_Surface *destination, SDL_Rect *parentViewport)
void setPicture (CSPicture *picture)
void setCentered (bool centered)
void setStretched (bool stretched)

Static Public Attributes

const char * CLASS = "CSPictureArea"

Protected Attributes

bool mStretched
bool mCentered
CSPicturemPicture

Constructor & Destructor Documentation

CSPictureArea::CSPictureArea  ) 
 

Definition at line 80 of file CSArea.cpp.

References LOG_ENTER, LOG_EXIT, mCentered, mPicture, and mStretched.

00081 {
00082     static char *functionName="CSRoundedArea";
00083     LOG_ENTER 
00084     mStretched = true;
00085     mCentered = true;
00086     mPicture = 0;
00087     LOG_EXIT
00088 }


Member Function Documentation

virtual std::string CSPictureArea::getType  )  [inline, virtual]
 

Reimplemented from CSArea.

Definition at line 74 of file CSArea.h.

References CLASS.

00074 {return (std::string) CLASS;}

void CSPictureArea::paint SDL_Surface *  destination,
SDL_Rect *  parentViewport
[virtual]
 

Reimplemented from CSArea.

Definition at line 90 of file CSArea.cpp.

References CSPicture::display(), CSPicture::getHeight(), CSPicture::getScaledPicture(), CSPicture::getWidth(), mCentered, mPicture, mStretched, and SDLMain::shutdown().

00091 {
00092     static char *functionName="paint";
00093     if (mPicture == 0)
00094     {
00095         SDL_FillRect(destination, area, mColor);
00096     }
00097     if (mStretched)
00098     {
00099         SDL_Surface *pic = mPicture->getScaledPicture(area->w, area->h);
00100         if (pic)
00101         {
00102             if (SDL_BlitSurface(pic, 0, destination, area)< 0)
00103             {
00104                 SDLMain::shutdown((std::string)"BlitSurface error: " + SDL_GetError(), 1);
00105             }
00106             
00107             return;
00108         }
00109     }
00110     if (mCentered)
00111     {
00112         int x = area->w/2 - mPicture->getWidth()/2;
00113         int y = area->h - mPicture->getHeight()/2;
00114         mPicture->display(destination, x, y);
00115         return;
00116     }
00117     mPicture->display(destination, area->x, area->y);
00118 }

Here is the call graph for this function:

void CSPictureArea::setPicture CSPicture picture  )  [inline]
 

Definition at line 77 of file CSArea.h.

References mPicture.

00077 {mPicture = picture;}

void CSPictureArea::setCentered bool  centered  )  [inline]
 

Definition at line 78 of file CSArea.h.

References mCentered.

00078 {mCentered = centered;}

void CSPictureArea::setStretched bool  stretched  )  [inline]
 

Definition at line 79 of file CSArea.h.

References mStretched.

00079 {mStretched = stretched;}


Field Documentation

bool CSPictureArea::mStretched [protected]
 

Definition at line 68 of file CSArea.h.

Referenced by CSPictureArea(), paint(), and setStretched().

bool CSPictureArea::mCentered [protected]
 

Definition at line 69 of file CSArea.h.

Referenced by CSPictureArea(), paint(), and setCentered().

CSPicture* CSPictureArea::mPicture [protected]
 

Definition at line 70 of file CSArea.h.

Referenced by CSPictureArea(), paint(), and setPicture().

const char * CSPictureArea::CLASS = "CSPictureArea" [static]
 

Reimplemented from CSArea.

Definition at line 14 of file CSArea.cpp.

Referenced by getType().


Generated on Wed Jul 14 00:44:58 2004 for CSLib by doxygen 1.3.6