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

CSPictureIcon Class Reference

#include <CSIcon.h>

Inheritance diagram for CSPictureIcon:

CSIcon CSGrafikElement CSMessageDispatchable CSMessageListener

Public Member Functions

virtual std::string getType ()
virtual ~CSPictureIcon ()
bool initIcon (std::string enabledPictureFile, std::string disabledPictureFile)
bool initIcon (CSPicture *picture)
virtual void paint (SDL_Surface *destination, SDL_Rect *parentViewport)
virtual void layoutSetup ()

Static Public Member Functions

CSPictureIconbuildIcon (std::string enabledPictureFile, std::string disabledPictureFile)
CSPictureIconbuildIcon (CSPicture *picture)
CSPictureIconbuildIcon (std::string enabledPictureFile)

Static Public Attributes

const char * CLASS = "CSPictureIcon"
 static element, name of this class (introsepection)


Protected Member Functions

 CSPictureIcon ()
void layoutSetupPictureIcon ()

Constructor & Destructor Documentation

CSPictureIcon::CSPictureIcon  )  [inline, protected]
 

Definition at line 69 of file CSIcon.h.

References ICON_KIND_PICTURE.

Referenced by buildIcon().

00069 : CSIcon(ICON_KIND_PICTURE){}

CSPictureIcon::~CSPictureIcon  )  [virtual]
 

Definition at line 14 of file CSIcon.cpp.

References LOG_ENTER, and LOG_EXIT.

00015 {
00016     static char *functionName="~CSPictureIcon";
00017     LOG_ENTER 
00018     mEnabledPicture = 0;
00019     mDisabledPicture = 0;
00020     LOG_EXIT
00021 }


Member Function Documentation

void CSPictureIcon::layoutSetupPictureIcon  )  [protected]
 

Definition at line 83 of file CSIcon.cpp.

References CSPicture::getHeight(), and CSPicture::getWidth().

Referenced by layoutSetup().

00084 {
00085     if (mEnabledPicture)
00086     {
00087         mMinHeight = mHeight = mEnabledPicture->getHeight();
00088         mMinWidth = mWidth = mEnabledPicture->getWidth();
00089     }
00090 }

Here is the call graph for this function:

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

Reimplemented from CSIcon.

Definition at line 74 of file CSIcon.h.

References CLASS.

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

CSPictureIcon* CSPictureIcon::buildIcon std::string  enabledPictureFile,
std::string  disabledPictureFile
[inline, static]
 

Definition at line 75 of file CSIcon.h.

References CSPictureIcon(), initIcon(), and CSGrafikElement::layoutChanged().

Referenced by HTMLElement::buildDisplay(), and CSLAF::getIconInternal().

00076         {
00077             CSPictureIcon* icon = 0;
00078             try
00079             {
00080                 icon = new CSPictureIcon();
00081                 if (!icon->initIcon(enabledPictureFile, disabledPictureFile))
00082                 {
00083                     delete(icon);
00084                     icon = 0;
00085                 }
00086             }
00087             catch (...) {}
00088             icon->layoutChanged();
00089             return icon;
00090         }

Here is the call graph for this function:

CSPictureIcon* CSPictureIcon::buildIcon CSPicture picture  )  [inline, static]
 

Definition at line 91 of file CSIcon.h.

References CSPictureIcon(), initIcon(), and CSGrafikElement::layoutChanged().

00092         {
00093             CSPictureIcon* icon = 0;
00094             try
00095             {
00096                 icon = new CSPictureIcon();
00097                 if (!icon->initIcon(picture))
00098                 {
00099                     delete(icon);
00100                     icon = 0;
00101                 }
00102             }
00103             catch (...) {}
00104             icon->layoutChanged();
00105             return icon;
00106         }

Here is the call graph for this function:

CSPictureIcon* CSPictureIcon::buildIcon std::string  enabledPictureFile  )  [inline, static]
 

