summaryrefslogtreecommitdiffstats
path: root/src/libgui/editor.h
blob: 1a4c54ddfd29f701b6c5eaf6026a0e250a7fd22e (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
69
/***************************************************************************
 *   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 <tqlabel.h>
#include <tqlayout.h>
#include <tqvaluevector.h>
#include "common/common/qflags.h"
#include <kstdaction.h>
class KPopupMenu;

#include "common/global/purl.h"

class Editor : public TQWidget
{
Q_OBJECT
  TQ_OBJECT
public:
  Editor(const TQString &title, const TQString &tag, TQWidget *tqparent, const char *name);
  Editor(TQWidget *tqparent, const char *name);
  virtual TQSizePolicy sizePolicy() const;
  virtual PURL::FileType fileType() const = 0;
  virtual bool isModified() const = 0;
  void setModified(bool modified);
  virtual PURL::Url url() const = 0;
  TQString name() const { return _title; }
  TQString 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 TQValueList<uint> bookmarkLines() const = 0;
  virtual void setBookmarkLines(const TQValueList<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 TQString &text);
  void dropEventPass(TQDropEvent *e);

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

private:
  TQString _title, _tag;
};

#endif