view.h
/* This file is part of the KDE libraries
Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KATE_VIEW_INCLUDE_
#define _KATE_VIEW_INCLUDE_
#include <ktexteditor/document.h>
#include <ktexteditor/view.h>
#include <ktexteditor/clipboardinterface.h>
#include <ktexteditor/popupmenuinterface.h>
#include <ktexteditor/markinterface.h>
#include <ktexteditor/viewcursorinterface.h>
#include <ktexteditor/codecompletioninterface.h>
#include <ktexteditor/dynwordwrapinterface.h>
class KConfig;
namespace Kate
{
class Document;
class KATEPARTINTERFACES_EXPORT View : public KTextEditor::View, public KTextEditor::ClipboardInterface,
public KTextEditor::PopupMenuInterface, public KTextEditor::ViewCursorInterface,
public KTextEditor::CodeCompletionInterface, public KTextEditor::DynWordWrapInterface
{
Q_OBJECT
public:
enum saveResult { SAVE_OK, SAVE_CANCEL, SAVE_RETRY, SAVE_ERROR };
View ( KTextEditor::Document *, QWidget *, const char *name = 0 );
virtual ~View ();
virtual bool isOverwriteMode() const { return false; }
virtual void setOverwriteMode( bool ) { }
virtual QString currentTextLine() { return 0L; }
virtual QString currentWord() { return 0L; }
virtual QString word(int , int ) { return 0L; }
virtual void insertText(const QString &mark ) { Q_UNUSED(mark); }
virtual bool canDiscard() { return false; }
public:
virtual int tabWidth() = 0;
virtual void setTabWidth(int) = 0;
virtual void setEncoding (QString e) = 0;
virtual bool isLastView() = 0;
public slots:
virtual void flush () { ; };
virtual saveResult save() { return SAVE_CANCEL; };
virtual saveResult saveAs() { return SAVE_CANCEL; };
virtual void indent() { ; };
virtual void unIndent() { ; };
virtual void cleanIndent() { ; };
virtual void comment() { ; };
virtual void uncomment() { ; };
virtual void keyReturn () { ; };
virtual void keyDelete () { ; };
virtual void backspace () { ; };
virtual void killLine () { ; };
virtual void cursorLeft () { ; };
virtual void shiftCursorLeft () { ; };
virtual void cursorRight () { ; };
virtual void shiftCursorRight () { ; };
virtual void wordLeft () { ; };
virtual void shiftWordLeft () { ; };
virtual void wordRight () { ; };
virtual void shiftWordRight () { ; };
virtual void home () { ; };
virtual void shiftHome () { ; };
virtual void end () { ; };
virtual void shiftEnd () { ; };
virtual void up () { ; };
virtual void shiftUp () { ; };
virtual void down () { ; };
virtual void shiftDown () { ; };
virtual void scrollUp () { ; };
virtual void scrollDown () { ; };
virtual void topOfView () { ; };
virtual void bottomOfView () { ; };
virtual void pageUp () { ; };
virtual void shiftPageUp () { ; };
virtual void pageDown () { ; };
virtual void shiftPageDown () { ; };
virtual void top () { ; };
virtual void shiftTop () { ; };
virtual void bottom () { ; };
virtual void shiftBottom () { ; };
virtual void find() { ; };
virtual void replace() { ; };
virtual void gotoLine() { ; };
public:
virtual void readSessionConfig(KConfig *) { ; };
virtual void writeSessionConfig(KConfig *) { ; };
public slots:
virtual int getEol() { return 0L; }
virtual void setEol(int) { }
// Should remove this, it's redundant.
virtual void setFocus () { QWidget::setFocus(); }
virtual void findAgain(bool forward ) { Q_UNUSED(forward); }
virtual void findAgain () { };
virtual void findPrev () { }
virtual void slotEditCommand () { }
virtual void setIconBorder (bool enable ) { Q_UNUSED(enable); }
virtual void toggleIconBorder () { }
virtual void setLineNumbersOn (bool enable) { Q_UNUSED(enable); }
virtual void toggleLineNumbersOn () {}
public:
virtual bool iconBorder() { return false; }
virtual bool lineNumbersOn() { return false; }
virtual Document *getDoc () { return 0L; }
public slots:
virtual void slotIncFontSizes () { }
virtual void slotDecFontSizes () { }
virtual void gotoMark (KTextEditor::Mark *mark) = 0;
// TODO: Remove when BIC is allowed
virtual void toggleBookmark () {}
virtual void gotoLineNumber( int ) = 0;
signals:
void gotFocus (View *);
// void newStatus(); // Kate app connects to this signal, should be in the interface
public:
virtual void setActive (bool b) = 0;
virtual bool isActive () = 0;
};
KATEPARTINTERFACES_EXPORT View *view (KTextEditor::View *view);
}
#endif
Kate::View::getDoc
virtual Document * getDoc()
Returns a pointer to the document of the view.
Definition: view.h:267
Kate::View::setFocus
virtual void setFocus()
Set focus to the current window.
Definition: view.h:214
Kate::View::findAgain
virtual void findAgain()
Searches for the last searched text forward from cursor position.
Definition: view.h:224
Kate::View::setOverwriteMode
virtual void setOverwriteMode(bool)
Get editor mode.
Definition: view.h:68
Kate::Document
This interface provides access to the Kate Document class.
Definition: document.h:182
Kate::View::saveAs
virtual saveResult saveAs()
Allows the user to save the file under a new name.
Definition: view.h:118
Kate::View::iconBorder
virtual bool iconBorder()
Returns whether iconborder is visible.
Definition: view.h:259
Kate::View::findAgain
virtual void findAgain(bool forward)
Searches for the last searched text forward from cursor position.
Definition: view.h:219
Kate::View
The Kate::View text editor interface.
Definition: view.h:42
Kate::View::saveResult
saveResult
Return values for "save" related commands.
Definition: view.h:52
Kate::View::setLineNumbersOn
virtual void setLineNumbersOn(bool enable)
Sets display of line numbers on/off depending on enable.
Definition: view.h:249
Kate::View::getEol
virtual int getEol()
Get the end of line mode (Unix, Macintosh or Dos).
Definition: view.h:205
Kate::View::toggleBookmark
virtual void toggleBookmark()
Definition: view.h:286
Kate::View::setIconBorder
virtual void setIconBorder(bool enable)
Sets icon border on or off depending on.
Definition: view.h:240
Kate::View::slotIncFontSizes
virtual void slotIncFontSizes()
Increase font size.
Definition: view.h:273
Kate::View::replace
virtual void replace()
Presents a replace dialog to the user.
Definition: view.h:184
Kate::View::insertText
virtual void insertText(const QString &mark)
Insert text at the current cursor position.
Definition: view.h:86
Kate::View::toggleIconBorder
virtual void toggleIconBorder()
Toggles icon border.
Definition: view.h:244
Kate::View::gotoLine
virtual void gotoLine()
Presents a "Goto Line" dialog to the user.
Definition: view.h:188
Kate::View::cleanIndent
virtual void cleanIndent()
Optimizes the selected indentation, replacing tabs and spaces as needed.
Definition: view.h:130
Kate::View::cursorLeft
virtual void cursorLeft()
Move cursor in the view.
Definition: view.h:149
Kate::View::slotEditCommand
virtual void slotEditCommand()
Presents an edit command popup window, where the user can apply a shell command to the contents of th...
Definition: view.h:234
Kate::View::keyReturn
virtual void keyReturn()
Some simply key commands.
Definition: view.h:142
Kate::View::setEol
virtual void setEol(int)
Set the end of line mode (Unix, Macintosh or Dos).
Definition: view.h:209
Kate::View::word
virtual QString word(int, int)
Gets the word at position x, y.
Definition: view.h:81
Kate::View::uncomment
virtual void uncomment()
Removes comment signs in the current line.
Definition: view.h:138
Kate::View::comment
virtual void comment()
Comments out current line.
Definition: view.h:134
KConfig
Kate::View::canDiscard
virtual bool canDiscard()
Works exactly like closeURL() of KParts::ReadWritePart.
Definition: view.h:90
Kate::View::writeSessionConfig
virtual void writeSessionConfig(KConfig *)
Writes session config into the KConfig object.
Definition: view.h:199
Kate::View::readSessionConfig
virtual void readSessionConfig(KConfig *)
Reads session config out of the KConfig object.
Definition: view.h:195
Kate::View::findPrev
virtual void findPrev()
Searches for the last searched text forward from cursor position.
Definition: view.h:229
Kate::View::save
virtual saveResult save()
Saves the file under the current file name.
Definition: view.h:114
Kate::View::isOverwriteMode
virtual bool isOverwriteMode() const
Set editor mode.
Definition: view.h:64
Kate::View::flush
virtual void flush()
Flushes the document of the text widget.
Definition: view.h:108
Kate::View::find
virtual void find()
Presents a search dialog to the user.
Definition: view.h:180
KStdAccel::home
const KShortcut & home()
Kate::View::lineNumbersOn
virtual bool lineNumbersOn()
Definition: view.h:263
Kate::View::currentTextLine
virtual QString currentTextLine()
Gets the text line where the cursor is on.
Definition: view.h:72
Kate::View::indent
virtual void indent()
Moves the current line or the selection one position to the right.
Definition: view.h:122
KStdAccel::up
const KShortcut & up()
KStdAccel::end
const KShortcut & end()
Kate::View::toggleLineNumbersOn
virtual void toggleLineNumbersOn()
Toggles display of lineNumbers.
Definition: view.h:253
Kate::View::slotDecFontSizes
virtual void slotDecFontSizes()
Decrease font size.
Definition: view.h:277
Kate::View::unIndent
virtual void unIndent()
Moves the current line or the selection one position to the left.
Definition: view.h:126
Kate::View::currentWord
virtual QString currentWord()
Gets the word where the cursor is on.
Definition: view.h:76

KDE Home | KDE Accessibility Home | Description of Access Keys