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

PlanetInfoDlg Class Reference

#include <planetinfodlg.h>

Inheritance diagram for PlanetInfoDlg:

Inheritance graph
[legend]
Collaboration diagram for PlanetInfoDlg:

Collaboration graph
[legend]

Public Member Functions

 PlanetInfoDlg (StarSystem *&aSs, Window *aParent)
 ~PlanetInfoDlg (void)
virtual const bool MainLoop (void)
 true if the screen must be refreshed

void SetupInfo (Planet *aPl)

Protected Member Functions

virtual const bool SetupWindow (const Message &msg)
virtual const bool evMouseLClick (const CtrlMessage &msg)

Private Attributes

StarSystem *& ss
bool ans

Constructor & Destructor Documentation

PlanetInfoDlg::PlanetInfoDlg StarSystem *&  aSs,
Window *  aParent
 

Definition at line 16 of file planetinfodlg.cpp.

References ePlanetInfoDlg, and BqBase::f.

00017 : ss( aSs ) , BqBase( ePlanetInfoDlg , aParent )
00018 {
00019         f = Load( "PlanetInfoDlg" , ePlanetInfoDlg );
00020 }

PlanetInfoDlg::~PlanetInfoDlg void   ) 
 

Definition at line 22 of file planetinfodlg.cpp.

00023 {
00024 }


Member Function Documentation

const bool PlanetInfoDlg::evMouseLClick const CtrlMessage &  msg  )  [protected, virtual]
 

Definition at line 91 of file planetinfodlg.cpp.

References ans, Planet::ClickedOn(), BqBase::f, BqBase::isDisplayed, SetupInfo(), and ss.

00092 {
00093         BqBase::evMouseLClick( msg );
00094 
00095         if( isDisplayed )
00096                 if( ((Window *)msg.source)->GetId() == 1 )
00097                         isDisplayed= false;     
00098                 else if( ((Window *)msg.source)->GetId() == 2 )
00099                 {
00100                         vector<Planet *>::iterator pos = find_if( ss->begin() , ss->end() , bind2nd( mem_fun( &Planet::ClickedOn ) , &ArsApplication::mousexy ) );
00101                         if( pos != ss->end() )
00102                         {
00103                                 SetupInfo( *pos );
00104                                 f->Draw();
00105                         }
00106                         else
00107                                 ans = isDisplayed= false;       
00108                 }
00109 
00110         return true;
00111 }

const bool PlanetInfoDlg::MainLoop void   )  [virtual]
 

true if the screen must be refreshed

Reimplemented from BqBase.

Definition at line 82 of file planetinfodlg.cpp.

References ans, BqBase::MainLoop(), and BqBase::SetupDialog().

Referenced by StarSystemObject::evMouseLClick().

00083 {
00084         SetupDialog( "PlanetInfoDlg" );
00085         ans = true;
00086         BqBase::MainLoop();
00087 
00088         return ans;
00089 }

void PlanetInfoDlg::SetupInfo Planet aPl  ) 
 

Definition at line 33 of file planetinfodlg.cpp.

References BqBase::f, Planet::GetDeuterium(), Planet::GetEnergy(), Planet::GetFauna(), Planet::GetFlora(), Planet::GetLithium(), Planet::GetOre(), Planet::GetSoil(), Planet::GetSunFactor(), Planet::GetSurfaceGravity(), Planet::GetTotalHumidity(), Planet::GetTotalPressure(), Planet::GetTotalSurfaceTemperature(), Planet::GetWater(), Planet::planetName, Planet::planetType, Parameters::plIndice, and PlanetImageObject::SetPlanetIndex().

Referenced by StarSystemObject::evMouseLClick(), and evMouseLClick().

