• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Kate

kateviewhelpers.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, 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 #include <qscrollbar.h>
00031 #include <qintdict.h>
00032 
00033 class KateDocument;
00034 class KateView;
00035 class KateViewInternal;
00036 
00037 namespace Kate {
00038   class Command;
00039 }
00040 
00048 class KateScrollBar : public QScrollBar
00049 {
00050   Q_OBJECT
00051 
00052   public:
00053     KateScrollBar(Orientation orientation, class KateViewInternal *parent, const char* name = 0L);
00054 
00055     inline bool showMarks() { return m_showMarks; };
00056     inline void setShowMarks(bool b) { m_showMarks = b; update(); };
00057 
00058   signals:
00059     void sliderMMBMoved(int value);
00060 
00061   protected:
00062     virtual void mousePressEvent(QMouseEvent* e);
00063     virtual void mouseReleaseEvent(QMouseEvent* e);
00064     virtual void mouseMoveEvent (QMouseEvent* e);
00065     virtual void paintEvent(QPaintEvent *);
00066     virtual void resizeEvent(QResizeEvent *);
00067     virtual void styleChange(QStyle &oldStyle);
00068     virtual void valueChange();
00069     virtual void rangeChange();
00070 
00071   protected slots:
00072     void sliderMaybeMoved(int value);
00073     void marksChanged();
00074 
00075   private:
00076     void redrawMarks();
00077     void recomputeMarksPositions(bool forceFullUpdate = false);
00078     void watchScrollBarSize();
00079 
00080   bool m_middleMouseDown;
00081 
00082     KateView *m_view;
00083     KateDocument *m_doc;
00084     class KateViewInternal *m_viewInternal;
00085 
00086     int m_topMargin;
00087     int m_bottomMargin;
00088     uint m_savVisibleLines;
00089 
00090     QIntDict<QColor> m_lines;
00091 
00092     bool m_showMarks;
00093 };
00094 
00095 class KateCmdLine : public KLineEdit
00096 {
00097   Q_OBJECT
00098 
00099   public:
00100     KateCmdLine (KateView *view);
00101 
00102   private slots:
00103     void slotReturnPressed ( const QString& cmd );
00104     void hideMe ();
00105 
00106   protected:
00107     void focusInEvent ( QFocusEvent *ev );
00108     void keyPressEvent( QKeyEvent *ev );
00109 
00110   private:
00111     void fromHistory( bool up );
00112     KateView *m_view;
00113     bool m_msgMode;
00114     QString m_oldText;
00115     uint m_histpos; 
00116     uint m_cmdend; 
00117     Kate::Command *m_command; 
00118     class KCompletion *m_oldCompletionObject; 
00119     class KateCmdLnWhatsThis *m_help;
00120 };
00121 
00122 class KateIconBorder : public QWidget
00123 {
00124   Q_OBJECT
00125 
00126   public:
00127     KateIconBorder( KateViewInternal* internalView, QWidget *parent );
00128 
00129     // VERY IMPORTANT ;)
00130     virtual QSize sizeHint() const;
00131 
00132     void updateFont();
00133     int lineNumberWidth() const;
00134 
00135     void setIconBorderOn(     bool enable );
00136     void setLineNumbersOn(    bool enable );
00137     void setDynWrapIndicators(int state );
00138     int dynWrapIndicators()  const { return m_dynWrapIndicators; }
00139     bool dynWrapIndicatorsOn() const { return m_dynWrapIndicatorsOn; }
00140     void setFoldingMarkersOn( bool enable );
00141     void toggleIconBorder()     { setIconBorderOn(     !iconBorderOn() );     }
00142     void toggleLineNumbers()    { setLineNumbersOn(    !lineNumbersOn() );    }
00143     void toggleFoldingMarkers() { setFoldingMarkersOn( !foldingMarkersOn() ); }
00144     bool iconBorderOn()       const { return m_iconBorderOn;     }
00145     bool lineNumbersOn()      const { return m_lineNumbersOn;    }
00146     bool foldingMarkersOn()   const { return m_foldingMarkersOn; }
00147 
00148     enum BorderArea { None, LineNumbers, IconBorder, FoldingMarkers };
00149     BorderArea positionToArea( const QPoint& ) const;
00150 
00151   signals:
00152     void toggleRegionVisibility( unsigned int );
00153 
00154   private:
00155     void paintEvent( QPaintEvent* );
00156     void paintBorder (int x, int y, int width, int height);
00157 
00158     void mousePressEvent( QMouseEvent* );
00159     void mouseMoveEvent( QMouseEvent* );
00160     void mouseReleaseEvent( QMouseEvent* );
00161     void mouseDoubleClickEvent( QMouseEvent* );
00162 
00163     void showMarkMenu( uint line, const QPoint& pos );
00164 
00165     KateView *m_view;
00166     KateDocument *m_doc;
00167     KateViewInternal *m_viewInternal;
00168 
00169     bool m_iconBorderOn:1;
00170     bool m_lineNumbersOn:1;
00171     bool m_foldingMarkersOn:1;
00172     bool m_dynWrapIndicatorsOn:1;
00173     int m_dynWrapIndicators;
00174 
00175     uint m_lastClickedLine;
00176 
00177     int m_cachedLNWidth;
00178 
00179     int m_maxCharWidth;
00180 
00181     mutable QPixmap m_arrow;
00182     mutable QColor m_oldBackgroundColor;
00183 };
00184 
00185 class KateViewEncodingAction : public KActionMenu
00186 {
00187   Q_OBJECT
00188 
00189   public:
00190     KateViewEncodingAction(KateDocument *_doc, KateView *_view, const QString& text, QObject* parent = 0, const char* name = 0);
00191 
00192     ~KateViewEncodingAction(){;};
00193 
00194   private:
00195     KateDocument* doc;
00196     KateView *view;
00197 
00198   public  slots:
00199     void slotAboutToShow();
00200 
00201   private slots:
00202     void setMode (int mode);
00203 };
00204 
00205 #endif
00206 
00207 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal