PictureTextCBox Class Reference

#include <picture_text_cbox.h>

Inheritance diagram for PictureTextCBox:

Inheritance graph
[legend]
Collaboration diagram for PictureTextCBox:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PictureTextCBox (const std::string &label, const std::string &resource_id, const Rectanglei &rect, bool value=true)
void Draw (const Point2i &mousePosition, Surface &surf) const
void SetSizePosition (const Rectanglei &rect)

Private Attributes

Surface m_image

Detailed Description

Definition at line 27 of file picture_text_cbox.h.


Constructor & Destructor Documentation

PictureTextCBox::PictureTextCBox ( const std::string &  label,
const std::string &  resource_id,
const Rectanglei rect,
bool  value = true 
)

Definition at line 28 of file picture_text_cbox.cpp.

00029                                                                     :
00030   CheckBox(label, rect, value)
00031 {
00032   Profile *res = resource_manager.LoadXMLProfile( "graphism.xml", false);   
00033   m_image = resource_manager.LoadImage(res, resource_id);
00034   resource_manager.UnLoadXMLProfile( res);
00035  
00036   SetPosition( rect.GetPosition() );
00037   SetSize( rect.GetSize() );
00038 
00039   SetSizeY( m_image.GetHeight() + (*Font::GetInstance(Font::FONT_NORMAL, Font::BOLD)).GetHeight() );
00040   m_value = value;
00041 
00042   txt_label = new Text(label, dark_gray_color, Font::GetInstance(Font::FONT_NORMAL, Font::BOLD), false);
00043   txt_label->SetMaxWidth (GetSizeX());
00044 }

Here is the call graph for this function:


Member Function Documentation

void PictureTextCBox::Draw ( const Point2i mousePosition,
Surface surf 
) const [virtual]

Reimplemented from CheckBox.

Definition at line 46 of file picture_text_cbox.cpp.

00047 {
00048   if (!hidden)
00049     {
00050       // center the image
00051       uint tmp_x = GetPositionX() + (GetSizeX() - m_image.GetWidth() - 20)/2 ;
00052       uint tmp_y = GetPositionY() + (GetSizeY() - m_image.GetHeight() - txt_label->GetHeight() - 5) /2;
00053       
00054       AppWormux::GetInstance()->video.window.Blit(m_image, Point2i(tmp_x, tmp_y));
00055       
00056       txt_label->DrawCenterTop( GetPositionX() + GetSizeX()/2, 
00057                                 GetPositionY() + GetSizeY() - txt_label->GetHeight() );
00058       
00059       if (m_value)
00060         m_checked_image->SetCurrentFrame(0);
00061       else 
00062         m_checked_image->SetCurrentFrame(1);
00063       
00064       m_checked_image->Blit(surf, 
00065                             GetPositionX() + GetSizeX() - 16, 
00066                             GetPositionY() + (GetSizeY()-16)/2 );
00067     }
00068 }

Here is the call graph for this function:

void PictureTextCBox::SetSizePosition ( const Rectanglei rect  )  [virtual]

Reimplemented from CheckBox.

Definition at line 70 of file picture_text_cbox.cpp.

00071 {
00072   StdSetSizePosition(rect);
00073   txt_label->SetMaxWidth (GetSizeX());
00074 }

Here is the call graph for this function:


Member Data Documentation

Surface PictureTextCBox::m_image [private]

Definition at line 30 of file picture_text_cbox.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:10:24 2007 for Wormux by  doxygen 1.4.7