compile
[kdegraphics.git] / kolourpaint / environments / kpEnvironmentBase.h
blobd460fbc26f4607f633470a7e6b27c879e865432c
2 // LOREFACTOR: The files in this folder duplicate too much code.
3 // Use mixin multiple inheritance to get around this.
4 //
5 // LOREFACTOR: Move as much kpMainWindow code as possible into these classes
6 // to reduce the size of kpMainWindow. But do not split concerns /
7 // "aspects" in kpMainWindow, with half the code there and half here,
8 // as that would be confusing.
11 Copyright (c) 2003-2007 Clarence Dang <dang@kde.org>
12 All rights reserved.
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions
16 are met:
18 1. Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
20 2. Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in the
22 documentation and/or other materials provided with the distribution.
24 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #ifndef kpEnvironmentBase_H
38 #define kpEnvironmentBase_H
41 #include <QObject>
44 class kpAbstractImageSelection;
45 class kpAbstractSelection;
46 class kpColor;
47 class kpCommandEnvironment;
48 class kpDocument;
49 class kpMainWindow;
50 class kpTextSelection;
51 class kpViewManager;
54 // Abstract facade bridging kpMainWindow and other suppliers (e.g. kpTool,
55 // kpToolToolBar, kpColorToolBar) to clients.
57 // This decouples as many classes as possible from clients, for maintainability.
58 // If adding new methods to this class, it is preferable to expose additional
59 // functionality, rather than expose additional classes.
61 // This class also avoids cramming excessive functionality into kpMainWindow.
63 // If this interface gets too bloated, push down the specialized methods into
64 // a new class.
65 class kpEnvironmentBase : public QObject
67 Q_OBJECT
69 // (must derive from)
70 protected:
71 // Note: Our interface must never publicly leak <mainWindow> or any other
72 // classes we are trying to hide as that would defeat the point of
73 // the facade.
74 kpEnvironmentBase (kpMainWindow *mainWindow);
75 virtual ~kpEnvironmentBase ();
77 public:
78 kpDocument *document () const;
80 kpAbstractSelection *selection () const;
81 kpAbstractImageSelection *imageSelection () const;
82 kpTextSelection *textSelection () const;
84 kpViewManager *viewManager () const;
86 kpCommandEnvironment *commandEnvironment () const;
88 kpColor backgroundColor (bool ofSelection = false) const;
90 protected:
91 kpMainWindow *mainWindow () const;
93 private:
94 struct kpEnvironmentBasePrivate * const d;
98 #endif // kpEnvironmentBase_H