ubit
uupdate.hpp
1 /* ==================================================== ======== ======= *
2  *
3  * update.hpp : graphics update
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 _update_hpp_
18 #define _update_hpp_ 1
19 #include <ubit/udefs.hpp>
20 namespace ubit {
21 
25 class UUpdate {
26 public:
27  enum {
28  PAINT = 1<<0,
30 
31  LAYOUT = 1<<1,
33 
36 
42  SHOW = 1<<6,
43  HIDE = 1<<7,
44  ADJUST_WIN_SIZE = 1<<8
45  };
46 
47  static const UUpdate paint;
49 
50  static const UUpdate layoutAndPaint;
52 
53  ~UUpdate();
54 
55  UUpdate(unsigned int mode_mask = LAYOUT|PAINT);
68  UUpdate(const UUpdate&);
69  UUpdate& operator=(const UUpdate&);
70 
71  bool operator==(const UUpdate&);
72 
73  void addModes(unsigned int m) {modes |= m;}
74 
75  long getModes() const {return modes;}
77 
78  bool isHiddenObjectsMode() const {return (modes & HIDDEN_OBJECTS) != 0;}
80 
81  void setPaintData(const UData*);
83 
84  void setPaintStr(const UStr*, int strpos1, int strpos2);
86 
87  void setMove(float delta_x, float delta_y, bool x_percent, bool y_percent);
89 
90  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
91  enum {
92  ADD_REMOVE = 1<<11,
93  STR_DATA = 1<<12, // doit impliquer PAINT
94  //SCROLL = 1<<13, // appel direct de updateView() par Scrollpane sans update()
95  MOVE = 1<<14 // appel en NO_DELAY par UPos
96  };
97 
98 private:
99  friend class UElem;
100  friend class UBox;
101  friend class UWin;
102  friend class UView;
103  friend class UAppliImpl;
104  friend class UpdateRequest;
105  long modes;
106 
107 public: // a cause d'un bug de CC
108  struct ScrollMove {
109  float delta_x, delta_y;
110  bool xpercent, ypercent;
111  };
112 
113  struct StrData {
114  const UData* data;
115  mutable URect* region; // mutable impose par UBox::doUpdate()
116  int pos1, pos2;
117  };
118 
119 private:
120  // IMPL NOTE: il ne DOIT pas y avoir de subclasses car UUpdate est copie
121  // directement dans UpdateRequest (voir uappliImpl.hpp)
122  union /*UpdateImpl*/ {
123  StrData sd;
124  ScrollMove sm;
125  } props;
126 };
127 
128 
129 }
130 #endif
static const UUpdate layoutAndPaint
layout then paint: prefined constant for UUpdate(LAYOUT|PAINT);
Definition: uupdate.hpp:50
Box container.
Definition: ubox.hpp:64
static const UUpdate paint
paint only: prefined constant for UUpdate(PAINT);
Definition: uupdate.hpp:47
Definition: uappliImpl.hpp:40
updates the layout and the paint.
Definition: uupdate.hpp:34
2D Rectangle.
Definition: ugeom.hpp:165
Definition: uupdate.hpp:108
updates objects even if they are not shown.
Definition: uupdate.hpp:37
specifies how to update UElem, UBox, UWin objects and subclasses.
Definition: uupdate.hpp:25
Base class for Viewable Objects.
Definition: udata.hpp:31
void setPaintStr(const UStr *, int strpos1, int strpos2)
[impl] set the string to be painted.
Definition: uupdate.cpp:126
lightweight general purpose container.
Definition: uelem.hpp:44
void setPaintData(const UData *)
[impl] set the data to be painted.
Definition: uupdate.cpp:115
long getModes() const
returns the current mode mask.
Definition: uupdate.hpp:75
Definition: uappliImpl.hpp:31
UUpdate(unsigned int mode_mask=LAYOUT|PAINT)
creates an object that specifies how to update UElem(s) and subclasses.
Box View.
Definition: uview.hpp:65
Definition: uhardfont.hpp:31
bool isHiddenObjectsMode() const
if true, hidden objects (which are normally ignored) will be updated.
Definition: uupdate.hpp:78
Base class for windows and menus.
Definition: uwin.hpp:47
Definition: uupdate.hpp:113
void setMove(float delta_x, float delta_y, bool x_percent, bool y_percent)
[impl] used to move objects.
Definition: uupdate.cpp:140
Ubit String.
Definition: ustr.hpp:72
updates the layout (not the paint).
Definition: uupdate.hpp:31
updates the paint (not the layout).
Definition: uupdate.hpp:28