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 <klineedit.h>
00025 
00026 #include <qwidget.h>
00027 #include <qpixmap.h>
00028 #include <qcolor.h>
00029 
00030 class KateDocument;
00031 class KateView;
00032 class KateViewInternal;
00033 
00034 class KateCmdLine : public KLineEdit
00035 {
00036   Q_OBJECT
00037 
00038   public:
00039     KateCmdLine (KateView *view);
00040 
00041   private slots:
00042     void slotReturnPressed ( const QString& cmd );
00043     void hideMe ();
00044 
00045   protected:
00046     void focusInEvent ( QFocusEvent *ev );
00047     void keyPressEvent( QKeyEvent *ev );
00048 
00049   private:
00050     KateView *m_view;
00051     bool m_msgMode;
00052     QString m_oldText;
00053 };
00054 
00055 class KateIconBorder : public QWidget
00056 {
00057   Q_OBJECT
00058 
00059   public:
00060     KateIconBorder( KateViewInternal* internalView, QWidget *parent );
00061 
00062     // VERY IMPORTANT ;)
00063     virtual QSize sizeHint() const;
00064 
00065     void updateFont();
00066     int lineNumberWidth() const;
00067 
00068     void setIconBorderOn(     bool enable );
00069     void setLineNumbersOn(    bool enable );
00070     void setDynWrapIndicators(int state );
00071     int dynWrapIndicators()  const { return m_dynWrapIndicators; }
00072     bool dynWrapIndicatorsOn() const { return m_dynWrapIndicatorsOn; }
00073     void setFoldingMarkersOn( bool enable );
00074     void toggleIconBorder()     { setIconBorderOn(     !iconBorderOn() );     }
00075     void toggleLineNumbers()    { setLineNumbersOn(    !lineNumbersOn() );    }
00076     void toggleFoldingMarkers() { setFoldingMarkersOn( !foldingMarkersOn() ); }
00077     bool iconBorderOn()       const { return m_iconBorderOn;     }
00078     bool lineNumbersOn()      const { return m_lineNumbersOn;    }
00079     bool foldingMarkersOn()   const { return m_foldingMarkersOn; }
00080 
00081     enum BorderArea { None, LineNumbers, IconBorder, FoldingMarkers };
00082     BorderArea positionToArea( const QPoint& ) const;
00083 
00084   signals:
00085     void toggleRegionVisibility( unsigned int );
00086 
00087   private:
00088     void paintEvent( QPaintEvent* );
00089     void paintBorder (int x, int y, int width, int height);
00090 
00091     void mousePressEvent( QMouseEvent* );
00092     void mouseMoveEvent( QMouseEvent* );
00093     void mouseReleaseEvent( QMouseEvent* );
00094     void mouseDoubleClickEvent( QMouseEvent* );
00095 
00096     void showMarkMenu( uint line, const QPoint& pos );
00097 
00098     KateView *m_view;
00099     KateDocument *m_doc;
00100     KateViewInternal *m_viewInternal;
00101 
00102     bool m_iconBorderOn:1;
00103     bool m_lineNumbersOn:1;
00104     bool m_foldingMarkersOn:1;
00105     bool m_dynWrapIndicatorsOn:1;
00106     int m_dynWrapIndicators;
00107 
00108     uint m_lastClickedLine;
00109 
00110     int m_cachedLNWidth;
00111 
00112     int m_maxCharWidth;
00113 
00114     mutable QPixmap m_arrow;
00115     mutable QColor m_oldBackgroundColor;
00116 };
00117 
00118 #endif
00119 
00120 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Nov 27 13:52:46 2004 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003