#include <stdio.h>
#include "graphapp.h"
App *app;
void close_it(Window *w)
{
char *filename = NULL;
int result = ask_yes_no_cancel(app, "Confirm Save", "Save changes?");
if (result == YES) {
filename = ask_file_save(app, "Save File As",
"Save the file as:", "untitled.txt");
/* save the file somehow */
ask_ok(app, "File Saved", "The file was sucessfully saved.");
}
else if (result == CANCEL)
return;
hide_window(w);
}
int main(int argc, char *argv[])
{
Window *w;
app = new_app(argc, argv);
w = newwindow(app, rect(0,0,300,250),
"Text Editor", STANDARD_WINDOW);
setclose(w, close_it);
show_window(w);
main_loop(app);
return 0;
}
Notes: