gui_application.h

00001 /*
00002  * gui_application.h
00003  * This file is part of dbPager Classes Library (DCL)
00004  *
00005  * Copyright (c) 2008 Dennis Prochko <wolfsoft@mail.ru>
00006  *
00007  * DCL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation version 3.
00010  *
00011  * DCL is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with DCL; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00019  * Boston, MA  02110-1301  USA
00020  */
00021 
00022 #ifndef _GUI_APPLICATION_H_
00023 #define _GUI_APPLICATION_H_
00024 
00025 #include <dcl/application.h>
00026 #include <dcl/plugin.h>
00027 #include <dcl/widget_factory.h>
00028 
00029 namespace dbp {
00030 
00032 
00038 class gui_application: public application_int,
00039   public singleton<gui_application> {
00040         friend class singleton<gui_application>;
00041 public:
00042         virtual ~gui_application();
00043         virtual void set_name(const std::string &app_name) {
00044                 pimpl->set_name(app_name);
00045         };
00046         virtual void set_description(const std::string &description) {
00047                 pimpl->set_description(description);
00048         };
00049         virtual void register_cmdline_parameter(const cmdline_parameter &param,
00050           application_int::cmdline_parameter_handler handler) {
00051                 pimpl->register_cmdline_parameter(param, handler);
00052         };
00053         virtual void on_execute(on_execute_handler handler) {
00054                 pimpl->on_execute(handler);
00055         };
00056         virtual void on_exception(on_exception_handler handler) {
00057                 pimpl->on_exception(handler);
00058         };
00059         virtual int run(int argc, char *argv[]) {
00060                 return pimpl->run(argc, argv);
00061         };
00063 
00069         widget_factory& factory() {
00070                 return *_widget_factory;
00071         };
00072 protected:
00073         gui_application();
00074 private:
00075         plugin _plugin;
00076         widget_factory *_widget_factory;
00077         widget_factory::gui_application_ptr pimpl;
00078 };
00079 
00080 } // namespace
00081 
00082 #endif /*_GUI_APPLICATION_H_*/
00083 

 
Support This Project
SourceForge.net Logo