00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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