00001 00002 // DashEdit.h 00003 // 00005 // 00006 // Copyright (c) 2002 Iain Murray 00007 // 00009 00010 /* 00011 An abstract DashEditbox class is described here. 00012 An implementation will handle interaction between Dasher and an actual Edit control. 00013 e.g. - output characters to the edit control 00014 - tapping on the edit box updates the Dasher display 00015 */ 00016 00017 #ifndef __DashEdit_h__ 00018 #define __DashEdit_h__ 00019 00020 #include "DasherWidgetInterface.h" 00021 00022 namespace Dasher {class CDashEditbox;} 00023 class Dasher::CDashEditbox 00024 { 00025 public: 00026 CDashEditbox() : m_dirty(false),m_iFlushed(0), m_DasherInterface(0) {} 00027 00029 virtual void SetInterface(CDasherWidgetInterface* DasherInterface) {m_DasherInterface = DasherInterface;} 00030 00032 virtual void write_to_file()=0; 00033 00035 // 00038 void set_flushed(int i) {m_iFlushed=i;} 00039 00041 // 00045 virtual void get_new_context(std::string& str, int max)=0; 00046 00048 virtual void unflush()=0; 00049 00051 virtual void output(symbol Symbol)=0; 00052 00054 virtual void deletetext()=0; 00055 00057 // 00060 virtual void flush(symbol Symbol)=0; 00061 00062 // File I/O (optional) 00063 00065 // 00068 virtual void TimeStampNewFiles(bool ) {} 00069 00071 bool IsDirty() {return m_dirty;} 00072 00074 // 00078 virtual void New(const std::string& ) {}; // filename can be "", but you cannot call Save() without having set a filename. 00079 00081 // 00085 virtual bool Open(const std::string& ) {return false;}; 00086 00088 // 00093 virtual bool OpenAppendMode(const std::string& ) {return false;}; 00095 // 00099 virtual bool SaveAs(const std::string& ) {return false;}; 00100 00102 // 00105 virtual bool Save() {return false;}; // returns false if there is no filename set, or if saving fails 00106 00107 // Clipboard (optional) 00109 // 00112 virtual void Cut() {}; 00113 00115 // 00117 virtual void Copy() {}; 00118 00120 // 00122 virtual void CopyAll() {}; 00123 00125 // 00128 virtual void Paste() {}; 00129 00131 virtual void SelectAll() {}; 00132 00134 virtual void Clear()=0; // Must at least be able to clear edit box 00135 00137 // 00142 virtual void SetEncoding(Opts::FileEncodingFormats Encoding)=0; 00143 00145 // 00148 virtual void SetFont(std::string Name, long Size)=0; 00149 00150 // TODO sort relationship between CDashEditbox and derived classes 00151 protected: 00153 bool m_dirty; 00154 00156 int m_iFlushed; // how many characters have been flushed 00157 00159 CDasherWidgetInterface* m_DasherInterface; 00160 }; 00161 00162 00163 #endif /* #ifndef __DashEdit_h__ */
1.4.2