vtkScriptedModuleGUI.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $RCSfile: vtkGradientAnisotropicDiffusionFilterGUI.h,v $
00010   Date:      $Date: 2006/03/19 17:12:29 $
00011   Version:   $Revision: 1.3 $
00012 
00013 =========================================================================auto=*/
00014 #ifndef __vtkScriptedModuleGUI_h
00015 #define __vtkScriptedModuleGUI_h
00016 
00017 #include "vtkSlicerBaseGUIWin32Header.h"
00018 #include "vtkSlicerModuleGUI.h"
00019 
00020 #include "vtkMRMLScene.h"
00021 #include "vtkScriptedModuleLogic.h"
00022 
00023 
00024 class VTK_SCRIPTED_EXPORT vtkScriptedModuleGUI : public vtkSlicerModuleGUI
00025 {
00026 public:
00027   static vtkScriptedModuleGUI *New();
00028   vtkTypeMacro(vtkScriptedModuleGUI,vtkSlicerModuleGUI);
00029   void PrintSelf(ostream& os, vtkIndent indent);
00030 
00031    // Description: Get/Set MRML node
00032   vtkGetObjectMacro (Logic, vtkScriptedModuleLogic);
00033   vtkSetObjectMacro (Logic, vtkScriptedModuleLogic);
00034   
00035   // Description: Get/Set MRML node
00036   vtkGetObjectMacro (ScriptedModuleNode, vtkMRMLScriptedModuleNode);
00037   vtkSetObjectMacro (ScriptedModuleNode, vtkMRMLScriptedModuleNode);
00038   void SetAndObserveScriptedModuleNode (vtkMRMLScriptedModuleNode *n)
00039     {
00040     vtkSetAndObserveMRMLNodeMacro( this->ScriptedModuleNode, n);
00041     }
00042 
00043   // Description:
00044   // Create widgets
00045   virtual void BuildGUI ( void );
00046   virtual void BuildGUI ( vtkKWFrame * f ) { this->Superclass::BuildGUI(f); }
00047   virtual void BuildGUI ( vtkKWFrame * f, double * bgColor ) { this->Superclass::BuildGUI(f,bgColor); }
00048 
00049   // Description:
00050   // Delete Widgets
00051   virtual void TearDownGUI ( );
00052 
00053   // Description:
00054   // Add obsereves to GUI widgets
00055   virtual void AddGUIObservers ( );
00056   
00057   // Description:
00058   // Remove obsereves to GUI widgets
00059   virtual void RemoveGUIObservers ( );
00060 
00061   // Description:
00062   // Remove obsereves to MRML node
00063   virtual void RemoveMRMLNodeObservers ( );
00064 
00065   // Description:
00066   // Remove obsereves to Logic
00067   virtual void RemoveLogicObservers ( );
00068   
00069   // Description:
00070   // Pprocess events generated by Logic
00071   virtual void ProcessLogicEvents ( vtkObject * vtkNotUsed(caller), 
00072       unsigned long vtkNotUsed(event), void * vtkNotUsed(callData) ){};
00073 
00074   // Description:
00075   // Pprocess events generated by GUI widgets
00076   virtual void ProcessGUIEvents ( vtkObject *caller, unsigned long event,
00077                                   void *callData );
00078 
00079   // Description:
00080   // Pprocess events generated by MRML
00081   virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, 
00082                                   void *callData);
00083   // Description:
00084   // Calls the passed method of the parentClass
00085   virtual void Invoke (char* method);
00086 
00087   // Description:
00088   // Describe behavior at module startup and exit.
00089   virtual void Enter ( void );
00090   virtual void Enter ( vtkMRMLNode* node ) { this->Superclass::Enter(node); }
00091   virtual void Exit ( );
00092 
00093   // Description: set an observer by number (work around
00094   // limitation in kwwidgets tcl wrapping)
00095   unsigned long AddObserverByNumber (vtkObject *observee, unsigned long event);
00096   unsigned long AddMRMLObserverByNumber (vtkObject *observee, unsigned long event);
00097   void RemoveObserverByNumber (vtkObject *observee, unsigned long event);
00098   void RemoveMRMLObserverByNumber (vtkObject *observee, unsigned long event);
00099   unsigned long GetNumberForVTKEvent( const char *eventName );
00100 
00101   vtkGetMacro(Language,int);
00102   vtkSetMacro(Language,int);
00103   void SetLanguageToTcl() { this->SetLanguage(Tcl); }
00104   void SetLanguageToPython() { this->SetLanguage(Python); }
00105 //BTX
00106   enum {
00107     Tcl = 0,
00108     Python
00109   };
00110 //ETX
00111 
00112 
00113 protected:
00114   
00115 private:
00116   vtkScriptedModuleGUI();
00117   ~vtkScriptedModuleGUI();
00118   vtkScriptedModuleGUI(const vtkScriptedModuleGUI&);
00119   void operator=(const vtkScriptedModuleGUI&);
00120 
00121   // Description:
00122   // Updates GUI widgets based on parameters values in MRML node
00123   void UpdateGUI();
00124 
00125   // Description:
00126   // Updates parameters values in MRML node based on GUI widgets 
00127   void UpdateMRML();
00128   
00129   vtkScriptedModuleLogic *Logic;
00130   vtkMRMLScriptedModuleNode* ScriptedModuleNode;
00131 
00132   int Language;
00133 };
00134 
00135 #endif
00136 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1