kchart

KDChartPropertySet.h
Go to the documentation of this file.
1/*
2 KDChart - a multi-platform charting engine
3 */
4
5/****************************************************************************
6 ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB. All rights reserved.
7 **
8 ** This file is part of the KDChart library.
9 **
10 ** This file may be distributed and/or modified under the terms of the
11 ** GNU General Public License version 2 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.GPL included in the
13 ** packaging of this file.
14 **
15 ** Licensees holding valid commercial KDChart licenses may use this file in
16 ** accordance with the KDChart Commercial License Agreement provided with
17 ** the Software.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.klaralvdalens-datakonsult.se/?page=products for
23 ** information about KDChart Commercial License Agreements.
24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you.
27 **
28 **********************************************************************/
29#ifndef __KDCHARTPROPERTYSET__
30#define __KDCHARTPROPERTYSET__
31
32
33#include <KDChartEnums.h>
34#include <kdchart_export.h>
35#include <tqdom.h>
36#include <tqcolor.h>
37#include <tqbrush.h>
38
44
66class KDCHART_EXPORT KDChartPropertySet :public TQObject
67{
68 TQ_OBJECT
69
70 TQ_ENUMS( SpecialDataPropertyID )
71
72 // Required by TQSA
73 TQ_ENUMS( PenStyle )
74
75 friend class KDChartParams;
76
77 public:
91 UndefinedID = -2,
92 OwnID = -1
93 };
94
100 mOwnID( UndefinedID )
101 { fullReset(""); }
102
103
117 KDChartPropertySet( const TQString& name, int idParent=KDChartPropertySet::UndefinedID ) :
118 mOwnID( UndefinedID )
119 { fullReset( name, idParent ); }
120
121
129 void deepCopy( const KDChartPropertySet* source );
130
131
141 const KDChartPropertySet* clone() const;
142
143
155 void quickReset( const TQString& name, int idParent=KDChartPropertySet::UndefinedID );
156
157
170 void fullReset( const TQString& name, int idParent=KDChartPropertySet::UndefinedID );
171
172
179 TQDomElement saveXML(TQDomDocument& doc) const;
180
181
194 static bool loadXML( const TQDomElement& element, KDChartPropertySet& set );
195
196public slots:
200 int id() const { return mOwnID; }
201
205 void setName( const TQString& name )
206 {
207 mName = name;
208 }
209
213 TQString name() const { return mName; }
214
215
216
242 void setShowBar( int idShowBar, bool showBar )
243 {
244 mIdShowBar = idShowBar;
245 mShowBar = showBar;
246 }
247
283 bool hasOwnShowBar( int& idShowBar, bool& showBar )
284 {
285 idShowBar = mIdShowBar;
286 if( OwnID == idShowBar ){
287 showBar = mShowBar;
288 return true;
289 }
290 return false;
291 }
292
315 void setBarColor( int idBarColor, const TQColor& barColor )
316 {
317 mIdBarColor = idBarColor;
318 mBarColor = barColor;
319 }
320
352 bool hasOwnBarColor( int& idBarColor, TQColor& barColor )
353 {
354 idBarColor = mIdBarColor;
355 if( OwnID == mIdBarColor ){
356 barColor = mBarColor;
357 return true;
358 }
359 return false;
360 }
361
362
386 void setLineWidth( int idLineWidth, int lineWidth )
387 {
388 mIdLineWidth = idLineWidth;
389 mLineWidth = lineWidth;
390 }
391
420 bool hasOwnLineWidth( int& idLineWidth, int& lineWidth )
421 {
422 idLineWidth = mIdLineWidth;
423 if( OwnID == mIdLineWidth ){
424 lineWidth = mLineWidth;
425 return true;
426 }
427 return false;
428 }
429
453 void setLineColor( int idLineColor, const TQColor& lineColor )
454 {
455 mIdLineColor = idLineColor;
456 mLineColor = lineColor;
457 }
458
491 bool hasOwnLineColor( int& idLineColor, TQColor& lineColor )
492 {
493 idLineColor = mIdLineColor;
494 if( OwnID == mIdLineColor ){
495 lineColor = mLineColor;
496 return true;
497 }
498 return false;
499 }
500
524 void setLineStyle( int idLineStyle, const TQt::PenStyle& lineStyle )
525 {
526 mIdLineStyle = idLineStyle;
527 mLineStyle = lineStyle;
528 }
529
562 bool hasOwnLineStyle( int& idLineStyle, TQt::PenStyle& lineStyle )
563 {
564 idLineStyle = mIdLineStyle;
565 if( OwnID == mIdLineStyle ){
566 lineStyle = mLineStyle;
567 return true;
568 }
569 return false;
570 }
571
572
573
596 void setAreaBrush( int idAreaBrush, const TQBrush& areaBrush )
597 {
598 mIdAreaBrush = idAreaBrush;
599 mAreaBrush = areaBrush;
600 }
601
633 bool hasOwnAreaBrush( int& idAreaBrush, TQBrush& areaBrush )
634 {
635 idAreaBrush = mIdAreaBrush;
636 if( OwnID == mIdAreaBrush ){
637 areaBrush = mAreaBrush;
638 return true;
639 }
640 return false;
641 }
642
643
644
645
646
672 void setShowMarker( int idShowMarker, bool showMarker )
673 {
674 mIdShowMarker = idShowMarker;
675 mShowMarker = showMarker;
676 }
677
713 bool hasOwnShowMarker( int& idShowMarker, bool& showMarker )
714 {
715 idShowMarker = mIdShowMarker;
716 if( OwnID == idShowMarker ){
717 showMarker = mShowMarker;
718 return true;
719 }
720 return false;
721 }
722
748 void setMarkerAlign( int idMarkerAlign, uint markerAlign )
749 {
750 mIdMarkerAlign = idMarkerAlign;
751 mMarkerAlign = markerAlign;
752 }
753 bool hasOwnMarkerAlign( int& idMarkerAlign, uint& markerAlign )
754 {
755 idMarkerAlign = mIdMarkerAlign;
756 if( OwnID == idMarkerAlign ){
757 markerAlign = mMarkerAlign;
758 return true;
759 }
760 return false;
761 }
762 void setMarkerSize( int idMarkerSize, const TQSize& markerSize )
763 {
764 mIdMarkerSize = idMarkerSize;
765 mMarkerSize = markerSize;
766 }
767 bool hasOwnMarkerSize( int& idMarkerSize, TQSize& markerSize )
768 {
769 idMarkerSize = mIdMarkerSize;
770 if( OwnID == idMarkerSize ){
771 markerSize = mMarkerSize;
772 return true;
773 }
774 return false;
775 }
776 void setMarkerColor( int idMarkerColor, const TQColor& markerColor )
777 {
778 mIdMarkerColor = idMarkerColor;
779 mMarkerColor = markerColor;
780 }
781 bool hasOwnMarkerColor( int& idMarkerColor, TQColor& markerColor )
782 {
783 idMarkerColor = mIdMarkerColor;
784 if( OwnID == idMarkerColor ){
785 markerColor = mMarkerColor;
786 return true;
787 }
788 return false;
789 }
790 void setMarkerStyle( int idMarkerStyle, int markerStyle )
791 {
792 mIdMarkerStyle = idMarkerStyle;
793 mMarkerStyle = markerStyle;
794 }
795 bool hasOwnMarkerStyle( int& idMarkerStyle, int& markerStyle )
796 {
797 idMarkerStyle = mIdMarkerStyle;
798 if( OwnID == idMarkerStyle ){
799 markerStyle = mMarkerStyle;
800 return true;
801 }
802 return false;
803 }
804
805
806
807
808
809
810 void setExtraLinesAlign( int idExtraLinesAlign, uint extraLinesAlign )
811 {
812 mIdExtraLinesAlign = idExtraLinesAlign;
813 mExtraLinesAlign = extraLinesAlign;
814 }
815 bool hasOwnExtraLinesAlign( int& idExtraLinesAlign, uint& extraLinesAlign )
816 {
817 idExtraLinesAlign = mIdExtraLinesAlign;
818 if( OwnID == idExtraLinesAlign ){
819 extraLinesAlign = mExtraLinesAlign;
820 return true;
821 }
822 return false;
823 }
824 void setExtraLinesInFront( int idExtraLinesInFront, bool extraLinesInFront )
825 {
826 mIdExtraLinesInFront = idExtraLinesInFront;
827 mExtraLinesInFront = extraLinesInFront;
828 }
829 bool hasOwnExtraLinesInFront( int& idExtraLinesInFront, bool& extraLinesInFront )
830 {
831 idExtraLinesInFront = mIdExtraLinesInFront;
832 if( OwnID == idExtraLinesInFront ){
833 extraLinesInFront = mExtraLinesInFront;
834 return true;
835 }
836 return false;
837 }
838 void setExtraLinesLength( int idExtraLinesLength, int extraLinesLength )
839 {
840 mIdExtraLinesLength = idExtraLinesLength;
841 mExtraLinesLength = extraLinesLength;
842 }
843 bool hasOwnExtraLinesLength( int& idExtraLinesLength, int& extraLinesLength )
844 {
845 idExtraLinesLength = mIdExtraLinesLength;
846 if( OwnID == idExtraLinesLength ){
847 extraLinesLength = mExtraLinesLength;
848 return true;
849 }
850 return false;
851 }
852 void setExtraLinesWidth( int idExtraLinesWidth, int extraLinesWidth )
853 {
854 mIdExtraLinesWidth = idExtraLinesWidth;
855 mExtraLinesWidth = extraLinesWidth;
856 }
857 bool hasOwnExtraLinesWidth( int& idExtraLinesWidth, int& extraLinesWidth )
858 {
859 idExtraLinesWidth = mIdExtraLinesWidth;
860 if( OwnID == idExtraLinesWidth ){
861 extraLinesWidth = mExtraLinesWidth;
862 return true;
863 }
864 return false;
865 }
866 void setExtraLinesColor( int idExtraLinesColor, const TQColor& extraLinesColor )
867 {
868 mIdExtraLinesColor = idExtraLinesColor;
869 mExtraLinesColor = extraLinesColor;
870 }
871 bool hasOwnExtraLinesColor( int& idExtraLinesColor, TQColor& extraLinesColor )
872 {
873 idExtraLinesColor = mIdExtraLinesColor;
874 if( OwnID == idExtraLinesColor ){
875 extraLinesColor = mExtraLinesColor;
876 return true;
877 }
878 return false;
879 }
880 void setExtraLinesStyle( int idExtraLinesStyle, const TQt::PenStyle extraLinesStyle )
881 {
882 mIdExtraLinesStyle = idExtraLinesStyle;
883 mExtraLinesStyle = extraLinesStyle;
884 }
885 bool hasOwnExtraLinesStyle( int& idExtraLinesStyle, TQt::PenStyle& extraLinesStyle )
886 {
887 idExtraLinesStyle = mIdExtraLinesStyle;
888 if( OwnID == idExtraLinesStyle ){
889 extraLinesStyle = mExtraLinesStyle;
890 return true;
891 }
892 return false;
893 }
894
895 void setExtraMarkersAlign( int idExtraMarkersAlign, uint extraMarkersAlign )
896 {
897 mIdExtraMarkersAlign = idExtraMarkersAlign;
898 mExtraMarkersAlign = extraMarkersAlign;
899 }
900 bool hasOwnExtraMarkersAlign( int& idExtraMarkersAlign, uint& extraMarkersAlign )
901 {
902 idExtraMarkersAlign = mIdExtraMarkersAlign;
903 if( OwnID == idExtraMarkersAlign ){
904 extraMarkersAlign = mExtraMarkersAlign;
905 return true;
906 }
907 return false;
908 }
909 void setExtraMarkersSize( int idExtraMarkersSize, const TQSize& extraMarkersSize )
910 {
911 mIdExtraMarkersSize = idExtraMarkersSize;
912 mExtraMarkersSize = extraMarkersSize;
913 }
914 bool hasOwnExtraMarkersSize( int& idExtraMarkersSize, TQSize& extraMarkersSize )
915 {
916 idExtraMarkersSize = mIdExtraMarkersSize;
917 if( OwnID == idExtraMarkersSize ){
918 extraMarkersSize = mExtraMarkersSize;
919 return true;
920 }
921 return false;
922 }
923 void setExtraMarkersColor( int idExtraMarkersColor, const TQColor& extraMarkersColor )
924 {
925 mIdExtraMarkersColor = idExtraMarkersColor;
926 mExtraMarkersColor = extraMarkersColor;
927 }
928 bool hasOwnExtraMarkersColor( int& idExtraMarkersColor, TQColor& extraMarkersColor )
929 {
930 idExtraMarkersColor = mIdExtraMarkersColor;
931 if( OwnID == idExtraMarkersColor ){
932 extraMarkersColor = mExtraMarkersColor;
933 return true;
934 }
935 return false;
936 }
937 void setExtraMarkersStyle( int idExtraMarkersStyle, int extraMarkersStyle )
938 {
939 mIdExtraMarkersStyle = idExtraMarkersStyle;
940 mExtraMarkersStyle = extraMarkersStyle;
941 }
942 bool hasOwnExtraMarkersStyle( int& idExtraMarkersStyle, int& extraMarkersStyle )
943 {
944 idExtraMarkersStyle = mIdExtraMarkersStyle;
945 if( OwnID == idExtraMarkersStyle ){
946 extraMarkersStyle = mExtraMarkersStyle;
947 return true;
948 }
949 return false;
950 }
951
952protected:
953 // the following member only to be set internally by KDChartParams::registerProperties
954 // and by KDChartParams::setProperties
955 int mOwnID;
956
957private:
958 KDChartPropertySet( const KDChartPropertySet& ) : TQObject(0) {}
959
960 TQString mName;
961 // IDs: values used if ID == OwnID:
962 int mIdLineWidth; int mLineWidth;
963 int mIdLineColor; TQColor mLineColor;
964 int mIdLineStyle; TQt::PenStyle mLineStyle;
965 int mIdShowMarker; bool mShowMarker;
966 int mIdMarkerSize; TQSize mMarkerSize;
967 int mIdMarkerColor; TQColor mMarkerColor;
968 int mIdMarkerStyle; int mMarkerStyle;
969 int mIdMarkerAlign; uint mMarkerAlign;
970 int mIdExtraLinesAlign; uint mExtraLinesAlign;
971 int mIdExtraLinesInFront; bool mExtraLinesInFront;
972 int mIdExtraLinesLength; int mExtraLinesLength;
973 int mIdExtraLinesWidth; int mExtraLinesWidth;
974 int mIdExtraLinesColor; TQColor mExtraLinesColor;
975 int mIdExtraLinesStyle; TQt::PenStyle mExtraLinesStyle;
976 int mIdExtraMarkersAlign; uint mExtraMarkersAlign;
977 int mIdExtraMarkersSize; TQSize mExtraMarkersSize;
978 int mIdExtraMarkersColor; TQColor mExtraMarkersColor;
979 int mIdExtraMarkersStyle; int mExtraMarkersStyle;
980 int mIdShowBar; bool mShowBar;
981 int mIdBarColor; TQColor mBarColor;
982 int mIdAreaBrush; TQBrush mAreaBrush;
983 void fillValueMembersWithDummyValues();
984};
985
986#endif
Definition of global enums.
Property settings of a single KDChart data cell.
KDChartPropertySet()
default constructor setting all values to undefined and name to empty string
int id() const
Returns the name of this property set.
bool hasOwnBarColor(int &idBarColor, TQColor &barColor)
Returns whether this property set is specifying it's own bar color settings.
bool hasOwnShowBar(int &idShowBar, bool &showBar)
Returns whether this property set is specifying it's own flag indicating whether this cell's bar is t...
void setShowBar(int idShowBar, bool showBar)
Specify the ID of the property set specifying a boolean flag indicating whether this cell's bar is to...
void setName(const TQString &name)
Change the descriptive name of this property set.
bool hasOwnLineWidth(int &idLineWidth, int &lineWidth)
Returns whether this property set is specifying it's own line width settings.
void setLineWidth(int idLineWidth, int lineWidth)
Specify the ID of the property set specifying the line width to be used for drawing a line from this ...
SpecialDataPropertyID
Special property IDs.
KDChartPropertySet(const TQString &name, int idParent=KDChartPropertySet::UndefinedID)
Constructor setting all Property Set IDs to the same ID value.
void setLineColor(int idLineColor, const TQColor &lineColor)
Specify the ID of the property set specifying the line color to be used for drawing a line from this ...
void setMarkerAlign(int idMarkerAlign, uint markerAlign)
Specify the ID of the property set specifying the alignment of the Marker to be displayed for this da...
bool hasOwnLineStyle(int &idLineStyle, TQt::PenStyle &lineStyle)
Returns whether this property set is specifying it's own line style settings.
bool hasOwnShowMarker(int &idShowMarker, bool &showMarker)
Returns whether this property set is specifying it's own flag indicating whether a Marker is to be di...
void setShowMarker(int idShowMarker, bool showMarker)
Specify the ID of the property set specifying a boolean flag indicating whether a Marker is to be dis...
void fullReset(const TQString &name, int idParent=KDChartPropertySet::UndefinedID)
Set the name, set all of the ID settings to idParent, set all of the value settings back to their def...
TQString name() const
Returns the name of this property set.
void setAreaBrush(int idAreaBrush, const TQBrush &areaBrush)
Specify the ID of the property set specifying the area brush to be used for this cell or specify the ...
void setBarColor(int idBarColor, const TQColor &barColor)
Specify the ID of the property set specifying the bar color to be used for this cell or specify the b...
bool hasOwnAreaBrush(int &idAreaBrush, TQBrush &areaBrush)
Returns whether this property set is specifying it's own area brush settings.
bool hasOwnLineColor(int &idLineColor, TQColor &lineColor)
Returns whether this property set is specifying it's own line color settings.
void setLineStyle(int idLineStyle, const TQt::PenStyle &lineStyle)
Specify the ID of the property set specifying the line style to be used for drawing a line from this ...