1 /*=========================================================================
4 Module: $RCSfile: vtkPVFoamSelectTimeSet.h,v $
6 Copyright (c) Kitware, Inc.
8 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
15 // .NAME vtkPVFoamSelectTimeSet - Special time selection widget used by PVFoamReaderModule
16 // .SECTION Description
17 // This is a PVWidget specially designed to be used with PVFoamReaderModule.
18 // It provides support for multiple sets. The time value selected by
19 // the user is passed to the Foam reader with a SetTimeValue() call.
21 #ifndef __vtkPVFoamSelectTimeSet_h
22 #define __vtkPVFoamSelectTimeSet_h
24 #include "vtkPVWidget.h"
28 class vtkKWLabeledFrame
;
29 class vtkDataArrayCollection
;
30 class vtkPVScalarListWidgetProperty
;
32 class VTK_EXPORT vtkPVFoamSelectTimeSet
: public vtkPVWidget
35 static vtkPVFoamSelectTimeSet
* New();
36 vtkTypeRevisionMacro(vtkPVFoamSelectTimeSet
, vtkPVWidget
);
37 void PrintSelf(ostream
& os
, vtkIndent indent
);
39 virtual void Create(vtkKWApplication
*pvApp
);
43 // Called when accept button is pushed.
44 // Sets objects variable to the widgets value.
45 // Adds a trace entry. Side effect is to turn modified flag off.
46 virtual void AcceptInternal(vtkClientServerID
);
50 // Called when the reset button is pushed.
51 // Sets widget's value to the object-variable's value.
52 // Side effect is to turn the modified flag off.
53 virtual void ResetInternal();
56 // Adds a script to the menu of the animation interface.
57 virtual void AddAnimationScriptsToMenu(vtkKWMenu
*menu
,
58 vtkPVAnimationInterfaceEntry
*ai
);
61 // Called whenthe animation method menu item is selected.
62 // Needed for proper tracing.
63 // It would be nice if the menu and cascade menus would trace
64 // invokation of items (?relying of enumeration of menu items or label?)
65 void AnimationMenuCallback(vtkPVAnimationInterfaceEntry
*ai
);
68 // This is the labeled frame around the timeset tree.
69 vtkGetObjectMacro(LabeledFrame
, vtkKWLabeledFrame
);
72 // Label displayed on the labeled frame.
73 void SetLabel(const char* label
);
74 const char* GetLabel();
77 // Updates the time value label and the time ivar.
78 void SetTimeValue(float time
);
79 vtkGetMacro(TimeValue
, float);
82 // Calls this->SetTimeValue () and Reader->SetTimeValue()
83 // with currently selected time value.
84 void SetTimeValueCallback(const char* item
);
88 // Creates and returns a copy of this widget. It will create
89 // a new instance of the same type as the current object
90 // using NewInstance() and then copy some necessary state
92 vtkPVFoamSelectTimeSet
* ClonePrototype(vtkPVSource
* pvSource
,
93 vtkArrayMap
<vtkPVWidget
*, vtkPVWidget
*>* map
);
97 // This serves a dual purpose. For tracing and for saving state.
98 virtual void Trace(ofstream
*file
);
101 // Set/get the property to use with this widget.
102 virtual void SetProperty(vtkPVWidgetProperty
*prop
);
103 virtual vtkPVWidgetProperty
* GetProperty();
106 // Create the right property for use with this widget.
107 virtual vtkPVWidgetProperty
* CreateAppropriateProperty();
110 // Set/get the command to pass the value to VTK.
111 vtkSetStringMacro(SetCommand
);
112 vtkGetStringMacro(SetCommand
);
115 // Save this widget to a file.
116 virtual void SaveInBatchScript(ofstream
*file
);
119 vtkPVFoamSelectTimeSet();
120 ~vtkPVFoamSelectTimeSet();
122 vtkPVFoamSelectTimeSet(const vtkPVFoamSelectTimeSet
&); // Not implemented
123 void operator=(const vtkPVFoamSelectTimeSet
&); // Not implemented
125 vtkPVScalarListWidgetProperty
*Property
;
129 vtkSetStringMacro(FrameLabel
);
130 vtkGetStringMacro(FrameLabel
);
133 vtkKWWidget
* TreeFrame
;
134 vtkKWLabel
* TimeLabel
;
135 vtkKWLabeledFrame
* LabeledFrame
;
137 void AddRootNode(const char* name
, const char* text
);
138 void AddChildNode(const char* parent
, const char* name
,
139 const char* text
, const char* data
);
144 vtkDataArrayCollection
* TimeSets
;
145 vtkClientServerID ServerSideID
;
147 // Fill the TimeSets collection with that from the actual reader.
148 void SetTimeSetsFromReader();
151 virtual void CopyProperties(vtkPVWidget
* clone
, vtkPVSource
* pvSource
,
152 vtkArrayMap
<vtkPVWidget
*, vtkPVWidget
*>* map
);
155 int ReadXMLAttributes(vtkPVXMLElement
* element
,
156 vtkPVXMLPackageParser
* parser
);
159 // An interface for saving a widget into a script.
160 virtual void SaveInBatchScriptForPart(ofstream
*file
, vtkClientServerID
);