ubit
uupdatecontext.hpp
1 /************************************************************************
2  *
3  * uupdatecontext.hpp: [implementation] stack context
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 _uupdatecontext_hpp_
18 #define _uupdatecontext_hpp_ 1
19 #include <ubit/udefs.hpp>
20 #include <ubit/ustyle.hpp>
21 #include <ubit/ufontImpl.hpp>
22 #include <ubit/uview.hpp>
23 #include <vector>
24 namespace ubit {
25 
26  // ====[internal implementation]=========================================
27  // NOTE: this header is part of the Ubit intrinsics and subject to change
28 
29  /* [impl] UUpdateContext = a subcontext (not the first layer of the context cstack)
30  * and a base for UWinUpdateContext (the first layer of the cstack)
31  */
33  public:
34  UUpdateContext(const UUpdateContext& parent_ctx, UElem*, UView*, UViewUpdateImpl*);
36 
37  UElem* getObj() {return obj;}
39 
40  UBox* getBoxParent() {return view->getBoxParent();}
41  /*< returns the direct or *indirect* box parent of getObj().
42  * 'boxes' are UBox objects or objects that derive from UBox.
43  */
44 
45  UView* getView() {return view;}
47 
48  UView* getWinView() {return view->getWinView();}
50 
51  UDisp* getDisp() const {return view->getDisp();}
52  // const necessaire pour certains appels
53 
54  UGraph* getGraph() {return graph;}
55 
56  void rescale();
58 
59  void addFlagdef(const UFlagdef*);
60  const UFlagdef* getFlagdef(const UFlag&) const;
61  const UFlagdef* getFlagdef(const UFlag*) const;
62  const UPropdef* getPropdef(const UFlag&) const;
63  const UPropdef* getPropdef(const UFlag*) const;
64 
65  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66 #ifndef NO_DOC
67  // cette implementation est dangereuse car dans certains cas win_ctx est undef
68  const UUpdateContext* parent_ctx;
69  UWinUpdateContext* win_ctx; // not const because of the flags vector
70  unsigned short flag_count; // number of valid flagdefs for this stack level
71 
72  UElem* obj;
73  UView* view;
74  UViewUpdateImpl* view_impl;
75  const UStyle* obj_style;
76  ULocalProps local;
77  UPos* pos; // UPos ou U3dpos, UPos peut etre proportionnelle
78  UFontDesc fontdesc;
79  bool boxIsHFlex, boxIsVFlex; // true if the object is Horiz or Vert Flexible
80  char valign, halign;
81  float xyscale; // current scale
82  float vspacing, hspacing;
83  UEdit* edit;
84  const UColor *color, *bgcolor;
85  const UCursor *cursor;
86  UGraph* graph;
87 
88  protected:
89  friend class UViewFind;
90  UUpdateContext() {} // pour UViewFind
91  UUpdateContext(UView* win_view); // for UWinUpdateContext
92 #endif
93  };
94 
95  /* ==================================================== ======== ======= */
96  /* [impl] UWinUpdateContext = the first layer of the context cstack
97  */
99  public:
100  UWinUpdateContext(UView* winview, UGraph*);
105  private:
106  friend class UUpdateContext;
107  std::vector<const UFlagdef*> flags;
108  };
109 
110  /* ==================================================== ======== ======= */
111 
112  // cette implementation est dangereuse car dans certains cas win_ctx est undef
113  //inline UView* UUpdateContext::getWinView() {return win_ctx->view;}
114  //inline UDisp* UUpdateContext::getDisp() const {return win_ctx->view->getDisp();}
115  //inline UGraph* UUpdateContext::getGraph() {return win_ctx->graph;}
116 
117 }
118 #endif
UElem * getObj()
returns the object (a UElem, a UElem or a UBox) that is related to this context.
Definition: uupdatecontext.hpp:37
Widget position.
Definition: uboxgeom.hpp:91
Definition: uviewImpl.hpp:92
Box container.
Definition: ubox.hpp:64
class for drawing on widgets.
Definition: ugraph.hpp:44
Display Context.
Definition: udisp.hpp:44
void rescale()
rescales the coordinates according to the current scale.
Definition: uupdatecontext.cpp:160
Definition: uupdatecontext.hpp:98
UView * getWinView()
returns the window view that contains getView().
Definition: uupdatecontext.hpp:48
[impl] Internal representation for fonts.
Definition: ufontImpl.hpp:24
Text editing and caret controller.
Definition: uedit.hpp:30
Color attribute of an element or a widget.
Definition: ucolor.hpp:73
Definition: uflag.hpp:103
UDisp * getDisp() const
returns the Display where this view is displayed.
Definition: uview.cpp:86
Flagging conditions.
Definition: uflag.hpp:45
Definition: uflag.hpp:74
lightweight general purpose container.
Definition: uelem.hpp:44
Definition: uviewImpl.hpp:178
UView * getWinView() const
returns the view of the Window where this view is displayed.
Definition: uview.cpp:89
UView * getView()
returns the view related to this context.
Definition: uupdatecontext.hpp:45
Box View.
Definition: uview.hpp:65
Definition: uupdatecontext.hpp:32
Definition: uhardfont.hpp:31
Definition: ustyle.hpp:26
UBox * getBoxParent() const
returns the closest UBox parent of getBox() (which is not necessarily a direct parent).
Definition: uview.cpp:99
Mouse cursor property.
Definition: ucursor.hpp:31
Compiled Object Style.
Definition: ustyle.hpp:44