Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

uima.hpp

00001 /* ==================================================== ======== ======= * 00002 * 00003 * uima.hpp 00004 * Ubit Project [Elc][2003] 00005 * Author: Eric Lecolinet 00006 * 00007 * Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs 00008 * 00009 * (C) 1999-2003 Eric Lecolinet @ ENST Paris 00010 * WWW: http://www.enst.fr/~elc/ubit Email: elc@enst.fr (Subject: ubit) 00011 * 00012 * *********************************************************************** 00013 * COPYRIGHT NOTICE : 00014 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 00015 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 00016 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 00017 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 00018 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION. 00019 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS. 00020 * *********************************************************************** 00021 * 00022 * ==================================================== [Elc:03] ======= * 00023 * ==================================================== ======== ======= */ 00024 00025 #ifndef _uima_hpp_ 00026 #define _uima_hpp_ 00027 //pragma ident "@(#)uima.hpp ubit:03.05.02" 00028 #include <ubit/uelem.hpp> 00029 00030 00042 class UIma: public UElem { 00043 public: 00044 UIma(const UStr& filename); 00045 UIma(const char* filename = null); 00046 UIma(const char** xpm_data, u_modes = 0); 00061 friend UIma& uima(const UStr& filename) {return *new UIma(filename);} 00062 friend UIma& uima(const char* filename) {return *new UIma(filename);} 00063 friend UIma& uima(const char** xpm_data) {return *new UIma(xpm_data);} 00065 00066 virtual ~UIma(); 00067 00068 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00069 00070 virtual void set(const UStr& filename); 00071 virtual void set(const char* filename); 00072 virtual void set(const char** xpm_data); 00087 virtual int load(); 00088 virtual int readFile(const UStr& filename); 00089 virtual int readFile(const char* filename); 00090 virtual int readData(const char** xpm_data); 00106 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00107 00108 void copy(const UIma& ima2); 00114 void copyResized(const UIma& ima2, u_dim width, u_dim height); 00120 void copyRescaled(const UIma&, float xscale, float yscale); 00126 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00127 00128 const char* getNameChars() const; 00130 00131 int getStatus() const; 00132 bool isLoaded() const; 00134 00135 bool isRealized() const; 00137 00138 bool isShaped() const; 00139 bool isTransparent() const {return isShaped();} 00141 00142 virtual u_dim getHeight() const; 00143 virtual u_dim getWidth() const; 00145 00146 virtual void update(); 00148 00149 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00150 // implementation 00151 00152 int realize(class UDisp& disp, bool force_reload = true) const; 00165 std::list<class UNatIma*>& getNatImas() const {return natimas;} 00167 00168 #ifndef NO_DOC 00169 friend class UBox; 00170 friend class UNatIma; 00171 friend class UPix; 00172 00173 virtual void setImpl(const char* fname); 00174 virtual void setImpl(const char** xpm_data); 00175 virtual void cleanCache(); 00176 virtual void getSize(UContext*, u_dim *w, u_dim *h) const; 00177 virtual void paint(UWinGraph&, UContext*, const URegion &r) const; 00178 00179 protected: 00180 mutable std::list<class UNatIma*> natimas; 00181 char *name; 00182 const char **data; 00183 mutable signed char stat; // can have negative values 00184 mutable bool read_from_file, read_from_data, show_unknown_ima; 00185 00186 class UNatIma* findImaInCache(class UNatDisp*, int lscale) const; 00187 class UNatIma* addImaInCache(class UNatDisp*, int lscale) const; 00188 #endif 00189 }; 00190 00191 /* ==================================================== [Elc:03] ======= */ 00192 /* ==================================================== ======== ======= */ 00193 00199 class UPix: public UIma { 00200 public: 00201 static UPix 00202 folder, ofolder, doc, diskette, plus, minus, ellipsis, rball, 00203 select, cross, check, zoom, left, right, up, down, turn, question, 00204 leftarrow, rightarrow, uparrow, downarrow, 00205 stop, ray, clock, bomb, windows, book, edit, eyes, colors; 00215 UPix(const UStr& filename); 00216 UPix(const char* filename = null); 00217 UPix(const char** xpm_data, u_modes = 0); 00226 friend UPix& upix(const UStr& filename) {return *new UPix(filename);} 00227 friend UPix& upix(const char* filename) {return *new UPix(filename);} 00228 friend UPix& upix(const char** xpm_data) {return *new UPix(xpm_data);} 00230 00231 virtual ~UPix(); 00232 00233 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00234 // implementation 00235 00236 std::vector<class UNatPix*>& getNatPixs() const {return natpixs;} 00237 //< [impl] 00238 00239 #ifndef NO_DOC 00240 virtual void cleanCache(); 00241 virtual void getSize(UContext*, u_dim *w, u_dim *h) const; 00242 virtual void paint(UWinGraph&, UContext*, const URegion &r) const; 00243 #endif 00244 00245 private: 00246 mutable std::vector<class UNatPix*> natpixs; 00247 }; 00248 00249 00250 /* ==================================================== [TheEnd] ======= */ 00251 /* ==================================================== [Elc:03] ======= */ 00252 #endif

Generated on Tue Jul 27 18:01:55 2004 for Ubit[Eric.Lecolinet@enst.fr] by doxygen 1.3.7