00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 #ifndef MMSIMAGEWIDGET_H_
00034 #define MMSIMAGEWIDGET_H_
00035 
00036 #include "mmsgui/mmswidget.h"
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 class MMSImageWidget : public MMSWidget {
00047     private:
00048         string              className;
00049         MMSImageWidgetClass *imageWidgetClass;
00050         MMSImageWidgetClass myImageWidgetClass;
00051 
00052         bool imagepath_set;
00053         bool selimagepath_set;
00054 
00055         bool imagepath_p_set;
00056         bool selimagepath_p_set;
00057 
00058         bool imagepath_i_set;
00059         bool selimagepath_i_set;
00060 
00061         MMSFBSurface    *image;
00062         MMSIM_DESC_SUF  *image_suf;
00063         unsigned int    image_curr_index;
00064         MMSFBSurface    *selimage;
00065         MMSIM_DESC_SUF  *selimage_suf;
00066         unsigned int    selimage_curr_index;
00067 
00068         MMSFBSurface    *image_p;
00069         MMSIM_DESC_SUF  *image_p_suf;
00070         unsigned int    image_p_curr_index;
00071         MMSFBSurface    *selimage_p;
00072         MMSIM_DESC_SUF  *selimage_p_suf;
00073         unsigned int    selimage_p_curr_index;
00074 
00075         MMSFBSurface    *image_i;
00076         MMSIM_DESC_SUF  *image_i_suf;
00077         unsigned int    image_i_curr_index;
00078         MMSFBSurface    *selimage_i;
00079         MMSIM_DESC_SUF  *selimage_i_suf;
00080         unsigned int    selimage_i_curr_index;
00081 
00082         bool    image_loaded;
00083         bool    image_p_loaded;
00084         bool    image_i_loaded;
00085         bool    selimage_loaded;
00086         bool    selimage_p_loaded;
00087         bool    selimage_i_loaded;
00088 
00089         class MMSImageWidgetThread  *imageThread;
00090 
00091 
00092         bool            current_fgset;
00093 
00094 
00095         MMSFBSurface    *current_fgimage;
00096 
00097 
00098         MMSFBSurface    *current_fgimage2;
00099 
00100         bool create(MMSWindow *root, string className, MMSTheme *theme);
00101 
00102         bool init();
00103         bool release();
00104 
00105         void getForeground(MMSFBSurface **image, MMSFBSurface **image2);
00106         bool enableRefresh(bool enable = true);
00107         bool checkRefreshStatus();
00108 
00109         bool draw(bool *backgroundFilled = NULL);
00110 
00111         void loadMyImage(string path, string filename, MMSFBSurface **surface, MMSIM_DESC_SUF **surfdesc,
00112                          unsigned int *index, unsigned int mirror_size, bool gen_taff);
00113 
00114         void workWithRatio(MMSFBSurface *suf, MMSFBRectangle *surfaceGeom);
00115 
00116     public:
00117         MMSImageWidget(MMSWindow *root, string className, MMSTheme *theme = NULL);
00118         virtual ~MMSImageWidget();
00119 
00120         MMSWidget *copyWidget();
00121 
00122         void setVisible(bool visible, bool refresh = true);
00123 
00124     public:
00125         
00126         string getImagePath();
00127         string getImageName();
00128         string getSelImagePath();
00129         string getSelImageName();
00130         string getImagePath_p();
00131         string getImageName_p();
00132         string getSelImagePath_p();
00133         string getSelImageName_p();
00134         string getImagePath_i();
00135         string getImageName_i();
00136         string getSelImagePath_i();
00137         string getSelImageName_i();
00138         bool getUseRatio();
00139         bool getFitWidth();
00140         bool getFitHeight();
00141         MMSALIGNMENT getAlignment();
00142         unsigned int getMirrorSize();
00143         bool getGenTaff();
00144 
00145         void setImagePath(string imagepath, bool load = true, bool refresh = true);
00146         void setImageName(string imagename, bool load = true, bool refresh = true);
00147         void setImage(string imagepath, string imagename, bool load = true, bool refresh = true);
00148         void setSelImagePath(string selimagepath, bool load = true, bool refresh = true);
00149         void setSelImageName(string selimagename, bool load = true, bool refresh = true);
00150         void setSelImage(string selimagepath, string selimagename, bool load = true, bool refresh = true);
00151         void setImagePath_p(string imagepath_p, bool load = true, bool refresh = true);
00152         void setImageName_p(string imagename_p, bool load = true, bool refresh = true);
00153         void setImage_p(string imagepath_p, string imagename_p, bool load = true, bool refresh = true);
00154         void setSelImagePath_p(string selimagepath_p, bool load = true, bool refresh = true);
00155         void setSelImageName_p(string selimagename_p, bool load = true, bool refresh = true);
00156         void setSelImage_p(string selimagepath_p, string selimagename_p, bool load = true, bool refresh = true);
00157         void setImagePath_i(string imagepath_i, bool load = true, bool refresh = true);
00158         void setImageName_i(string imagename_i, bool load = true, bool refresh = true);
00159         void setImage_i(string imagepath_i, string imagename_i, bool load = true, bool refresh = true);
00160         void setSelImagePath_i(string selimagepath_i, bool load = true, bool refresh = true);
00161         void setSelImageName_i(string selimagename_i, bool load = true, bool refresh = true);
00162         void setSelImage_i(string selimagepath_i, string selimagename_i, bool load = true, bool refresh = true);
00163         void setUseRatio(bool useratio, bool refresh = true);
00164         void setFitWidth(bool fitwidth, bool refresh = true);
00165         void setFitHeight(bool fitheight, bool refresh = true);
00166         void setAlignment(MMSALIGNMENT alignment, bool refresh = true);
00167         void setMirrorSize(unsigned int mirrorsize, bool refresh = true);
00168         void setGenTaff(bool gentaff, bool refresh = true);
00169 
00170         void updateFromThemeClass(MMSImageWidgetClass *themeClass);
00171 
00172     friend class MMSImageWidgetThread;
00173 };
00174 
00175 #endif