VrGUI_int.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
#ifndef VRGUI_INT_H_
00038
#define VRGUI_INT_H_
00039
00040
#include <math.h>
00041
#include <qglobal.h>
00042
#include <qwidget.h>
00043
#include <qframe.h>
00044
#include <qpainter.h>
00045
#include <qpixmap.h>
00046
#include <qstring.h>
00047
#include <qpushbutton.h>
00048
#include <qdatetime.h>
00049
#include <qrect.h>
00050
#include <qlabel.h>
00051
00052
00053
00054 #define LOGO_FILE "/dev/null"
00055
00056 #define qwtMax(x,y) ( (x) > (y) ? (x) : (y) )
00057 #define qwtMin(x,y) ( (x) < (y) ? (x) : (y) )
00058 #define qwtAbs(x) ( (x) > 0 ? (x) : -(x) )
00059
00060
00061
class VrCounter;
00062
class VrGUILayout;
00063
00064
00065 class VrGUICallback :
public QObject {
00066 Q_OBJECT
00067
public:
00068
VrGUICallback(
void (*arg_callback)(
double),
float arg_min,
float arg_max);
00069
VrGUICallback(
void (*arg_callback)());
00070
private:
00071 float local_min;
00072 float local_max;
00073 void (*callback)(
double);
00074 void (*callback_void)();
00075
private slots:
00076
void callback_slot(
double f);
00077
void callback_void_slot();
00078 };
00079
00080 class VrLogoFrame :
public QFrame {
00081 Q_OBJECT
00082
public:
00083
VrLogoFrame (
VrGUILayout *layout);
00084 signals:
00085
void pixmapResized();
00086
void plotMousePressed(
const QMouseEvent &e);
00087
void plotMouseReleased(
const QMouseEvent &e);
00088
void plotMouseMoved(
const QMouseEvent &e);
00089
protected:
00090
void paintEvent(QPaintEvent *e);
00091
private:
00092 QPixmap
pmap;
00093 };
00094
00095
class VrScale;
00096 class VrScaleDraw {
00097
public:
00098
VrScaleDraw();
00099 enum Orientation {
Bottom,
Top,
Left,
Right,
Round };
00100 Orientation d_orient;
00101 double d_lBound;
double d_hBound;
double d_majStep;
00102 QArray<double>
d_minMarks,
d_majMarks;
00103 int d_maxMajor;
00104 int d_maxMinor;
00105 int d_y1,
d_y2;
00106 double d_cnv;
00107
void setGeometry(
int xorigin,
int yorigin,
int length, Orientation o);
00108
int maxWidth(
const VrScale *arg_widget)
const;
00109
int zzmaxHeight(
const QWidget *arg_widget)
const;
00110
int maxLabelWidth(QPainter *p)
const;
00111
void scaledraw(QPainter *p)
const;
00112
void rebuild(
double step);
00113 int d_prec;
00114 char d_fmt;
00115
private:
00116
static const int minLen;
00117 int d_xorg,
d_yorg,
d_len,
d_pad;
00118 int d_medLen,
d_majLen,
d_minLen;
00119
void drawTick(QPainter *p,
int val,
int len)
const;
00120 };
00121
00122 class VrScale :
public QWidget {
00123
public:
00124
VrScale( VrScaleDraw::Orientation ori, QWidget *parent,
00125
const char *title_name,
double arg_min,
double arg_max,
double arg_scalemin,
00126
double arg_scalemax,
int arg_divisions);
00127
~VrScale();
00128
int minBorderDist()
const;
00129 QSize
sizeHint()
const;
00130 VrScaleDraw d_scale;
00131 int zyd_y1;
00132 double zyd_cnv;
00133 int d_borderDist;
00134 QString
d_title;
00135
protected:
00136
void paintEvent(QPaintEvent *e);
00137
void resizeEvent(QResizeEvent *e);
00138
private:
00139 int d_baseDist,
d_titleDist,
d_titleOffset;
00140
void setRange(
double x1,
double x2);
00141 };
00142
00143 class VrPlotPixFrame :
public QFrame {
00144 Q_OBJECT
00145
public:
00146
VrPlotPixFrame (QWidget *parent);
00147 QPixmap
d_pix;
00148 signals:
00149
void pixmapResized();
00150
void plotMousePressed(
const QMouseEvent &e);
00151
void plotMouseReleased(
const QMouseEvent &e);
00152
void plotMouseMoved(
const QMouseEvent &e);
00153
protected:
00154
virtual void resizeEvent(QResizeEvent *e);
00155
virtual void paintEvent(QPaintEvent *e);
00156 };
00157
00158 class VrPlot:
public QFrame {
00159 Q_OBJECT
00160
public:
00161
VrPlot::VrPlot(QWidget *p,
int nPoints,
int divisions,
const char *xaxis_name,
00162
const char *yaxis_name,
bool lines,
00163
double xmin,
double xmax,
double ymin,
double ymax);
00164
virtual ~VrPlot();
00165
void plotPressed(QMouseEvent *e);
00166
void plotReleased(QMouseEvent *e);
00167
void plotMoved(QMouseEvent *e);
00168
void data(
double *x,
double *y,
int size);
00169
void clear();
00170
void set_persistent(
bool arg_persistent);
00171
private:
00172 VrPlotPixFrame *
d_frmPlot;
00173 VrScale *
yyd_bottom, *
yyd_left;
00174 int d_lines;
00175 bool persistent;
00176
protected:
00177
void redrawPixmap();
00178
void updateAxes(
VrScale *arg_scale,
int arg_dist, QRect *arg_rect,
int arg_offset);
00179
void resizeEvent(QResizeEvent *e);
00180 };
00181
00182 class VrArrowButton :
public QPushButton {
00183 Q_OBJECT
00184
public:
00185
VrArrowButton(
VrCounter *parent,
int num,
int dir,
int arg_height,
int arg_width);
00186
private:
00187 int d_num,
d_dir,
d_increment;
00188 VrCounter *
d_parent;
00189
protected:
00190
void drawButtonLabel(QPainter *p);
00191
private slots:
00192
void button_pressed();
00193
void button_released();
00194 };
00195
00196 class VrCounter :
public QWidget {
00197 Q_OBJECT
00198
public:
00199
VrCounter(QWidget *parent,
double vmin,
double vmax,
double vstep,
double arg_default);
00200
~VrCounter();
00201
void update_value();
00202 double d_minValue,
d_maxValue,
d_prevValue;
00203
void setNewValue(
double x,
int align = 0);
00204 double d_value,
d_step;
00205 int tmrID,
d_tmrIntv,
d_tick,
d_nButtons,
d_incValue,
d_Inc[3];
00206
private:
00207 QLabel *
lblValue;
00208
void valueChange();
00209
protected:
00210
void resizeEvent(QResizeEvent *e);
00211
void timerEvent(QTimerEvent *e);
00212 signals:
00213
void valueChanged(
double);
00214
void buttonReleased(
double);
00215 };
00216
00217 class VrSlider:
public QWidget{
00218 Q_OBJECT
00219
public:
00220
enum {
ScrNone,
ScrMouse,
ScrPage };
00221 enum Orientation{
Vertical,
Horizontal};
00222 enum ScalePos {
None,
Left,
Right,
Top,
Bottom };
00223 Orientation d_orient;
00224 QRect
d_sliderRect;
00225 int d_thumbLength,
d_thumbHalf,
d_thumbWidth,
d_borderWidth,
d_bwTrough;
00226 int markerPos,
d_pageSize,
d_tracking;
00227 double d_value,
d_step,
d_prevValue;
00228
VrSlider(QWidget *parent, Orientation orient, ScalePos scalePos,
00229
double vmin,
double vmax,
double arg_val,
double arg_step = 1.0);
00230
~VrSlider();
00231
void stopMoving();
00232
void setNewValue(
double x,
int align = 0);
00233
protected:
00234 VrScaleDraw yyd_scale;
00235 int d_scrollMode,
d_direction;
00236 double d_mouseOffset;
00237
void timerEvent(QTimerEvent *e);
00238
void mousePressEvent(QMouseEvent *e);
00239
void mouseReleaseEvent(QMouseEvent *e);
00240
void mouseMoveEvent(QMouseEvent *e);
00241
virtual void drawSlider (QPainter *p,
const QRect &r);
00242
double getValue(
const QPoint &p);
00243
void paintEvent (QPaintEvent *e);
00244
void valueChange();
00245 void resizeEvent(QResizeEvent *e) { }
00246
void scaleChange();
00247
private:
00248 int d_tmrID,
d_updTime,
d_timerTick;
00249 QTime
d_time;
00250
void buttonReleased();
00251
public slots:
00252
void setValue(
double val);
00253 signals:
00254
void valueChanged(
double value);
00255
void sliderPressed();
00256
void sliderReleased();
00257
void sliderMoved(
double value);
00258 };
00259
00260
#endif
Generated on Wed Aug 4 02:22:05 2004 for GNU Radio by
1.3.8