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
#ifndef _uima_hpp_
00026
#define _uima_hpp_
00027
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
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;
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
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
00235
00236 std::vector<class UNatPix*>& getNatPixs()
const {
return natpixs;}
00237
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
00251
00252
#endif