ubit
upix.hpp
1 /* ==================================================== ======== ======= *
2  *
3  * upix.hpp: X11 pixmaps
4  * Ubit GUI Toolkit - Version 6
5  * (C) 2009 | Eric Lecolinet | TELECOM ParisTech | http://www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 
17 #ifndef _upix_hpp_
18 #define _upix_hpp_ 1
19 #include <ubit/uima.hpp>
20 namespace ubit {
21 
31 class UPix: public UIma {
32 public:
33  UCLASS(UPix)
34 
35 
41  static UPix
42  metal, velin, folder, ofolder, doc, diskette, plus, minus,
43  zoom, undo, bigFolder, bigDoc, bigText, bigIma, bigLeft, bigRight, bigUp, bigDown,
44  hslider, vslider, ray, question, link, stop;
45 
46  UPix(const char* filename = null, bool load_now = false);
48 
49  UPix(const UStr& filename, bool load_now = false);
51 
52  UPix(const char** xpm_data, bool load_now = false);
54 
55  UPix(const char** xpm_data, UConst);
56 
57  virtual ~UPix();
58 
59  virtual bool isPix() const {return true;}
61 
62  // - - - impl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63 #ifndef NO_DOC
64  virtual void cleanCache();
65  virtual void getSize(UUpdateContext&, UDimension&) const;
66  virtual void paint(UGraph&, UUpdateContext&, const URect&) const;
67  UHardPix* getOrCreatePix(UDisp*, float xyscale) const; // not virtual!
68 private:
69 #if WITH_2D_GRAPHICS
70  std::vector<UHardPix*>& getNatPixs() const {return natpixs;}
71  mutable std::vector<UHardPix*> natpixs;
72 #endif
73 #endif
74 };
75 
76 
77 inline UPix& upix(const UStr& filename) {return *new UPix(filename);}
79 
80 inline UPix& upix(const char* filename) {return *new UPix(filename);}
82 
83 inline UPix& upix(const char** xpm_data) {return *new UPix(xpm_data);}
85 
86 }
87 #endif
virtual ~UPix()
Definition: upix.cpp:62
2D Dimension.
Definition: ugeom.hpp:55
Image.
Definition: uima.hpp:50
Definition: uobject.hpp:282
class for drawing on widgets.
Definition: ugraph.hpp:44
2D Rectangle.
Definition: ugeom.hpp:165
Display Context.
Definition: udisp.hpp:44
static UPix metal
Predefined Pixmap Images (small icons).
Definition: upix.hpp:42
Definition: uupdatecontext.hpp:32
Definition: uhardfont.hpp:31
virtual bool isPix() const
returns true as this UIma is a UPix.
Definition: upix.hpp:59
Pixmap Image.
Definition: upix.hpp:31
Ubit String.
Definition: ustr.hpp:72
UPix(const char *filename=null, bool load_now=false)
creates a new UPix image from an image file;