kate Library API Documentation

ISearchPlugin.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002 by John Firebaugh <jfirebaugh@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef _ISearchPlugin_H_ 00020 #define _ISearchPlugin_H_ 00021 00022 #include <ktexteditor/plugin.h> 00023 #include <ktexteditor/view.h> 00024 #include <ktexteditor/document.h> 00025 #include <ktexteditor/searchinterface.h> 00026 #include <ktexteditor/viewcursorinterface.h> 00027 #include <ktexteditor/selectioninterface.h> 00028 00029 #include <kxmlguiclient.h> 00030 #include <qobject.h> 00031 #include <qguardedptr.h> 00032 00033 class QLabel; 00034 00035 class ISearchPlugin : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface 00036 { 00037 Q_OBJECT 00038 00039 public: 00040 ISearchPlugin( QObject *parent = 0, const char* name = 0, const QStringList &args = QStringList() ); 00041 virtual ~ISearchPlugin(); 00042 00043 void addView (KTextEditor::View *view); 00044 void removeView (KTextEditor::View *view); 00045 00046 private: 00047 QPtrList<class ISearchPluginView> m_views; 00048 }; 00049 00050 class ISearchPluginView : public QObject, public KXMLGUIClient 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 ISearchPluginView( KTextEditor::View *view ); 00056 virtual ~ISearchPluginView(); 00057 00058 virtual bool eventFilter( QObject*, QEvent* ); 00059 00060 void setView( KTextEditor::View* view ); 00061 00062 public slots: 00063 void setCaseSensitive( bool ); 00064 void setFromBeginning( bool ); 00065 void setRegExp( bool ); 00066 void setAutoWrap( bool ); 00067 00068 private slots: 00069 void slotSearchForwardAction(); 00070 void slotSearchBackwardAction(); 00071 void slotSearchAction( bool reverse ); 00072 void slotTextChanged( const QString& text ); 00073 void slotReturnPressed( const QString& text ); 00074 void slotAddContextMenuItems( QPopupMenu *menu); 00075 00076 private: 00077 void readConfig(); 00078 void writeConfig(); 00079 00080 void updateLabelText( bool failing = false, bool reverse = false, 00081 bool wrapped = false, bool overwrapped = false ); 00082 void startSearch(); 00083 void endSearch(); 00084 void quitToView( const QString &text ); 00085 00086 void nextMatch( bool reverse ); 00087 bool iSearch( uint startLine, uint startCol, 00088 const QString& text, bool reverse, bool autoWrap ); 00089 00090 KTextEditor::View* m_view; 00091 KTextEditor::Document* m_doc; 00092 KTextEditor::SearchInterface* m_searchIF; 00093 KTextEditor::ViewCursorInterface* m_cursorIF; 00094 KTextEditor::SelectionInterface* m_selectIF; 00095 KAction* m_searchForwardAction; 00096 KAction* m_searchBackwardAction; 00097 KWidgetAction* m_comboAction; 00098 QGuardedPtr<QLabel> m_label; 00099 QGuardedPtr<KHistoryCombo> m_combo; 00100 QString m_lastString; 00101 bool m_searchBackward; 00102 bool m_caseSensitive; 00103 bool m_fromBeginning; 00104 bool m_regExp; 00105 bool m_autoWrap; 00106 bool m_wrapped; 00107 uint m_startLine, m_startCol; 00108 uint m_searchLine, m_searchCol; 00109 uint m_foundLine, m_foundCol, m_matchLen; 00110 bool m_toolBarWasHidden; 00111 enum { NoSearch, TextSearch, MatchSearch } state; 00112 }; 00113 00114 #endif // _ISearchPlugin_H_
KDE Logo
This file is part of the documentation for kate Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 8 11:16:24 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003