QPPanel.qo.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 #ifndef QPPANEL_H_
00028 #define QPPANEL_H_
00029
00030 #ifdef AIPS_HAS_QWT
00031
00032 #include <graphics/GenericPlotter/PlotPanel.h>
00033
00034 #include <QCheckBox>
00035 #include <QFrame>
00036 #include <QPushButton>
00037
00038 #include <vector>
00039
00040 namespace casa {
00041
00042
00043 class QPButton : public QObject, public PlotButton {
00044 Q_OBJECT
00045
00046 public:
00047
00048
00049 QPButton(const String& text, bool toggleable = false);
00050
00051
00052 ~QPButton();
00053
00054
00055
00056
00057
00058 bool isEnabled() const;
00059
00060
00061 void setEnabled(bool enabled = true);
00062
00063
00064 bool isVisible() const;
00065
00066
00067 void setVisible(bool visible = true);
00068
00069
00070 String tooltip() const;
00071
00072
00073 void setTooltip(const String& text);
00074
00075
00076
00077
00078
00079 bool textShown() const;
00080
00081
00082 void showText(bool show = true);
00083
00084
00085 String text() const;
00086
00087
00088 void setText(const String& text);
00089
00090
00091 bool imageShown() const;
00092
00093
00094 void showImage(bool show = true);
00095
00096
00097 void setImagePath(const String& imgPath);
00098
00099
00100 bool isToggleable() const;
00101
00102
00103 void setToggleable(bool toggleable = true);
00104
00105
00106 bool isToggled() const;
00107
00108
00109 void setToggled(bool toggled = true);
00110
00111
00112 void registerHandler(PlotButtonEventHandlerPtr handler);
00113
00114
00115 std::vector<PlotButtonEventHandlerPtr> allHandlers() const;
00116
00117
00118 void unregisterHandler(PlotButtonEventHandlerPtr handler);
00119
00120
00121
00122
00123
00124
00125 QPushButton* asQPushButton();
00126 const QPushButton* asQPushButton() const;
00127
00128
00129 private:
00130 QPushButton* m_button;
00131 String m_text;
00132 String m_imageLoc;
00133
00134 std::vector<PlotButtonEventHandlerPtr> m_handlers;
00135
00136 private slots:
00137
00138 void buttonPushed();
00139
00140
00141 void buttonDeleted();
00142 };
00143
00144
00145
00146 class QPCheckbox : public QObject, public PlotCheckbox {
00147 Q_OBJECT
00148
00149 public:
00150
00151 QPCheckbox(const String& text);
00152
00153
00154 ~QPCheckbox();
00155
00156
00157
00158
00159
00160 bool isEnabled() const;
00161
00162
00163 void setEnabled(bool enabled = true);
00164
00165
00166 bool isVisible() const;
00167
00168
00169 void setVisible(bool visible = true);
00170
00171
00172 String tooltip() const;
00173
00174
00175 void setTooltip(const String& text);
00176
00177
00178
00179
00180
00181 String text() const;
00182
00183
00184 void setText(const String& text);
00185
00186
00187 bool isChecked() const;
00188
00189
00190 void setChecked(bool checked = true);
00191
00192
00193 void registerHandler(PlotCheckboxEventHandlerPtr handler);
00194
00195
00196 std::vector<PlotCheckboxEventHandlerPtr> allHandlers() const;
00197
00198
00199 void unregisterHandler(PlotCheckboxEventHandlerPtr handler);
00200
00201
00202
00203
00204
00205
00206 QCheckBox* asQCheckBox();
00207 const QCheckBox* asQCheckBox() const;
00208
00209
00210 private:
00211 QCheckBox* m_checkbox;
00212 std::vector<PlotCheckboxEventHandlerPtr> m_handlers;
00213
00214 private slots:
00215
00216 void checkboxToggled();
00217
00218
00219 void checkboxDeleted();
00220 };
00221
00222
00223
00224 class QPPanel : public QObject, public PlotPanel {
00225 Q_OBJECT
00226
00227 public:
00228
00229 QPPanel();
00230
00231
00232 ~QPPanel();
00233
00234
00235
00236
00237
00238 std::vector<PlotWidgetPtr> widgets() const;
00239
00240
00241 int addWidget(PlotWidgetPtr widget);
00242
00243
00244 void clearWidgets();
00245
00246
00247
00248 void removeWidget(PlotWidgetPtr widget);
00249 void removeWidget(int index);
00250
00251
00252
00253
00254
00255
00256
00257 QFrame* asQFrame();
00258 const QFrame* asQFrame() const;
00259
00260
00261 private:
00262 QFrame* m_frame;
00263 std::vector<PlotWidgetPtr> m_widgets;
00264
00265 private slots:
00266
00267 void frameDeleted();
00268 };
00269
00270 }
00271
00272 #endif
00273
00274 #endif