kword

KWFrameView.h
1/* This file is part of the KOffice project
2 * Copyright (C) 2005 Thomas Zander <zander@kde.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; version 2.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public License
14 * along with this library; see the file COPYING.LIB. If not, write to
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18#ifndef kwframeview_h
19#define kwframeview_h
20
21#include "defs.h"
22class KWFrameView;
24class KWFrame;
25class KWView;
26class KWViewMode;
27class KoZoomHandler;
28class KoPoint;
29class TDEActionSeparator;
30class TDEAction;
31class TQPopupMenu;
32
37public:
39 FramePolicy(KWFrameView *view);
45 virtual MouseMeaning mouseMeaning( const KoPoint &point, int keyState ) = 0;
51 virtual TQPopupMenu* createPopup( const KoPoint &point, KWView *view ) = 0;
55 virtual void setSelected(MouseMeaning) { }
56
57protected:
63 virtual MouseMeaning mouseMeaningOnBorder(const KoPoint &point, int keyState);
69 void addFloatingAction(KWView *view, TQPtrList<TDEAction> &actionList);
70
71 KWFrameView *m_view;
72 TDEActionSeparator *m_separator;
73
74 friend class KWFrameView; // so it can call mouseMeaningOnBorder which assumes some stuff
75};
76
83public:
90 virtual ~KWFrameView();
91
93 bool selected() const { return m_selected; }
100 void setSelected(bool selected, MouseMeaning selectPolicy = MEANING_MOUSE_SELECT);
101
103 KWFrame *frame() const { return m_frame; }
104
106 bool isBorderHit(const KoPoint &point) const;
108 bool contains(const KoPoint &point, bool fuzzy = true) const;
109
115 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
116
118 KWFrameViewManager *parent() const { return m_manager; }
119
128 void showPopup( const KoPoint &point, KWView *view, const TQPoint &popupPoint) const;
129
137 void paintFrameAttributes(TQPainter *painter, const TQRect &crect, KWViewMode *vm, KoZoomHandler *zh);
138
139private:
146 bool hit(const KoPoint &point, bool fuzzy, bool borderOnly) const;
147
148private:
149 KWFrame *m_frame;
150 bool m_selected;
151 FramePolicy *m_policy;
152 KWFrameViewManager *m_manager;
153};
154
156class TableFramePolicy : public FramePolicy {
157public:
158 TableFramePolicy(KWFrameView *view);
159 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
160 TQPopupMenu* createPopup( const KoPoint &point, KWView *view );
161 void setSelected(MouseMeaning selectPolicy);
162
163protected:
164 MouseMeaning mouseMeaningOnBorder( const KoPoint &point, int keyState);
165};
166
168class PartFramePolicy : public FramePolicy {
169public:
170 PartFramePolicy(KWFrameView *view);
171 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
172 TQPopupMenu* createPopup( const KoPoint &point, KWView *view );
173};
174
176class TextFramePolicy : public FramePolicy {
177public:
178 TextFramePolicy(KWFrameView *view);
179 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
180 TQPopupMenu* createPopup( const KoPoint &point, KWView *view );
181};
182
184class ImageFramePolicy : public FramePolicy {
185public:
186 ImageFramePolicy(KWFrameView *view);
187 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
188 TQPopupMenu* createPopup( const KoPoint &point, KWView *view );
189};
190#endif
This base class is an interface for Policies used in the KWFrameView.
Definition KWFrameView.h:36
virtual void setSelected(MouseMeaning)
Override this method to do more than select the parent frame-view.
Definition KWFrameView.h:55
void addFloatingAction(KWView *view, TQPtrList< TDEAction > &actionList)
Shared method for all policies to add the 'set floating' action to a popup menu.
virtual MouseMeaning mouseMeaning(const KoPoint &point, int keyState)=0
Return the MouseMeaning enum value for the parent view.
virtual MouseMeaning mouseMeaningOnBorder(const KoPoint &point, int keyState)
Shared method for all policies called when the border of the frame is clicked.
FramePolicy(KWFrameView *view)
Constructor.
virtual TQPopupMenu * createPopup(const KoPoint &point, KWView *view)=0
Return a fully initialized popup for the context of frame at point.
MouseMeaning mouseMeaning(const KoPoint &point, int keyState)
Return the MouseMeaning enum value for the parent view.
TQPopupMenu * createPopup(const KoPoint &point, KWView *view)
Return a fully initialized popup for the context of frame at point.
Class that knows about all the (visible) frames in the document and will act as a manager between the...
an instance of a KWFrameView represents the view in the MVC model of a frame; there can be multiple K...
Definition KWFrameView.h:82
bool isBorderHit(const KoPoint &point) const
returns if the point is on the border
void setSelected(bool selected, MouseMeaning selectPolicy=MEANING_MOUSE_SELECT)
Set the selected state of this frameView.
KWFrameViewManager * parent() const
Return the parent KWFrameViewManager this frameView belongs to.
bool contains(const KoPoint &point, bool fuzzy=true) const
returns if the point is anywhere in te frame, if fuzzy is true; also a little outside
KWFrameView(KWFrameViewManager *parent, KWFrame *frame)
Constructor.
KWFrame * frame() const
returns the frame this frameView represents
bool selected() const
returns if this frameView is selected. A selected frame is shown differently on screen.
Definition KWFrameView.h:93
void paintFrameAttributes(TQPainter *painter, const TQRect &crect, KWViewMode *vm, KoZoomHandler *zh)
Paint view based items of the frameView, like selected state.
void showPopup(const KoPoint &point, KWView *view, const TQPoint &popupPoint) const
Show a context-sensitive popup menu based on the location of 'point'.
MouseMeaning mouseMeaning(const KoPoint &point, int keyState)
Return the MouseMeaning enum value for the parent view.
This class represents a single frame.
Definition KWFrame.h:68
Abstract base class for KWCanvas's view modes.
Definition KWViewMode.h:48
TQPopupMenu * createPopup(const KoPoint &point, KWView *view)
Return a fully initialized popup for the context of frame at point.
MouseMeaning mouseMeaning(const KoPoint &point, int keyState)
Return the MouseMeaning enum value for the parent view.
MouseMeaning mouseMeaning(const KoPoint &point, int keyState)
Return the MouseMeaning enum value for the parent view.
TQPopupMenu * createPopup(const KoPoint &point, KWView *view)
Return a fully initialized popup for the context of frame at point.
MouseMeaning mouseMeaningOnBorder(const KoPoint &point, int keyState)
Shared method for all policies called when the border of the frame is clicked.
void setSelected(MouseMeaning selectPolicy)
Override this method to do more than select the parent frame-view.
MouseMeaning mouseMeaning(const KoPoint &point, int keyState)
Return the MouseMeaning enum value for the parent view.
TQPopupMenu * createPopup(const KoPoint &point, KWView *view)
Return a fully initialized popup for the context of frame at point.