00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _uedit_hpp_
00026 #define _uedit_hpp_
00027
00028 #include <ubit/uprop.hpp>
00029
00030
00039 class UEdit : public UProp {
00040 public:
00041 UEdit(bool is_editable = true);
00042 virtual ~UEdit();
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
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;
00108 uptr<UCall>calls;
00109 int caret_pos;
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
00120