1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Qwt User's Guide: qwt_legend.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>qwt_legend.h</h1><pre class="fragment"><div>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span>
00002 <span class="comment"> * Qwt Widget Library</span>
00003 <span class="comment"> * Copyright (C) 1997 Josef Wilgen</span>
00004 <span class="comment"> * Copyright (C) 2002 Uwe Rathmann</span>
00005 <span class="comment"> *</span>
00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span>
00008 <span class="comment"> *****************************************************************************/</span>
00009
00010 <span class="comment">// vim: expandtab</span>
00011
00012 <span class="preprocessor">#ifndef QWT_LEGEND_H</span>
00013 <span class="preprocessor"></span><span class="preprocessor">#define QWT_LEGEND_H</span>
00014 <span class="preprocessor"></span>
00015 <span class="preprocessor">#include <qpen.h></span>
00016 <span class="preprocessor">#include <qscrollview.h></span>
00017 <span class="preprocessor">#include <qlabel.h></span>
00018 <span class="preprocessor">#include "qwt_global.h"</span>
00019 <span class="preprocessor">#include "qwt_symbol.h"</span>
00020 <span class="preprocessor">#include "qwt_push_button.h"</span>
00021
00022 <span class="preprocessor">#if QT_VERSION < 0x040000</span>
00023 <span class="preprocessor"></span><span class="preprocessor">#include <qwidgetintdict.h></span>
00024 <span class="preprocessor">#else</span>
00025 <span class="preprocessor"></span><span class="preprocessor">#include "qwt_plot_dict.h"</span>
00026 <span class="keyword">class </span>QWT_EXPORT QWidgetIntDict: <span class="keyword">public</span> QwtSeqDict<QWidget>
00027 {
00028 <span class="keyword">public</span>:
00029 QWidgetIntDict() {}
00030 };
00031 <span class="keyword">typedef</span> QIntDictIterator<QWidget> QWidgetIntDictIt;
00032 <span class="preprocessor">#endif</span>
00033 <span class="preprocessor"></span>
00034 <span class="keyword">class </span>QPainter;
00035 <span class="keyword">class </span><a class="code" href="class_qwt_text.html">QwtText</a>;
00036
<a name="l00041"></a><a class="code" href="class_qwt_legend_item.html">00041</a> <span class="keyword">class </span><a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>
00042 {
00043 <span class="keyword">public</span>:
<a name="l00051"></a><a class="code" href="class_qwt_legend_item.html#w4">00051</a> <span class="keyword">enum</span> <a class="code" href="class_qwt_legend_item.html#w4">IdentifierMode</a>
00052 {
00053 NoIdentifier = 0,
00054 ShowLine = 1,
00055 ShowSymbol = 2,
00056 ShowText = 4
00057 };
00058
00059 <a class="code" href="class_qwt_legend_item.html#a0">QwtLegendItem</a>();
00060 <a class="code" href="class_qwt_legend_item.html#a0">QwtLegendItem</a>(<span class="keyword">const</span> <a class="code" href="class_qwt_symbol.html">QwtSymbol</a> &, <span class="keyword">const</span> QPen &);
00061
00062 <span class="keyword">virtual</span> <a class="code" href="class_qwt_legend_item.html#a2">~QwtLegendItem</a>();
00063
00064 <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#a3">setIdentifierMode</a>(<span class="keywordtype">int</span>);
00065 <span class="keywordtype">int</span> <a class="code" href="class_qwt_legend_item.html#a4">identifierMode</a>() const;
00066
00067 <span class="keywordtype">void</span> setSymbol(const <a class="code" href="class_qwt_symbol.html">QwtSymbol</a> &);
00068 const QwtSymbol& symbol() const;
00069
00070 <span class="keywordtype">void</span> setCurvePen(const QPen &);
00071 const QPen& curvePen() const;
00072
00073 virtual <span class="keywordtype">void</span> drawIdentifier(QPainter *, const QRect &) const;
00074 virtual <span class="keywordtype">void</span> drawItem(QPainter *p, const QRect &) const;
00075
00076 virtual <span class="keywordtype">void</span> setTitle(const QString &) = 0;
00077 virtual QString title() const = 0;
00078
00079 protected:
00080 virtual <a class="code" href="class_qwt_text.html">QwtText</a> *titleText() const = 0;
00081 virtual <span class="keywordtype">void</span> updateItem();
00082
00083 private:
00084 <span class="keywordtype">int</span> d_identifierMode;
00085 QwtSymbol d_symbol;
00086 QPen d_curvePen;
00087 };
00088
<a name="l00099"></a><a class="code" href="class_qwt_legend_button.html">00099</a> class QWT_EXPORT <a class="code" href="class_qwt_legend_button.html">QwtLegendButton</a>: public <a class="code" href="class_qwt_push_button.html">QwtPushButton</a>, public <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>
00100 {
00101 Q_OBJECT
00102 <span class="keyword">public</span>:
00103 <a class="code" href="class_qwt_legend_button.html">QwtLegendButton</a>(QWidget *parent = 0, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00104 <a class="code" href="class_qwt_legend_button.html">QwtLegendButton</a>(<span class="keyword">const</span> QwtSymbol &, <span class="keyword">const</span> QPen &,
00105 <span class="keyword">const</span> QString &, QWidget *parent = 0, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00106
00107 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setTitle(<span class="keyword">const</span> QString &);
00108 <span class="keyword">virtual</span> QString title() <span class="keyword">const</span>;
00109
00110 <span class="keyword">protected</span>:
00111 <span class="keyword">virtual</span> <a class="code" href="class_qwt_text.html">QwtText</a> *titleText() <span class="keyword">const</span>;
00112 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#b1">updateItem</a>();
00113 <span class="keyword">virtual</span> <span class="keywordtype">void</span> updateIconset();
00114
00115 <span class="keyword">private</span>:
00116 <span class="keywordtype">void</span> init();
00117 };
00118
<a name="l00128"></a><a class="code" href="class_qwt_legend_label.html">00128</a> <span class="keyword">class </span>QWT_EXPORT QwtLegendLabel: <span class="keyword">public</span> QLabel, <span class="keyword">public</span> <a class="code" href="class_qwt_legend_item.html">QwtLegendItem</a>
00129 {
00130 Q_OBJECT
00131 <span class="keyword">public</span>:
00132 QwtLegendLabel(QWidget *parent = 0, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00133 QwtLegendLabel(<span class="keyword">const</span> <a class="code" href="class_qwt_symbol.html">QwtSymbol</a> &, <span class="keyword">const</span> QPen &,
00134 <span class="keyword">const</span> QString &, QWidget *parent = 0, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00135
00136 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setTitle(<span class="keyword">const</span> QString &);
00137 <span class="keyword">virtual</span> QString title() <span class="keyword">const</span>;
00138
00139 <span class="keyword">protected</span>:
00140 <span class="keyword">virtual</span> <a class="code" href="class_qwt_text.html">QwtText</a> *titleText() <span class="keyword">const</span>;
00141 <span class="keyword">virtual</span> <span class="keywordtype">void</span> drawContents(QPainter *);
00142 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_qwt_legend_item.html#b1">updateItem</a>();
00143
00144 <span class="keyword">private</span>:
00145 <span class="keywordtype">void</span> init();
00146 };
00147
<a name="l00158"></a><a class="code" href="class_qwt_legend.html">00158</a> <span class="keyword">class </span>QWT_EXPORT QwtLegend : <span class="keyword">public</span> QScrollView
00159 {
00160 Q_OBJECT
00161
00162 Q_PROPERTY( <span class="keywordtype">bool</span> readOnly READ isReadOnly WRITE setReadOnly )
00163
00164 <span class="keyword">public</span>:
00165
<a name="l00187"></a><a class="code" href="class_qwt_legend.html#w3">00187</a> <span class="keyword">enum</span> LegendDisplayPolicy
00188 {
00189 None = 0,
00190 Fixed = 1,
00191 Auto = 2
00192 };
00193
00194 QwtLegend(QWidget *parent = 0, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = 0);
00195
00196 <span class="keywordtype">void</span> setReadOnly(<span class="keywordtype">bool</span> readOnly);
00197 <span class="keywordtype">bool</span> isReadOnly() const;
00198
00199 <span class="keywordtype">void</span> setDisplayPolicy(LegendDisplayPolicy policy, <span class="keywordtype">int</span> mode = -1);
00200 LegendDisplayPolicy displayPolicy() const;
00201
00202 <span class="keywordtype">int</span> identifierMode() const;
00203
00204 QWidget *contentsWidget();
00205 const QWidget *contentsWidget() const;
00206
00207 <span class="keywordtype">void</span> insertItem(QWidget *, <span class="keywordtype">long</span> key);
00208 QWidget *findItem(<span class="keywordtype">long</span> key);
00209 const QWidget *findItem(<span class="keywordtype">long</span> key) const;
00210 QWidget *takeItem(<span class="keywordtype">long</span> key);
00211
00212 virtual QWidgetIntDictIt itemIterator() const;
00213
00214 <span class="keywordtype">long</span> key(const QWidget *) const;
00215
00216 <span class="keywordtype">void</span> clear();
00217
00218 <span class="keywordtype">bool</span> isEmpty() const;
00219 uint itemCount() const;
00220
00221 virtual <span class="keywordtype">bool</span> eventFilter(QObject *, QEvent *);
00222
00223 virtual QSize sizeHint() const;
00224 virtual <span class="keywordtype">int</span> heightForWidth(<span class="keywordtype">int</span> w) const;
00225
00226 protected:
00227 virtual <span class="keywordtype">void</span> viewportResizeEvent(QResizeEvent *);
00228 virtual <span class="keywordtype">void</span> layoutContents();
00229
00230 private:
00231 <span class="keywordtype">bool</span> d_readOnly;
00232 LegendDisplayPolicy d_displayPolicy;
00233 <span class="keywordtype">int</span> d_identifierMode;
00234 QWidgetIntDict d_items;
00235 QWidget *d_contentsWidget;
00236 };
00237
<a name="l00239"></a><a class="code" href="class_qwt_legend.html#a15">00239</a> inline <span class="keywordtype">bool</span> QwtLegend::isEmpty()<span class="keyword"> const </span>
00240 <span class="keyword"></span>{
00241 <span class="keywordflow">return</span> d_items.count() == 0;
00242 }
00243
<a name="l00245"></a><a class="code" href="class_qwt_legend.html#a16">00245</a> <span class="keyword">inline</span> uint <a class="code" href="class_qwt_legend.html#a16">QwtLegend::itemCount</a>()<span class="keyword"> const </span>
00246 <span class="keyword"></span>{
00247 <span class="keywordflow">return</span> d_items.count();
00248 }
00249
00250 <span class="preprocessor">#endif // QWT_LEGEND_H</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 16 21:12:20 2004 for Qwt User's Guide by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>
|