2 * Author: Len Trigg <trigg@cs.waikato.ac.nz>
6 Update: Franck Wolff <frawolff@club-internet.fr>
7 -----------------------------------------------------------------------
8 List of updated functions :
10 add -s option for a save panel...
11 -----------------------------------------------------------------------
14 #include <WINGs/WINGs.h>
36 " -s\t\tSave panel (default open panel)\n"
37 " -i <str>\tInitial directory (default /)\n"
38 " -t <str>\tQuery window title (default none)\n"
41 "\t%s pops up a WindowMaker style file selection panel.\n"
42 "\n" "version:\n" "\t%s\n", ProgName
, ProgName
, __DATE__
);
46 #define OPEN_PANEL_TYPE 0
47 #define SAVE_PANEL_TYPE 1
49 int main(int argc
, char **argv
)
51 Display
*dpy
= XOpenDisplay("");
60 int panelType
= OPEN_PANEL_TYPE
;
65 puts("could not open display");
69 WMInitializeApplication("WMFile", &argc
, argv
);
73 while ((ch
= getopt(argc
, argv
, "si:ht:")) != -1)
76 panelType
= SAVE_PANEL_TYPE
;
88 for (; optind
< argc
; optind
++)
91 scr
= WMCreateSimpleApplicationScreen(dpy
);
93 pixmap
= WMCreatePixmapFromXPMData(scr
, GNUSTEP_XPM
);
94 WMSetApplicationIconPixmap(scr
, pixmap
);
95 WMReleasePixmap(pixmap
);
96 if (panelType
== SAVE_PANEL_TYPE
) {
97 sPanel
= WMGetSavePanel(scr
);
98 if (WMRunModalFilePanelForDirectory(sPanel
, NULL
, initial
,
99 /*title */ NULL
, NULL
) == True
)
100 printf("%s\n", WMGetFilePanelFileName(sPanel
));
104 oPanel
= WMGetOpenPanel(scr
);
105 if (WMRunModalFilePanelForDirectory(oPanel
, NULL
, initial
,
106 /*title */ NULL
, NULL
) == True
)
107 printf("%s\n", WMGetFilePanelFileName(oPanel
));