Salome HOME
Merge from V6_main 13/12/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 #include "HEXABLOCKGUI_OccGraphicView.hxx"
26 #include "HEXABLOCKGUI.hxx"
27
28 #include <QDialog>
29
30 class SalomeApp_DoubleSpinBox;
31 class GeometryGUI;
32 class MyDlgRef_Skeleton;
33 class QSpinBox;
34 class QDoubleSpinBox;
35 class QLineEdit;
36 class QButtonGroup;
37 class QPushButton;
38
39 #ifndef COORD_MIN
40 #  define COORD_MIN -1e+15
41 #  define COORD_MAX +1e+15
42 #  define MAX_NUMBER 100000
43 #  define DBL_DIGITS_DISPLAY 16
44 #endif // COORD_MIN
45
46 class GEOMBASE_EXPORT MyGEOMBase_Skeleton : public QDialog, public MyGEOMBase_Helper
47 {
48   Q_OBJECT
49
50 public:
51     MyGEOMBase_Skeleton( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 );
52     ~MyGEOMBase_Skeleton();
53
54 private:
55     void Init();
56
57 protected:
58     void                initSpinBox( QSpinBox*, int, int, int = 1 );
59     void                initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, const char* = "length_precision" );
60
61     void                updateAttributes( GEOM::GEOM_Object_ptr, const QStringList& );
62
63     void                closeEvent( QCloseEvent* );
64     void                keyPressEvent( QKeyEvent* );
65
66     /*! initialize "Name" field with a string "thePrefix_X" (Vertex_3)
67      */
68     void                initName( const QString& = QString() );
69
70     /*! returns contents of "Name" field
71      */
72     virtual QString getNewObjectName() const;
73
74     /*! returns id of a selected "constructor" radio button or '-1' in case of error
75      */
76     int                 getConstructorId() const;
77     /*! set selected "constructor" radio button id
78      */
79     void                setConstructorId( const int );
80     /*! unset selection on all "constructor" radio buttons
81      */
82     void                unsetConstructorId();
83
84     void                showOnlyPreviewControl();
85
86     void                setHelpFileName( const QString& );
87
88     MyDlgRef_Skeleton*    mainFrame();
89     QWidget*            centralWidget();
90     QPushButton*        buttonCancel() const;
91     //QPushButton*        buttonOk() const;
92     QPushButton*        buttonApply() const;
93     QPushButton*        buttonHelp() const;
94
95 protected:
96     QLineEdit*          myEditCurrentArgument; //!< Current LineEdit
97     GeometryGUI*        myGeomGUI;             //!< reference GEOM GUI
98     QString             myHelpFileName;        //!< Associated HTML help file name
99
100     QButtonGroup*       myRBGroup;             //!< radio button group
101     MyDlgRef_Skeleton*    myMainFrame;           //!< dialog box's mainframe widgetx
102
103 public slots:
104   virtual void close();
105
106 protected slots:
107     virtual void        processPreview();
108     void                LineEditReturnPressed();
109     void                DeactivateActiveDialog();
110     void                ActivateThisDialog();
111     void                ClickOnHelp();
112
113 signals:
114     void                constructorsClicked( int );
115 };
116
117 #endif // MYGEOMBASE_SKELETON_H