/***************************************************************************
                          SIMPLY POWERFUL TOOLKIT (SPTK)
                               DEMO PROGRAMS SET
                          file_dialogs.cpp  -  description
                             -------------------
    begin                : January 3, 2003
    copyright            : (C) 2003 by Alexey S.Parshin
    email                : alexeyp@gmail.com
 ***************************************************************************/

/***************************************************************************
   This library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Library General Public License as published by
   the Free Software Foundation; either version 2 of the License, or (at 
   your option) any later version.

   This library is distributed in the hope that it will be useful, but 
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
   General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; if not, write to the Free Software Foundation, 
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

   Please report all bugs and problems to "alexeyp@gmail.com"
 ***************************************************************************/

#ifdef __BORLANDC__
#include <vcl.h>
#pragma hdrstop
#endif

#include <FL/Fl.h>
#include <FL/fl_ask.h>
#include <FL/Fl_Pixmap.h>
#include <stdio.h>

#include <locale.h>

#include <sptk3/CWindow.h>
#include <sptk3/CFileOpenDialog.h>
#include <sptk3/CFileSaveDialog.h>
#include <sptk3/CException.h>
#include <sptk3/CThemes.h>

void exit_cb(Fl_Widget *w,void *) {
	w->window()->hide();
}

void open_dialog_cb(Fl_Widget *,void *) {
	CFileOpenDialog dialog;
	dialog.directory(".");
	dialog.addPattern("C++ Files","*.cpp;*.cxx");
	dialog.addPattern("VC++ Projects","*.dsp");
	dialog.fileName("file_dialog.cpp");
	dialog.execute();
}

void save_dialog_cb(Fl_Widget *,void *) {
	CFileSaveDialog dialog;
	dialog.directory(".");
	dialog.addPattern("C++ Files","*.cpp;*.cxx");
	dialog.addPattern("VC++ Projects","*.dsp");
	dialog.fileName("file_dialog.cpp");
	dialog.execute();
}

int main(int argc,char *argv[]) {

	CWindow w(200,150);

	CButton b3(SP_EXIT_BUTTON,SP_ALIGN_BOTTOM);
	b3.callback(exit_cb);

	CButton b1(SP_OPEN_BUTTON,SP_ALIGN_TOP,"File Open Dialog");
	b1.callback(open_dialog_cb);

	CButton b2(SP_SAVE_BUTTON,SP_ALIGN_TOP,"File Save Dialog");
	b2.callback(save_dialog_cb);

	w.end();
	w.show(argc,argv);

	CThemes::set("OSX");

	return Fl::run();
}
