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 KateView;
00031 
00032 class KateCmdLine : public KLineEdit
00033 {
00034   Q_OBJECT
00035 
00036   public:
00037     KateCmdLine (KateView *view);
00038     virtual ~KateCmdLine ();
00039 
00040   private slots:
00041     void slotReturnPressed ( const QString& cmd );
00042     void hideMe ();
00043 
00044   protected:
00045     void focusInEvent ( QFocusEvent *ev );
00046     void keyPressEvent( QKeyEvent *ev );
00047 
00048   private:
00049     KateView *m_view;
00050     bool m_msgMode;
00051     QString m_oldText;
00052 };
00053 
00054 class KateIconBorder : public QWidget
00055 {
00056   Q_OBJECT
00057 
00058   public:
00059     KateIconBorder( class KateViewInternal* internalView, QWidget *parent );
00060     ~KateIconBorder() {};
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     class KateView *m_view;
00099     class KateDocument *m_doc;
00100     class 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
KDE Logo
This file is part of the documentation for kate Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 12 09:10:45 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003