Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoXtFileSelectionDialog.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _SO_XTFILESELECTIONDIALOG_
25#define _SO_XTFILESELECTIONDIALOG_
26
27#include <Inventor/SbLinear.h>
28#include <Inventor/SbBasic.h>
29#include <Inventor/Xt/SoXtDef.h>
30
31#if defined(_WIN32) && !defined(SOQT)
32class SoWinFileSelectionDialog;
33#define SoXtFileSelectionDialog SoWinFileSelectionDialog
34#define SoXtFileSelectionDialogCB SoWinFileSelectionDialogCB
35typedef void SoWinFileSelectionDialogCB(void *data, SoWinFileSelectionDialog *dialog);
36#elif defined(__APPLE__) || defined(SOQT)
37class SoQtFileSelectionDialog;
38#define SoXtFileSelectionDialog SoQtFileSelectionDialog
39#define SoXtFileSelectionDialogCB SoQtFileSelectionDialogCB
40typedef void SoQtFileSelectionDialogCB(void *data, SoQtFileSelectionDialog *dialog);
41#else
43#include <Xm/Xm.h>
45typedef void SoXtFileSelectionDialogCB(void *data, SoXtFileSelectionDialog *dialog);
46#endif
47
48#define charset XmSTRING_DEFAULT_CHARSET
49
50/*****************************************************************************/
51//: Class used to realize fileselection boxes to open or save a file
52/******************************************************************************/
53
66 public:
75
79 void setSize(const SbVec2s &size);
80
85
86
90 void setTitle(char *title);
91
95 char *getTitle(void);
96
97
101 void setFilter(char *suffix, char *title);
102
106 void getFilter(char **suffix, char **title);
107
108
112 void setFileDirectory(char *directory);
113
118
122 void setFileName(char *fName);
123
127 char *getFileName(void);
128
132 char *getFilePath(void);
133
145
146
150 void setMode(Dialog_Mode dMode);
151
156
160 void show();
161
165 void setAcceptCallback(SoXtFileSelectionDialogCB *f, void *data);
166
170 void setAbortCallback(SoXtFileSelectionDialogCB *f, void *data);
171
172
173 private :
174 void buildFilePath(void);
175 void updateFileDirectory(void);
176 char *m_boxTitle;
177 char *m_filterSuffix;
178 char *m_filterTitle;
179 char *m_fileDirectory;
180 char *m_fileName;
181 char m_fullFilePath[1000];
182 Dialog_Mode m_dlgMode;
183 SoXtFileSelectionDialogCB *acceptPtr;
185 void *acceptDataPtr;
186 void *abortDataPtr;
187 void setFilePath(char *fPath);
188
189 SbVec2s m_dlgSize;
190#if !defined(_WIN32) && !defined(SOQT)
191 SbBool m_boxExist;
192 SbVec2s m_defaultSize;
193 SoWidget m_toplevel;
194 SoWidget m_fileSelectionDialog;
195 SoWidget m_SoXtFileSelectionDialog;
196 static void OK_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
197 static void Cancel_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
198 SbBool m_keepDialog;
199 public:
200
205
206#endif
207
208};
209
210#endif // _SO_XTFILESELECTIONDIALOG_
211
212
213
2D vector class.
Definition SbVec.h:700
Cross-platform file selection box.
void setFilter(char *suffix, char *title)
Sets the suffix filter and the filter title.
void setTitle(char *title)
Sets the file selection dialog box title.
char * getFileName(void)
Gets the file name.
~SoXtFileSelectionDialog()
Destructor.
void setAcceptCallback(SoXtFileSelectionDialogCB *f, void *data)
Set the callback associated with the OK button.
void SoXtFileSelectionDialogCB(void *data, SoXtFileSelectionDialog *dialog)
void setFileName(char *fName)
Sets the file name.
char * getFilePath(void)
Retrieves the full file path.
void setFileDirectory(char *directory)
Sets the file directory.
void show()
Shows the file selection box dialog.
SbVec2s getSize(void)
Gets the dialog box size (UNIX only).
Dialog_Mode getMode(void)
Gets the mode (Open or Close) of the file selection box.
void setMode(Dialog_Mode dMode)
Sets the mode (Open or Close) of the file selection box.
SoXtFileSelectionDialog()
Constructor.
char * getTitle(void)
Gets the file selection dialog box title.
void setAbortCallback(SoXtFileSelectionDialogCB *f, void *data)
Set the callback associated with the Cancel button.
char * getFileDirectory()
Gets the file directory.
void setSize(const SbVec2s &size)
Sets the dialog box size (UNIX only).
Dialog_Mode
Enum to set the dialog box mode (Open file / Save file).
void getFilter(char **suffix, char **title)
Gets the suffix filter and the filter title.
void keepDialog(SbBool)
Sets the persistency property, if TRUE, the dialog box will not be deleted after buttons are pressed.
int SbBool
Boolean type.
Definition SbBase.h:87
void * XtPointer
Definition SoQtDef.h:122