summaryrefslogtreecommitdiffstats
path: root/src/libgui/editor.h
blob: 9247c8039b398717aec3e3be5d034f9f90f7f726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************
 *   Copyright (C) 2005 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#ifndef EDITOR_H
#define EDITOR_H

#include <qlabel.h>
#include <qlayout.h>
#include <qvaluevector.h>
#include "common/common/qflags.h"
#include <kstdaction.h>
class KPopupMenu;

#include "common/global/purl.h"

class Editor : public QWidget
{
Q_OBJECT
public:
  Editor(const QString &title, const QString &tag, QWidget *parent, const char *name);
  Editor(QWidget *parent, const char *name);
  virtual QSizePolicy sizePolicy() const;
  virtual PURL::FileType fileType() const = 0;
  virtual bool isModified() const = 0;
  void setModified(bool modified);
  virtual PURL::Url url() const = 0;
  QString name() const { return _title; }
  QString tag() const { return _tag; }
  void setReadOnly(bool readOnly);
  virtual bool isReadOnly() const = 0;
  bool checkSaved();
  bool reload();
  virtual void setFocus() = 0;
  virtual bool open(const PURL::Url &url) = 0;
  virtual bool save(const PURL::Url &url) = 0;
  virtual void addGui() = 0;
  virtual void removeGui() = 0;
  virtual QValueList<uint> bookmarkLines() const = 0;
  virtual void setBookmarkLines(const QValueList<uint> &lines) = 0;

public slots:
  bool slotLoad();
  bool save();
  bool saveAs();
  void toggleReadOnly() { setReadOnly(!isReadOnly()); }
  virtual void statusChanged() = 0;

signals:
  void modified();
  void guiChanged();
  void statusTextChanged(const QString &text);
  void dropEventPass(QDropEvent *e);

protected:
  QString filename() const;
  virtual void setModifiedInternal(bool modified) = 0;
  virtual void setReadOnlyInternal(bool readOnly) = 0;

private:
  QString _title, _tag;
};

#endif