1 /***********************************************************************/ 2 /* Open Visualization Data Explorer */ 3 /* (C) Copyright IBM Corp. 1989,1999 */ 4 /* ALL RIGHTS RESERVED */ 5 /* This code licensed under the */ 6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ 7 /***********************************************************************/ 8 9 #include <dxconfig.h> 10 #include "../base/defines.h" 11 12 13 14 15 #ifndef _ValueListInteractor_h 16 #define _ValueListInteractor_h 17 18 #include <Xm/Xm.h> 19 20 #include "ValueInteractor.h" 21 #include "ListEditor.h" 22 23 // 24 // Class name definition: 25 // 26 #define ClassValueListInteractor "ValueListInteractor" 27 28 class InteractorNode; 29 class InteractorInstance; 30 class Node; 31 class Network; 32 class ControlPanel; 33 class Dialog; 34 class SetAttrDialog; 35 36 // 37 // Virtual Interactor class definition: 38 // 39 class ValueListInteractor : public ValueInteractor, public ListEditor 40 { 41 private: 42 // 43 // Private member data: 44 // 45 static boolean ClassInitialized; 46 47 protected: 48 // 49 // Protected member data: 50 // 51 52 static String DefaultResources[]; 53 54 Widget listForm; 55 56 // 57 // Build the stepper, dial, ... widget tree and set any information 58 // that is specific to the derived class. Passes back an unmanaged widget 59 // that is put in the frame created by this->createFrame(). 60 // 61 virtual Widget createInteractivePart(Widget p); 62 63 // 64 // Perform any actions that need to be done after the parent of 65 // this->interactivePart has been managed. This may include a call 66 // to Interactor::PassEvents(). 67 // 68 virtual void completeInteractivePart(); 69 70 71 // 72 // Build the interacive value editing part. 73 // This probably called by createEditingPart(). 74 // 75 virtual Widget createValueEditor(Widget mainForm); 76 77 // 78 // Called by this->listCallback() when a new item is selected in the list. 79 // This should update the the values displayed in the editor to match 80 // the values selected (i.e. listItem). 81 // 82 virtual void updateValueEditor(const char *listItem); 83 84 // 85 // Get the value in the value editor that should be added to the list. 86 // The returned string must be freed by the caller. 87 // Returns NULL if the value in the value editor is not valid and 88 // can issue an error message in that case. 89 // 90 virtual char *getValueEditorValue(); 91 92 // 93 // Before calling the superclass method, we check and massage the entered 94 // value to make sure it matches the output type for this module. 95 // 96 void valueEditorCallback(Widget w, XtPointer cb); 97 98 // 99 // After calling the superclass method to update the list, we set the 100 // current output to a DX style list containing the listed items. 101 // 102 void addCallback(Widget w, XtPointer cb); 103 void deleteCallback(Widget w, XtPointer cb); 104 // 105 // Read the displayed values and set the output from them. 106 // 107 boolean updateOutputFromDisplay(); 108 109 // 110 // Determine if the text in the ValueEditor can be added to the current 111 // list of items. If the current list is size is 1 and the item is 112 // selected, then the text can match any of the outputs, otherwise it 113 // must match the item type of current list of items. 114 // Returns NULL if it does not type match, otherwise a string that must 115 // be freed by the caller. The returned string may be different from the 116 // valueEditor text if the text was coerced to the expected type. 117 // An error message is issued if the text is not valid. 118 // 119 char *verifyValueEditorText(); 120 121 122 public: 123 // 124 // Constructor: 125 // 126 ValueListInteractor(const char * name, InteractorInstance *ii); 127 128 // 129 // Destructor: 130 // 131 ~ValueListInteractor(); 132 133 134 // 135 // Allocate the interactor class and widget tree. 136 // 137 static Interactor *AllocateInteractor(const char *name, 138 InteractorInstance *ii); 139 140 virtual void handleInteractivePartStateChange( 141 InteractorInstance *src_ii, 142 boolean major_change); 143 144 // 145 // Update the display values for an interactor; 146 // Called when an InteractorNode does a this->setOutputValue(). 147 // 148 virtual void updateDisplayedInteractorValue(void); 149 150 151 // 152 // One time initialize for the class. 153 // 154 virtual void initialize(); 155 156 // 157 // Returns a pointer to the class name. 158 // getClassName()159 const char* getClassName() 160 { 161 return ClassValueListInteractor; 162 } 163 }; 164 165 166 #endif // _ValueListInteractor_h 167