// Generated by gmmproc 2.84.0 -- DO NOT MODIFY! #ifndef _GTKMM_STYLECONTEXT_H #define _GTKMM_STYLECONTEXT_H #ifndef GTKMM_DISABLE_DEPRECATED #include #include /* Copyright (C) 2010 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, see . */ #include #include #include #include #include #include #include #include #include #include // The entire file is deprecated. #ifndef DOXYGEN_SHOULD_SKIP_THIS using GtkStyleContext = struct _GtkStyleContext; using GtkStyleContextClass = struct _GtkStyleContextClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class GTKMM_API StyleContext_Class; } // namespace Gtk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gdk { class GTKMM_API Texture; } namespace Gtk { /** This object stores styling information affecting a widget defined by WidgetPath. * * In order to construct the final style information, StyleContext * queries information from all attached StyleProviders. Style providers * can be either attached explicitly to the context through * add_provider(), or to the display through * add_provider_for_display(). The resulting style is a * combination of all providers' information in priority order. * * For GTK+ widgets, any StyleContext returned by * Widget::get_style_context() will already have a WidgetPath, a * Gdk::Display and RTL/LTR information set, The style context will be also * updated automatically if any of these settings change on the widget. * *

Transition animations

* * StyleContext has built-in support for state change transitions. * Note that these animations respect the Settings::property_gtk_enable_animations() * setting. * * For simple widgets where state changes affect the whole widget area, * calling notify_state_change() with a no region * is sufficient to trigger the transition animation. And GTK+ already * does that when Widget::set_state() or Widget::set_state_flags() * are called. * * If a widget needs to declare several animatable regions (i.e. not * affecting the whole widget area), its Widget::signal_draw() signal handler * needs to wrap the render operations for the different regions with * calls to push_animatable_region() and * pop_animatable_region(). These methods take an * identifier for the region which must be unique within the style context. * For simple widgets with a fixed set of animatable regions, using an * enumeration works well. * * For complex widgets with an arbitrary number of animatable regions, it * is up to the implementation to come up with a way to uniquely identify * each animatable region. Using pointers to internal objects is one way * to achieve this. * * The widget also needs to notify the style context about a state change * for a given animatable region so the animation is triggered. * notify_state_change() can take no region IDs, meaning that the whole widget * area will be updated by the animation. * * @newin{3,0} * @deprecated 4.10: The relevant API has been moved to Gtk::Widget and * Gtk::StyleProvider where applicable; otherwise, there is no replacement * for querying the style machinery. Stylable UI elements should use widgets. */ class GTKMM_API StyleContext : public Glib::Object { #ifndef DOXYGEN_SHOULD_SKIP_THIS public: using CppObjectType = StyleContext; using CppClassType = StyleContext_Class; using BaseObjectType = GtkStyleContext; using BaseClassType = GtkStyleContextClass; // noncopyable StyleContext(const StyleContext&) = delete; StyleContext& operator=(const StyleContext&) = delete; private: friend class StyleContext_Class; static CppClassType stylecontext_class_; protected: explicit StyleContext(const Glib::ConstructParams& construct_params); explicit StyleContext(GtkStyleContext* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: StyleContext(StyleContext&& src) noexcept; StyleContext& operator=(StyleContext&& src) noexcept; ~StyleContext() 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. GtkStyleContext* gobj() { return reinterpret_cast(gobject_); } ///Provides access to the underlying C GObject. const GtkStyleContext* 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. GtkStyleContext* gobj_copy(); private: protected: StyleContext(); public: /** @addtogroup gtkmmEnums gtkmm Enums and Flags */ /** * @var PrintFlags::NONE * Default value. * * @var PrintFlags::RECURSE * Print the entire tree of * CSS nodes starting at the style context's node. * * @var PrintFlags::SHOW_STYLE * Show the values of the * CSS properties for each node. * * @var PrintFlags::SHOW_CHANGE * Show information about * what changes affect the styles. */ /** Flags that modify the behavior of Gtk::StyleContext::to_string(). * * New values may be added to this enumeration. * * @ingroup gtkmmEnums * @par Bitwise operators: * StyleContext::PrintFlags operator|(StyleContext::PrintFlags, StyleContext::PrintFlags)
* StyleContext::PrintFlags operator&(StyleContext::PrintFlags, StyleContext::PrintFlags)
* StyleContext::PrintFlags operator^(StyleContext::PrintFlags, StyleContext::PrintFlags)
* StyleContext::PrintFlags operator~(StyleContext::PrintFlags)
* StyleContext::PrintFlags& operator|=(StyleContext::PrintFlags&, StyleContext::PrintFlags)
* StyleContext::PrintFlags& operator&=(StyleContext::PrintFlags&, StyleContext::PrintFlags)
* StyleContext::PrintFlags& operator^=(StyleContext::PrintFlags&, StyleContext::PrintFlags)
*/ enum class PrintFlags { NONE = 0x0, RECURSE = 1 << 0, SHOW_STYLE = 1 << 1, SHOW_CHANGE = 1 << 2 }; #ifndef GTKMM_DISABLE_DEPRECATED /** Adds a global style provider to @a display, which will be used * in style construction for all `Gtk::StyleContexts` under @a display. * * GTK uses this to make styling information from `Gtk::Settings` * available. * * @note If both priorities are the same, A `Gtk::StyleProvider` * added through add_provider() takes * precedence over another added through this function. * * @deprecated Use Gtk::StyleProvider::add_provider_for_display() instead. * * @param display A `Gdk::Display`. * @param provider A `Gtk::StyleProvider`. * @param priority The priority of the style provider. The lower * it is, the earlier it will be used in the style construction. * Typically this will be in the range between * GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and * GTK_STYLE_PROVIDER_PRIORITY_USER. */ static void add_provider_for_display(const Glib::RefPtr& display, const Glib::RefPtr& provider, guint priority); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Removes @a provider from the global style providers list in @a display. * * @deprecated Use Gtk::StyleProvider::remove_provider_for_display() instead. * * @param display A `Gdk::Display`. * @param provider A `Gtk::StyleProvider`. */ static void remove_provider_for_display(const Glib::RefPtr& display, const Glib::RefPtr& provider); #endif // GTKMM_DISABLE_DEPRECATED /** Adds a style provider to @a context, to be used in style construction. * * Note that a style provider added by this function only affects * the style of the widget to which @a context belongs. If you want * to affect the style of all widgets, use * add_provider_for_display(). * * @note If both priorities are the same, a `Gtk::StyleProvider` * added through this function takes precedence over another added * through add_provider_for_display(). * * Deprecated: 4.10: Use style classes instead * * @param provider A `Gtk::StyleProvider`. * @param priority The priority of the style provider. The lower * it is, the earlier it will be used in the style construction. * Typically this will be in the range between * GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and * GTK_STYLE_PROVIDER_PRIORITY_USER. */ void add_provider(const Glib::RefPtr& provider, guint priority); /** Removes @a provider from the style providers list in @a context. * * Deprecated: 4.10 * * @param provider A `Gtk::StyleProvider`. */ void remove_provider(const Glib::RefPtr& provider); /** Saves the @a context state. * * This allows temporary modifications done through * add_class(), * remove_class(), * set_state() to be quickly * reverted in one go through restore(). * * The matching call to restore() * must be done before GTK returns to the main loop. * * Deprecated: 4.10: This API will be removed in GTK 5 */ void context_save(); /** Restores @a context state to a previous stage. * * See save(). * * Deprecated: 4.10: This API will be removed in GTK 5 */ void context_restore(); #ifndef GTKMM_DISABLE_DEPRECATED /** Sets the state to be used for style matching. * * Deprecated: 4.10: You should not use this api * * @deprecated You should not use this api. * * @param flags State to represent. */ void set_state(StateFlags flags); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Returns the state used for style matching. * * This method should only be used to retrieve the `Gtk::StateFlags` * to pass to `Gtk::StyleContext` methods, like * get_padding(). * If you need to retrieve the current state of a `Gtk::Widget`, use * Gtk::Widget::get_state_flags(). * * Deprecated: 4.10: Use Gtk::Widget::get_state_flags() instead * * @deprecated Use Gtk::Widget::get_state_flags() instead. * * @return The state flags. */ StateFlags get_state() const; #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Sets the scale to use when getting image assets for the style. * * Deprecated: 4.10: You should not use this api * * @deprecated You should not use this api. * * @param scale Scale. */ void set_scale(int scale); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Returns the scale used for assets. * * Deprecated: 4.10: Use Gtk::Widget::get_scale_factor() instead * * @deprecated Use Gtk::Widget::get_scale_factor() instead. * * @return The scale. */ int get_scale() const; #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Adds a style class to @a context, so later uses of the * style context will make use of this new class for styling. * * In the CSS file format, a `Gtk::Entry` defining a “search” * class, would be matched by: * * * [C example ellipted] * * While any widget defining a “search” class would be * matched by: * * [C example ellipted] * Deprecated: 4.10: Use Gtk::Widget::add_css_class() instead * * @deprecated Use Gtk::Widget::add_css_class() instead. * * @param class_name Class name to use in styling. */ void add_class(const Glib::ustring& class_name); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Removes @a class_name from @a context. * * Deprecated: 4.10: Use Gtk::Widget::remove_css_class() instead * * @deprecated Use Gtk::Widget::remove_css_class() instead. * * @param class_name Class name to remove. */ void remove_class(const Glib::ustring& class_name); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Returns true if @a context currently has defined the * given class name. * * Deprecated: 4.10: Use Gtk::Widget::has_css_class() instead * * @deprecated Use Gtk::Widget::has_css_class() instead. * * @param class_name A class name. * @return true if @a context has @a class_name defined. */ bool has_class(const Glib::ustring& class_name); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Attaches @a context to the given display. * * The display is used to add style information from “global” * style providers, such as the display's `Gtk::Settings` instance. * * If you are using a `Gtk::StyleContext` returned from * Gtk::Widget::get_style_context(), you do not need to * call this yourself. * * Deprecated: 4.10: You should not use this api * * @deprecated You should not use this api. * * @param display A `Gdk::Display`. */ void set_display(const Glib::RefPtr& display); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Returns the `Gdk::Display` to which @a context is attached. * * Deprecated: 4.10: Use Gtk::Widget::get_display() instead * * @deprecated Use Gtk::Widget::get_display() instead. * * @return A `Gdk::Display`. */ Glib::RefPtr get_display(); #endif // GTKMM_DISABLE_DEPRECATED #ifndef GTKMM_DISABLE_DEPRECATED /** Returns the `Gdk::Display` to which @a context is attached. * * Deprecated: 4.10: Use Gtk::Widget::get_display() instead * * @deprecated Use Gtk::Widget::get_display() instead. * * @return A `Gdk::Display`. */ Glib::RefPtr get_display() const; #endif // GTKMM_DISABLE_DEPRECATED /** Looks up and resolves a color name in the @a context color map. * * Deprecated: 4.10: This api will be removed in GTK 5 * * @param color_name Color name to lookup. * @param color Return location for the looked up color. * @return true if @a color_name was found and resolved, false otherwise. */ bool lookup_color(const Glib::ustring& color_name, Gdk::RGBA& color); /** Gets the foreground color for a given state. * * @newin{3,0} * @deprecated Use Gtk::Widget::get_color() instead. * * @return The foreground color for the given state. */ Gdk::RGBA get_color() const; Border get_border() const; Border get_padding() const; Border get_margin() const; /** Renders a checkmark (as in a `Gtk::CheckButton`). * * The Gtk::StateFlags::CHECKED state determines whether the check is * on or off, and Gtk::StateFlags::INCONSISTENT determines whether it * should be marked as undefined. * * Typical checkmark rendering: * * ![](checks.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_check(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders an option mark (as in a radio button), the Gtk::StateFlags::CHECKED * state will determine whether the option is on or off, and * Gtk::StateFlags::INCONSISTENT whether it should be marked as undefined. * * Typical option mark rendering: * * ![](options.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_option(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders an arrow pointing to @a angle. * * Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π: * * ![](arrows.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param angle Arrow angle from 0 to 2 * G_PI, being 0 the arrow pointing to the north. * @param x X origin of the render area. * @param y Y origin of the render area. * @param size Square side for render area. */ void render_arrow(const Cairo::RefPtr& cr, double angle, double x, double y, double size); /** Renders the background of an element. * * Typical background rendering, showing the effect of * `background-image`, `border-width` and `border-radius`: * * ![](background.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_background(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders a frame around the rectangle defined by @a x, @a y, @a width, @a height. * * Examples of frame rendering, showing the effect of `border-image`, * `border-color`, `border-width`, `border-radius` and junctions: * * ![](frames.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_frame(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders an expander (as used in `Gtk::TreeView` and `Gtk::Expander`) in the area * defined by @a x, @a y, @a width, @a height. The state Gtk::StateFlags::CHECKED * determines whether the expander is collapsed or expanded. * * Typical expander rendering: * * ![](expanders.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_expander(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders a focus indicator on the rectangle determined by @a x, @a y, @a width, @a height. * * Typical focus rendering: * * ![](focus.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_focus(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders @a layout on the coordinates @a x, @a y * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin. * @param y Y origin. * @param layout The `Pango::Layout` to render. */ void render_layout(const Cairo::RefPtr& cr, double x, double y, const Glib::RefPtr& layout); /** Renders a line from (x0, y0) to (x1, y1). * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x0 X coordinate for the origin of the line. * @param y0 Y coordinate for the origin of the line. * @param x1 X coordinate for the end of the line. * @param y1 Y coordinate for the end of the line. */ void render_line(const Cairo::RefPtr& cr, double x0, double y0, double x1, double y1); /** Renders a handle (as in `Gtk::Paned` and `Gtk::Window`’s resize grip), * in the rectangle determined by @a x, @a y, @a width, @a height. * * Handles rendered for the paned and grip classes: * * ![](handles.png) * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_handle(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders an activity indicator (such as in `Gtk::Spinner`). * The state Gtk::StateFlags::CHECKED determines whether there is * activity going on. * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param x X origin of the rectangle. * @param y Y origin of the rectangle. * @param width Rectangle width. * @param height Rectangle height. */ void render_activity(const Cairo::RefPtr& cr, double x, double y, double width, double height); /** Renders the icon in @a texture at the specified @a x and @a y coordinates. * * This function will render the icon in @a texture at exactly its size, * regardless of scaling factors, which may not be appropriate when * drawing on displays with high pixel densities. * * Deprecated: 4.10 * * @param cr A `cairo_t`. * @param texture A `Gdk::Texture` containing the icon to draw. * @param x X position for the @a texture. * @param y Y position for the @a texture. */ void render_icon(const Cairo::RefPtr& cr, const Glib::RefPtr& texture, double x, double y); /** Converts the style context into a string representation. * * The string representation always includes information about * the name, state, id, visibility and style classes of the CSS * node that is backing @a context. Depending on the flags, more * information may be included. * * This function is intended for testing and debugging of the * CSS implementation in GTK. There are no guarantees about * the format of the returned string, it may change. * * Deprecated: 4.10: This api will be removed in GTK 5 * * @param flags Flags that determine what to print. * @return A newly allocated string representing @a context. */ Glib::ustring to_string(PrintFlags flags) const; /** The display of the style context. * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::RefPtr > property_display() ; /** The display of the style context. * * @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_display() const; public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: }; } // namespace Gtk namespace Gtk { /** @ingroup gtkmmEnums */ inline constexpr StyleContext::PrintFlags operator|(StyleContext::PrintFlags lhs, StyleContext::PrintFlags rhs) { return static_cast(static_cast(lhs) | static_cast(rhs)); } /** @ingroup gtkmmEnums */ inline constexpr StyleContext::PrintFlags operator&(StyleContext::PrintFlags lhs, StyleContext::PrintFlags rhs) { return static_cast(static_cast(lhs) & static_cast(rhs)); } /** @ingroup gtkmmEnums */ inline constexpr StyleContext::PrintFlags operator^(StyleContext::PrintFlags lhs, StyleContext::PrintFlags rhs) { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } /** @ingroup gtkmmEnums */ inline constexpr StyleContext::PrintFlags operator~(StyleContext::PrintFlags flags) { return static_cast(~static_cast(flags)); } /** @ingroup gtkmmEnums */ inline StyleContext::PrintFlags& operator|=(StyleContext::PrintFlags& lhs, StyleContext::PrintFlags rhs) { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } /** @ingroup gtkmmEnums */ inline StyleContext::PrintFlags& operator&=(StyleContext::PrintFlags& lhs, StyleContext::PrintFlags rhs) { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } /** @ingroup gtkmmEnums */ inline StyleContext::PrintFlags& operator^=(StyleContext::PrintFlags& lhs, StyleContext::PrintFlags rhs) { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } } // namespace Gtk #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Glib { template <> class GTKMM_API Value : public Glib::Value_Flags { public: static GType value_type() G_GNUC_CONST; }; } // namespace Glib #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 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 Gtk::StyleContext */ GTKMM_API Glib::RefPtr wrap(GtkStyleContext* object, bool take_copy = false); } #endif // GTKMM_DISABLE_DEPRECATED #endif /* _GTKMM_STYLECONTEXT_H */