Back to index

salome-paravis  6.5.0
MyViewOptions.cxx
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003    Program: ParaView
00004    Module:    $RCSfile: MyViewOptions.cxx,v $
00005 
00006    Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
00007    All rights reserved.
00008 
00009    ParaView is a free software; you can redistribute it and/or modify it
00010    under the terms of the ParaView license version 1.2. 
00011 
00012    See License_v1.2.txt for the full ParaView license.
00013    A copy of this license can be obtained by contacting
00014    Kitware Inc.
00015    28 Corporate Drive
00016    Clifton Park, NY 12065
00017    USA
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
00023 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00025 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 
00031 =========================================================================*/
00032 
00033 #include "MyViewOptions.h"
00034 
00035 #include <QHBoxLayout>
00036 #include "pqColorChooserButton.h"
00037 #include "MyView.h"
00038 
00039 //----------------------------------------------------------------------------
00040 MyViewOptions::MyViewOptions(QWidget *widgetParent)
00041   : pqOptionsContainer(widgetParent)
00042 {
00043   QHBoxLayout* l = new QHBoxLayout(this);
00044   this->ColorChooser = new pqColorChooserButton(this);
00045   l->addWidget(this->ColorChooser);
00046   QObject::connect(this->ColorChooser, SIGNAL(chosenColorChanged(QColor)), 
00047                    this, SIGNAL(changesAvailable()));
00048 }
00049 
00050 MyViewOptions::~MyViewOptions()
00051 {
00052 }
00053 
00054 void MyViewOptions::setPage(const QString&)
00055 {
00056 }
00057 
00058 QStringList MyViewOptions::getPageList()
00059 {
00060   QStringList ret;
00061   ret << "My View";
00062   return ret;
00063 }
00064   
00065 void MyViewOptions::setView(pqView* view)
00066 {
00067   this->View = qobject_cast<MyView*>(view);
00068   if(this->View)
00069     {
00070     this->ColorChooser->setChosenColor(this->View->background());
00071     this->ColorChooser->setEnabled(true);
00072     }
00073   else
00074     {
00075     this->ColorChooser->setEnabled(false);
00076     }
00077 }
00078 
00079 void MyViewOptions::applyChanges()
00080 {
00081   if(!this->View)
00082     {
00083     return;
00084     }
00085 
00086   this->View->setBackground(this->ColorChooser->chosenColor());
00087 }
00088 
00089 void MyViewOptions::resetChanges()
00090 {
00091 }
00092