plugin_arg_form.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: plugin_arg_form.hpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 21:17:13 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.1
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_CORE___PLUGIN_ARG_FORM__HPP
- #define GUI_CORE___PLUGIN_ARG_FORM__HPP
- /* $Id: plugin_arg_form.hpp,v 1000.0 2004/06/01 21:17:13 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <FL/Fl_Choice.H>
- #include <FL/Fl_Input.H>
- #include <FL/Fl_Button.H>
- #include <FL/Fl_Group.H>
- #include <FL/Fl_Menu.H>
- #include <FL/Fl_Multi_Browser.H>
- #include <gui/objutils/objects.hpp>
- #include <gui/core/obj_convert.hpp>
- #include <gui/widgets/fl/form.hpp>
- #include <gui/plugin/PluginArg.hpp>
- #include <gui/plugin/PluginArgSet.hpp>
- BEGIN_NCBI_SCOPE
- //
- // class CArgFormatter defines the abstract interface required of a class that
- // can format an object as an argument of a particular type. There are many
- // private derived classes from this, one for each handled type.
- //
- class CArgFormatter : public CObject
- {
- public:
- virtual ~CArgFormatter() {}
- virtual void Process(void) = 0;
- // extract the GUI component required for this formatter
- virtual Fl_Widget* GetWidget(void) = 0;
- };
- //
- // class CPluginArgForm is the main form container
- //
- class CPluginArgForm : public CFlForm
- {
- public:
- // typedef our arg formatter container
- typedef list< CRef<CArgFormatter> > TArgFormatters;
- // default (FLTK) constructor
- CPluginArgForm(int x, int y, int w, int h, const char* label = NULL);
- // set the arguments for this form
- void SetArgs(objects::CPluginArgSet& args,
- const TConstScopedObjects& selections);
- // add a formatter to our form. Internally, this will force creation of
- // the GUI components and add it to the pack.
- void AddFormatter(CArgFormatter& fmt);
- // add a title row
- void AddTitle(const string& str);
- // process the form
- void Process();
- // generate a new argument formatter based on a given argument.
- static CArgFormatter* GetFormatter(objects::CPluginArg& arg,
- const TConstScopedObjects& objs);
- private:
- TArgFormatters m_Formatters;
- void x_AddOptions(objects::CPluginArgSet::Tdata& opts,
- const char* title,
- CConvertCache& convert_cache,
- const TConstScopedObjects& objs);
- void x_AddFlags(objects::CPluginArgSet::Tdata& opts,
- const char* title,
- CConvertCache& convert_cache);
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: plugin_arg_form.hpp,v $
- * Revision 1000.0 2004/06/01 21:17:13 gouriano
- * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.1
- *
- * Revision 1.1 2004/06/01 18:04:44 dicuccio
- * Initial revision. Lots of changes: added gui_project ASN.1 project, added new
- * plugin arg form (separate widget), added plugin selector dialog
- *
- * ===========================================================================
- */
- #endif // GUI_CORE___PLUGIN_ARG_FORM__HPP