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 <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
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