• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_DialogFactory.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Application Framework
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program 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 this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
00020  */
00021 
00022 #ifndef XAP_DIALOGFACTORY_H
00023 #define XAP_DIALOGFACTORY_H
00024 
00025 /*****************************************************************
00026 ******************************************************************
00027 ** This file defines the base class for the cross-platform
00028 ** application dialog factory.  This is used as a container
00029 ** and constructor for all dialogs.
00030 ******************************************************************
00031 *****************************************************************/
00032 
00033 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
00034  * so even if it's commented out in-file that's still a lot of work for
00035  * the preprocessor to do...
00036  */
00037 
00038 #if defined(__MINGW32__)
00039 #  undef snprintf
00040 #  if __GNUC__ <= 3
00041 #    define _GLIBCXX_USE_C99_DYNAMIC 1
00042 #  endif
00043 #endif
00044 
00045 #include <map>
00046 
00047 #ifndef UT_TYPES_H
00048 #include "ut_types.h"
00049 #endif
00050 #include "ut_misc.h"
00051 #include "ut_vector.h"
00052 
00053 #include "xap_Dialog.h"
00054 #include "xap_Types.h"
00055 
00056 class XAP_Dialog;
00057 class XAP_App;
00058 class XAP_Frame;
00059 
00060 /*****************************************************************/
00061 
00062 class ABI_EXPORT XAP_DialogFactory
00063 {
00064 public:
00065     struct _dlg_table
00066     {
00067         XAP_Dialog_Id   m_id;
00068         XAP_Dialog_Type m_type;
00069         XAP_Dialog *    (*m_pfnStaticConstructor)(XAP_DialogFactory *, XAP_Dialog_Id id);
00070         bool            m_tabbed;
00071     };
00072 
00073     XAP_DialogFactory(XAP_App * pApp, int nrElem, const struct _dlg_table * pDlgTable, XAP_Frame * pFrame = NULL);
00074     virtual ~XAP_DialogFactory(void);
00075 
00076     inline XAP_App *    getApp(void) const  { return m_pApp; };
00077 
00078     XAP_Dialog *        requestDialog(XAP_Dialog_Id id);
00079     XAP_Dialog *        justMakeTheDialog(XAP_Dialog_Id id);
00080     void                releaseDialog(XAP_Dialog * pDialog);
00081     XAP_Dialog_Id       getNextId(void);
00082     XAP_Dialog_Id       registerDialog(XAP_Dialog *(*pStaticConstructor)(XAP_DialogFactory *, XAP_Dialog_Id id),XAP_Dialog_Type iDialogType);
00083     void                unregisterDialog(XAP_Dialog_Id id);
00084 
00085     bool                registerNotebookPage(XAP_Dialog_Id dialog, const XAP_NotebookDialog::Page * page);
00086     bool                unregisterNotebookPage(XAP_Dialog_Id dialog, const XAP_NotebookDialog::Page * page);
00087 
00088 protected:
00089     bool                _findDialogInTable(XAP_Dialog_Id id, UT_sint32 * pIndex) const;
00090 
00091     XAP_App *           m_pApp;
00092     XAP_Frame *         m_pFrame;
00093     XAP_Dialog_Type     m_dialogType;
00094     UT_Vector           m_vecDialogs;
00095     UT_NumberVector     m_vecDialogIds;
00096 
00097     UT_uint32           m_nrElementsDlgTable;
00098     UT_GenericVector<const _dlg_table *>    m_vec_dlg_table;            /* a Vector of elements */
00099     UT_GenericVector<_dlg_table *>  m_vecDynamicTable;          /* a Vector of elements */
00100 
00101 private:
00102     void addPages(XAP_NotebookDialog * pDialog, XAP_Dialog_Id id);
00103 };
00104 
00105 #endif /* XAP_DIALOGFACTORY_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1