![]() |
![]() |
00001 //<<<<<< INCLUDES >>>>>> 00002 00003 #include "Iguana/Studio/interface/IgQtAppImageService.h" 00004 #include "Iguana/Framework/interface/IgState.h" 00005 #include <classlib/utils/DebugAids.h> 00006 #include <qpixmap.h> 00007 #include <qstring.h> 00008 00009 //<<<<<< PRIVATE DEFINES >>>>>> 00010 //<<<<<< PRIVATE CONSTANTS >>>>>> 00011 //<<<<<< PRIVATE TYPES >>>>>> 00012 //<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> 00013 //<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> 00014 //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> 00015 00016 IG_DEFINE_STATE_ELEMENT (IgQtAppImageService, "Services/Qt/Images"); 00017 00018 //<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> 00019 //<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> 00020 //<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> 00021 00022 IgQtAppImageService::IgQtAppImageService (IgState *state) 00023 :m_state (state) 00024 { 00025 ASSERT (state); 00026 state->put (s_key, this); 00027 } 00028 00029 IgQtAppImageService::~IgQtAppImageService (void) 00030 { 00031 m_state->detach (s_key); 00032 } 00033 00034 void 00035 IgQtAppImageService::registerImage (const char *data[], const int id) 00036 { 00037 QPixmap *pixmap = m_images[id]; 00038 00039 if (!pixmap) 00040 { 00041 pixmap = new QPixmap (data); 00042 m_images[id] = pixmap; 00043 } 00044 } 00045 00046 void 00047 IgQtAppImageService::registerImage (const QPixmap *map, const int id) 00048 { 00049 QPixmap *pixmap = m_images[id]; 00050 00051 if (!pixmap) 00052 { 00053 pixmap = new QPixmap (*map); 00054 m_images[id] = pixmap; 00055 } 00056 } 00057 00058 void 00059 IgQtAppImageService::registerImage (const QString &name, const int id) 00060 { 00061 QPixmap *pixmap = m_images[id]; 00062 00063 if (!pixmap) 00064 { 00065 pixmap = new QPixmap (name); 00066 m_images[id] = pixmap; 00067 } 00068 } 00069 00070 QPixmap * 00071 IgQtAppImageService::pixmapById (const int id) 00072 { 00073 return m_images[id]; 00074 }