Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __GR_UNIXCAIROGRAPHICS_H__
00024 #define __GR_UNIXCAIROGRAPHICS_H__
00025
00026 #include <gdk/gdk.h>
00027 #include "xap_Gtk2Compat.h"
00028 #include "gr_CairoGraphics.h"
00029
00030 class ABI_EXPORT GR_UnixCairoAllocInfo : public GR_CairoAllocInfo
00031 {
00032 public:
00033 GR_UnixCairoAllocInfo(GdkWindow * win, bool double_buffered=false)
00034 : GR_CairoAllocInfo(false, false, double_buffered),
00035 m_win(win)
00036 {}
00037 GR_UnixCairoAllocInfo(GtkWidget *widget)
00038 : GR_CairoAllocInfo(false, false, gtk_widget_get_double_buffered(widget)),
00039 m_win(gtk_widget_get_window(GTK_WIDGET(widget)))
00040 {}
00041
00042 GR_UnixCairoAllocInfo(bool bPreview)
00043 : GR_CairoAllocInfo(bPreview, true, false),
00044 m_win(NULL){}
00045
00046 cairo_t *createCairo() {return NULL;}
00047 GdkWindow * m_win;
00048 };
00049
00050 class ABI_EXPORT GR_UnixCairoGraphicsBase
00051 : public GR_CairoGraphics
00052 {
00053 public:
00054 ~GR_UnixCairoGraphicsBase();
00055
00056 virtual GR_Image* createNewImage(const char* pszName,
00057 const UT_ByteBuf* pBB,
00058 const std::string& mimetype,
00059 UT_sint32 iDisplayWidth,
00060 UT_sint32 iDisplayHeight,
00061 GR_Image::GRType =GR_Image::GRT_Raster);
00062 protected:
00063 GR_UnixCairoGraphicsBase();
00064 GR_UnixCairoGraphicsBase(cairo_t *cr, UT_uint32 iDeviceResolution);
00065
00066 };
00067
00068
00069 class ABI_EXPORT GR_UnixCairoGraphics
00070 : public GR_UnixCairoGraphicsBase
00071 {
00072 public:
00073 ~GR_UnixCairoGraphics();
00074 static UT_uint32 s_getClassId() {return GRID_UNIX_PANGO;}
00075 virtual UT_uint32 getClassId() {return s_getClassId();}
00076
00077 static const char * graphicsDescriptor(){return "Unix Cairo Pango";}
00078 static GR_Graphics * graphicsAllocator(GR_AllocInfo&);
00079 GdkWindow * getWindow () {return m_pWin;}
00080
00081 virtual GR_Font * getGUIFont(void);
00082
00083 virtual void setCursor(GR_Graphics::Cursor c);
00084 virtual void scroll(UT_sint32, UT_sint32);
00085 virtual void scroll(UT_sint32 x_dest, UT_sint32 y_dest,
00086 UT_sint32 x_src, UT_sint32 y_src,
00087 UT_sint32 width, UT_sint32 height);
00088 virtual GR_Image * genImageFromRectangle(const UT_Rect & r);
00089
00090 void init3dColors(GtkWidget* w);
00091 #if !GTK_CHECK_VERSION(3,0,0)
00092 void init3dColors(GtkStyle* pStyle);
00093 #endif
00094 void initWidget(GtkWidget *widget);
00095 virtual bool queryProperties(GR_Graphics::Properties gp) const;
00096
00097 protected:
00098 virtual void _resetClip(void);
00099 static void widget_size_allocate (GtkWidget *widget,
00100 GtkAllocation *allocation,
00101 GR_UnixCairoGraphics *me);
00102 static void widget_destroy (GtkWidget *widget,
00103 GR_UnixCairoGraphics *me);
00104 GR_UnixCairoGraphics(GdkWindow * win = NULL, bool double_buffered=false);
00105 virtual GdkWindow * _getWindow(void)
00106 { return m_pWin;}
00107
00108 virtual void _beginPaint();
00109 virtual void _endPaint();
00110
00111 private:
00112 GdkWindow *m_pWin;
00113 bool m_double_buffered;
00114 bool m_CairoCreated;
00115 bool m_Painting;
00116 gulong m_Signal, m_DestroySignal;
00117 GtkWidget *m_Widget;
00118 };
00119
00120
00121 #endif
00122