Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

DashEdit.h

Go to the documentation of this file.
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_iFlushed(0), m_DasherInterface(0), m_dirty(false) {}
00027 
00029         virtual void SetInterface(CDasherWidgetInterface* DasherInterface) {m_DasherInterface = DasherInterface;}
00030         
00032         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 inline void unflush()=0;
00049         
00051         virtual void output(symbol Symbol)=0;
00052         
00054         //
00057         virtual void flush(symbol Symbol)=0;
00058         
00059         // File I/O (optional)
00060 
00062         //
00065         virtual void TimeStampNewFiles(bool Value) {}
00066 
00068         bool IsDirty() {return m_dirty;}
00069 
00071         //
00075         virtual void New(const std::string& filename) {}; // filename can be "", but you cannot call Save() without having set a filename.
00076         
00078         //
00082         virtual bool Open(const std::string& filename) {return false;};
00083 
00085         // 
00090         virtual bool OpenAppendMode(const std::string& filename) {return false;};
00092         // 
00096         virtual bool SaveAs(const std::string& filename) {return false;};
00097 
00099         //
00102         virtual bool Save() {return false;}; // returns false if there is no filename set, or if saving fails
00103         
00104         // Clipboard (optional)
00106         //
00109         virtual void Cut() {};
00110 
00112         //
00114         virtual void Copy() {};
00115 
00117         //
00119         virtual void CopyAll() {};
00120 
00122         //
00125         virtual void Paste() {};
00126 
00128         virtual void SelectAll() {};
00129 
00131         virtual void Clear()=0; // Must at least be able to clear edit box
00132 
00134         //
00139         virtual void SetEncoding(Opts::FileEncodingFormats Encoding)=0;
00140 
00142         //
00145         virtual void SetFont(std::string Name, long Size)=0;
00146         
00147 // TODO sort relationship between CDashEditbox and derived classes
00148 protected:
00150         bool m_dirty;
00151 
00153         int m_iFlushed; // how many characters have been flushed
00154 
00156         CDasherWidgetInterface* m_DasherInterface;
00157 };
00158 
00159 
00160 #endif /* #ifndef __DashEdit_h__ */

Generated on Fri Mar 7 23:23:12 2003 for Dasher by doxygen1.3-rc3