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 -----------------------------------------------------------------------
16 #include <WINGs/WINGs.h>
41 " -s\t\tSave panel (default open panel)\n"
42 " -i <str>\tInitial directory (default /)\n"
43 " -t <str>\tQuery window title (default none)\n"
46 "\t%s pops up a WindowMaker style file selection panel.\n"
50 ,ProgName
,ProgName
,__DATE__
55 #define OPEN_PANEL_TYPE 0
56 #define SAVE_PANEL_TYPE 1
58 int main(int argc
, char **argv
)
60 Display
*dpy
= XOpenDisplay("");
69 int panelType
= OPEN_PANEL_TYPE
;
73 WMInitializeApplication("WMFile", &argc
, argv
);
78 puts("could not open display");
81 while((ch
= getopt(argc
, argv
, "si:ht:")) != -1)
85 panelType
= SAVE_PANEL_TYPE
;
97 for(; optind
<argc
; optind
++)
100 scr
= WMCreateSimpleApplicationScreen(dpy
);
104 pixmap
= WMCreatePixmapFromXPMData(scr
, GNUSTEP_XPM
);
105 WMSetApplicationIconPixmap(scr
, pixmap
);
106 WMReleasePixmap(pixmap
);
107 if (panelType
== SAVE_PANEL_TYPE
) {
108 sPanel
= WMGetSavePanel(scr
);
109 if (WMRunModalFilePanelForDirectory(sPanel
, NULL
, initial
,
110 /*title*/ NULL
, NULL
) == True
)
111 printf("%s\n", WMGetFilePanelFileName(sPanel
));
115 oPanel
= WMGetOpenPanel(scr
);
116 if (WMRunModalFilePanelForDirectory(oPanel
, NULL
, initial
,
117 /*title*/ NULL
, NULL
) == True
)
118 printf("%s\n", WMGetFilePanelFileName(oPanel
));