Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

uedit.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  uedit.hpp
00004  *  Ubit Project  [Elc][2003]
00005  *  Author: Eric Lecolinet
00006  *
00007  *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00008  *
00009  *  (C) 1999-2003 Eric Lecolinet @ ENST Paris
00010  *  WWW: http://www.enst.fr/~elc/ubit   Email: elc@enst.fr (subject: ubit)
00011  *
00012  * ***********************************************************************
00013  * COPYRIGHT NOTICE : 
00014  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00015  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00016  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00017  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00018  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00019  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00020  * ***********************************************************************
00021  *
00022  * ==================================================== [Elc:03] ======= *
00023  * ==================================================== ======== ======= */
00024 
00025 #ifndef _uedit_hpp_
00026 #define _uedit_hpp_
00027 //pragma ident  "@(#)uedit.hpp  ubit:03.05.05"
00028 #include <ubit/uprop.hpp>
00029 
00030 
00039 class UEdit : public UProp {
00040 public:
00041   UEdit(bool is_editable = true);
00042   virtual ~UEdit();   // necessaire car removingFrom specifique
00043 
00044   friend UEdit &uedit(bool is_editable = true) {return *(new UEdit(is_editable));}
00046 
00047   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00048 
00049   void setEditable(bool = true);
00050   bool isEditable() const;
00051   
00052   const UStr *getCaretStr() const;
00053   const UStr *getCaretStr(int& pos) const;
00061   void setCaretStr(UStr*, int pos);
00070   UStr* getPreviousStr(UGroup* par) const;
00071   UStr* getNextStr(UGroup* par) const;
00072 
00073   virtual void update();
00074 
00075   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00076   // implementation
00077 
00078   bool nextChar(UGroup* par, bool update_views, bool is_flowview);
00079   bool previousChar(UGroup* par, bool update_views, bool is_flowview);
00080   void deletePreviousChar(UGroup* par, bool update_views, bool is_flowview);
00081   void deleteChar();
00082   void setCaretStr(UStr*, int pos, bool update_view, bool no_scrolling);
00083 
00084   UEdit& enableReturn(bool = true) {return *this;}
00086 
00087 #ifndef NO_DOC
00088 
00089   virtual void putProp(class UContext*, class UCtrl*);
00090   virtual void addingTo(class ULink *selflink, UGroup *parent);
00091   virtual void removingFrom(class ULink *selflink, UGroup *parent);
00093 
00095   virtual int getXpos(class UWinGraph&, class UContext*, 
00096                       const URegion& r) const;
00097   virtual void paint(class UWinGraph&, class UContext*, 
00098                      const URegion &r) const;
00099 
00101   virtual int getXpos(class UWinGraph&, class UContext*, const URegion& r,
00102                       int offset, int cellen) const;
00103   virtual void paint(class UWinGraph&, class UContext*, const URegion &r, 
00104                      int offset, int cellen) const;
00105 
00106 private:
00107   uptr<UStr> caret_str;  // the string that contains the caret (if any)
00108   uptr<UCall>calls;      // callback object
00109   int caret_pos;         // the position of the caret in 'caret_str'
00110   bool is_editable;
00111   void callbacks(UEvent&);
00112   void kpressed(UEvent&);
00113   void mpressed(UEvent&);
00114   void mreleased(UEvent&);
00115 #endif
00116 };
00117 
00118 #endif
00119 /* ==================================================== [TheEnd] ======= */
00120 /* ==================================================== [Elc:03] ======= */

Generated on Thu Mar 3 04:56:50 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1