00001 #ifndef __GTEXTVIEW4_H
00002 #define __GTEXTVIEW4_H
00003
00004 #include "GDocView.h"
00005 #include "GUndo.h"
00006
00007
00008
00009
00010 #define TEXTED_USES_CR 0x00000001
00011 #define DEFAULT_TAB_SIZE 4
00012 #define WM_DEBUG_TEXT (WM_USER+0x3421)
00013
00014 extern char Delimiters[];
00015
00016 enum GTextMove
00017 {
00018 GUpLine,
00019 GDownLine,
00020 GLeftChar,
00021 GRightChar,
00022 GStartLine,
00023 GEndLine
00024 };
00025
00026 class GTextView4 :
00027 public GDocView,
00028 public ResObject
00029 {
00030 protected:
00031 class GTextView4Private *d;
00032
00033 public:
00034
00035 GTextView4( int Id,
00036 int x,
00037 int y,
00038 int cx,
00039 int cy,
00040 GFontType *FontInfo = 0);
00041 ~GTextView4();
00042
00043 char *GetMimeType() { return "text/plain"; }
00044
00045
00046 char *Name();
00047 bool Name(char *s);
00048 char16 *NameW();
00049 bool NameW(char16 *s);
00050
00051 bool Insert(int At, char16 *Data, int Len);
00052 bool Delete(int At, int Len);
00053 int HitText(int x, int y);
00054 void DeleteSelection(char16 **Cut = 0);
00055
00056
00057 GFont *GetFont();
00058 void SetFont(GFont *f, bool OwnIt = false);
00059 bool GetFixed();
00060 void SetFixed(bool f);
00061
00062
00063 void SetTabSize(uint8 i);
00064 void SetBorder(int b);
00065 void SetReadOnly(bool i);
00066 void SetWrapType(uint8 i);
00067
00068
00069 void SetCursor(int i, bool Select, bool ForceFullUpdate = false);
00070 int IndexAt(int x, int y);
00071 bool IsDirty();
00072 bool HasSelection();
00073 void UnSelectAll();
00074 void SelectWord(int From);
00075 void SelectAll();
00076 int GetCursor(bool Cursor = true);
00077 void PositionAt(int &x, int &y, int Index = -1);
00078 int GetLines();
00079 void GetTextExtent(int &x, int &y);
00080 char *GetSelection();
00081
00082
00083 bool Open(char *Name, char *Cs = 0);
00084 bool Save(char *Name, char *Cs = 0);
00085
00086
00087 bool Cut();
00088 bool Copy();
00089 bool Paste();
00090
00091
00092 bool ClearDirty(bool Ask, char *FileName = 0);
00093 void UpdateScrollBars(bool Reset = false);
00094 void GotoLine(int Line);
00095 bool DoGoto();
00096 bool DoFind();
00097 bool DoFindNext();
00098 bool DoReplace();
00099 bool DoCase(bool Upper);
00100 void Undo();
00101 void Redo();
00102
00103
00104 bool OnFind(char16 *Find, bool MatchWord, bool MatchCase, bool SelectionOnly);
00105 bool OnReplace(char16 *Find, char16 *Replace, bool All, bool MatchWord, bool MatchCase, bool SelectionOnly);
00106 bool OnMultiLineTab(bool In);
00107 void OnSetHidden(int Hidden);
00108 void OnPosChange();
00109 void OnCreate();
00110 void OnEscape(GKey &K);
00111 void OnMouseWheel(double Lines);
00112
00113
00114 void OnFocus(bool f);
00115 void OnMouseClick(GMouse &m);
00116 void OnMouseMove(GMouse &m);
00117 bool OnKey(GKey &k);
00118 void OnPaint(GSurface *pDC);
00119 int OnEvent(GMessage *Msg);
00120 int OnNotify(GView *Ctrl, int Flags);
00121 void OnPulse();
00122 int OnHitTest(int x, int y);
00123
00124
00125 virtual void OnEnter(GKey &k);
00126 virtual void OnUrl(char *Url);
00127 };
00128
00129 #endif