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

Ars::XProgress Class Reference

#include <xprogress.h>

Inheritance diagram for Ars::XProgress:

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

Collaboration graph
[legend]

Public Member Functions

 XProgress (void)
 ~XProgress (void)
 Standard destructor.

virtual void Init (icstring &aStr)
virtual const bool SetupWindow (const Message &msg)
 Deregister the setup_window message.

virtual void SetLimits (const int Min, const int Max)
 Set the limits of the progress bar.

const int GetMinLimit (void) const
 The minimum limit of the progress bar.

const int GetMaxLimit (void) const
 The maximum limit of the progress bar.

virtual void SetProgress (const int iProgress, const bool aNow=false)
 Set the current progress value.

const int GetProgress (void) const
 The current progress value.

virtual void Draw (void)
 Draws the progress bar.

virtual const bool evMouseMove (const MouseMessage &msg)

Private Attributes

int m_iMin
 The minimum value of the progress bar.

int m_iMax
 The maximum value of the progress bar.

int m_iProgress
 The current value of the progress bar.

RGBColor BarColor
 The color of the progress bar.


Constructor & Destructor Documentation

Ars::XProgress::XProgress void   ) 
 

Constructs a progress bar, initilizes the limits to 0, and 100 with the progress at 0

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 xprogress.cpp.

00007 : m_iMin(0),m_iMax(100),m_iProgress(0),BarColor( 0 , 0 , 0 )
00008 {
00009 }

Ars::XProgress::~XProgress void   ) 
 

Standard destructor.

Definition at line 12 of file xprogress.cpp.

00013 {
00014 
00015 }


Member Function Documentation

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

Draws the progress bar.

Reimplemented from Ars::XLabel.

Definition at line 49 of file xprogress.cpp.

References BarColor, Ars::XBox::DrawRaised(), Ars::HPaint::DrawRect(), Ars::XRect::Grow(), m_iMax, m_iMin, and m_iProgress.

00050 {
00051         XRect SubRect( *this );
00052         SubRect.Grow( -1 );
00053         if( m_iProgress > m_iMin )
00054         {
00055                 SubRect.w = static_cast<unsigned int>( SubRect.w * (static_cast<double>(m_iProgress - m_iMin) / (m_iMax - m_iMin) ) );
00056                 DrawRect( SubRect , true , BarColor , BarColor );
00057                 DrawRaised( SubRect , BarColor );
00058         }
00059 
00060         XLabel::Draw();
00061 }

virtual const bool Ars::XProgress::evMouseMove const MouseMessage msg  )  [inline, virtual]
 

Reimplemented from Ars::XLabel.

Definition at line 59 of file xprogress.h.

00059 {       return false;   }

const int Ars::XProgress::GetMaxLimit void   )  const [inline]
 

The maximum limit of the progress bar.

Definition at line 47 of file xprogress.h.

References m_iMax.

00047 { return m_iMax; }

const int Ars::XProgress::GetMinLimit void   )  const [inline]
 

The minimum limit of the progress bar.

Definition at line 44 of file xprogress.h.

References m_iMin.

00044 { return m_iMin; }

const int Ars::XProgress::GetProgress void   )  const [inline]
 

The current progress value.

Definition at line 53 of file xprogress.h.

References m_iProgress.

00053 {       return m_iProgress;     }

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

Initialize the thing object via a string the CAR identifiers used are: min_max: lower and upper bounadry of the progress (default is 0 1) barColor: color to paint the progress bar (default = fgcolor + 32)

Reimplemented from Ars::Window.

Definition at line 17 of file xprogress.cpp.

References BarColor, Ars::Thing::GetFgColor(), icstring, m_iMax, and m_iMin.

00018 {
00019         XLabel::Init( aStr );
00020 
00021         icstring        tmp = Rsrc::FindCrdOf( aStr , "min_max" );
00022         m_iMin = max( 0 , Rsrc::GetInt( tmp ) );
00023         m_iMax = max( 1 , Rsrc::GetInt( tmp ) );
00024 
00025         tmp = Rsrc::FindCrdOf( aStr , "barColor" );
00026         BarColor = Rsrc::GetColor( tmp , GetFgColor().FadeColor( 32 ) );
00027 }

virtual void Ars::XProgress::SetLimits const int  Min,
const int  Max
[inline, virtual]
 

Set the limits of the progress bar.

Definition at line 41 of file xprogress.h.

References m_iMax, and m_iMin.

00041 {       m_iMin = Min;   m_iMax = Max;   }

void Ars::XProgress::SetProgress const int  iProgress,
const bool  aNow = false
[virtual]
 

Set the current progress value.

Definition at line 38 of file xprogress.cpp.

References m_iMax, m_iProgress, Ars::XLabel::SetWndText(), and Ars::Window::UpdateWindow().

Referenced by SetupWindow().

00039 {
00040         m_iProgress = min( m_iMax , iProgress );
00041         
00042         char    tmp[50];
00043         sprintf( tmp , "%d %%" , (m_iProgress * 100) / m_iMax );
00044         SetWndText( tmp );
00045 
00046         UpdateWindow( aNow );
00047 }

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

Deregister the setup_window message.

Reimplemented from Ars::XLabel.

Definition at line 29 of file xprogress.cpp.

References SetProgress().

00030 {
00031         XLabel::SetupWindow( msg );
00032 
00033         SetProgress( 0 );
00034 
00035         return false;
00036 }


Field Documentation

RGBColor Ars::XProgress::BarColor [private]
 

The color of the progress bar.

Definition at line 19 of file xprogress.h.

Referenced by Draw(), and Init().

int Ars::XProgress::m_iMax [private]
 

The maximum value of the progress bar.

Definition at line 13 of file xprogress.h.

Referenced by Draw(), GetMaxLimit(), Init(), SetLimits(), and SetProgress().

int Ars::XProgress::m_iMin [private]
 

The minimum value of the progress bar.

Definition at line 10 of file xprogress.h.

Referenced by Draw(), GetMinLimit(), Init(), and SetLimits().

int Ars::XProgress::m_iProgress [private]
 

The current value of the progress bar.

Definition at line 16 of file xprogress.h.

Referenced by Draw(), GetProgress(), and SetProgress().


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