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>
22 _Noreturn
void wAbort(void)
29 _Noreturn
void usage(void)
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("");
59 int panelType
= OPEN_PANEL_TYPE
;
62 puts("could not open display");
66 WMInitializeApplication("WMFile", &argc
, argv
);
70 while ((ch
= getopt(argc
, argv
, "si:ht:")) != -1)
73 panelType
= SAVE_PANEL_TYPE
;
85 for (; optind
< argc
; optind
++)
88 scr
= WMCreateSimpleApplicationScreen(dpy
);
90 pixmap
= WMCreatePixmapFromXPMData(scr
, GNUSTEP_XPM
);
91 WMSetApplicationIconPixmap(scr
, pixmap
);
92 WMReleasePixmap(pixmap
);
93 if (panelType
== SAVE_PANEL_TYPE
) {
94 sPanel
= WMGetSavePanel(scr
);
95 if (WMRunModalFilePanelForDirectory(sPanel
, NULL
, initial
,
97 printf("%s\n", WMGetFilePanelFileName(sPanel
));
101 oPanel
= WMGetOpenPanel(scr
);
102 if (WMRunModalFilePanelForDirectory(oPanel
, NULL
, initial
,
103 title
, NULL
) == True
)
104 printf("%s\n", WMGetFilePanelFileName(oPanel
));