tooltip: Use an element name
This will allow us to drop hardcoded type names in the theme.
This commit is contained in:
parent
1760ada1ff
commit
efc8dc63e3
@ -36,6 +36,8 @@
|
|||||||
#include "gtkstylecontext.h"
|
#include "gtkstylecontext.h"
|
||||||
#include "gtkwindowprivate.h"
|
#include "gtkwindowprivate.h"
|
||||||
#include "gtkaccessible.h"
|
#include "gtkaccessible.h"
|
||||||
|
#include "gtkcssnodeprivate.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_WAYLAND
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
@ -57,7 +59,7 @@
|
|||||||
* When you need a tooltip with a little more fancy contents, like adding an
|
* When you need a tooltip with a little more fancy contents, like adding an
|
||||||
* image, or you want the tooltip to have different contents per #GtkTreeView
|
* image, or you want the tooltip to have different contents per #GtkTreeView
|
||||||
* row or cell, you will have to do a little more work:
|
* row or cell, you will have to do a little more work:
|
||||||
*
|
*
|
||||||
* - Set the #GtkWidget:has-tooltip property to %TRUE, this will make GTK+
|
* - Set the #GtkWidget:has-tooltip property to %TRUE, this will make GTK+
|
||||||
* monitor the widget for motion and related events which are needed to
|
* monitor the widget for motion and related events which are needed to
|
||||||
* determine when and where to show a tooltip.
|
* determine when and where to show a tooltip.
|
||||||
@ -76,7 +78,7 @@
|
|||||||
* In the probably rare case where you want to have even more control over the
|
* In the probably rare case where you want to have even more control over the
|
||||||
* tooltip that is about to be shown, you can set your own #GtkWindow which
|
* tooltip that is about to be shown, you can set your own #GtkWindow which
|
||||||
* will be used as tooltip window. This works as follows:
|
* will be used as tooltip window. This works as follows:
|
||||||
*
|
*
|
||||||
* - Set #GtkWidget:has-tooltip and connect to #GtkWidget::query-tooltip as before.
|
* - Set #GtkWidget:has-tooltip and connect to #GtkWidget::query-tooltip as before.
|
||||||
* Use gtk_widget_set_tooltip_window() to set a #GtkWindow created by you as
|
* Use gtk_widget_set_tooltip_window() to set a #GtkWindow created by you as
|
||||||
* tooltip window.
|
* tooltip window.
|
||||||
@ -85,6 +87,10 @@
|
|||||||
* gtk_widget_get_tooltip_window() and manipulate as you wish. The semantics of
|
* gtk_widget_get_tooltip_window() and manipulate as you wish. The semantics of
|
||||||
* the return value are exactly as before, return %TRUE to show the window,
|
* the return value are exactly as before, return %TRUE to show the window,
|
||||||
* %FALSE to not show it.
|
* %FALSE to not show it.
|
||||||
|
*
|
||||||
|
* # CSS nodes
|
||||||
|
*
|
||||||
|
* The toplevel used for tooltips has a single CSS node with name tooltip.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -169,12 +175,12 @@ gtk_tooltip_class_init (GtkTooltipClass *klass)
|
|||||||
static void
|
static void
|
||||||
gtk_tooltip_init (GtkTooltip *tooltip)
|
gtk_tooltip_init (GtkTooltip *tooltip)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
AtkObject *atk_obj;
|
AtkObject *atk_obj;
|
||||||
|
GtkCssNode *cssnode;
|
||||||
|
|
||||||
tooltip->timeout_id = 0;
|
tooltip->timeout_id = 0;
|
||||||
tooltip->browse_mode_timeout_id = 0;
|
tooltip->browse_mode_timeout_id = 0;
|
||||||
@ -197,8 +203,8 @@ gtk_tooltip_init (GtkTooltip *tooltip)
|
|||||||
G_CALLBACK (gtk_tooltip_window_hide), tooltip);
|
G_CALLBACK (gtk_tooltip_window_hide), tooltip);
|
||||||
|
|
||||||
_gtk_window_request_csd (GTK_WINDOW (window));
|
_gtk_window_request_csd (GTK_WINDOW (window));
|
||||||
context = gtk_widget_get_style_context (window);
|
cssnode = gtk_widget_get_css_node (window);
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP);
|
gtk_css_node_set_name (cssnode, I_("tooltip"));
|
||||||
|
|
||||||
atk_obj = gtk_widget_get_accessible (window);
|
atk_obj = gtk_widget_get_accessible (window);
|
||||||
if (GTK_IS_ACCESSIBLE (atk_obj))
|
if (GTK_IS_ACCESSIBLE (atk_obj))
|
||||||
|
Loading…
Reference in New Issue
Block a user