#include <picture_widget.h>
Inheritance diagram for PictureWidget:
Public Member Functions | |
PictureWidget (const Rectanglei &rect) | |
PictureWidget (const Rectanglei &rect, const std::string resource_id) | |
~PictureWidget () | |
void | SetSurface (const Surface &s, bool enable_scaling=false) |
void | SetNoSurface () |
void | Draw (const Point2i &mousePosition, Surface &surf) const |
void | SetSizePosition (const Rectanglei &rect) |
void | Disable () |
Private Attributes | |
bool | disabled |
Sprite * | spr |
Definition at line 29 of file picture_widget.h.
PictureWidget::PictureWidget | ( | const Rectanglei & | rect | ) |
PictureWidget::PictureWidget | ( | const Rectanglei & | rect, | |
const std::string | resource_id | |||
) |
Definition at line 33 of file picture_widget.cpp.
00033 : Widget(rect) 00034 { 00035 spr = NULL; 00036 disabled = false; 00037 00038 Profile *res = resource_manager.LoadXMLProfile( "graphism.xml", false); 00039 Surface tmp = resource_manager.LoadImage(res, resource_id); 00040 SetSurface(tmp, false); 00041 resource_manager.UnLoadXMLProfile( res); 00042 }
Here is the call graph for this function:
PictureWidget::~PictureWidget | ( | ) |
void PictureWidget::Disable | ( | ) |
Definition at line 98 of file picture_widget.cpp.
00099 { 00100 disabled = true; 00101 }
Here is the caller graph for this function:
Implements Widget.
Definition at line 76 of file picture_widget.cpp.
00078 { 00079 if (spr != NULL) { 00080 int x = GetPositionX() + ( GetSizeX()/2 ) - (spr->GetWidth()/2); 00081 int y = GetPositionY() + ( GetSizeY()/2 ) - (spr->GetHeight()/2); 00082 00083 spr->Blit ( surf, x, y); 00084 00085 // Draw a transparency mask 00086 if (disabled) { 00087 surf.BoxColor(Rectanglei(x,y,spr->GetWidth(),spr->GetHeight()), 00088 defaultOptionColorBox); 00089 } 00090 } 00091 }
Here is the call graph for this function:
void PictureWidget::SetNoSurface | ( | ) |
Definition at line 66 of file picture_widget.cpp.
00067 { 00068 need_redrawing = true; 00069 00070 if (spr != NULL) 00071 delete spr; 00072 00073 spr = NULL; 00074 }
Here is the caller graph for this function:
void PictureWidget::SetSizePosition | ( | const Rectanglei & | rect | ) | [virtual] |
Implements Widget.
Definition at line 93 of file picture_widget.cpp.
00094 { 00095 StdSetSizePosition(rect); 00096 }
Here is the call graph for this function:
void PictureWidget::SetSurface | ( | const Surface & | s, | |
bool | enable_scaling = false | |||
) |
Definition at line 50 of file picture_widget.cpp.
00051 { 00052 need_redrawing = true; 00053 00054 if (spr != NULL) 00055 delete spr; 00056 00057 spr = new Sprite(s); 00058 if (enable_scaling) { 00059 float scale = std::min( float(GetSizeY())/spr->GetHeight(), 00060 float(GetSizeX())/spr->GetWidth() ) ; 00061 00062 spr->Scale (scale, scale); 00063 } 00064 }
Here is the call graph for this function:
Here is the caller graph for this function:
bool PictureWidget::disabled [private] |
Definition at line 32 of file picture_widget.h.
Sprite* PictureWidget::spr [private] |
Definition at line 33 of file picture_widget.h.