00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _POXTLEGENDEDITOR_H_
00025 #define _POXTLEGENDEDITOR_H_
00026
00027 #include <MeshViz/PoMeshVizW.h>
00028 #include <Inventor/SbLinear.h>
00029 #include <Inventor/Xt/SoXtComponent.h>
00030
00031 #include <MeshViz/PbBasic.h>
00032
00033 #include <Inventor/dialog/PoXtDialog.h>
00034
00035 class SoCallbackList;
00036 class PoLegend;
00037 class SoSensor;
00038 class SoNodeSensor;
00039 struct menuColumn;
00040
00041 class SoDEPRECATED PoXtLegendEditor
00053 : public SoXtComponent
00054 {
00055
00056 public:
00057
00061 typedef void PoXtLegendEditorCB (void * userData, PoLegend * data);
00062
00063 enum LegendMask
00064 {
00065 NO_LEGEND_MASK = 0x00000000,
00066
00067 TITLE_VISIBILITY = 0x00000001,
00068 TITLE_POSITION = 0x00000002,
00069 TITLE_PATH = 0x00000004,
00070 TITLE_FONT_NAME = 0x00000008,
00071 TITLE_FONT_SIZE = 0x00000010,
00072 TITLE_STRING = 0x00000020,
00073 TITLE = TITLE_STRING | TITLE_FONT_SIZE | TITLE_FONT_NAME | TITLE_PATH
00077 | TITLE_POSITION | TITLE_VISIBILITY,
00078
00079 VALUE_VISIBILITY = 0x00000040,
00080 VALUE_POSITION = 0x00000080,
00081 VALUE_FONT_NAME = 0x00000100,
00082 VALUE_ADD_STRING_VISIBILITY = 0x00000200,
00083 VALUE_ADD_STRING = 0x00000400,
00084 VALUE = VALUE_ADD_STRING | VALUE_ADD_STRING_VISIBILITY | VALUE_FONT_NAME
00088 | VALUE_POSITION | VALUE_VISIBILITY,
00089
00090 MARGIN_TYPE = 0x00000800,
00091 MARGIN_LEFT = 0x00001000,
00092 MARGIN_RIGHT = 0x00002000,
00093 MARGIN_BOTTOM = 0x00004000,
00094 MARGIN_TOP = 0x00008000,
00095 MARGIN = MARGIN_TOP | MARGIN_BOTTOM | MARGIN_RIGHT
00099 | MARGIN_LEFT | MARGIN_TYPE,
00100
00101 INCREMENT_TYPE = 0x00010000,
00102 NUM_COLUMNS = 0x00020000,
00103 BOX_RATIO = 0x00040000,
00104 MISC_TEXT_ATTR = 0x00080000,
00108 MISC = INCREMENT_TYPE | NUM_COLUMNS | BOX_RATIO | MISC_TEXT_ATTR,
00109
00110 ALL_LEGEND_MASK = TITLE | VALUE | MARGIN | MISC
00111 } ;
00112
00113
00114 enum Presentation
00115 {
00116 TOGGLE_FOLD,
00117 TOGGLE_UNFOLD,
00118 LABEL_UNFOLD
00119 } ;
00120
00121
00122 enum UpdateFrequency
00123 {
00127 CONTINUOUS,
00131 AFTER_ACCEPT
00132 } ;
00133
00134
00135
00136 public:
00137
00141 virtual void attach (PoLegend * legend);
00142
00146 void detach ();
00147
00151 SbBool isAttached () const;
00152
00158 void addLegendChangedCallback (PoXtLegendEditorCB * func, void * userData);
00159
00164 void removeLegendChangedCallback (PoXtLegendEditorCB * func, void * userData);
00165
00169 virtual void setPresentation (Presentation type);
00170
00174 Presentation getPresentation () const;
00175
00179 void setUpdateFrequency (UpdateFrequency freq);
00180
00184 UpdateFrequency getUpdateFrequency () const;
00185
00191 void setLegendFilter (unsigned long inclusionMask,
00192 unsigned long exclusionMask);
00193
00198 void getLegendFilter (unsigned long & inclusionMask,
00199 unsigned long & exclusionMask) const;
00200
00201 virtual void show ();
00202 virtual void hide ();
00203
00204
00205
00206
00207
00208 PoINTERNAL private:
00209
00210 PoXtLegendEditor (SoWidget Parent = NULL,
00211 const char * name = NULL,
00212 SbBool buildInsideParent = TRUE);
00213
00214 virtual void buildWidget (SoWidget Parent,
00215 const char * name,
00216 SbBool buildInsideParent);
00217 virtual void setFilter();
00218
00219 virtual ~PoXtLegendEditor ();
00220
00221
00222 virtual SbString getDefaultWidgetName() const;
00223 virtual SbString getDefaultTitle() const;
00224 virtual SbString getDefaultIconTitle() const;
00225
00226 void updateXtElements ();
00227
00228 virtual void copyLegendFields(PoLegend * dest, PoLegend * source);
00229 virtual void updateLegendFromXtElements ();
00230
00231 virtual int getMenuItems();
00232
00233
00234 PoLegend * _legend;
00235 PoLegend * _attachedLegend;
00236 PoXtDialog * _dialog;
00237 SoNodeSensor * _sensor;
00238
00239 Presentation _presentation;
00240
00241 menuColumn * _menu;
00242 int _menuItems;
00243 SoCallbackList * _callbackList;
00244
00245 private:
00246 UpdateFrequency _frequency;
00247 int _classMenusNb;
00248 unsigned long _incLegendMask;
00249 unsigned long _excLegendMask;
00250
00251 SbBool _isLegendSet;
00252
00253 void activate ();
00254 void deactivate ();
00255
00256
00257
00258 static void acceptCallback (void *, const PoXtDialog::PoXtDialogDataCB *);
00259 static void elementsCallback (void *, const PoXtDialog::PoXtDialogDataCB *);
00260 static void visibilityChangeCB (void *, SbBool visible);
00261 static void sensorCB (void *, SoSensor *);
00262 };
00263
00264
00265 #endif // _POXTLEGENDEDITOR_H_
00266
00267