]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/modules/lseditor/editorpl.h
updates to correct build errors (new locations, etc.)
[wxWidgets.git] / utils / wxPython / modules / lseditor / editorpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: editorbase.h
3 // Purpose: General interfaces for editor plug-ins.
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 11/04/1999
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleskandars Gluchovas
9 // Licence: GNU General Public License wxWindows licence v2.0
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __EDITORBASE_G__
13 #define __EDITORBASE_G__
14
15 #include "plugin.h"
16 #include "wx/window.h"
17
18 class wxsSourceEditorPlugin : public wxsComponent
19 {
20 protected:
21 string mFileName;
22
23 public:
24 /*** overridables (with default implementations) ***/
25
26 // user-level commands
27
28 virtual void OnOpen( const string& fname ) = 0;
29 virtual void OnSave( const string& fname ) = 0;
30
31 virtual void OnCopy() {}
32 virtual void OnCut() {}
33 virtual void OnPaste() {}
34 virtual void OnDelete() {}
35
36 virtual void OnUndo() {}
37 virtual void OnRedo() {}
38
39 virtual void SelectAll() {}
40
41 // NOTE:: column -1 should result cursor to appear
42 // at the start of the first word in the line (if any)
43
44 virtual void OnGotoLine( int lineNo, int column = -1 ) {}
45
46 // should invoke editor's own "goto-line" dialog
47 virtual void OnGotoLine() {}
48
49 virtual void OnProperties() {}
50
51 virtual void OnFind() {}
52 virtual void OnFindNext() {}
53 virtual void OnFindPrevious() {}
54 virtual void OnReplace() {}
55
56 virtual void OnToggleBookmark() {}
57 virtual void OnNextBookmark() {}
58 virtual void OnPreviousBookmark() {}
59 virtual void OnShowBookmarks() {}
60
61 virtual void SetCheckpoint() {}
62 virtual bool CheckpointModified() { return TRUE; }
63
64 // UI-updates
65
66 virtual bool CanCopy() { return FALSE; }
67 virtual bool CanCut() { return FALSE; }
68 virtual bool CanPaste() { return FALSE; }
69 virtual bool CanUndo() { return FALSE; }
70 virtual bool CanRedo() { return FALSE; }
71
72 // accesed by framework
73
74 virtual bool IsModified() { return TRUE; }
75
76 // returned buffer is NULL, if operation is not supported
77 // by this concrete editor
78
79 virtual void GetAllText( char** ppBuf, size_t* length )
80
81 { *ppBuf = NULL; *length = 0; }
82
83 virtual string FindWordAtCursor() = 0;
84
85 // returned line and column are -1s, if operation
86 // is not supported this concrete editor
87
88 virtual void GetCursorPos( int* line, int* column )
89
90 { *line = -1; *column = -1; }
91
92 virtual void GetPagePos( int* line, int* column )
93
94 { *line = -1; *column = -1; }
95
96 virtual void SetCursorPos( int line, int column ) {}
97
98 // returned buffer is NULL, if operation is not supported
99 // by this concrete editor,
100 // (NOTE: range is given from "fromLine", but not
101 // including tillLine, [fomrLine,tillLine) )
102
103 virtual void GetText( int fromLine, int fromColumn,
104 int tillLine, int tillColumn,
105 char** ppBuf, size_t* length )
106 { ppBuf = NULL; }
107
108 virtual void InsertText( int line, int column,
109 char* text, size_t lenght )
110 {}
111
112 virtual void DeleteText( int fromLine, int fromColumn,
113 int tillLine, int tillColumn )
114 {}
115
116 virtual void PositionToXY( int line, int column, int* x, int* y )
117
118 { *x = -1; *y = -1; }
119
120 virtual void GetSelectionRange( int* fromLine, int* fromColumn,
121 int* tillLine, int* tillColumn )
122
123 { *fromLine = -1; // not supported by default
124 }
125
126 virtual wxSize GetCharacterSize() { return wxSize(-1,-1); }
127
128 virtual bool IsUnixText()
129
130 // default impl., actual implementation should use auto-detection
131
132 #ifdef __WINDOWS__
133 { return FALSE; }
134 #else
135 { return TRUE; }
136 #endif
137
138 // requests editor to keep cursor blinking, even when
139 // the window has lost it's focus
140
141 virtual void HoldCursor( bool hold )
142 {}
143
144 virtual string GetFileName() { return mFileName; }
145 virtual void SetFileName( const string& fname ) { mFileName = fname; }
146
147 // overriden methods of wxStudioPluginBase
148 virtual WXS_PLUGIN_TYPE GetType() {return WXS_EDITOR_PLUGIN;}
149 virtual string GetCategory() { return "Editor";}
150 };
151
152 #endif
153 // __EDITORBASE_G__