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

gr_UnixCairoGraphics.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 /* AbiWord
00003  * Copyright (C) 2004-2006 Tomas Frydrych <dr.tomas@yahoo.co.uk>
00004  * Copyright (C) 2009 Hubert Figuiere
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., 59 Temple Place - Suite 330, Boston, MA  
00019  * 02111-1307, USA.
00020  */
00021 
00022 
00023 #ifndef __GR_UNIXCAIROGRAPHICS_H__
00024 #define __GR_UNIXCAIROGRAPHICS_H__
00025 
00026 #include <gdk/gdk.h>
00027 #include "gr_CairoGraphics.h"
00028 
00029 class ABI_EXPORT GR_UnixCairoAllocInfo : public GR_CairoAllocInfo
00030 {
00031 public:
00032     GR_UnixCairoAllocInfo(GdkWindow * win, bool double_buffered=false)
00033         : GR_CairoAllocInfo(false, false, double_buffered),
00034         m_win(win)
00035         {}
00036     GR_UnixCairoAllocInfo(GtkWidget *widget)
00037         : GR_CairoAllocInfo(false, false, GTK_WIDGET_DOUBLE_BUFFERED(widget)),
00038           m_win(GTK_WIDGET(widget)->window)
00039     {}
00040     
00041     GR_UnixCairoAllocInfo(bool bPreview)
00042         : GR_CairoAllocInfo(bPreview, true, false),
00043           m_win(NULL){}
00044     virtual cairo_t *createCairo();
00045 
00046     GdkWindow     * m_win;
00047 };
00048 
00049 class ABI_EXPORT GR_UnixCairoGraphicsBase
00050     : public GR_CairoGraphics
00051 {
00052  public:
00053     ~GR_UnixCairoGraphicsBase();
00054 
00055     virtual GR_Image*   createNewImage(const char* pszName,
00056                                        const UT_ByteBuf* pBB,
00057                                        const std::string& mimetype,
00058                                        UT_sint32 iDisplayWidth,
00059                                        UT_sint32 iDisplayHeight,
00060                                        GR_Image::GRType =GR_Image::GRT_Raster);
00061  protected:
00062     GR_UnixCairoGraphicsBase();
00063     GR_UnixCairoGraphicsBase(cairo_t *cr, UT_uint32 iDeviceResolution);
00064 
00065 };
00066 
00067 
00068 class ABI_EXPORT GR_UnixCairoGraphics
00069     : public GR_UnixCairoGraphicsBase
00070 {
00071 public:
00072     ~GR_UnixCairoGraphics();
00073     static UT_uint32       s_getClassId() {return GRID_UNIX_PANGO;}
00074     virtual UT_uint32      getClassId() {return s_getClassId();}
00075 
00076     static const char *    graphicsDescriptor(){return "Unix Cairo Pango";}
00077     static GR_Graphics *   graphicsAllocator(GR_AllocInfo&);
00078     GdkWindow *  getWindow () {return m_pWin;}
00079 
00080     virtual GR_Font * getGUIFont(void);
00081     
00082     virtual void        setCursor(GR_Graphics::Cursor c);
00083     void                createPixmapFromXPM(char ** pXPM,GdkPixmap *source,
00084                                             GdkBitmap * mask);
00085     virtual void        scroll(UT_sint32, UT_sint32);
00086     virtual void        scroll(UT_sint32 x_dest, UT_sint32 y_dest,
00087                            UT_sint32 x_src, UT_sint32 y_src,
00088                            UT_sint32 width, UT_sint32 height);
00089     virtual void        saveRectangle(UT_Rect & r, UT_uint32 iIndx);
00090     virtual void        restoreRectangle(UT_uint32 iIndx);
00091     virtual GR_Image *  genImageFromRectangle(const UT_Rect & r);
00092 
00093     void                init3dColors(GtkStyle * pStyle);
00094     void                initWidget(GtkWidget *widget);
00095 
00096 protected:
00097     virtual void        _resetClip(void);
00098     static void     widget_size_allocate (GtkWidget        *widget,
00099                                       GtkAllocation    *allocation,
00100                                       GR_UnixCairoGraphics *me);
00101     GR_UnixCairoGraphics(GdkDrawable * win = NULL, bool double_buffered=false);
00102     virtual GdkDrawable * _getDrawable(void)
00103     {  return static_cast<GdkDrawable *>(m_pWin);}
00104 
00105     UT_GenericVector<UT_Rect*>     m_vSaveRect;
00106     UT_GenericVector<GdkPixbuf *>  m_vSaveRectBuf;
00107 
00108     virtual void _beginPaint();
00109     virtual void _endPaint();
00110 
00111 private:
00112     GdkWindow *m_pWin;
00113     bool m_double_buffered;
00114 };
00115 
00116 
00117 #endif
00118 

Generated on Sat Dec 3 2011 for AbiWord by  doxygen 1.7.1