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

Ars::XImage Class Reference

#include <ximage.h>

Inheritance diagram for Ars::XImage:

Inheritance graph
[legend]
Collaboration diagram for Ars::XImage:

Collaboration graph
[legend]

Public Member Functions

 XImage (void)
 ~XImage (void)
 Standard destructor.

virtual void Init (icstring &aStr)
virtual const bool SetupWindow (const Message &msg)
 Initialize the XImage.

void ChangeImage (const string &aFilename)
void ChangeImage (const string &aSection, const string &aId, string aFilename="")
void SetImageId (const int aId)
const int GetImageId (void) const
virtual void Draw (void)
 Draws the XImage.


Protected Attributes

int id
int fade
string sct
string key
string fname

Constructor & Destructor Documentation

Ars::XImage::XImage void   ) 
 

Constructs a new XImage

Parameters:
WindowRect A CRect that defines the outer limits of the control
aStr the rest of the resource to initialize the object

Definition at line 6 of file ximage.cpp.

00007 : id( -1 ) , fade( 255 )
00008 {
00009 }

Ars::XImage::~XImage void   ) 
 

Standard destructor.

Definition at line 11 of file ximage.cpp.

00012 {
00013 }


Member Function Documentation

void Ars::XImage::ChangeImage const string &  aSection,
const string &  aId,
string  aFilename = ""
 

Definition at line 55 of file ximage.cpp.

References Ars::Window::clientRect, id, Ars::Thing::SetDirty(), and Ars::Window::UpdateWindow().

00056 {
00057         int     previd = id;
00058         id = Graf::LoadImg( aSection , aId , aFilename );
00059         Graf::Img( id , static_cast<XRect *>( this ) );
00060         clientRect = *this;
00061         if( previd != id )
00062                 SetDirty();
00063         UpdateWindow();
00064 }

void Ars::XImage::ChangeImage const string &  aFilename  ) 
 

Definition at line 44 of file ximage.cpp.

References Ars::Window::clientRect, id, Ars::Thing::SetDirty(), and Ars::Window::UpdateWindow().

00045 {
00046         int     previd = id;
00047         id = Graf::LoadImg( aFilename );
00048         Graf::Img( id , static_cast<XRect *>( this ) );
00049         clientRect = *this;
00050         if( previd != id )
00051                 SetDirty();
00052         UpdateWindow();
00053 }

void Ars::XImage::Draw void   )  [virtual]
 

Draws the XImage.

Reimplemented from Ars::XBox.

Definition at line 79 of file ximage.cpp.

References fade, Ars::HPaint::GetGDI(), Ars::Thing::GetWindowRect(), and id.

00080 {
00081         XBox::Draw();
00082         XRect   dst( GetWindowRect() );
00083         SDL_Surface *sfc = Graf::Img( id );
00084         if( sfc )
00085         {
00086                 SDL_SetAlpha( sfc , SDL_SRCALPHA , fade );
00087                 Graf::SDL_StretchBlt( sfc , 0 , GetGDI() , &dst , false );
00088 //              SDL_BlitSurface( sfc , 0 , GetGDI() , &dst );
00089         }
00090 }

const int Ars::XImage::GetImageId void   )  const [inline]
 

Definition at line 36 of file ximage.h.

References id.

00036 {       return id;      }

void Ars::XImage::Init icstring aStr  )  [virtual]
 

Initialize the thing object via a string the CAR identifiers used are: cfg: "section" "key" "fname" NB if fname starts with @ the string is the key of associated with afilename in the global Cfg file

Reimplemented from Ars::Window.

Reimplemented in Ars::XMPEG.

Definition at line 15 of file ximage.cpp.

References fade, fname, icstring, key, and sct.

00016 {
00017         XBox::Init( aStr );
00018 
00019         icstring        tmp = Rsrc::FindCrdOf( aStr , "cfg" );
00020 
00021         sct = Rsrc::GetStr( tmp );
00022         key = Rsrc::GetStr( tmp );
00023         fname = Rsrc::GetStr( tmp );
00024         tmp = Rsrc::FindCrdOf( aStr , "fade" );
00025         fade = Rsrc::GetInt( tmp , fade );
00026 }

void Ars::XImage::SetImageId const int  aId  ) 
 

Definition at line 66 of file ximage.cpp.

References Ars::Window::clientRect, id, Ars::Thing::SetDirty(), and Ars::Window::UpdateWindow().

00067 {
00068         int     previd = id;
00069         id = aId;
00070 
00071         Graf::Img( id , static_cast<XRect *>( this ) );
00072         clientRect = *this;
00073 
00074         if( previd != id )
00075                 SetDirty();
00076         UpdateWindow();
00077 }

const bool Ars::XImage::SetupWindow const Message msg  )  [virtual]
 

Initialize the XImage.

Reimplemented from Ars::Window.

Reimplemented in Ars::XMPEG.

Definition at line 28 of file ximage.cpp.

References Ars::Window::clientRect, fname, id, key, and sct.

00029 {
00030         XBox::SetupWindow( msg );
00031 
00032         if( id == -1 )
00033                 if( key.empty() )
00034                         id = Graf::LoadImg( fname.empty() ? sct : fname );
00035                 else
00036                         id = Graf::LoadImg( sct , key , fname );
00037 
00038         //      If the width and height are not specified, they are assigned to the loaded image
00039         Graf::Img( id , static_cast<XRect *>( this ) );
00040         clientRect = *this;
00041         return true;
00042 }


Field Documentation

int Ars::XImage::fade [protected]
 

Definition at line 9 of file ximage.h.

Referenced by Draw(), and Init().

string Ars::XImage::fname [protected]
 

Reimplemented in Ars::XMPEG.

Definition at line 10 of file ximage.h.

Referenced by Init(), and SetupWindow().

int Ars::XImage::id [protected]
 

Definition at line 8 of file ximage.h.

Referenced by ChangeImage(), Draw(), GetImageId(), SetImageId(), and SetupWindow().

string Ars::XImage::key [protected]
 

Reimplemented in Ars::XMPEG.

Definition at line 10 of file ximage.h.

Referenced by Init(), and SetupWindow().

string Ars::XImage::sct [protected]
 

Reimplemented in Ars::XMPEG.

Definition at line 10 of file ximage.h.

Referenced by Init(), and SetupWindow().


The documentation for this class was generated from the following files:
Generated on Fri Dec 5 04:06:58 2003 for Borqueror by doxygen 1.3.3