Salome HOME
Merge from V6_main (04/10/2012)
[modules/hexablock.git] / src / HEXABLOCKGUI / MyGEOMBase_Skeleton.hxx
1 // Copyright (C) 2009-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef MYGEOMBASE_SKELETON_H
21 #define MYGEOMBASE_SKELETON_H
22
23 #include "GEOM_GEOMBase.hxx"
24 #include "MyGEOMBase_Helper.hxx"
25
26 #include <QDialog>
27
28 class SalomeApp_DoubleSpinBox;
29 class GeometryGUI;
30 class MyDlgRef_Skeleton;
31 class QSpinBox;
32 class QDoubleSpinBox;
33 class QLineEdit;
34 class QButtonGroup;
35 class QPushButton;
36
37 #ifndef COORD_MIN
38 #  define COORD_MIN -1e+15
39 #  define COORD_MAX +1e+15
40 #  define MAX_NUMBER 100000
41 #  define DBL_DIGITS_DISPLAY 16
42 #endif // COORD_MIN
43
44 class GEOMBASE_EXPORT MyGEOMBase_Skeleton : public QDialog, public MyGEOMBase_Helper
45 {
46   Q_OBJECT
47
48 public:
49     MyGEOMBase_Skeleton( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 );
50     ~MyGEOMBase_Skeleton();
51
52 private:
53     void Init();
54
55 protected:
56     void                initSpinBox( QSpinBox*, int, int, int = 1 );
57     void                initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, const char* = "length_precision" );
58
59     void                updateAttributes( GEOM::GEOM_Object_ptr, const QStringList& );
60
61     void                closeEvent( QCloseEvent* );
62     void                keyPressEvent( QKeyEvent* );
63
64     /*! initialize "Name" field with a string "thePrefix_X" (Vertex_3)
65      */
66     void                initName( const QString& = QString() );
67
68     /*! returns contents of "Name" field
69      */
70     virtual QString getNewObjectName() const;
71
72     /*! returns id of a selected "constructor" radio button or '-1' in case of error
73      */
74     int                 getConstructorId() const;
75     /*! set selected "constructor" radio button id
76      */
77     void                setConstructorId( const int );
78     /*! unset selection on all "constructor" radio buttons
79      */
80     void                unsetConstructorId();
81
82     void                showOnlyPreviewControl();
83
84     void                setHelpFileName( const QString& );
85
86     MyDlgRef_Skeleton*    mainFrame();
87     QWidget*            centralWidget();
88     QPushButton*        buttonCancel() const;
89     //QPushButton*        buttonOk() const;
90     QPushButton*        buttonApply() const;
91     QPushButton*        buttonHelp() const;
92
93 protected:
94     QLineEdit*          myEditCurrentArgument; //!< Current LineEdit
95     GeometryGUI*        myGeomGUI;             //!< reference GEOM GUI
96     QString             myHelpFileName;        //!< Associated HTML help file name
97
98     QButtonGroup*       myRBGroup;             //!< radio button group
99     MyDlgRef_Skeleton*    myMainFrame;           //!< dialog box's mainframe widgetx
100
101 public slots:
102   virtual void close();
103
104 protected slots:
105     virtual void        processPreview();
106     void                LineEditReturnPressed();
107     void                DeactivateActiveDialog();
108     void                ActivateThisDialog();
109     void                ClickOnHelp();
110
111 signals:
112     void                constructorsClicked( int );
113 };
114
115 #endif // MYGEOMBASE_SKELETON_H