Add support for flat buttons

* src/xfaces.c (Finternal_set_lisp_face_attribute):
(realize_gui_face): Add support for `flat-button' (bug#45735).

Copyright-paperwork-exempt: yes
This commit is contained in:
Pedro Andres Aranda Gutierrez 2021-01-10 14:10:18 +01:00 committed by Lars Ingebrigtsen
parent e62f71988f
commit 13bd909591
3 changed files with 19 additions and 10 deletions

View file

@ -2485,15 +2485,16 @@ avoiding any increase in the character height or width. For simplification
the width could be specified with only a single number @var{n} instead
of a list, such case is equivalent to @code{((abs @var{n}) . @var{n})}.
The value @var{color} specifies the color to draw with. The default is
the foreground color of the face for simple boxes, and the background
color of the face for 3D boxes.
The value @var{style} specifies whether to draw a 3D box. If it is
@code{released-button}, the box looks like a 3D button that is not being
pressed. If it is @code{pressed-button}, the box looks like a 3D button
that is being pressed. If it is @code{nil} or omitted, a plain 2D box
is used.
@code{released-button}, the box looks like a 3D button that is not
being pressed. If it is @code{pressed-button}, the box looks like a
3D button that is being pressed. If it is @code{nil},
@code{flat-button} or omitted, a plain 2D box is used.
The value @var{color} specifies the color to draw with. The default
is the background color of the face for 3D boxes and
@code{flat-button}, and the foreground color of the face for other
boxes.
@end table
@item :inverse-video

View file

@ -1514,7 +1514,9 @@ that makes it a valid button.
** Miscellaneous
+++
*** 'add-to-ordered-list' can now take a test predicate.
*** New button face 'flat-button'.
This is a plain 2D button, but uses the background color instead of
the foreground color.
+++
*** New predicate functions 'length<', 'length>' and 'length='.

View file

@ -3293,7 +3293,8 @@ FRAME 0 means change the face on all frames, and change the default
}
else if (EQ (k, QCstyle))
{
if (!EQ (v, Qpressed_button) && !EQ (v, Qreleased_button))
if (!EQ (v, Qpressed_button) && !EQ (v, Qreleased_button)
&& !EQ(v, Qflat_button))
break;
}
else
@ -6031,6 +6032,10 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
face->box = FACE_RAISED_BOX;
else if (EQ (value, Qpressed_button))
face->box = FACE_SUNKEN_BOX;
else if (EQ (value, Qflat_button)) {
face->box = FACE_SIMPLE_BOX;
face->box_color = face->background;
}
}
}
}
@ -6919,6 +6924,7 @@ syms_of_xfaces (void)
DEFSYM (Qwave, "wave");
DEFSYM (Qreleased_button, "released-button");
DEFSYM (Qpressed_button, "pressed-button");
DEFSYM (Qflat_button, "flat-button");
DEFSYM (Qnormal, "normal");
DEFSYM (Qextra_light, "extra-light");
DEFSYM (Qlight, "light");