EnergyBar Class Reference

#include <EnergyBar.h>

Inheritance diagram for EnergyBar:

Inheritance graph
[legend]
Collaboration diagram for EnergyBar:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 EnergyBar ()
void Actu (long val)
Color GetColorValue (long app_energy) const

Public Attributes

Color colors_value [NB_OF_ENERGY_COLOR]

Static Public Attributes

static const int NB_OF_ENERGY_COLOR = 6

Detailed Description

Definition at line 27 of file EnergyBar.h.


Constructor & Destructor Documentation

EnergyBar::EnergyBar (  ) 

Definition at line 29 of file EnergyBar.cpp.

00029                      : ProgressBar()
00030 {
00031   Profile *res = resource_manager.LoadXMLProfile("graphism.xml", false);
00032   for(int i = 0; i < NB_OF_ENERGY_COLOR ;i++) {
00033     std::ostringstream color_name;
00034     color_name << "energy_bar/energy_color_" << energy_step[i] << "_percent";
00035     colors_value[i] = resource_manager.LoadColor(res, color_name.str());
00036   }
00037 }

Here is the call graph for this function:


Member Function Documentation

void EnergyBar::Actu ( long  val  ) 

Definition at line 48 of file EnergyBar.cpp.

00048                                      {
00049   long app_energy;
00050 
00051   /* update progress bar position*/
00052   ProgressBar::UpdateValue(real_energy);
00053 
00054   /* get the real applied enargie value. It may be different from the
00055    * real_energy in case of under/over flow*/
00056   app_energy = ProgressBar::GetVal();
00057 
00058   SetValueColor(GetColorValue(app_energy));
00059 }

Here is the call graph for this function:

Here is the caller graph for this function:

Color EnergyBar::GetColorValue ( long  app_energy  )  const

Definition at line 39 of file EnergyBar.cpp.

00040 {
00041   for(int i = 0; i < NB_OF_ENERGY_COLOR - 1; ++i) {
00042     if(energy_step[i] > ((float)app_energy / GetMaxVal()) * 100)
00043       return colors_value[i];
00044   }
00045   return colors_value[NB_OF_ENERGY_COLOR - 1];
00046 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Color EnergyBar::colors_value[NB_OF_ENERGY_COLOR]

Definition at line 30 of file EnergyBar.h.

const int EnergyBar::NB_OF_ENERGY_COLOR = 6 [static]

Definition at line 29 of file EnergyBar.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:45:08 2007 for Wormux by  doxygen 1.4.7