Definition at line 108 of file CSIcon.h.

References CSPictureIcon(), initIcon(), and CSGrafikElement::layoutChanged().

00109         {
00110             CSPictureIcon* icon = 0;
00111             try
00112             {
00113                 icon = new CSPictureIcon();
00114                 if (!icon->initIcon(enabledPictureFile, enabledPictureFile))
00115                 {
00116                     delete(icon);
00117                     icon = 0;
00118                 }
00119             }
00120             catch (...) {}
00121             icon->layoutChanged();
00122             return icon;
00123         }

Here is the call graph for this function:

bool CSPictureIcon::initIcon std::string  enabledPictureFile,
std::string  disabledPictureFile
 

Definition at line 42 of file CSIcon.cpp.

References CSPicture::getHeight(), CSPicture::getWidth(), CSGrafikElement::init(), Loadable< CSPicture >::load(), LOG_ENTER, and LOG_EXIT.

Referenced by buildIcon().

00043 {
00044     static char *functionName="initIcon";
00045     LOG_ENTER 
00046     mEnabledPicture = CSPictureLoader::INSTANCE.load(enabledPictureFile);
00047     mDisabledPicture = CSPictureLoader::INSTANCE.load(disabledPictureFile);
00048     if (mEnabledPicture && mDisabledPicture)
00049     {
00050         if ((mEnabledPicture->getHeight() != mDisabledPicture->getHeight()) || (mEnabledPicture->getWidth() != mDisabledPicture->getWidth()))
00051         {
00052             LOG_EXIT
00053             return false;
00054         }
00055         init(mEnabledPicture->getHeight(), mEnabledPicture->getWidth());
00056     }
00057     else
00058     {
00059         LOG_EXIT
00060         return false;
00061     }
00062     LOG_EXIT
00063     return true;
00064 }

Here is the call graph for this function:

bool CSPictureIcon::initIcon CSPicture picture  ) 
 

Definition at line 23 of file CSIcon.cpp.

References CSGrafikElement::init(), LOG_ENTER, and LOG_EXIT.

00024 {
00025     static char *functionName="initIcon";
00026     LOG_ENTER 
00027     mEnabledPicture = picture;
00028     mDisabledPicture = picture;
00029     if (mEnabledPicture && mDisabledPicture)
00030     {
00031         init(mEnabledPicture->getMaxY(), mEnabledPicture->getMaxX());
00032     }
00033     else
00034     {
00035         LOG_EXIT
00036         return false;
00037     }
00038     LOG_EXIT
00039     return true;
00040 }

Here is the call graph for this function:

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

Todo:
display picture is allways on screen! -> must change!

Implements CSIcon.

Definition at line 67 of file CSIcon.cpp.

References CSPicture::display(), CSGrafikElement::getElementArea(), CSIcon::getState(), ICON_STATE_DISABLED, ICON_STATE_ENABLED, and CSGrafikElement::setEnabled().

00068 {
00069     static char *functionName="paint";
00070     int state = getState();
00071     if (state == ICON_STATE_ENABLED)
00072     {
00073         setEnabled(true);
00074         mEnabledPicture->display(getElementArea().x + parentViewport->x, getElementArea().y + parentViewport->y);
00075     }
00076     if (state == ICON_STATE_DISABLED)
00077     {
00078         setEnabled(false);
00079         mDisabledPicture->display(getElementArea().x + parentViewport->x, getElementArea().y + parentViewport->y);
00080     }
00081 }

Here is the call graph for this function:

virtual void CSPictureIcon::layoutSetup  )  [inline, virtual]
 

Reimplemented from CSGrafikElement.

Definition at line 128 of file CSIcon.h.

References layoutSetupPictureIcon().

Here is the call graph for this function:


Field Documentation

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

static element, name of this class (introsepection)

Reimplemented from CSIcon.

Definition at line 11 of file CSIcon.cpp.

Referenced by getType().


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