Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoXtFileSelectionDialog.h
Go to the documentation of this file.
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-2019 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>
44typedef void SoXtFileSelectionDialogCB(void *data, SoXtFileSelectionDialog *dialog);
45#endif
46
47#define charset XmSTRING_DEFAULT_CHARSET
48
49/*****************************************************************************/
50//: Class used to realize fileselection boxes to open or save a file
51/******************************************************************************/
52
65 public:
74
78 void setSize(const SbVec2s &size);
79
84
85
89 void setTitle(char *title);
90
94 char *getTitle(void);
95
96
100 void setFilter(char *suffix, char *title);
101
105 void getFilter(char **suffix, char **title);
106
107
111 void setFileDirectory(char *directory);
112
117
121 void setFileName(char *fName);
122
126 char *getFileName(void);
127
131 char *getFilePath(void);
132
144
145
149 void setMode(Dialog_Mode dMode);
150
155
159 void show();
160
165
170
171
172 private :
173 void buildFilePath(void);
174 void updateFileDirectory(void);
175 char *m_boxTitle;
176 char *m_filterSuffix;
177 char *m_filterTitle;
178 char *m_fileDirectory;
179 char *m_fileName;
180 char m_fullFilePath[1000];
181 Dialog_Mode m_dlgMode;
182 SoXtFileSelectionDialogCB *acceptPtr;
184 void *acceptDataPtr;
185 void *abortDataPtr;
186 void setFilePath(char *fPath);
187
188 SbVec2s m_dlgSize;
189#if !defined(_WIN32) && !defined(SOQT)
190 SbBool m_boxExist;
191 SbVec2s m_defaultSize;
192 SoWidget m_toplevel;
193 SoWidget m_fileSelectionDialog;
194 SoWidget m_SoXtFileSelectionDialog;
195 static void OK_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
196 static void Cancel_Button (SoWidget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs);
197 SbBool m_keepDialog;
198 public:
199
204
205#endif
206
207};
208
209#endif // _SO_XTFILESELECTIONDIALOG_
210
211
212
void * XtPointer
Definition SoQtDef.h:118
#define SoWidget
Definition SoQtDef.h:40
void SoXtFileSelectionDialogCB(void *data, SoXtFileSelectionDialog *dialog)
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 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
size_t size() const