| 1 | #include <qwidget.h> |
| 2 | #include <qspinbox.h> |
| 3 | #include <qcombobox.h> |
| 4 | #include <qtabwidget.h> |
| 5 | #include <qslider.h> |
| 6 | #include <qpushbutton.h> |
| 7 | #include <qlabel.h> |
| 8 | #include <qlayout.h> |
| 9 | #include <qdialog.h> |
| 10 | #include <qradiobutton.h> |
| 11 | #include <qcheckbox.h> |
| 12 | #include <qmainwindow.h> |
| 13 | #include <qgroupbox.h> |
| 14 | #if QT_VERSION >= 0x40000 |
| 15 | #include <qmenu.h> |
| 16 | #define QPopupMenu QMenu |
| 17 | #else |
| 18 | #include <qpopupmenu.h> |
| 19 | #endif |
| 20 | |
| 21 | #include <Inventor/Qt/SoQt.h> |
| 22 | #include <Inventor/Qt/viewers/SoQtExaminerViewer.h> |
| 23 | |
| 24 | class DecSpinBox : public QSpinBox |
| 25 | { |
| 26 | Q_OBJECT |
| 27 | |
| 28 | public: |
| 29 | DecSpinBox(int minValue, int maxValue, int step, QWidget * parent, |
| 30 | const char *name); |
| 31 | #if QT_VERSION >= 0x40000 |
| 32 | QString textFromValue(int value) const; |
| 33 | int valueFromText(QString text) const; |
| 34 | #else |
| 35 | QString mapValueToText(int value); |
| 36 | int mapTextToValue(bool* ok); |
| 37 | #endif |
| 38 | }; |
| 39 | |
| 40 | class LineColorSpinBox : public DecSpinBox |
| 41 | { |
| 42 | Q_OBJECT |
| 43 | |
| 44 | public: |
| 45 | LineColorSpinBox(int minValue, int maxValue, int step, QWidget * parent, |
| 46 | const char *name, int id); |
| 47 | |
| 48 | public slots: |
| 49 | void valueChangedCB(int value); |
| 50 | |
| 51 | private: |
| 52 | int which; |
| 53 | }; |
| 54 | |
| 55 | class LinePatternComboBox : public QComboBox |
| 56 | { |
| 57 | Q_OBJECT |
| 58 | |
| 59 | public: |
| 60 | LinePatternComboBox(bool rw, QWidget * parent, const char *name, int id); |
| 61 | |
| 62 | public slots: |
| 63 | void valueChangedCB(int position); |
| 64 | |
| 65 | private: |
| 66 | int which; |
| 67 | }; |
| 68 | |
| 69 | typedef struct EditMenuItems |
| 70 | { |
| 71 | QPopupMenu *items; |
| 72 | int which; |
| 73 | } EditMenuItems; |
| 74 | |
| 75 | class PreferDialog : public QDialog |
| 76 | { |
| 77 | Q_OBJECT |
| 78 | |
| 79 | public: |
| 80 | PreferDialog(QWidget * parent, const char *name); |
| 81 | void update(); |
| 82 | |
| 83 | public slots: |
| 84 | void closePreferDialogAndGiveUpChange(); |
| 85 | void closePreferDialogAndUpdateScene(); |
| 86 | void savePreferAndUpdateScene(); |
| 87 | void applyPreferDialogChangeAndUpdateScene(); |
| 88 | void graphCoordinateSystemToggledCB(int which); |
| 89 | void graphTypeWidgetToggledCB(int which); |
| 90 | void graphStyleWidgetToggledCB(int which); |
| 91 | void graphCoordWidgetToggledCB(int which); |
| 92 | void defaultGraphWidgetToggledCB(int bit); |
| 93 | |
| 94 | private: |
| 95 | void createPreferNotebookPages(QTabWidget *notebook); |
| 96 | void createPreferActionFormControls(QWidget *parent); |
| 97 | void createPreferDefaultPages(QWidget *parent); |
| 98 | void createLineAttPages(QWidget *parent); |
| 99 | void createLineColorAndPatternPrefSheetGuts(QWidget *parent, QGridLayout *layout, const char *name, int id); |
| 100 | void createColorAndLinePrefSheetHeader(QWidget *parent, QGridLayout *form, int column); |
| 101 | void createLineAttrPrefSheetParts(QWidget *parent, QGridLayout *form, const char** name); |
| 102 | void createGraphCoordinateSystemFrameGuts(QGroupBox *frame); |
| 103 | void createGraphStyleFrameGuts(QGroupBox *frame); |
| 104 | void createGraphTypeFrameGuts(QGroupBox *frame); |
| 105 | void createOptionFrameGuts(QGroupBox *frame); |
| 106 | void createGraphCoordPartsFrameGuts(QGroupBox *frame); |
| 107 | QRadioButton **coordSysButton, **styleButton, **typeButton, |
| 108 | **coordButton; |
| 109 | QCheckBox **widgetButton; |
| 110 | }; |
| 111 | |
| 112 | class MainWindow : public QMainWindow |
| 113 | { |
| 114 | Q_OBJECT |
| 115 | |
| 116 | public: |
| 117 | MainWindow(); |
| 118 | void setListValue(); |
| 119 | |
| 120 | public slots: |
| 121 | void quit(); |
| 122 | void open(); |
| 123 | void save(); |
| 124 | void print(); |
| 125 | void editMenuRotating(); |
| 126 | void editMenuBary(); |
| 127 | void editMenuBig(); |
| 128 | void editMenuSmall(); |
| 129 | void typeMenuDisplay(); |
| 130 | void typeMenuBifurcation(); |
| 131 | void typeMenuSolution(); |
| 132 | void styleMenuDisplay(); |
| 133 | void styleMenuLine(); |
| 134 | void styleMenuTube(); |
| 135 | void styleMenuSurface(); |
| 136 | void styleMenuMesh(); |
| 137 | void styleMenuAll(); |
| 138 | void coordMenuNone(); |
| 139 | void coordMenuCenter(); |
| 140 | void coordMenuLA(); |
| 141 | void coordMenuLB(); |
| 142 | void coordMenuOrigin(); |
| 143 | void coordMenuScale(); |
| 144 | void coordMenuDisplay(); |
| 145 | void optMenuPeriod(); |
| 146 | void optMenuSat(); |
| 147 | void optMenuPlane(); |
| 148 | void optMenuSphere(); |
| 149 | void optMenuPrimaries(); |
| 150 | void optMenuLibration(); |
| 151 | void optMenuLabels(); |
| 152 | void optMenuNumbers(); |
| 153 | void optMenuBackground(); |
| 154 | void optMenuLegend(); |
| 155 | void optMenuNormalize(); |
| 156 | void optMenuDisplay(); |
| 157 | void centerMenuDisplay(); |
| 158 | void showAboutDialog(); |
| 159 | void showHelp(); |
| 160 | void createPreferDialog(); |
| 161 | void xListCallBack(const QString &); |
| 162 | void yListCallBack(const QString &); |
| 163 | void zListCallBack(const QString &); |
| 164 | void lblListCallBack(const QString &); |
| 165 | void colorMethodSelectionCB(const QString &); |
| 166 | void numPeriodAnimatedCB(const QString &); |
| 167 | void orbitSpeedCB(int position); |
| 168 | void satSpeedCB(int position); |
| 169 | void lineWidthCB(int position); |
| 170 | void dimensionToggledCB(); |
| 171 | void createBdBoxCB(); |
| 172 | |
| 173 | private: |
| 174 | void buildMenu(); |
| 175 | QPopupMenu *buildFileMenu(); |
| 176 | QPopupMenu *buildTypeMenu(); |
| 177 | QPopupMenu *buildHelpMenu(); |
| 178 | QPopupMenu *buildOptionMenu(); |
| 179 | QPopupMenu *buildStyleMenu(); |
| 180 | QPopupMenu *buildCoordMenu(); |
| 181 | QPopupMenu *buildCenterMenu(); |
| 182 | |
| 183 | void getFileName(int); |
| 184 | void editMenuPick(int which); |
| 185 | void typeMenuPick(int which); |
| 186 | void styleMenuPick(int which); |
| 187 | void coordMenuPick(int which); |
| 188 | void optMenuPick(int which); |
| 189 | unsigned optItem(unsigned i); |
| 190 | |
| 191 | QComboBox *xAxisList, *yAxisList, *zAxisList, *labelsList, |
| 192 | *colorMethodSeletionList; |
| 193 | QPushButton *dimButton; |
| 194 | PreferDialog *preferDialog; |
| 195 | |
| 196 | EditMenuItems *optMenuItems; |
| 197 | SoSeparator *sceneGraph; |
| 198 | #ifdef USE_EXAM_VIEWER |
| 199 | SoQtExaminerViewer *renderArea; |
| 200 | #else |
| 201 | SoQtRenderArea *renderArea; |
| 202 | #endif |
| 203 | }; |