00001 /*************************************************************************** 00002 * Copyright (C) 2005 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #ifndef DRAWPART_H 00012 #define DRAWPART_H 00013 00014 #include <item.h> 00015 00016 class ICNDocument; 00017 class ItemDocument; 00018 class LibraryItem; 00019 class RectangularOverlay; 00020 00024 class DrawPart : public Item 00025 { 00026 public: 00027 enum DrawAction 00028 { 00029 // Note: values are used for popup menu 00030 da_text = 0, 00031 da_line = 1, 00032 da_arrow = 2, 00033 da_rectangle = 3, 00034 da_ellipse = 4 00035 }; 00036 00037 DrawPart( ItemDocument *itemDocument, bool newItem, const char *id ); 00038 virtual ~DrawPart(); 00039 00040 int rtti() const; 00041 00042 virtual bool canResize() const { return true; } 00043 00044 virtual Variant * createProperty( const QString & id, Variant::Type::Value type ); 00045 00046 Qt::PenStyle getDataPenStyle( const QString & id ); 00047 Qt::PenCapStyle getDataPenCapStyle( const QString & id ); 00048 00049 void setDataPenStyle( const QString & id, Qt::PenStyle value ); 00050 void setDataPenCapStyle( const QString & id, Qt::PenCapStyle value ); 00051 00052 virtual ItemData itemData() const; 00053 virtual void restoreFromItemData( const ItemData &itemData ); 00054 00055 // Convention for following functions: name is i18n'd name of style, id is the english one 00056 00057 static QString penStyleToID( Qt::PenStyle style ); 00058 static Qt::PenStyle idToPenStyle( const QString & id ); 00059 static QString penCapStyleToID( Qt::PenCapStyle style ); 00060 static Qt::PenCapStyle idToPenCapStyle( const QString & id ); 00061 00062 static QString penStyleToName( Qt::PenStyle style ); 00063 static Qt::PenStyle nameToPenStyle( const QString & name ); 00064 static QString penCapStyleToName( Qt::PenCapStyle style ); 00065 static Qt::PenCapStyle nameToPenCapStyle( const QString & name ); 00066 }; 00067 00068 #endif
1.5.1