File: SEditor.h

package info (click to toggle)
yudit 2.5.4-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,528 kB
  • ctags: 8,403
  • sloc: cpp: 59,394; ansic: 2,585; perl: 2,398; makefile: 864; sh: 321
file content (79 lines) | stat: -rw-r--r-- 2,706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/** 
 *  Yudit Unicode Editor Source File
 *
 *  GNU Copyright (C) 2002  Gaspar Sinai <gsinai@yudit.org>  
 *  GNU Copyright (C) 2001  Gaspar Sinai <gsinai@yudit.org>  
 *  GNU Copyright (C) 2000  Gaspar Sinai <gsinai@yudit.org>  
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License, version 2,
 *  dated June 1991. See file COPYYING for details.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef SEditor_h
#define SEditor_h

#include "swidget/SUndo.h"
#include "swidget/SEditorIF.h"
#include "swindow/SWindow.h"
#include "stoolkit/STextIndex.h"
#include "stoolkit/SStringVector.h"


/**
 * This is the class that maps actions into editing actions.
 */
class SEditor 
{
public:
  SEditor(void);
  SEditor(const SString& lineBreak);
  SEditor (const SEditor& in);
  virtual ~SEditor ();
  SEditor operator=(const SEditor& in);
  virtual void setInterface(SEditorIF* editorIF);
  virtual void keyPressed (SWindowListener::SKey key, const SString& s,
            bool ctrl, bool shift, bool meta);
  virtual void keyReleased (SWindowListener::SKey key, const SString& s,
            bool ctrl, bool shift, bool meta);
  virtual void buttonPressed (int button, const STextIndex& index);
  virtual void buttonReleased (int button, const STextIndex& index);
  virtual void buttonDragged (int button, const STextIndex& index);
  virtual void multiClicked (int button, const STextIndex& index, int count);

  virtual void setInputMethods (const SStringVector& in);
  virtual void setFonts (const SStringVector& in);
  virtual void setVI (bool vimode=true);
  virtual bool undo();
  virtual bool redo();
  virtual void clearUndo();
  virtual void clear ();
  virtual void setLineBreak (const SString& lineBreak);
  virtual void insertText (const SString& text);
  virtual SString getLineBreak () const;
protected:
  void          pasteText (const STextIndex& index);
  void          add (const SUndo& undo);
  bool          vimode;
  bool          cleared;
private:
  SString       lineBreak;
  void          fKey(int num, bool ctrl);
  void          setup();
  SStringVector inputMethods;
  SStringVector fonts;
  SEditorIF*    editorIF;
  SV_Undo	    undoBuffer;
  unsigned int  undoIndex;
};

#endif /* SEditor_h */