/*========================================================================= Program: bbtk Module: $RCSfile: bbkwSlider.cxx,v $ Language: C++ Date: $Date: 2008/12/02 13:37:56 $ Version: $Revision: 1.2 $ =========================================================================*/ /* --------------------------------------------------------------------- * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux * * This software is governed by the CeCILL-B license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL-B * license as circulated by CEA, CNRS and INRIA at the following URL * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html * or in the file LICENSE.txt. * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited * liability. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-B license and that you accept its terms. * ------------------------------------------------------------------------ */ /** * \file * \brief Short description in one line * * Long * description * */ #ifdef USE_KWWIDGETS #include "bbkwSlider.h" #include "bbkwPackage.h" #include "bbtkUtilities.h" #include "vtkKWScale.h" #include "vtkObjectFactory.h" #include "vtkCommand.h" namespace bbkw { /* //-------------------------------------------------------------------------- class Callback : public vtkCommand { public: static Callback *New() { return new Callback; } virtual void Execute(vtkObject* caller, unsigned long, void*) { // std::cout << "$$$$$$$$$$$$ Slider CB $$$$$$$$$$$$"<bbSetOutputOut( scale->GetValue() ); mBox->bbSetInputIn( scale->GetValue() ); // and signal that the output has changed mBox->bbSignalOutputModification("Out"); } Slider* mBox; }; //-------------------------------------------------------------------------- */ //-------------------------------------------------------------------------- //------------------------------------------------------------------------- // KwBlackBox implementation //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- BBTK_BLACK_BOX_IMPLEMENTATION(Slider,bbtk::KWBlackBox); BBTK_ADD_BLACK_BOX_TO_PACKAGE(kw,Slider); //-------------------------------------------------------------------------- void Slider::bbUserConstructor() { bbSetInputIn(0); bbSetInputMin(0); bbSetInputMax(500); bbSetOutputOut(0); bbSetOutputWidget(0); bbSetInputOrientation("HORIZONTAL"); bbSetInputChangeResolution(false); bbSetInputLabel(true); bbSetInputTitle(""); bbSetInputReactiveOnTrack(0); } //-------------------------------------------------------------------------- void Slider::Process() { bbSetOutputOut( bbGetInputIn() ); } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- void Slider::CreateWidget(vtkKWFrame* parent) { vtkKWScale* s = vtkKWScale::New(); bbSetOutputWidget(s); s->AddObserver(vtkKWScale::ScaleValueChangingEvent,this); s->SetParent((vtkKWWidget*)parent); s->Create(); s->SetRange(bbGetInputMin(),bbGetInputMax()); // s->SetResolution(1.0); // s->SetLength(150); s->SetLabelText(bbGetInputTitle().c_str()); if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true) { s->SetOrientationToHorizontal(); } else if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true) { s->SetOrientationToVertical(); } else { bbtkWarning("Unrecognized value for input 'Orientation' of "<GetValue() ); bbSetInputIn( scale->GetValue() ); // and signal that the output has changed bbSignalOutputModification("Out"); } //-------------------------------------------------------------------------- } //namespace bbkw #endif // USE_KWWIDGETS