//
// See http://www.salome-platform.org/
//
-// File : LightApp_ModuleDlg.cxx\r
-// Author : Michael Zorin (mzn)\r
-// Module : LightApp\r
-\r
-#include <LightApp_ModuleDlg.h>\r
-\r
-#include <qframe.h>\r
-#include <qlabel.h>\r
-#include <qpushbutton.h>\r
-#include <qlayout.h>\r
-#include <qpixmap.h>\r
-\r
-#ifndef WIN32\r
-using namespace std;\r
-#endif\r
-\r
-/*!Default icon*/\r
-static const char* const default_icon[] = { \r
-"48 48 17 1",\r
-". c None",\r
-"# c #161e4c",\r
-"b c #1d3638",\r
-"e c #2f585b",\r
-"i c #345b5e",\r
-"c c #386266",\r
-"g c #3f7477",\r
-"d c #4d8589",\r
-"m c #519099",\r
-"o c #6abbc1",\r
-"a c #70c9d3",\r
-"f c #79ddea",\r
-"n c #7adff2",\r
-"k c #7ce2f4",\r
-"j c #993550",\r
-"h c #d84b71",\r
-"l c #ef537d",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................########.########.########......",\r
-"...............#aaaaaa###aaaaaa###aaaaaa##......",\r
-"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......",\r
-".............########b########b########cc#......",\r
-".............#dddddd#b#dddddd#b#dddddd#cc#......",\r
-"...........########d########d########d#cc#......",\r
-"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......",\r
-".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......",\r
-"........########b########e########cc#d#c#.......",\r
-"........#dddddd#b#dddddd#e#ffffff#cc#d####......",\r
-"......########d########d########f#cc###g##......",\r
-".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......",\r
-"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......",\r
-"...########b########i########jj#f#c#gg#cc#......",\r
-"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......",\r
-"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......",\r
-"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......",\r
-"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......",\r
-"...#kkkkkk###kkkkkk###llllll####d#cc###g##......",\r
-"...########g########g########o##d#cc#gg#c#......",\r
-"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......",\r
-"...########b########b########cc#d#c#gg#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........",\r
-"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........",\r
-"...########g########g########g##g#cc#...........",\r
-"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........",\r
-"...########b########b########cc#g#c#............",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",\r
-"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................",\r
-"...#kkkkkk###kkkkkk###kkkkkk##..................",\r
-"...########.########.########...................",\r
-"................................................",\r
-"................................................",\r
-"................................................",\r
-"................................................"};\r
-\r
-//==============================================================================================================================\r
-/*!\r
- * LightApp_ModuleDlg::LightApp_ModuleDlg \n\r
- *\r
- * Constructor.\r
- */\r
-//==============================================================================================================================\r
-LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon )\r
- : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
- QPixmap defaultIcon( ( const char** ) default_icon );\r
- setCaption( tr( "CAPTION" ) );\r
- setSizeGripEnabled( TRUE );\r
- \r
- QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); \r
- ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );\r
-\r
- // Module's name and icon\r
- myComponentFrame = new QFrame( this, "myComponentFrame" );\r
- myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );\r
- myComponentFrame->setMinimumHeight( 100 );\r
- myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
- \r
- QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); \r
- myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );\r
-\r
- // --> icon\r
- myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" );\r
- myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );\r
- myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );\r
- myComponentIcon->setScaledContents( false );\r
- myComponentIcon->setAlignment( AlignCenter );\r
- // --> name\r
- myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" );\r
- QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); \r
- myComponentLab->setAlignment( AlignCenter );\r
-\r
- myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );\r
- myComponentFrameLayout->addWidget( myComponentLab, 0, 1 );\r
-\r
- // Info\r
- QVBoxLayout* infoLayout = new QVBoxLayout();\r
- infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );\r
- \r
- // --> top line\r
- QFrame* myLine1 = new QFrame( this, "myLine1" );\r
- myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );\r
- // --> info label \r
- myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" );\r
- myInfoLabel->setAlignment( AlignCenter );\r
- // --> bottom line\r
- QFrame* myLine2 = new QFrame( this, "myLine2" );\r
- myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );\r
- \r
- infoLayout->addStretch();\r
- infoLayout->addWidget( myLine1 );\r
- infoLayout->addWidget( myInfoLabel );\r
- infoLayout->addWidget( myLine2 );\r
- infoLayout->addStretch();\r
- \r
- // Buttons\r
- QHBoxLayout* btnLayout = new QHBoxLayout(); \r
- btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );\r
- \r
- // --> New\r
- myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" );\r
- myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );\r
- // --> Open\r
- myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" );\r
- myOpenBtn->setAutoDefault( true );\r
- // --> Load\r
- myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" );\r
- myLoadBtn->setAutoDefault( true );\r
- // --> Cancel\r
- myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" );\r
- myCancelBtn->setAutoDefault( true );\r
- \r
- btnLayout->addWidget( myNewBtn );\r
- btnLayout->addWidget( myOpenBtn );\r
- btnLayout->addWidget( myLoadBtn );\r
- btnLayout->addStretch();\r
- btnLayout->addSpacing( 70 );\r
- btnLayout->addStretch();\r
- btnLayout->addWidget( myCancelBtn );\r
-\r
- ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 );\r
- ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 );\r
- ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 );\r
-\r
- // signals and slots connections\r
- connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );\r
- connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );\r
- connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );\r
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );\r
-}\r
-\r
-//==============================================================================================================================\r
-/*!\r
- * LightApp_ModuleDlg::onButtonClicked\r
- *\r
- * Buttons slot\r
- */\r
-//==============================================================================================================================\r
-void LightApp_ModuleDlg::onButtonClicked()\r
-{\r
- QPushButton* btn = ( QPushButton* )sender();\r
- if ( btn == myNewBtn )\r
- done( 1 );\r
- if ( btn == myOpenBtn )\r
- done( 2 );\r
- if ( btn == myLoadBtn )\r
- done( 3 );\r
-}\r
+// File : LightApp_ModuleDlg.cxx
+// Author : Michael Zorin (mzn)
+// Module : LightApp
+
+#include <LightApp_ModuleDlg.h>
+
+#include <qframe.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+
+#ifndef WIN32
+using namespace std;
+#endif
+
+/*!Default icon*/
+static const char* const default_icon[] = {
+"48 48 17 1",
+". c None",
+"# c #161e4c",
+"b c #1d3638",
+"e c #2f585b",
+"i c #345b5e",
+"c c #386266",
+"g c #3f7477",
+"d c #4d8589",
+"m c #519099",
+"o c #6abbc1",
+"a c #70c9d3",
+"f c #79ddea",
+"n c #7adff2",
+"k c #7ce2f4",
+"j c #993550",
+"h c #d84b71",
+"l c #ef537d",
+"................................................",
+"................................................",
+"................................................",
+"................................................",
+"................................................",
+"................########.########.########......",
+"...............#aaaaaa###aaaaaa###aaaaaa##......",
+"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......",
+".............########b########b########cc#......",
+".............#dddddd#b#dddddd#b#dddddd#cc#......",
+"...........########d########d########d#cc#......",
+"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......",
+".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......",
+"........########b########e########cc#d#c#.......",
+"........#dddddd#b#dddddd#e#ffffff#cc#d####......",
+"......########d########d########f#cc###g##......",
+".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......",
+"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......",
+"...########b########i########jj#f#c#gg#cc#......",
+"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......",
+"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......",
+"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......",
+"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......",
+"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......",
+"...#kkkkkk###kkkkkk###llllll####d#cc###g##......",
+"...########g########g########o##d#cc#gg#c#......",
+"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......",
+"...########b########b########cc#d#c#gg#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........",
+"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........",
+"...########g########g########g##g#cc#...........",
+"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........",
+"...########b########b########cc#g#c#............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................",
+"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................",
+"...#kkkkkk###kkkkkk###kkkkkk##..................",
+"...########.########.########...................",
+"................................................",
+"................................................",
+"................................................",
+"................................................"};
+
+//==============================================================================================================================
+/*!
+ * LightApp_ModuleDlg::LightApp_ModuleDlg \n
+ *
+ * Constructor.
+ */
+//==============================================================================================================================
+LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon )
+ : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ QPixmap defaultIcon( ( const char** ) default_icon );
+ setCaption( tr( "CAPTION" ) );
+ setSizeGripEnabled( TRUE );
+
+ QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this );
+ ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );
+
+ // Module's name and icon
+ myComponentFrame = new QFrame( this, "myComponentFrame" );
+ myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );
+ myComponentFrame->setMinimumHeight( 100 );
+ myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
+
+ QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame );
+ myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );
+
+ // --> icon
+ myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" );
+ myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+ myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );
+ myComponentIcon->setScaledContents( false );
+ myComponentIcon->setAlignment( AlignCenter );
+ // --> name
+ myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" );
+ QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt );
+ myComponentLab->setAlignment( AlignCenter );
+
+ myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );
+ myComponentFrameLayout->addWidget( myComponentLab, 0, 1 );
+
+ // Info
+ QVBoxLayout* infoLayout = new QVBoxLayout();
+ infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );
+
+ // --> top line
+ QFrame* myLine1 = new QFrame( this, "myLine1" );
+ myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );
+ // --> info label
+ myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" );
+ myInfoLabel->setAlignment( AlignCenter );
+ // --> bottom line
+ QFrame* myLine2 = new QFrame( this, "myLine2" );
+ myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );
+
+ infoLayout->addStretch();
+ infoLayout->addWidget( myLine1 );
+ infoLayout->addWidget( myInfoLabel );
+ infoLayout->addWidget( myLine2 );
+ infoLayout->addStretch();
+
+ // Buttons
+ QHBoxLayout* btnLayout = new QHBoxLayout();
+ btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
+
+ // --> New
+ myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" );
+ myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );
+ // --> Open
+ myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" );
+ myOpenBtn->setAutoDefault( true );
+ // --> Load
+ myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" );
+ myLoadBtn->setAutoDefault( true );
+ // --> Cancel
+ myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" );
+ myCancelBtn->setAutoDefault( true );
+
+ btnLayout->addWidget( myNewBtn );
+ btnLayout->addWidget( myOpenBtn );
+ btnLayout->addWidget( myLoadBtn );
+ btnLayout->addStretch();
+ btnLayout->addSpacing( 70 );
+ btnLayout->addStretch();
+ btnLayout->addWidget( myCancelBtn );
+
+ ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 );
+ ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 );
+ ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 );
+
+ // signals and slots connections
+ connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+ connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+ connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+//==============================================================================================================================
+/*!
+ * LightApp_ModuleDlg::onButtonClicked
+ *
+ * Buttons slot
+ */
+//==============================================================================================================================
+void LightApp_ModuleDlg::onButtonClicked()
+{
+ QPushButton* btn = ( QPushButton* )sender();
+ if ( btn == myNewBtn )
+ done( 1 );
+ if ( btn == myOpenBtn )
+ done( 2 );
+ if ( btn == myLoadBtn )
+ done( 3 );
+}