1 /*
2    GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
3 
4    Copyright (C) 2005-2014 Free Software Foundation
5 
6    Authors: Serg Stoyan
7 
8    This file is part of GNUstep.
9 
10    This application is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public
12    License as published by the Free Software Foundation; either
13    version 2 of the License, or (at your option) any later version.
14 
15    This application is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Library General Public License for more details.
19 
20    You should have received a copy of the GNU General Public
21    License along with this library; if not, write to the Free
22    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
23 */
24 
25 #ifndef _CodeEditor_h_
26 #define _CodeEditor_h_
27 
28 #import <Foundation/Foundation.h>
29 #import <AppKit/AppKit.h>
30 
31 @protocol CodeEditor <NSObject>
32 
33 // ===========================================================================
34 // ==== Initialization
35 // ===========================================================================
36 - (void)setParser:(id)parser;
37 
38 // Usually delegate is PCEditorManager or PCEditorManager
39 - (id)openFileAtPath:(NSString *)filePath
40        editorManager:(id)editorManager
41 	    editable:(BOOL)editable;
42 
43 - (void)show;
44 - (void)setWindowed:(BOOL)yn;
45 - (BOOL)isWindowed;
46 
47 // ===========================================================================
48 // ==== Accessor methods
49 // ===========================================================================
50 - (id)editorManager;
51 
52 - (NSWindow *)editorWindow;
53 - (NSView *)editorView;
54 - (NSView *)componentView;
55 
56 - (NSString *)path;
57 - (void)setPath:(NSString *)path;
58 
59 - (NSString *)categoryPath;
60 - (void)setCategoryPath:(NSString *)path;
61 
62 - (BOOL)isEdited;
63 - (void)setIsEdited:(BOOL)yn;
64 
65 - (NSImage *)fileIcon;
66 
67 // Returns class or method names
68 - (NSArray *)browserItemsForItem:(NSString *)item;
69 
70 // ===========================================================================
71 // ==== Object managment
72 // ===========================================================================
73 - (BOOL)saveFileIfNeeded;
74 - (BOOL)saveFile;
75 - (BOOL)saveFileTo:(NSString *)path;
76 - (BOOL)revertFileToSaved;
77 - (BOOL)closeFile:(id)sender save:(BOOL)save;
78 - (BOOL)close:(id)sender;
79 
80 // ===========================================================================
81 // ==== Parser and scrolling
82 // ===========================================================================
83 
84 - (void)fileStructureItemSelected:(NSString *)item;
85 - (void)scrollToLineNumber:(NSUInteger)lineNumber;
86 
87 @end
88 
89 #endif
90