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

gr_Control.h

Go to the documentation of this file.
00001 /* AbiSource Application Framework
00002  * Copyright (C) 2001 AbiSource, Inc.
00003  * Copyright (C) 2001 Dom Lachowicz <cinamod@hotmail.com>
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018  * 02110-1301 USA.
00019  */
00020 
00021 #ifndef GR_CONTROL_H
00022 #define GR_CONTROL_H
00023 
00024 #include "ut_types.h"
00025 #include "ut_bytebuf.h"
00026 
00027 class AV_View;
00028 class XAP_Frame;
00029 class GR_Graphics;
00030 
00037 class ABI_EXPORT GR_Control
00038 {
00039 
00040  public:
00041 
00045   virtual UT_Error isDrawable ( bool & drawable ) = 0;
00046 
00050   virtual UT_Error draw ( GR_Graphics * pGr,
00051               UT_uint32 x, UT_uint32 y ) = 0;
00052 
00057   virtual UT_Error isPersistable ( bool & persistable ) = 0;
00058 
00062   virtual UT_Error persist ( UT_ByteBuf * in ) = 0;
00063 
00067   virtual UT_Error _abi_callonce populate ( const UT_Byte * pBytes,
00068                         UT_uint32 dataLen ) = 0;
00069 
00073   virtual inline UT_Error _abi_callonce populate ( const UT_Bytebuf * pByteBuf )
00074     {
00075       return populate ( pByteBuf->getPointer(0), pByteBuf->getLength () );
00076     }
00077 
00081   virtual UT_Error getSize ( UT_uint32 &width, UT_uint32 &height ) = 0;
00082 
00086   virtual UT_Error resize ( UT_uint32 width, UT_uint32 height ) = 0;
00087 
00088  protected:
00089 
00093   GR_Control ( AV_View * pControllingView,
00094            XAP_Frame * pOwningFrame )
00095     : m_pView ( pControllingView ), m_pFrame ( pOwningFrame )
00096     {
00097     }
00098 
00102   virtual ~GR_Control ()
00103     {
00104     }
00105 
00109   inline AV_View * getControllingView () const
00110     {
00111       return m_pView;
00112     }
00113 
00117   inline XAP_Frame * getOwningFrame () const
00118     {
00119       return m_pFrame;
00120     }
00121 
00122  private:
00123 
00124   GR_Control ( const GR_Control & ); // no impl
00125   GR_Control & operator=( const GR_Control & ); // no impl
00126 
00127   AV_View   * m_pView;
00128   XAP_Frame * m_pFrame;
00129 };
00130 
00135 class ABI_EXPORT GR_ControlFactory
00136 {
00137 
00138  public:
00139 
00143   static GR_ControlFactory * instance ();   // actually defined in platform-specific code
00144 
00148   virtual ~GR_ControlFactory ()
00149     {
00150     }
00151 
00152   // pure virtual functions that are implemented in platform-specific code
00153 
00157   virtual UT_Error newControlForMimeType ( AV_View * pControllingView,
00158                        XAP_Frame * pOwningFrame,
00159                        const char * pszMime,
00160                        GR_Control ** pCtlOut ) = 0;
00161 
00165   virtual UT_Error newControlForExtension ( AV_View * pControllingView,
00166                         XAP_Frame * pOwningFrame,
00167                         const char * pszExt,
00168                         GR_Control ** pCtlOut ) = 0;
00169 
00174   virtual UT_Error newControlForData ( AV_View * pControllingView,
00175                        XAP_Frame * pOwningFrame,
00176                        const UT_Byte * pData,
00177                        UT_uint32 dataLen,
00178                        GR_Control ** pCtlOut ) = 0;
00179 
00184   inline UT_Error newControlForData ( AV_View * pControllingView,
00185                       XAP_Frame * pOwningFrame,
00186                       const UT_Bytebuf * pData,
00187                       GR_Control ** pCtlOut )
00188     {
00189       return newControlForData ( pControllingView, pOwningFrame,
00190                  pData->getPointer(0), pData->getLength(),
00191                  pCtlOut );
00192     }
00193 
00194  protected:
00195 
00199   GR_ControlFactory ()
00200     {
00201     }
00202 
00203  private:
00204 
00205   void operator delete ( GR_ControlFactory * ); // no impl
00206   GR_ControlFactory ( const GR_ControlFactory & ); // no impl
00207   GR_ControlFactory & operator=( const GR_ControlFactory & ); // no impl
00208 };
00209 
00210 #endif // GR_CONTROL_H

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1