00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef VIEW_ITEM_H
00023 #define VIEW_ITEM_H
00024
00025 #include <ContextItem.h>
00026 #include <QGraphicsScene>
00027 #include <QGraphicsView>
00028 #include <QGraphicsItem>
00029 #include <QGraphicsSceneMouseEvent>
00030 #include <QStyleOptionGraphicsItem>
00031 #include <QCursor>
00032 #include <Utils.h>
00033 #include <Themer.h>
00034
00035 class SheetView;
00036
00037
00038
00039
00040 #if ! defined (Q_WS_WIN)
00041 #define MAX_CANVAS_WIDTH 1073741824
00042 #define MAX_CANVAS_HEIGHT 1073741824
00043 #else
00044 #define MAX_CANVAS_WIDTH 107374182
00045 #define MAX_CANVAS_HEIGHT 107374182
00046 #endif
00047
00048
00049 class ViewItem : public ContextItem, public QGraphicsItem
00050 {
00051 Q_OBJECT
00052
00053 public:
00054
00055 ViewItem(ViewItem* parentViewItem=0, ContextItem* parentContext=0);
00056 ~ViewItem() {};
00057
00058 enum {Type = UserType + 1};
00059
00060 QRectF boundingRect() const;
00061 virtual void calculate_bounding_rect() {
00062 for (int i=0; i< QGraphicsItem::children().size(); ++i) {
00063 QGraphicsItem* item = QGraphicsItem::children().at(i);
00064 if (is_viewitem(item)) {
00065 ((ViewItem*)item)->calculate_bounding_rect();
00066 }
00067 }
00068 }
00069 virtual int get_childview_y_offset() const {return 0;}
00070 virtual int type() const;
00071 virtual int get_height() const {return (int)m_boundingRect.height();}
00072
00077 virtual void load_theme_data() {};
00078
00079 SheetView* get_sheetview() const {return m_sv;}
00080
00081 static bool is_viewitem(QGraphicsItem* item) {
00082 return item->type() == Type;
00083 }
00084
00085
00086 protected:
00087
00088 SheetView* m_sv;
00089 ViewItem* m_parentViewItem;
00090 QRectF m_boundingRect;
00091 };
00092
00093 inline QRectF ViewItem::boundingRect() const {return m_boundingRect;}
00094 inline int ViewItem::type() const {return Type;}
00095
00096 #endif
00097
00098