ubit
ucursor.hpp
1 /************************************************************************
2  *
3  * ucursor.hpp: Cursor Attribute
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 _ucursor_hpp_
18 #define _ucursor_hpp_ 1
19 #include <ubit/uattr.hpp>
20 namespace ubit {
21 
22  class UCursorImpl;
23 
31  class UCursor : public UAttr {
32  public:
33  UCLASS(UCursor)
34 
35  static UCursor none, pointer, crosshair, text, hand, pencil, wait, question,
36  hresize, vresize, move, dnd;
38 
39  UCursor(const UCursor& = UCursor::none);
41 
42  UCursor(int cursor_type);
44 
45  UCursor(int cursor_type, UConst);
47 
48  virtual ~UCursor();
49 
50  UCursor& operator=(const UCursor& c) {return set(c);}
52 
53  virtual UCursor& set(const UCursor&);
55 
56  bool operator==(const UCursor& c) const {return equals(c);}
57  bool operator!=(const UCursor& c) const {return !equals(c);}
58  virtual bool equals(const UCursor&) const;
59 
60  int getCursorType() const {return cursor_type;}
61 
62  // - - - impl - - - - - - - - - - - - - - - - - - - - - - - - - - -
63 
64  virtual void update() {}
65 
66  UCursorImpl* getCursorImpl(UDisp*) const;
68 
69 #ifndef NO_DOC
70  virtual void addingTo(UChild&, UElem& parent);
71  virtual void removingFrom(UChild&, UElem& parent);
72  virtual void putProp(UUpdateContext*, UElem&);
74 
75  private:
76  int cursor_type;
77  mutable std::vector<UCursorImpl*> cimpl;
78 #endif
79  };
80 
81 }
82 #endif
Base class for attributes.
Definition: uattr.hpp:97
Definition: uobject.hpp:282
Display Context.
Definition: udisp.hpp:44
static UCursor dnd
predefined cursors.
Definition: ucursor.hpp:35
virtual void addingTo(UChild &, UElem &parent)
called when this object is added to a parent.
Definition: ucursor.cpp:57
virtual void update()
updates parents graphics.
Definition: ucursor.hpp:64
virtual void removingFrom(UChild &, UElem &parent)
called when this object is removed from a parent (SEE DETAILS IF YOU REDEFINE THIS METHOD)...
Definition: ucursor.cpp:65
lightweight general purpose container.
Definition: uelem.hpp:44
UCursorImpl * getCursorImpl(UDisp *) const
[impl] returns internal data for this display.
Definition: ucursor.cpp:84
Definition: uupdatecontext.hpp:32
Definition: uhardfont.hpp:31
virtual void putProp(UUpdateContext *, UElem &)
NOTE that removingFrom() requires a destructor to be defined.
Definition: ucursor.cpp:71
Mouse cursor property.
Definition: ucursor.hpp:31
[impl] Internal implementation of a child node.
Definition: uchild.hpp:23