~ubuntu-branches/ubuntu/karmic/rkward/karmic

« back to all changes in this revision

Viewing changes to rkward/windows/rkmdiwindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2006-11-06 16:30:00 UTC
  • mfrom: (1.2.1 upstream) (3.1.1 feisty)
  • Revision ID: james.westby@ubuntu.com-20061106163000-qi8ju75eqecrfay7
* new upstream release
* depend on either php4-cli or php5-cli

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          rkmdiwindow  -  description
 
3
                             -------------------
 
4
    begin                : Tue Sep 26 2006
 
5
    copyright            : (C) 2006 by Thomas Friedrichsmeier
 
6
    email                : tfry@users.sourceforge.net
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#ifndef RKMDIWINDOW_H
 
19
#define RKMDIWINDOW_H
 
20
 
 
21
#include <qwidget.h>
 
22
 
 
23
#include <kparts/part.h>
 
24
 
 
25
class RKWorkplace;
 
26
 
 
27
/** Base class for rkward document mdi windows */
 
28
class RKMDIWindow : public QWidget {
 
29
        Q_OBJECT
 
30
public:
 
31
        enum Type {
 
32
                DataEditorWindow=1,
 
33
                CommandEditorWindow=2,
 
34
                OutputWindow=4,
 
35
                HelpWindow=8,
 
36
                AnyType=DataEditorWindow | CommandEditorWindow | OutputWindow | HelpWindow
 
37
        };
 
38
 
 
39
        enum State {
 
40
                Attached=1,
 
41
                Detached=2,
 
42
                AnyState=Attached | Detached
 
43
        };
 
44
protected:
 
45
/** constructor
 
46
@param parent parent widget
 
47
@param type Type of window */
 
48
        RKMDIWindow (QWidget *parent, Type type);
 
49
        virtual ~RKMDIWindow ();
 
50
public:
 
51
/** @returns true, if the window's document was modified (and would need to be saved) */
 
52
        virtual bool isModified () = 0;
 
53
/** @returns A long / complete caption. Default implementation simply calls shortCaption () */
 
54
        virtual QString fullCaption ();
 
55
/** @returns A short caption (e.g. only the filename without the path). Default implementation simply calls QWidget::caption () */
 
56
        virtual QString shortCaption ();
 
57
/** @returns The corresponding KPart for this window */
 
58
        virtual KParts::Part *getPart () = 0;
 
59
/** This is used in RKWorkplace::saveWorkplace () to save the info about the workplace. Make sure to add corresponding code to RKWorkplace::restoreWorkplace (), so your window(s) get restored when loading a Workspace
 
60
@returns An internal descriptive string suitable for storage in R. */
 
61
        virtual QString getRDescription () = 0;
 
62
/** Reimplemented from QWidget::setCaption () to emit the signal captionChanged () when the caption is changed. */
 
63
        void setCaption (const QString &caption);
 
64
/** Is this window attached (or detached)?
 
65
@returns true if attached, false if detached */
 
66
        bool isAttached () { return (state == Attached); };
 
67
signals:
 
68
/** This signal is emitted, whenever the window caption was changed.
 
69
@param RKMDIWindow* a pointer to this window */
 
70
        void captionChanged (RKMDIWindow *);
 
71
protected:
 
72
friend class RKWorkplace;
 
73
/** type of this window */
 
74
        Type type;
 
75
private:
 
76
/** state of this window (attached / detached). This is set from the RKWorkplace */
 
77
        State state;
 
78
};
 
79
 
 
80
#endif