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

ev_EditBinding.h

Go to the documentation of this file.
00001 /* AbiSource Program Utilities
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 
00021 
00022 
00023 #ifndef EV_EDITBINDING_H
00024 #define EV_EDITBINDING_H
00025 
00026 #include "ut_types.h"
00027 #include "ut_vector.h"
00028 #include "ev_EditBits.h"
00029 #include "ev_EditMethod.h"
00030 #include <vector>
00031 
00032 typedef UT_uint32 EV_EditBindingType;
00033 #define EV_EBT_METHOD           ((EV_EditBindingType) 0x1) /* final method */
00034 #define EV_EBT_PREFIX           ((EV_EditBindingType) 0x2) /* prefix state (like ^X in emacs */
00035 
00036 class EV_EditBindingMap;
00037 
00038 /*****************************************************************/
00039 /*****************************************************************/
00040 
00041 class ABI_EXPORT EV_EditBinding
00042 {
00043 public:
00044     EV_EditBinding(EV_EditBindingMap * pebm);
00045     EV_EditBinding(EV_EditMethod * pem);
00046 
00047     EV_EditBindingType              getType() const { return m_ebt; }
00048     EV_EditBindingMap *             getMap(void) const;
00049     EV_EditMethod *                 getMethod(void) const;
00050 
00051 protected:
00052     EV_EditBindingType              m_ebt;      /* discriminant for union */
00053     union _u
00054     {
00055         EV_EditBindingMap *         m_pebm;     /* we should destroy *//* this binding is a prefix */
00056         EV_EditMethod *             m_pem;      /* we should not destroy *//* this binding completes sequence */
00057     } u;
00058 };
00059 
00060 /*****************************************************************/
00061 /*****************************************************************/
00062 
00063 class ev_EB_MouseTable;
00064 class ev_EB_NVK_Table;
00065 class ev_EB_Char_Table;
00066 
00067 /*****************************************************************/
00068 /*****************************************************************/
00069 
00070 class ABI_EXPORT EV_EditBindingMap
00071 {
00072 public:
00073     EV_EditBindingMap(EV_EditMethodContainer * pemc);
00074     ~EV_EditBindingMap();
00075 
00076     EV_EditBinding *    findEditBinding(EV_EditBits eb);
00077     bool                setBinding(EV_EditBits eb, const char * szMethodName);
00078     bool                setBinding(EV_EditBits eb, EV_EditBinding * peb);
00079     bool                removeBinding(EV_EditBits eb);
00080     bool                parseEditBinding(void);
00081 
00082                         // clears the entire map of ALL bindings
00083     void                resetAll(); // --foddex
00084                         // adds all editbits that are a short cut for the specified command name
00085                         // to the specified list. does NOT explicitly clear the list!
00086     void                findEditBits( const char* szMethodName, std::vector<EV_EditBits>& list ); // --foddex
00087                         // adds all known editbits and their commands to the specified map
00088                         // does NOT explicitly clear the map!
00089     void                getAll( std::map<EV_EditBits,const char*>& map ); // --foddex
00090 
00091     const char *        getShortcutFor(const EV_EditMethod * pEM) const;
00092 
00093 protected:
00094     EV_EditMethodContainer *    m_pemc;
00095 
00096     ev_EB_MouseTable *          m_pebMT[EV_COUNT_EMB];
00097     ev_EB_NVK_Table *           m_pebNVK;
00098     ev_EB_Char_Table *          m_pebChar;
00099 
00100     bool                bindingUsesMethod( EV_EditBinding* binding, EV_EditMethod* method );
00101     UT_uint32 m_iLastMouseNo;
00102 };
00103 
00104 /*****************************************************************/
00105 /*****************************************************************/
00106 
00107 bool EV_LoadBindings_Default(EV_EditMethodContainer * pemc,
00108                                 EV_EditBindingMap **ppebm);
00109 
00110 #endif /* EV_EDITBINDING_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1