kate Library API Documentation

kateviewhelpers.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
00003    Copyright (C) 2001 Anders Lund <anders@alweb.dk>
00004    Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __KATE_VIEW_HELPERS_H__
00022 #define __KATE_VIEW_HELPERS_H__
00023 
00024 #include <kaction.h>
00025 #include <klineedit.h>
00026 
00027 #include <qwidget.h>
00028 #include <qpixmap.h>
00029 #include <qcolor.h>
00030 
00031 class KateDocument;
00032 class KateView;
00033 class KateViewInternal;
00034 namespace Kate {
00035   class Command;
00036 }
00037 
00038 class KateCmdLine : public KLineEdit
00039 {
00040   Q_OBJECT
00041 
00042   public:
00043     KateCmdLine (KateView *view);
00044 
00045   private slots:
00046     void slotReturnPressed ( const QString& cmd );
00047     void hideMe ();
00048 
00049   protected:
00050     void focusInEvent ( QFocusEvent *ev );
00051     void keyPressEvent( QKeyEvent *ev );
00052 
00053   private:
00054     void fromHistory( bool up );
00055     KateView *m_view;
00056     bool m_msgMode;
00057     QString m_oldText;
00058     uint m_histpos; 
00059     uint m_cmdend; 
00060     Kate::Command *m_command; 
00061     class KCompletion *m_oldCompletionObject; 
00062     class KateCmdLnWhatsThis *m_help;
00063 };
00064 
00065 class KateIconBorder : public QWidget
00066 {
00067   Q_OBJECT
00068 
00069   public:
00070     KateIconBorder( KateViewInternal* internalView, QWidget *parent );
00071 
00072     // VERY IMPORTANT ;)
00073     virtual QSize sizeHint() const;
00074 
00075     void updateFont();
00076     int lineNumberWidth() const;
00077 
00078     void setIconBorderOn(     bool enable );
00079     void setLineNumbersOn(    bool enable );
00080     void setDynWrapIndicators(int state );
00081     int dynWrapIndicators()  const { return m_dynWrapIndicators; }
00082     bool dynWrapIndicatorsOn() const { return m_dynWrapIndicatorsOn; }
00083     void setFoldingMarkersOn( bool enable );
00084     void toggleIconBorder()     { setIconBorderOn(     !iconBorderOn() );     }
00085     void toggleLineNumbers()    { setLineNumbersOn(    !lineNumbersOn() );    }
00086     void toggleFoldingMarkers() { setFoldingMarkersOn( !foldingMarkersOn() ); }
00087     bool iconBorderOn()       const { return m_iconBorderOn;     }
00088     bool lineNumbersOn()      const { return m_lineNumbersOn;    }
00089     bool foldingMarkersOn()   const { return m_foldingMarkersOn; }
00090 
00091     enum BorderArea { None, LineNumbers, IconBorder, FoldingMarkers };
00092     BorderArea positionToArea( const QPoint& ) const;
00093 
00094   signals:
00095     void toggleRegionVisibility( unsigned int );
00096 
00097   private:
00098     void paintEvent( QPaintEvent* );
00099     void paintBorder (int x, int y, int width, int height);
00100 
00101     void mousePressEvent( QMouseEvent* );
00102     void mouseMoveEvent( QMouseEvent* );
00103     void mouseReleaseEvent( QMouseEvent* );
00104     void mouseDoubleClickEvent( QMouseEvent* );
00105 
00106     void showMarkMenu( uint line, const QPoint& pos );
00107 
00108     KateView *m_view;
00109     KateDocument *m_doc;
00110     KateViewInternal *m_viewInternal;
00111 
00112     bool m_iconBorderOn:1;
00113     bool m_lineNumbersOn:1;
00114     bool m_foldingMarkersOn:1;
00115     bool m_dynWrapIndicatorsOn:1;
00116     int m_dynWrapIndicators;
00117 
00118     uint m_lastClickedLine;
00119 
00120     int m_cachedLNWidth;
00121 
00122     int m_maxCharWidth;
00123 
00124     mutable QPixmap m_arrow;
00125     mutable QColor m_oldBackgroundColor;
00126 };
00127 
00128 class KateViewEncodingAction : public KActionMenu
00129 {
00130   Q_OBJECT
00131 
00132   public:
00133     KateViewEncodingAction(KateDocument *_doc, KateView *_view, const QString& text, QObject* parent = 0, const char* name = 0);
00134 
00135     ~KateViewEncodingAction(){;};
00136 
00137   private:
00138     KateDocument* doc;
00139     KateView *view;
00140 
00141   public  slots:
00142     void slotAboutToShow();
00143 
00144   private slots:
00145     void setMode (int mode);
00146 };
00147 
00148 #endif
00149 
00150 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 4 06:57:14 2005 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003