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 "ut_compiler.h"
00027
00028 ABI_W_NO_CONST_QUAL
00029 #include <gdk/gdk.h>
00030 ABI_W_POP
00031 #include "gr_CairoGraphics.h"
00032
00033 class ABI_EXPORT GR_UnixCairoAllocInfo : public GR_CairoAllocInfo
00034 {
00035 public:
00036 GR_UnixCairoAllocInfo(GdkWindow * win, bool double_buffered=true)
00037 : GR_CairoAllocInfo(false, false, double_buffered),
00038 m_win(win)
00039 {}
00040 GR_UnixCairoAllocInfo(GtkWidget *widget)
00041 : GR_CairoAllocInfo(false, false, true),
00042 m_win(gtk_widget_get_window(GTK_WIDGET(widget)))
00043 {}
00044
00045 GR_UnixCairoAllocInfo(bool bPreview)
00046 : GR_CairoAllocInfo(bPreview, true, false),
00047 m_win(NULL){}
00048
00049 cairo_t *createCairo() {return NULL;}
00050 GdkWindow * m_win;
00051 };
00052
00053 class ABI_EXPORT GR_UnixCairoGraphicsBase
00054 : public GR_CairoGraphics
00055 {
00056 public:
00057 ~GR_UnixCairoGraphicsBase();
00058
00059 virtual GR_Image* createNewImage(const char* pszName,
00060 const UT_ConstByteBufPtr& pBB,
00061 const std::string& mimetype,
00062 UT_sint32 iDisplayWidth,
00063 UT_sint32 iDisplayHeight,
00064 GR_Image::GRType =GR_Image::GRT_Raster);
00065 protected:
00066 GR_UnixCairoGraphicsBase();
00067 GR_UnixCairoGraphicsBase(cairo_t *cr, UT_uint32 iDeviceResolution);
00068
00069 };
00070
00071
00072 class ABI_EXPORT GR_UnixCairoGraphics
00073 : public GR_UnixCairoGraphicsBase
00074 {
00075 public:
00076 ~GR_UnixCairoGraphics();
00077 static UT_uint32 s_getClassId() {return GRID_UNIX_PANGO;}
00078 virtual UT_uint32 getClassId() {return s_getClassId();}
00079
00080 static const char * graphicsDescriptor(){return "Unix Cairo Pango";}
00081 static GR_Graphics * graphicsAllocator(GR_AllocInfo&);
00082 GdkWindow * getWindow () {return m_pWin;}
00083
00084 virtual GR_Font * getGUIFont(void);
00085
00086 virtual void setCursor(GR_Graphics::Cursor c);
00087 virtual void scroll(UT_sint32, UT_sint32);
00088 virtual void scroll(UT_sint32 x_dest, UT_sint32 y_dest,
00089 UT_sint32 x_src, UT_sint32 y_src,
00090 UT_sint32 width, UT_sint32 height);
00091 virtual GR_Image * genImageFromRectangle(const UT_Rect & r);
00092
00093 void init3dColors(GtkWidget* w);
00094 void initWidget(GtkWidget *widget);
00095 virtual bool queryProperties(GR_Graphics::Properties gp) const;
00096
00098 virtual bool getColor3D(GR_Color3D name, UT_RGBColor &color);
00099
00100 virtual void fillRect(GR_Color3D c,
00101 UT_sint32 x, UT_sint32 y,
00102 UT_sint32 w, UT_sint32 h);
00103 virtual void flush(void);
00104
00105 protected:
00106 virtual void _resetClip(void);
00107 static void widget_size_allocate (GtkWidget *widget,
00108 GtkAllocation *allocation,
00109 GR_UnixCairoGraphics *me);
00110 static void widget_destroy (GtkWidget *widget,
00111 GR_UnixCairoGraphics *me);
00112 GR_UnixCairoGraphics(GdkWindow * win = NULL, bool double_buffered=true);
00113 virtual GdkWindow * _getWindow(void)
00114 { return m_pWin;}
00115
00116 virtual void _beginPaint();
00117 virtual void _endPaint();
00118
00119 private:
00120 GdkWindow *m_pWin;
00121 bool m_CairoCreated;
00122 bool m_Painting;
00123 gulong m_Signal, m_DestroySignal;
00124 GtkWidget *m_Widget;
00125 GtkStyleContext* m_styleBg;
00126 GtkStyleContext* m_styleHighlight;
00127 };
00128
00129
00130 #endif
00131