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
00064 class SoXtFileSelectionDialog {
00065 public:
00069 SoXtFileSelectionDialog();
00073 ~SoXtFileSelectionDialog();
00074
00078 void setSize(const SbVec2s &size);
00079
00083 SbVec2s getSize(void);
00084
00085
00089 void setTitle(char *title);
00090
00094 char *getTitle(void);
00095
00096
00100 void setFilter(char *suffix, char *title);
00101
00105 void getFilter(char **suffix, char **title);
00106
00107
00111 void setFileDirectory(char *directory);
00112
00116 char *getFileDirectory();
00117
00121 void setFileName(char *fName);
00122
00126 char *getFileName(void);
00127
00131 char *getFilePath(void);
00132
00134 enum Dialog_Mode {
00138 OPEN_FILE,
00142 SAVE_FILE
00143 };
00144
00145
00149 void setMode(Dialog_Mode dMode);
00150
00154 Dialog_Mode getMode(void);
00155
00159 void show();
00160
00164 void setAcceptCallback(SoXtFileSelectionDialogCB *f, void *data);
00165
00169 void setAbortCallback(SoXtFileSelectionDialogCB *f, void *data);
00170
00171
00172 private :
00173 void buildFilePath(void);
00174 void updateFileDirectory(void);
00175 char *m_boxTitle;
00176 char *m_filterSuffix;
00177 char *m_filterTitle;
00178 char *m_fileDirectory;
00179 char *m_fileName;
00180 char m_fullFilePath[1000];
00181 Dialog_Mode m_dlgMode;
00182 SoXtFileSelectionDialogCB *acceptPtr;
00183 SoXtFileSelectionDialogCB *abortPtr;
00184 void *acceptDataPtr;
00185 void *abortDataPtr;
00186 void setFilePath(char *fPath);
00187
00188 SbVec2s m_dlgSize;
00189 #if !defined(_WIN32) && !defined(SOQT)
00190 SbBool m_boxExist;
00191 SbVec2s m_defaultSize;
00192 SoWidget m_toplevel;
00193 SoWidget m_fileSelectionDialog;
00194 SoWidget m_SoXtFileSelectionDialog;
00195 static void OK_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
00196 static void Cancel_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
00197 SbBool m_keepDialog;
00198 public:
00199
00203 void keepDialog(SbBool);
00204
00205 #endif
00206
00207 };
00208
00209 #endif // _SO_XTFILESELECTIONDIALOG_
00210
00211
00212
00213