]>
git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/modules/lseditor/editorpl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: General interfaces for editor plug-ins.
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleskandars Gluchovas
9 // Licence: GNU General Public License wxWindows licence v2.0
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __EDITORBASE_G__
13 #define __EDITORBASE_G__
16 #include "wx/window.h"
18 class wxsSourceEditorPlugin
: public wxsComponent
24 /*** overridables (with default implementations) ***/
26 // user-level commands
28 virtual void OnOpen( const string
& fname
) = 0;
29 virtual void OnSave( const string
& fname
) = 0;
31 virtual void OnCopy() {}
32 virtual void OnCut() {}
33 virtual void OnPaste() {}
34 virtual void OnDelete() {}
36 virtual void OnUndo() {}
37 virtual void OnRedo() {}
39 virtual void SelectAll() {}
41 // NOTE:: column -1 should result cursor to appear
42 // at the start of the first word in the line (if any)
44 virtual void OnGotoLine( int lineNo
, int column
= -1 ) {}
46 // should invoke editor's own "goto-line" dialog
47 virtual void OnGotoLine() {}
49 virtual void OnProperties() {}
51 virtual void OnFind() {}
52 virtual void OnFindNext() {}
53 virtual void OnFindPrevious() {}
54 virtual void OnReplace() {}
56 virtual void OnToggleBookmark() {}
57 virtual void OnNextBookmark() {}
58 virtual void OnPreviousBookmark() {}
59 virtual void OnShowBookmarks() {}
61 virtual void SetCheckpoint() {}
62 virtual bool CheckpointModified() { return TRUE
; }
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
; }
72 // accesed by framework
74 virtual bool IsModified() { return TRUE
; }
76 // returned buffer is NULL, if operation is not supported
77 // by this concrete editor
79 virtual void GetAllText( char** ppBuf
, size_t* length
)
81 { *ppBuf
= NULL
; *length
= 0; }
83 virtual string
FindWordAtCursor() = 0;
85 // returned line and column are -1s, if operation
86 // is not supported this concrete editor
88 virtual void GetCursorPos( int* line
, int* column
)
90 { *line
= -1; *column
= -1; }
92 virtual void GetPagePos( int* line
, int* column
)
94 { *line
= -1; *column
= -1; }
96 virtual void SetCursorPos( int line
, int column
) {}
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) )
103 virtual void GetText( int fromLine
, int fromColumn
,
104 int tillLine
, int tillColumn
,
105 char** ppBuf
, size_t* length
)
108 virtual void InsertText( int line
, int column
,
109 char* text
, size_t lenght
)
112 virtual void DeleteText( int fromLine
, int fromColumn
,
113 int tillLine
, int tillColumn
)
116 virtual void PositionToXY( int line
, int column
, int* x
, int* y
)
118 { *x
= -1; *y
= -1; }
120 virtual void GetSelectionRange( int* fromLine
, int* fromColumn
,
121 int* tillLine
, int* tillColumn
)
123 { *fromLine
= -1; // not supported by default
126 virtual wxSize
GetCharacterSize() { return wxSize(-1,-1); }
128 virtual bool IsUnixText()
130 // default impl., actual implementation should use auto-detection
138 // requests editor to keep cursor blinking, even when
139 // the window has lost it's focus
141 virtual void HoldCursor( bool hold
)
144 virtual string
GetFileName() { return mFileName
; }
145 virtual void SetFileName( const string
& fname
) { mFileName
= fname
; }
147 // overriden methods of wxStudioPluginBase
148 virtual WXS_PLUGIN_TYPE
GetType() {return WXS_EDITOR_PLUGIN
;}
149 virtual string
GetCategory() { return "Editor";}