00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _ubox_hpp_
00022 #define _ubox_hpp_
00023
00024 #include <ubit/ugroup.hpp>
00025 namespace ubit {
00026
00027
00068 class UBox: public UGroup {
00069 public:
00070 UBIT_ELEMENT_CLASS(UBox, UGroup)
00078 static UStyle* createStyle();
00083
00084
00085 UBox(const UArgs& a = UArgs::none);
00087
00088 friend UBox& ubox(const UArgs& a = UArgs::none) {return *new UBox(a);}
00093 virtual ~UBox() {destructs();}
00099 virtual UBox* boxCast() {return this;}
00101
00102
00103
00104 virtual UBorder* getBorder() const;
00105 virtual UBorder* getBorder(bool create_if_none);
00110 virtual UBox& addlist(const UArgs& a) {UGroup::addlist(a); return *this;}
00119 virtual UBox* getChildAt(const UPoint&, UView* box_view = null) const;
00125 virtual UBox* findChildAt(const UPoint&, UView* box_view = null) const;
00131 virtual UDimension getViewSize(UView* box_view = null) const;
00137 virtual UPoint getViewPos(UView* box_view = null) const;
00143 virtual UPoint getEventPos(const UMouseEvent&) const;
00148
00149
00150 virtual int getViewCount() const;
00152
00153 virtual int getViews(std::vector<UView*>&) const;
00162 virtual int getRelatedViews(std::vector<UView*>& v) const {return getViews(v);}
00163
00164 virtual UView* getView(int n = 0) const;
00174 virtual UView* getViewAt(const UMouseEvent&) const;
00176
00177 virtual UView* getViewContaining(const UView* child_view) const;
00183 virtual UView* getFirstViewInside(const UView* parent_view) const;
00189 void setViewModes(int view_modes, bool);
00190
00191 virtual void repaint() {update(UUpdate::paint);}
00192 virtual void update() {update(UUpdate::layoutAndPaint);}
00193 virtual void update(const UUpdate&);
00194
00195
00196
00197 #ifndef NO_DOC
00198 virtual UView* getViewInImpl(UView* parent_view, UChild*);
00199 virtual UView* getViewInImpl(UView* parent_view, UChild*, int& w, int& h);
00207 virtual void addView(UView*);
00208 virtual void updateView(UEvent&, UView*, const UUpdate&);
00209 virtual UBox* getChildAtImpl(const UPoint&, UView* box_view) const;
00210
00211 protected:
00212 friend class UGroup;
00213 friend class UWin;
00214 UView* views;
00215
00216 virtual void initView(UChild* self, UView *ancestor_view);
00217 virtual void initChildViews(UGroup*, UChild* childlink);
00218 virtual void deleteRelatedViews(UView* parview, UChild*);
00219
00220
00221 static void updateImpl(const class UUpdate& upmode,
00222 UView* winview, UView* layoutview, UView* showview,
00223 bool impose_size, int w, int h);
00224 public:
00225 UBox& onChildEvent(const UArgs&);
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 #endif
00243 };
00244
00245 }
00246 #endif
00247
00248