00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _uwin_hpp_
00021 #define _uwin_hpp_
00022
00023 #include <ubit/ubox.hpp>
00024 #include <ubit/uview.hpp>
00025 namespace ubit {
00026
00027 class UWinImpl;
00028 class UPlacement;
00029
00030
00051 class UWin : public UBox {
00052 public:
00053 UBIT_ELEMENT_CLASS(UWin, UBox)
00054
00055 UWin(const UArgs& = UArgs::none);
00057
00058 virtual ~UWin();
00064 virtual class UWin* winCast() {return this;}
00065
00066
00067
00068 UWin& addlist(const UArgs& a) {UGroup::addlist(a); return *this;}
00069
00070 virtual UWin& setTitle(const UStr&, UDisp* = null);
00072
00073 virtual void setPos(UMouseEvent&, float x = 0, float y = 0);
00078 virtual void setPos(const UWin& win, const UPoint&, UDisp* = null);
00080
00081 virtual void setPos(const UView& view, const UPoint&);
00083
00084 virtual void setPos(const UView& view, const UPlacement&);
00086
00087 virtual void setPosOnScreen(const UPoint&, UDisp* = null);
00089
00090 virtual void centerOnScreen(UDisp* = null);
00091
00092
00093 virtual UPoint getPos(const UWin& win, UDisp* = null) const;
00095
00096 virtual UPoint getPos(const UView& view) const;
00098
00099 virtual UPoint getPosOnScreen(UDisp* = null) const;
00101
00102
00103
00104 virtual float getWidth(UDisp* = null) const;
00106
00107 virtual float getHeight(UDisp* = null) const;
00109
00110 virtual UDimension getSize(UDisp* = null) const;
00112
00113 virtual void setSize(const UDimension&, UDisp* = null);
00115
00116 virtual void adjustSize();
00122 virtual void setFullScreen(bool state, UDisp* = null);
00124
00125 virtual void toBack(UDisp* = null);
00127
00128 virtual void toFront(UDisp* = null);
00130
00131
00132
00133 virtual bool isShown() const;
00134 virtual bool isShown(UDisp*) const;
00136
00137 virtual void show(bool state, UDisp*);
00138 virtual void show(bool state = true) {UWin::show(state, null);}
00146 virtual bool isModal() const;
00148
00149 virtual void setModal(bool = true) ;
00151
00152 virtual int showModal(UDisp* = null);
00163 virtual void close(int status = 0);
00174 virtual void repaint() {update(UUpdate::paint);}
00175 virtual void update() {update(UUpdate::layoutAndPaint);}
00176 virtual void update(const UUpdate& mode);
00177
00178 virtual void update(const UUpdate&, UDisp*);
00187
00188
00189 bool isHardWin() const {return is_hardwin;}
00190 bool isSoftWin() const {return !is_hardwin;}
00201 virtual UWin& setSoftWin(bool = true);
00208
00209
00210 static UStyle* createStyle();
00211
00212 virtual bool realize();
00217 UNatWin* getNatWin(UDisp* = null) const;
00219
00220 UView* getWinView(UDisp*) const;
00222
00223 virtual void highlight(bool state);
00225
00226 #ifndef NO_DOC
00227 friend class UBox;
00228 friend class UAppli;
00229 friend class UHardWinImpl;
00230 friend class USoftWinImpl;
00231 friend class UNatWin;
00232 friend class UNatDisp;
00233
00234 virtual void initView(UChild* self, UView* ancestor_view);
00235 virtual UView* initViewImpl(UChild* self, UView* ancestor_view, UDisp*);
00236 virtual void deleteRelatedViews(UView* parview, UChild*);
00237
00238
00239 void addWinView(UView*);
00240 UGroup* getSoftWins();
00241 UChildren* getSoftWinList();
00242 UHardWinImpl* hardImpl(UDisp*, const char* errmess = "") const;
00243 USoftWinImpl* softImpl(UDisp*, const char* errmess = "") const;
00244
00245 protected:
00246 bool is_hardwin;
00247 std::vector<UWinImpl*> wimpl;
00248
00249 virtual UView* realizeSoftWin(UWin* hardwin, UView* hardwin_view,
00250 UDisp* disp, bool add_to_the_end);
00251
00252 virtual bool realizeHardWin(unsigned short window_type);
00253
00254
00255 virtual void realizeChildren(UView* winview);
00256
00257
00258 UView* getCurrentViewOfSoftwin() const;
00259 #endif
00260 };
00261
00262
00263
00272 class UDialog : public UWin {
00273 public:
00274 UBIT_ELEMENT_CLASS(UDialog, UWin)
00275
00276 UDialog(const UArgs& = UArgs::none);
00277 friend UDialog& udialog(const UArgs& a = UArgs::none) {return *new UDialog(a);}
00279
00280 virtual ~UDialog() {destructs();}
00281
00282
00283
00284 virtual void show(bool state, UDisp*);
00285 virtual void show(bool state = true) {UDialog::show(state, null);}
00286
00287
00288
00289 static UStyle* createStyle();
00290 virtual bool realize();
00291
00292 #ifndef NO_DOC
00293 virtual void addingTo(UChild* self, UGroup *parent);
00294 virtual void removingFrom(UChild* self, UGroup *parent);
00295 private:
00296 UCall* open_call;
00297 #endif
00298 };
00299
00300
00301
00312 class UFrame : public UDialog {
00313 public:
00314 UBIT_ELEMENT_CLASS(UFrame, UDialog)
00315
00316 UFrame(const UArgs& a = UArgs::none);
00318
00319 friend UFrame& uframe(const UArgs& a = UArgs::none) {return *new UFrame(a);}
00321
00322
00323
00324 bool isMainFrame() const {return is_main_frame;}
00326
00327 virtual void show(bool state, UDisp*);
00328 virtual void show(bool state = true) {UFrame::show(state, null);}
00329
00330 virtual void close(int status = 0);
00336
00337
00338 static UStyle* createStyle();
00339 virtual bool realize();
00340
00341 private:
00342 friend class UAppli;
00343 bool is_main_frame;
00344 };
00345
00346
00347
00360 struct UPlacement {
00361 UPlacement();
00362
00363
00364
00365
00366 UHalign* halign;
00367
00368
00369 UValign* valign;
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386 bool hoppositeBorder, voppositeBorder;
00387
00388
00389
00390 int hdist, vdist;
00391 };
00392
00393 }
00394 #endif
00395
00396
00397
00398