mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 06:10:15 +00:00
menuitem: deprecate toggle-spacing style property
We can move this to just use the actual GtkCssGadget of the menu item.
This commit is contained in:
parent
3af5c83cd3
commit
5a87b5bbce
@ -371,6 +371,7 @@ gtk_private_h_sources = \
|
|||||||
gtkcairoblurprivate.h \
|
gtkcairoblurprivate.h \
|
||||||
gtkcellareaboxcontextprivate.h \
|
gtkcellareaboxcontextprivate.h \
|
||||||
gtkcheckbuttonprivate.h \
|
gtkcheckbuttonprivate.h \
|
||||||
|
gtkcheckmenuitemprivate.h \
|
||||||
gtkclipboardprivate.h \
|
gtkclipboardprivate.h \
|
||||||
gtkcolorswatchprivate.h \
|
gtkcolorswatchprivate.h \
|
||||||
gtkcoloreditorprivate.h \
|
gtkcoloreditorprivate.h \
|
||||||
|
@ -832,3 +832,9 @@ _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
|||||||
priv->active = is_active;
|
priv->active = is_active;
|
||||||
update_node_state (check_menu_item);
|
update_node_state (check_menu_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkCssGadget *
|
||||||
|
_gtk_check_menu_item_get_indicator_gadget (GtkCheckMenuItem *check_menu_item)
|
||||||
|
{
|
||||||
|
return check_menu_item->priv->indicator_gadget;
|
||||||
|
}
|
||||||
|
@ -108,12 +108,6 @@ void gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_i
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item);
|
gboolean gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item);
|
||||||
|
|
||||||
|
|
||||||
/* private */
|
|
||||||
void _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
|
||||||
gboolean is_active);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_CHECK_MENU_ITEM_H__ */
|
#endif /* __GTK_CHECK_MENU_ITEM_H__ */
|
||||||
|
32
gtk/gtkcheckmenuitemprivate.h
Normal file
32
gtk/gtkcheckmenuitemprivate.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* GTK - The GIMP Toolkit
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||||
|
*
|
||||||
|
* 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 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_CHECK_MENU_ITEM_PRIVATE_H__
|
||||||
|
#define __GTK_CHECK_MENU_ITEM_PRIVATE_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkcheckmenuitem.h>
|
||||||
|
#include <gtk/gtkcssgadgetprivate.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
void _gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
||||||
|
gboolean is_active);
|
||||||
|
GtkCssGadget * _gtk_check_menu_item_get_indicator_gadget (GtkCheckMenuItem *check_menu_item);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GTK_CHECK_MENU_ITEM_PRIVATE_H__ */
|
@ -110,6 +110,7 @@
|
|||||||
#include "gtkadjustment.h"
|
#include "gtkadjustment.h"
|
||||||
#include "gtkbindings.h"
|
#include "gtkbindings.h"
|
||||||
#include "gtkcheckmenuitem.h"
|
#include "gtkcheckmenuitem.h"
|
||||||
|
#include "gtkcheckmenuitemprivate.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkmenuprivate.h"
|
#include "gtkmenuprivate.h"
|
||||||
@ -3227,29 +3228,23 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
|
|||||||
gtk_menu_get_n_columns (menu) == 1 &&
|
gtk_menu_get_n_columns (menu) == 1 &&
|
||||||
!priv->no_toggle_size)
|
!priv->no_toggle_size)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
GtkWidget *menu_item;
|
||||||
GtkWidgetPath *check_path;
|
GtkCssGadget *indicator_gadget;
|
||||||
guint toggle_spacing;
|
gint indicator_width;
|
||||||
guint indicator_size;
|
|
||||||
|
|
||||||
context = gtk_style_context_new ();
|
/* Create a GtkCheckMenuItem, to query indicator size */
|
||||||
|
menu_item = gtk_check_menu_item_new ();
|
||||||
|
indicator_gadget = _gtk_check_menu_item_get_indicator_gadget
|
||||||
|
(GTK_CHECK_MENU_ITEM (menu_item));
|
||||||
|
|
||||||
/* Create a GtkCheckMenuItem path, only to query indicator spacing */
|
gtk_css_gadget_get_preferred_size (indicator_gadget,
|
||||||
check_path = _gtk_widget_create_path (widget);
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
gtk_widget_path_append_type (check_path, GTK_TYPE_CHECK_MENU_ITEM);
|
-1,
|
||||||
|
&indicator_width, NULL,
|
||||||
|
NULL, NULL);
|
||||||
|
max_toggle_size = indicator_width;
|
||||||
|
|
||||||
gtk_style_context_set_path (context, check_path);
|
gtk_widget_destroy (menu_item);
|
||||||
gtk_widget_path_free (check_path);
|
|
||||||
gtk_style_context_set_screen (context, gtk_widget_get_screen (widget));
|
|
||||||
|
|
||||||
gtk_style_context_get_style (context,
|
|
||||||
"toggle-spacing", &toggle_spacing,
|
|
||||||
"indicator-size", &indicator_size,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
max_toggle_size = indicator_size + toggle_spacing;
|
|
||||||
|
|
||||||
g_object_unref (context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
min_width += 2 * max_toggle_size + max_accel_width;
|
min_width += 2 * max_toggle_size + max_accel_width;
|
||||||
|
@ -934,6 +934,14 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
|||||||
GTK_PARAM_READABLE |
|
GTK_PARAM_READABLE |
|
||||||
G_PARAM_DEPRECATED));
|
G_PARAM_DEPRECATED));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkMenuItem:toggle-spacing:
|
||||||
|
*
|
||||||
|
* Spacing between menu icon and label.
|
||||||
|
*
|
||||||
|
* Deprecated: 3.20: use the standard margin CSS property on the check or
|
||||||
|
* radio nodes; the value of this style property is ignored.
|
||||||
|
*/
|
||||||
gtk_widget_class_install_style_property (widget_class,
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
g_param_spec_int ("toggle-spacing",
|
g_param_spec_int ("toggle-spacing",
|
||||||
"Icon Spacing",
|
"Icon Spacing",
|
||||||
@ -941,7 +949,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
|||||||
0,
|
0,
|
||||||
G_MAXINT,
|
G_MAXINT,
|
||||||
5,
|
5,
|
||||||
GTK_PARAM_READABLE));
|
GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkMenuItem:arrow-spacing:
|
* GtkMenuItem:arrow-spacing:
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "gtkmodelmenuitem.h"
|
#include "gtkmodelmenuitem.h"
|
||||||
|
|
||||||
#include "gtkaccellabel.h"
|
#include "gtkaccellabel.h"
|
||||||
|
#include "gtkcheckmenuitemprivate.h"
|
||||||
#include "gtkimage.h"
|
#include "gtkimage.h"
|
||||||
#include "gtkbox.h"
|
#include "gtkbox.h"
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gtkaccellabel.h"
|
#include "gtkaccellabel.h"
|
||||||
|
#include "gtkcheckmenuitemprivate.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkradiomenuitem.h"
|
#include "gtkradiomenuitem.h"
|
||||||
#include "deprecated/gtkactivatable.h"
|
#include "deprecated/gtkactivatable.h"
|
||||||
|
@ -1540,8 +1540,14 @@ menu,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menuitem accelerator { color: gtkalpha(currentColor,0.55); }
|
menuitem {
|
||||||
|
& accelerator { color: gtkalpha(currentColor,0.55); }
|
||||||
|
& check,
|
||||||
|
& radio {
|
||||||
|
&:dir(ltr) { margin-right: 7px; }
|
||||||
|
&:dir(rtl) { margin-left: 7px; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
* Popovers *
|
* Popovers *
|
||||||
@ -2096,8 +2102,6 @@ switch {
|
|||||||
color: mix($fg_color, $bg_color, 70%);
|
color: mix($fg_color, $bg_color, 70%);
|
||||||
-gtk-icon-source: -gtk-icontheme('#{$a}-symbolic');
|
-gtk-icon-source: -gtk-icontheme('#{$a}-symbolic');
|
||||||
-gtk-icon-shadow: none;
|
-gtk-icon-shadow: none;
|
||||||
&:dir(ltr) { margin-right: 7px; }
|
|
||||||
&:dir(rtl) { margin-left: 7px; }
|
|
||||||
&:hover, &:insensitive {
|
&:hover, &:insensitive {
|
||||||
-gtk-icon-source: -gtk-icontheme('#{$a}-symbolic');
|
-gtk-icon-source: -gtk-icontheme('#{$a}-symbolic');
|
||||||
-gtk-icon-shadow: none;
|
-gtk-icon-shadow: none;
|
||||||
|
@ -2154,6 +2154,10 @@ menu,
|
|||||||
|
|
||||||
menuitem accelerator {
|
menuitem accelerator {
|
||||||
color: alpha(currentColor,0.55); }
|
color: alpha(currentColor,0.55); }
|
||||||
|
menuitem check:dir(ltr), menuitem radio:dir(ltr) {
|
||||||
|
margin-right: 7px; }
|
||||||
|
menuitem check:dir(rtl), menuitem radio:dir(rtl) {
|
||||||
|
margin-left: 7px; }
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
* Popovers *
|
* Popovers *
|
||||||
@ -2771,10 +2775,6 @@ menu menuitem check {
|
|||||||
color: #b8bab8;
|
color: #b8bab8;
|
||||||
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
menu menuitem check:dir(ltr) {
|
|
||||||
margin-right: 7px; }
|
|
||||||
menu menuitem check:dir(rtl) {
|
|
||||||
margin-left: 7px; }
|
|
||||||
menu menuitem check:hover, menu menuitem check:insensitive {
|
menu menuitem check:hover, menu menuitem check:insensitive {
|
||||||
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
@ -2937,10 +2937,6 @@ menu menuitem radio {
|
|||||||
color: #b8bab8;
|
color: #b8bab8;
|
||||||
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
menu menuitem radio:dir(ltr) {
|
|
||||||
margin-right: 7px; }
|
|
||||||
menu menuitem radio:dir(rtl) {
|
|
||||||
margin-left: 7px; }
|
|
||||||
menu menuitem radio:hover, menu menuitem radio:insensitive {
|
menu menuitem radio:hover, menu menuitem radio:insensitive {
|
||||||
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
|
@ -2160,6 +2160,10 @@ menu,
|
|||||||
|
|
||||||
menuitem accelerator {
|
menuitem accelerator {
|
||||||
color: alpha(currentColor,0.55); }
|
color: alpha(currentColor,0.55); }
|
||||||
|
menuitem check:dir(ltr), menuitem radio:dir(ltr) {
|
||||||
|
margin-right: 7px; }
|
||||||
|
menuitem check:dir(rtl), menuitem radio:dir(rtl) {
|
||||||
|
margin-left: 7px; }
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
* Popovers *
|
* Popovers *
|
||||||
@ -2861,10 +2865,6 @@ menu menuitem check {
|
|||||||
color: #666a6b;
|
color: #666a6b;
|
||||||
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
menu menuitem check:dir(ltr) {
|
|
||||||
margin-right: 7px; }
|
|
||||||
menu menuitem check:dir(rtl) {
|
|
||||||
margin-left: 7px; }
|
|
||||||
menu menuitem check:hover, menu menuitem check:insensitive {
|
menu menuitem check:hover, menu menuitem check:insensitive {
|
||||||
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
-gtk-icon-source: -gtk-icontheme("checkbox-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
@ -3099,10 +3099,6 @@ menu menuitem radio {
|
|||||||
color: #666a6b;
|
color: #666a6b;
|
||||||
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
menu menuitem radio:dir(ltr) {
|
|
||||||
margin-right: 7px; }
|
|
||||||
menu menuitem radio:dir(rtl) {
|
|
||||||
margin-left: 7px; }
|
|
||||||
menu menuitem radio:hover, menu menuitem radio:insensitive {
|
menu menuitem radio:hover, menu menuitem radio:insensitive {
|
||||||
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
-gtk-icon-source: -gtk-icontheme("radio-symbolic");
|
||||||
-gtk-icon-shadow: none; }
|
-gtk-icon-shadow: none; }
|
||||||
|
Loading…
Reference in New Issue
Block a user