// Generated by gmmproc 2.82.0 -- DO NOT MODIFY! #ifndef _GDKMM_CURSOR_H #define _GDKMM_CURSOR_H #include #include /* * Copyright (C) 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include #ifndef DOXYGEN_SHOULD_SKIP_THIS using GdkCursor = struct _GdkCursor; using GdkCursorClass = struct _GdkCursorClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gdk { class GDKMM_API Cursor_Class; } // namespace Gdk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gdk { /** %Gdk::Cursor is used to create and destroy cursors. * * Cursors are immutable objects, so once you created them, there is no way * to modify them later. You should create a new cursor when you want to change * something about it. * * Cursors by themselves are not very interesting: they must be bound to a * window for users to see them. This is done with Gdk::Surface::set_cursor() * or Gdk::Surface::set_device_cursor(). Applications will typically * use higher-level GTK functions such as Gtk::Widget::set_cursor() instead. * * Cursors are not bound to a given Gdk::Display, so they can be shared. * However, the appearance of cursors may vary when used on different platforms. * * ## Named and texture cursors * * There are multiple ways to create cursors. The platform's own cursors can be * created with create(const Glib::ustring& name, const Glib::RefPtr& fallback). * That function lists the commonly available names that are shared with the CSS * specification. Other names may be available, depending on the platform in use. * On some platforms, what images are used for named cursors may be influenced by * the cursor theme. * * Another option to create a cursor is to use * create(const Glib::RefPtr& texture, int hotspot_x, int hotspot_y, * const Glib::RefPtr& fallback) * and provide an image to use for the cursor. * * To ease work with unsupported cursors, a fallback cursor can be provided. * If a Gdk::Surface cannot use a cursor, it will try the fallback cursor. * Fallback cursors can themselves have fallback cursors again, so it is possible * to provide a chain of progressively easier to support cursors. If none of * the provided cursors can be supported, the default cursor will be the ultimate * fallback. */ class GDKMM_API Cursor : public Glib::Object { #ifndef DOXYGEN_SHOULD_SKIP_THIS public: using CppObjectType = Cursor; using CppClassType = Cursor_Class; using BaseObjectType = GdkCursor; using BaseClassType = GdkCursorClass; // noncopyable Cursor(const Cursor&) = delete; Cursor& operator=(const Cursor&) = delete; private: friend class Cursor_Class; static CppClassType cursor_class_; protected: explicit Cursor(const Glib::ConstructParams& construct_params); explicit Cursor(GdkCursor* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: Cursor(Cursor&& src) noexcept; Cursor& operator=(Cursor&& src) noexcept; ~Cursor() noexcept override; /** Get the GType for this class, for use with the underlying GObject type system. */ static GType get_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_base_type() G_GNUC_CONST; #endif ///Provides access to the underlying C GObject. GdkCursor* gobj() { return reinterpret_cast(gobject_); } ///Provides access to the underlying C GObject. const GdkCursor* gobj() const { return reinterpret_cast(gobject_); } ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. GdkCursor* gobj_copy(); private: //We use DO_NOT_DERIVE_GTYPE because glib does not allow us to derive from a non-fundamental (abstract) type, for some reason. protected: public: //We use _WRAP_METHOD() instead of _WRAP_CREATE() and constructors, //because the gdk_cursor_new_*() functions actually return existing instances sometimes, //but constructors assume that they own the instance. //And we would have to have to use the gdk_cursor_new_*() functions in the constructors anyway, //because they do more than just call g_object_new(). /** Creates a new cursor from a `Gdk::Texture`. * * @param texture The texture providing the pixel data. * @param hotspot_x The horizontal offset of the “hotspot” of the cursor. * @param hotspot_y The vertical offset of the “hotspot” of the cursor. * @param fallback The `Gdk::Cursor` to fall back to when * this one cannot be supported. * @return A new `Gdk::Cursor`. */ static Glib::RefPtr create(const Glib::RefPtr& texture, int hotspot_x, int hotspot_y, const Glib::RefPtr& fallback = {}); /** Creates a new cursor by looking up @a name in the current cursor * theme. * * A recommended set of cursor names that will work across different * platforms can be found in the CSS specification: * * | | | | | * | --- | --- | ---- | --- | * | "none" | ![](default_cursor.png) "default" | ![](help_cursor.png) "help" | ![](pointer_cursor.png) "pointer" | * | ![](context_menu_cursor.png) "context-menu" | ![](progress_cursor.png) "progress" | ![](wait_cursor.png) "wait" | ![](cell_cursor.png) "cell" | * | ![](crosshair_cursor.png) "crosshair" | ![](text_cursor.png) "text" | ![](vertical_text_cursor.png) "vertical-text" | ![](alias_cursor.png) "alias" | * | ![](copy_cursor.png) "copy" | ![](no_drop_cursor.png) "no-drop" | ![](move_cursor.png) "move" | ![](not_allowed_cursor.png) "not-allowed" | * | ![](grab_cursor.png) "grab" | ![](grabbing_cursor.png) "grabbing" | ![](all_scroll_cursor.png) "all-scroll" | ![](col_resize_cursor.png) "col-resize" | * | ![](row_resize_cursor.png) "row-resize" | ![](n_resize_cursor.png) "n-resize" | ![](e_resize_cursor.png) "e-resize" | ![](s_resize_cursor.png) "s-resize" | * | ![](w_resize_cursor.png) "w-resize" | ![](ne_resize_cursor.png) "ne-resize" | ![](nw_resize_cursor.png) "nw-resize" | ![](sw_resize_cursor.png) "sw-resize" | * | ![](se_resize_cursor.png) "se-resize" | ![](ew_resize_cursor.png) "ew-resize" | ![](ns_resize_cursor.png) "ns-resize" | ![](nesw_resize_cursor.png) "nesw-resize" | * | ![](nwse_resize_cursor.png) "nwse-resize" | ![](zoom_in_cursor.png) "zoom-in" | ![](zoom_out_cursor.png) "zoom-out" | | * * @param name The name of the cursor. * @param fallback nullptr or the `Gdk::Cursor` to fall back to when * this one cannot be supported. * @return A new `Gdk::Cursor`, or nullptr if there is no * cursor with the given name. */ static Glib::RefPtr create(const Glib::ustring& name, const Glib::RefPtr& fallback = {}); /** Callback used by a dynamic %Gdk::Cursor to generate * a texture for the cursor image at the given @a cursor_size and @a scale. * * The actual cursor size in application pixels may be different * from @a cursor_size x @a cursor_size, and will be returned in * @a width, @a height. The returned texture should have a size that * corresponds to the actual cursor size, in device pixels (i.e. * application pixels, multiplied by @a scale). * * This function may fail and return an empty RefPtr, in which case * the fallback cursor will be used. * * @param cursor_size The nominal cursor size, in application pixels. * @param scale The device scale. * @param[out] width Return location for the actual cursor width, * in application pixels. * @param[out] height Return location for the actual cursor height, * in application pixels. * @param[out] hotspot_x Return location for the hotspot X position, * in application pixels. * @param[out] hotspot_y Return location for the hotspot Y position, * in application pixels. * @return The cursor image, or an empty RefPtr if none could be produced.. * * @newin{4,16} */ using SlotGetTexture = sigc::slot(int, double, int&, int&, int&, int&)>; /** Creates a new callback-based cursor object. * * Cursors of this kind produce textures for the cursor * image on demand, when the @a slot is called. * * @newin{4,16} * * @param slot Callback that lets you create a suitable texture. * @param fallback The %Gdk::Cursor to fall back to when this one cannot be supported. * @return A new %Gdk::Cursor. */ static Glib::RefPtr create_from_slot(const SlotGetTexture& slot, const Glib::RefPtr& fallback = {}); /** Returns the fallback for this @a cursor. * * The fallback will be used if this cursor is not available on a given * `Gdk::Display`. For named cursors, this can happen when using nonstandard * names or when using an incomplete cursor theme. For textured cursors, * this can happen when the texture is too large or when the `Gdk::Display` * it is used on does not support textured cursors. * * @return The fallback of the cursor or nullptr * to use the default cursor as fallback. */ Glib::RefPtr get_fallback(); /** Returns the fallback for this @a cursor. * * The fallback will be used if this cursor is not available on a given * `Gdk::Display`. For named cursors, this can happen when using nonstandard * names or when using an incomplete cursor theme. For textured cursors, * this can happen when the texture is too large or when the `Gdk::Display` * it is used on does not support textured cursors. * * @return The fallback of the cursor or nullptr * to use the default cursor as fallback. */ Glib::RefPtr get_fallback() const; /** Returns the name of the cursor. * * If the cursor is not a named cursor, nullptr will be returned. * * @return The name of the cursor or nullptr * if it is not a named cursor. */ Glib::ustring get_name() const; /** Returns the texture for the cursor. * * If the cursor is a named cursor, nullptr will be returned. * * @return The texture for cursor or nullptr * if it is a named cursor. */ Glib::RefPtr get_texture(); /** Returns the texture for the cursor. * * If the cursor is a named cursor, nullptr will be returned. * * @return The texture for cursor or nullptr * if it is a named cursor. */ Glib::RefPtr get_texture() const; /** Returns the horizontal offset of the hotspot. * * The hotspot indicates the pixel that will be directly above the cursor. * * Note that named cursors may have a nonzero hotspot, but this function * will only return the hotspot position for cursors created with * new_from_texture(). * * @return The horizontal offset of the hotspot or 0 for named cursors. */ int get_hotspot_x() const; /** Returns the vertical offset of the hotspot. * * The hotspot indicates the pixel that will be directly above the cursor. * * Note that named cursors may have a nonzero hotspot, but this function * will only return the hotspot position for cursors created with * new_from_texture(). * * @return The vertical offset of the hotspot or 0 for named cursors. */ int get_hotspot_y() const; /** Cursor to fall back to if this cursor cannot be displayed. * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_fallback() const; /** X position of the cursor hotspot in the cursor image. * * Default value: 0 * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< int > property_hotspot_x() const; /** Y position of the cursor hotspot in the cursor image. * * Default value: 0 * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< int > property_hotspot_y() const; /** Name of this this cursor. * * The name will be nullptr if the cursor was created from a texture. * * Default value: "" * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::ustring > property_name() const; /** The texture displayed by this cursor. * * The texture will be nullptr if the cursor was created from a name. * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_texture() const; public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: }; } //namespace Gdk namespace Glib { /** A Glib::wrap() method for this object. * * @param object The C instance. * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. * @result A C++ instance that wraps this C instance. * * @relates Gdk::Cursor */ GDKMM_API Glib::RefPtr wrap(GdkCursor* object, bool take_copy = false); } #endif /* _GDKMM_CURSOR_H */