ubit
udata.hpp
1 /* ***********************************************************************
2  *
3  * udata.hpp: all viewable objects that can be inserted in an element
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 _udata_hpp_
18 #define _udata_hpp_ 1
19 #include <ubit/unode.hpp>
20 namespace ubit {
21 
31 class UData: public UNode {
32 public:
33  //UCLASS("#data", UData, null);
34  UABSTRACT_CLASS(UData);
35 
36  UData() {}
37  UData(UConst) {omodes.IS_CONST = true;}
38 
39  virtual int getDisplayType() const {return DATA;}
40 
41  virtual UData* toData() {return this;}
42  virtual const UData* toData() const {return this;}
43 
44  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45 
46  virtual UData& onChange(UCall&);
51  virtual void changed(bool update = true);
57  virtual void update() = 0;
59 
60  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
61 #ifndef NO_DOC
62  friend class UArgs;
63  friend class UBox;
64  virtual void getSize(UUpdateContext&, UDimension&) const = 0;
65  virtual void paint(UGraph&, UUpdateContext&, const URect&) const = 0;
66 #endif
67 };
68 }
69 #endif
2D Dimension.
Definition: ugeom.hpp:55
Definition: uobject.hpp:282
virtual void changed(bool update=true)
[impl] called when object&#39;s content is changed.
Definition: unode.cpp:304
Box container.
Definition: ubox.hpp:64
Base class of objects that can be added to the UBIT scene graph (SEE DETAILS!).
Definition: unode.hpp:38
class for drawing on widgets.
Definition: ugraph.hpp:44
2D Rectangle.
Definition: ugeom.hpp:165
virtual void update()=0
updates graphics.
virtual UData & onChange(UCall &)
adds a callback that is fired when the value is modified.
Definition: unode.cpp:299
Base class for Viewable Objects.
Definition: udata.hpp:31
virtual const UData * toData() const
dynamic cast: returns this object if it derives from UData and null otherwise.
Definition: udata.hpp:42
base class of callback objects for firing functions or methods.
Definition: ucall.hpp:144
Argument list (for passing arguments to constructor or add functions).
Definition: uargs.hpp:43
Definition: uupdatecontext.hpp:32
Definition: uhardfont.hpp:31
virtual UData * toData()
dynamic cast: returns this object if it derives from UData and null otherwise.
Definition: udata.hpp:41