initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
55
libs/wxWidgets-3.3.1/include/wx/gtk/private/cairo.h
Normal file
55
libs/wxWidgets-3.3.1/include/wx/gtk/private/cairo.h
Normal file
@@ -0,0 +1,55 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/private/cairo.h
|
||||
// Purpose: Cairo-related helpers
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2022-09-23
|
||||
// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_PRIVATE_CAIRO_H_
|
||||
#define _WX_GTK_PRIVATE_CAIRO_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Redefine GDK function to avoiding deprecation warnings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
|
||||
static inline
|
||||
cairo_t* wx_gdk_cairo_create(GdkWindow* w) { return gdk_cairo_create(w); }
|
||||
#define gdk_cairo_create wx_gdk_cairo_create
|
||||
|
||||
wxGCC_WARNING_RESTORE(deprecated-declarations)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RAII helper creating a Cairo context in ctor and destroying it in dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
namespace wxGTKImpl
|
||||
{
|
||||
|
||||
class CairoContext
|
||||
{
|
||||
public:
|
||||
explicit CairoContext(GdkWindow* window)
|
||||
: m_cr(gdk_cairo_create(window))
|
||||
{
|
||||
}
|
||||
|
||||
~CairoContext()
|
||||
{
|
||||
cairo_destroy(m_cr);
|
||||
}
|
||||
|
||||
operator cairo_t*() const { return m_cr; }
|
||||
|
||||
private:
|
||||
cairo_t* const m_cr;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(CairoContext);
|
||||
};
|
||||
|
||||
} // namespace wxGTKImpl
|
||||
|
||||
#endif // _WX_GTK_PRIVATE_CAIRO_H_
|
||||
Reference in New Issue
Block a user