00034 {
00035         if( f )
00036         {
00037                 PlanetImageObject       *pio = dynamic_cast<PlanetImageObject *>( f->GetArsObject( 10 ) );
00038                 pio->SetImageId( Graf::LoadImg( "Planets" , "Planets" , "@Images" ) );
00039                 pio->SetPlanetIndex( aPl->planetType );
00040                 map<int,PlanetInfo *>::iterator pos = Parameters::plIndice.find( aPl->planetType );
00041                 if( pos == Parameters::plIndice.end() )
00042                 {
00043                         for( int i = 20 ; i < 41 ; 20 )
00044                                 f->GetArsObject( i )->SetWndText( "" );
00045                 }
00046                 else
00047                 {
00048                         char    temp[128];
00049                         int i = 20;
00050                         f->GetArsObject( 20 )->SetWndText( string( " " ) + aPl->planetName );
00051                         f->GetArsObject( 21 )->SetWndText( string( " " ) + pos->second->type );
00052                         f->GetArsObject( 22 )->SetWndText( string( " " ) + pos->second->surface );
00053                         f->GetArsObject( 23 )->SetWndText( string( " " ) + pos->second->athmosphere );
00054 
00055                         sprintf( temp , " between %d and %d" , pos->second->sizeMin , pos->second->sizeMax );           f->GetArsObject( 24 )->SetWndText( temp );
00056                         sprintf( temp , " between %d and %d million years" , pos->second->ageMin , pos->second->ageMax );               f->GetArsObject( 25 )->SetWndText( temp );
00057                         sprintf( temp , " %4.1f" , aPl->GetTotalHumidity() );           f->GetArsObject( 26 )->SetWndText( temp );
00058                         sprintf( temp , " %4.1f" , aPl->GetTotalPressure() );           f->GetArsObject( 27 )->SetWndText( temp );
00059                         sprintf( temp , " %4.1f" , aPl->GetTotalSurfaceTemperature() );         f->GetArsObject( 28 )->SetWndText( temp );
00060                         sprintf( temp , " %5.2f" , aPl->GetSurfaceGravity() );          f->GetArsObject( 29 )->SetWndText( temp );
00061 
00062                         sprintf( temp , "  %d" , (int)aPl->GetOre() );          f->GetArsObject( 30 )->SetWndText( temp );
00063                         sprintf( temp , "  %d" , (int)aPl->GetDeuterium() );            f->GetArsObject( 31 )->SetWndText( temp );
00064                         sprintf( temp , "  %d" , (int)aPl->GetLithium() );              f->GetArsObject( 32 )->SetWndText( temp );
00065                         sprintf( temp , "  %d" , (int)aPl->GetEnergy() );               f->GetArsObject( 33 )->SetWndText( temp );
00066                         sprintf( temp , "  %d" , (int)aPl->GetSunFactor() );            f->GetArsObject( 34 )->SetWndText( temp );
00067                         f->GetArsObject( 35 )->SetWndText( string( " " ) + pos->second->lifeForm );
00068                         sprintf( temp , "  %d" , (int)aPl->GetSoil() );         f->GetArsObject( 36 )->SetWndText( temp );
00069                         sprintf( temp , "  %d" , (int)aPl->GetFlora() );                f->GetArsObject( 37 )->SetWndText( temp );
00070                         sprintf( temp , "  %d" , (int)aPl->GetFauna() );                f->GetArsObject( 38 )->SetWndText( temp );
00071                         sprintf( temp , "  %d" , (int)aPl->GetWater() );                f->GetArsObject( 39 )->SetWndText( temp );
00072                         XLabel  *lbl = dynamic_cast<XLabel *>( f->GetArsObject( 40 ) );
00073                         lbl->SetWndText( "" );
00074                         if( !pos->second->Description.empty() )
00075                                 lbl->SetWndText( string( " " ) + pos->second->Description + "\n\n" );
00076                         if( !pos->second->example.empty() )
00077                                 lbl->AppendWindowText( string( "Examples are:\n" ) + pos->second->example );
00078                 }
00079         }
00080 }

const bool PlanetInfoDlg::SetupWindow const Message &  msg  )  [protected, virtual]
 

Reimplemented from BqBase.

Definition at line 26 of file planetinfodlg.cpp.

References BqBase::SetupWindow().

00027 {
00028         BqBase::SetupWindow( aMsg );
00029 
00030         return true;
00031 }


Field Documentation

bool PlanetInfoDlg::ans [private]
 

Definition at line 31 of file planetinfodlg.h.

Referenced by evMouseLClick(), and MainLoop().

StarSystem*& PlanetInfoDlg::ss [private]
 

Definition at line 30 of file planetinfodlg.h.

Referenced by evMouseLClick().


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