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

xav_Listener.h

Go to the documentation of this file.
00001 /* AbiSource Application Framework
00002  * Copyright (C) 1998-2000 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 #ifndef AV_LISTENER_H
00022 #define AV_LISTENER_H
00023 
00024 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
00025  * so even if it's commented out in-file that's still a lot of work for
00026  * the preprocessor to do...
00027  */
00028 #ifndef UT_TYPES_H
00029 #include "ut_types.h"
00030 #endif
00031 
00032 class AV_View;
00033 
00034 typedef UT_uint32 AV_ListenerId;
00035 
00036 
00037 typedef enum _AV_ListenerType
00038 {
00039     AV_LISTENER_MENU,
00040     AV_LISTENER_TOOLBAR,
00041     AV_LISTENER_LEFTRULER,
00042     AV_LISTENER_TOPRULER,
00043     AV_LISTENER_SCROLLBAR,
00044     AV_LISTENER_VIEW,
00045     AV_LISTENER_STATUSBAR,
00046     AV_LISTENER_CARET,
00047     AV_LISTENER_PLUGIN,
00048     AV_LISTENER_PLUGIN_EXTRA
00049 
00050 } AV_ListenerType;
00051 
00052 // TODO how did we fill this mask so fast?
00053 // TODO next it'll need to become a 32-bit mask. YEP done! MES 2/10/2004
00054 typedef UT_uint32 AV_ChangeMask;
00055 #define AV_CHG_NONE         (static_cast<AV_ChangeMask>(0x0000))
00056 #define AV_CHG_DO           (static_cast<AV_ChangeMask>(0x0001))        // canDo
00057 #define AV_CHG_DIRTY        (static_cast<AV_ChangeMask>(0x0002))        // isDirty
00058 #define AV_CHG_EMPTYSEL     (static_cast<AV_ChangeMask>(0x0004))        // isSelectionEmpty
00059 #define AV_CHG_FILENAME     (static_cast<AV_ChangeMask>(0x0008))        // getFilename
00060 #define AV_CHG_FMTBLOCK     (static_cast<AV_ChangeMask>(0x0010))        // getBlockFormat
00061 #define AV_CHG_FMTCHAR      (static_cast<AV_ChangeMask>(0x0020))        // getCharFormat
00062 #define AV_CHG_CLIPBOARD    (static_cast<AV_ChangeMask>(0x0040))
00063 #define AV_CHG_PAGECOUNT    (static_cast<AV_ChangeMask>(0x0080))        // number of pages
00064 #define AV_CHG_WINDOWSIZE   (static_cast<AV_ChangeMask>(0x0100))
00065 #define AV_CHG_FMTSECTION   (static_cast<AV_ChangeMask>(0x0200))
00066 #define AV_CHG_COLUMN       (static_cast<AV_ChangeMask>(0x0400))
00067 #define AV_CHG_INPUTMODE    (static_cast<AV_ChangeMask>(0x0800))
00068 #define AV_CHG_FMTSTYLE     (static_cast<AV_ChangeMask>(0x1000))        // getStyle
00069 #define AV_CHG_INSERTMODE   (static_cast<AV_ChangeMask>(0x2000))
00070 #define AV_CHG_HDRFTR       (static_cast<AV_ChangeMask>(0x4000))
00071 #define AV_CHG_DIRECTIONMODE (static_cast<AV_ChangeMask>(0x4000))
00072 #define AV_CHG_FRAMEDATA    (static_cast<AV_ChangeMask>(0x8000))        // frame-level preferences (pFrameData)
00073 #define AV_CHG_KEYPRESSED   (static_cast<AV_ChangeMask>(0x10000))       // A key was pressed
00074 #define AV_CHG_BLOCKCHECK   (static_cast<AV_ChangeMask>(0x20000))       // Checking a block in background
00075 #define AV_CHG_FOCUS        (static_cast<AV_ChangeMask>(0x40000))       // Change of focus
00076 #define AV_CHG_MOUSEPOS     (static_cast<AV_ChangeMask>(0x80000))       // Change of mouse position
00077 #define AV_CHG_CELL         (static_cast<AV_ChangeMask>(0x100000))      // Change of active cell/caret moved out of table
00078 #define AV_CHG_ALL          (static_cast<AV_ChangeMask>(0xFFFFFFFF))
00079 
00080 #define AV_CHG_SAVE         (static_cast<AV_ChangeMask>(AV_CHG_DO | AV_CHG_DIRTY | AV_CHG_FILENAME))
00081 #define AV_CHG_TYPING       (static_cast<AV_ChangeMask>(AV_CHG_DO | AV_CHG_DIRTY | AV_CHG_EMPTYSEL | AV_CHG_COLUMN))
00082 #define AV_CHG_MOTION       (static_cast<AV_ChangeMask>(AV_CHG_EMPTYSEL | AV_CHG_FMTSTYLE | AV_CHG_FMTBLOCK | AV_CHG_FMTSECTION | AV_CHG_FMTCHAR | AV_CHG_COLUMN | AV_CHG_CELL))
00083 #define AV_CHG_STYLE_PARA   (static_cast<AV_ChangeMask>(AV_CHG_FMTBLOCK | AV_CHG_FMTCHAR))
00084 /*
00085     Various UI elements (title, toolbar, etc.) need to stay in sync with
00086     the current state of an AV_View.  They can do so by registering
00087     an AV_Listener with the AV_View in order to be notified of the existence
00088     of certain changes to the document as they occur.
00089 
00090     Note that these notifications do *not* pass any document state, they
00091     simply note the existence of a certain category of changes to that state.
00092 
00093     The view will notify each registered listener (in an undefined order).
00094     When the listener registers, it is provided an ID which may be used
00095     later to refer to it.
00096 */
00097 
00098 class ABI_EXPORT AV_Listener
00099 {
00100 public:
00101     virtual ~AV_Listener() {}
00102 
00103     virtual bool        notify(AV_View * pView, const AV_ChangeMask mask) = 0;
00104     virtual AV_ListenerType    getType(void) = 0;
00105 };
00106 
00107 
00108 class ABI_EXPORT AV_ListenerExtra : public AV_Listener
00109 {
00110 public:
00111     virtual bool        notify(AV_View * pView, const AV_ChangeMask mask, void * pPrivateData =NULL) = 0;
00112     virtual AV_ListenerType    getType(void) = 0;
00113 };
00114 
00115 #endif /* AV_LISTENER_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1