• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • plugins
  • wordcompletion
docwordcompletion.h
1 /*
2  This library is free software; you can redistribute it and/or
3  modify it under the terms of the GNU Library General Public
4  License version 2 as published by the Free Software Foundation.
5 
6  This library is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9  Library General Public License for more details.
10 
11  You should have received a copy of the GNU Library General Public License
12  along with this library; see the file COPYING.LIB. If not, write to
13  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
14  Boston, MA 02110-1301, USA.
15 
16  ---
17  file: docwordcompletion.h
18 
19  KTextEditor plugin to autocompletion with document words.
20  Copyright Anders Lund <anders.lund@lund.tdcadsl.dk>, 2003
21 
22  The following completion methods are supported:
23  * Completion with bigger matching words in
24  either direction (backward/forward).
25  * NOT YET Pop up a list of all bigger matching words in document
26 
27 */
28 
29 #ifndef _DocWordCompletionPlugin_h_
30 #define _DocWordCompletionPlugin_h_
31 
32 #include <tdetexteditor/plugin.h>
33 #include <tdetexteditor/view.h>
34 #include <tdetexteditor/codecompletioninterface.h>
35 #include <tdetexteditor/configinterfaceextension.h>
36 #include <kxmlguiclient.h>
37 
38 #include <tqevent.h>
39 #include <tqobject.h>
40 #include <tqvaluelist.h>
41 
42 class DocWordCompletionPlugin
43  : public KTextEditor::Plugin
44  , public KTextEditor::PluginViewInterface
45  , public KTextEditor::ConfigInterfaceExtension
46 {
47  Q_OBJECT
48 
49  public:
50  DocWordCompletionPlugin( TQObject *parent = 0,
51  const char* name = 0,
52  const TQStringList &args = TQStringList() );
53  virtual ~DocWordCompletionPlugin() {};
54 
55  void addView (KTextEditor::View *view);
56  void removeView (KTextEditor::View *view);
57 
58  void readConfig();
59  void writeConfig();
60 
61  // ConfigInterfaceExtention
62  uint configPages() const { return 1; };
63  KTextEditor::ConfigPage * configPage( uint number, TQWidget *parent, const char *name );
64  TQString configPageName( uint ) const;
65  TQString configPageFullName( uint ) const;
66  TQPixmap configPagePixmap( uint, int ) const;
67 
68  uint treshold() const { return m_treshold; };
69  void setTreshold( uint t ) { m_treshold = t; };
70  bool autoPopupEnabled() const { return m_autopopup; };
71  void setAutoPopupEnabled( bool enable ) { m_autopopup = enable; };
72 
73 
74  private:
75  TQPtrList<class DocWordCompletionPluginView> m_views;
76  uint m_treshold;
77  bool m_autopopup;
78 
79 };
80 
81 class DocWordCompletionPluginView
82  : public TQObject, public KXMLGUIClient
83 {
84  Q_OBJECT
85 
86  public:
87  DocWordCompletionPluginView( uint treshold=3, bool autopopup=true, KTextEditor::View *view=0,
88  const char *name=0 );
89  ~DocWordCompletionPluginView() {};
90 
91  void settreshold( uint treshold );
92 
93  private slots:
94  void completeBackwards();
95  void completeForwards();
96  void shellComplete();
97 
98  void popupCompletionList( TQString word=TQString::null );
99  void autoPopupCompletionList();
100  void toggleAutoPopup();
101 
102  void slotVariableChanged( const TQString &, const TQString & );
103 
104  private:
105  void complete( bool fw=true );
106 
107  TQString word();
108  TQValueList<KTextEditor::CompletionEntry> allMatches( const TQString &word );
109  TQString findLongestUnique(const TQValueList < KTextEditor::CompletionEntry > &matches);
110  KTextEditor::View *m_view;
111  struct DocWordCompletionPluginViewPrivate *d;
112 };
113 
114 class DocWordCompletionConfigPage : public KTextEditor::ConfigPage
115 {
116  Q_OBJECT
117  public:
118  DocWordCompletionConfigPage( DocWordCompletionPlugin *completion, TQWidget *parent, const char *name );
119  virtual ~DocWordCompletionConfigPage() {};
120 
121  virtual void apply();
122  virtual void reset();
123  virtual void defaults();
124 
125  private:
126  DocWordCompletionPlugin *m_completion;
127  class TQCheckBox *cbAutoPopup;
128  class TQSpinBox *sbAutoPopup;
129  class TQLabel *lSbRight;
130 };
131 
132 #endif // _DocWordCompletionPlugin_h_
KXMLGUIClient

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.8.8
This website is maintained by Timothy Pearson.