kword
KWFrameView.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef kwframeview_h
00019 #define kwframeview_h
00020
00021 #include "defs.h"
00022 class KWFrameView;
00023 class KWFrameViewManager;
00024 class KWFrame;
00025 class KWView;
00026 class KWViewMode;
00027 class KoZoomHandler;
00028 class KoPoint;
00029 class KActionSeparator;
00030 class KAction;
00031 class QPopupMenu;
00032
00036 class FramePolicy {
00037 public:
00039 FramePolicy(KWFrameView *view);
00045 virtual MouseMeaning mouseMeaning( const KoPoint &point, int keyState ) = 0;
00051 virtual QPopupMenu* createPopup( const KoPoint &point, KWView *view ) = 0;
00055 virtual void setSelected(MouseMeaning) { }
00056
00057 protected:
00063 virtual MouseMeaning mouseMeaningOnBorder(const KoPoint &point, int keyState);
00069 void addFloatingAction(KWView *view, QPtrList<KAction> &actionList);
00070
00071 KWFrameView *m_view;
00072 KActionSeparator *m_separator;
00073
00074 friend class KWFrameView;
00075 };
00076
00082 class KWFrameView {
00083 public:
00089 KWFrameView(KWFrameViewManager *parent, KWFrame *frame);
00090 virtual ~KWFrameView();
00091
00093 bool selected() const { return m_selected; }
00100 void setSelected(bool selected, MouseMeaning selectPolicy = MEANING_MOUSE_SELECT);
00101
00103 KWFrame *frame() const { return m_frame; }
00104
00106 bool isBorderHit(const KoPoint &point) const;
00108 bool contains(const KoPoint &point, bool fuzzy = true) const;
00109
00115 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
00116
00118 KWFrameViewManager *parent() const { return m_manager; }
00119
00128 void showPopup( const KoPoint &point, KWView *view, const QPoint &popupPoint) const;
00129
00137 void paintFrameAttributes(QPainter *painter, const QRect &crect, KWViewMode *vm, KoZoomHandler *zh);
00138
00139 private:
00146 bool hit(const KoPoint &point, bool fuzzy, bool borderOnly) const;
00147
00148 private:
00149 KWFrame *m_frame;
00150 bool m_selected;
00151 FramePolicy *m_policy;
00152 KWFrameViewManager *m_manager;
00153 };
00154
00156 class TableFramePolicy : public FramePolicy {
00157 public:
00158 TableFramePolicy(KWFrameView *view);
00159 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
00160 QPopupMenu* createPopup( const KoPoint &point, KWView *view );
00161 void setSelected(MouseMeaning selectPolicy);
00162
00163 protected:
00164 MouseMeaning mouseMeaningOnBorder( const KoPoint &point, int keyState);
00165 };
00166
00168 class PartFramePolicy : public FramePolicy {
00169 public:
00170 PartFramePolicy(KWFrameView *view);
00171 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
00172 QPopupMenu* createPopup( const KoPoint &point, KWView *view );
00173 };
00174
00176 class TextFramePolicy : public FramePolicy {
00177 public:
00178 TextFramePolicy(KWFrameView *view);
00179 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
00180 QPopupMenu* createPopup( const KoPoint &point, KWView *view );
00181 };
00182
00184 class ImageFramePolicy : public FramePolicy {
00185 public:
00186 ImageFramePolicy(KWFrameView *view);
00187 MouseMeaning mouseMeaning( const KoPoint &point, int keyState );
00188 QPopupMenu* createPopup( const KoPoint &point, KWView *view );
00189 };
00190 #endif
|