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 _SO_XTFILESELECTIONDIALOG_
00025 #define _SO_XTFILESELECTIONDIALOG_
00026
00027 #include <Inventor/SbLinear.h>
00028 #include <Inventor/SbBasic.h>
00029 #include <Inventor/Xt/SoXtDef.h>
00030
00031 #if defined(_WIN32) && !defined(SOQT)
00032 class SoWinFileSelectionDialog;
00033 #define SoXtFileSelectionDialog SoWinFileSelectionDialog
00034 #define SoXtFileSelectionDialogCB SoWinFileSelectionDialogCB
00035 typedef void SoWinFileSelectionDialogCB(void *data, SoWinFileSelectionDialog *dialog);
00036 #elif defined(__APPLE__) || defined(SOQT)
00037 class SoQtFileSelectionDialog;
00038 #define SoXtFileSelectionDialog SoQtFileSelectionDialog
00039 #define SoXtFileSelectionDialogCB SoQtFileSelectionDialogCB
00040 typedef void SoQtFileSelectionDialogCB(void *data, SoQtFileSelectionDialog *dialog);
00041 #else
00042 class SoXtFileSelectionDialog;
00043 #include <Xm/Xm.h>
00044 typedef void SoXtFileSelectionDialogCB(void *data, SoXtFileSelectionDialog *dialog);
00045 #endif
00046
00047 #define charset XmSTRING_DEFAULT_CHARSET
00048
00049
00050
00051
00052
00065 class SoXtFileSelectionDialog {
00066 public:
00070 SoXtFileSelectionDialog();
00074 ~SoXtFileSelectionDialog();
00075
00079 void setSize(const SbVec2s &size);
00080
00084 SbVec2s getSize(void);
00085
00086
00090 void setTitle(char *title);
00091
00095 char *getTitle(void);
00096
00097
00101 void setFilter(char *suffix, char *title);
00102
00106 void getFilter(char **suffix, char **title);
00107
00108
00112 void setFileDirectory(char *directory);
00113
00117 char *getFileDirectory();
00118
00122 void setFileName(char *fName);
00123
00127 char *getFileName(void);
00128
00132 char *getFilePath(void);
00133
00135 enum Dialog_Mode {
00139 OPEN_FILE,
00143 SAVE_FILE
00144 };
00145
00146
00150 void setMode(Dialog_Mode dMode);
00151
00155 Dialog_Mode getMode(void);
00156
00160 void show();
00161
00165 void setAcceptCallback(SoXtFileSelectionDialogCB *f, void *data);
00166
00170 void setAbortCallback(SoXtFileSelectionDialogCB *f, void *data);
00171
00172
00173 private :
00174 void buildFilePath(void);
00175 void updateFileDirectory(void);
00176 char *m_boxTitle;
00177 char *m_filterSuffix;
00178 char *m_filterTitle;
00179 char *m_fileDirectory;
00180 char *m_fileName;
00181 char m_fullFilePath[1000];
00182 Dialog_Mode m_dlgMode;
00183 SoXtFileSelectionDialogCB *acceptPtr;
00184 SoXtFileSelectionDialogCB *abortPtr;
00185 void *acceptDataPtr;
00186 void *abortDataPtr;
00187 void setFilePath(char *fPath);
00188
00189 SbVec2s m_dlgSize;
00190 #if !defined(_WIN32) && !defined(SOQT)
00191 SbBool m_boxExist;
00192 SbVec2s m_defaultSize;
00193 SoWidget m_toplevel;
00194 SoWidget m_fileSelectionDialog;
00195 SoWidget m_SoXtFileSelectionDialog;
00196 static void OK_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
00197 static void Cancel_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
00198 SbBool m_keepDialog;
00199 public:
00200
00204 void keepDialog(SbBool);
00205
00206 #endif
00207
00208 };
00209
00210 #endif // _SO_XTFILESELECTIONDIALOG_
00211
00212
00213
00214