Related tdf#173606 - Show an icon in combobox depending on msg type

Following the prototype of gtk3

Change-Id: Id25c0a61c3c38427e86525f58c6bb40b9cd257ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211476
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Heiko Tietze
2026-09-26 11:19:15 +02:00
committed by Heiko Tietze
parent 94f01698f5
commit 3b602bc4fc
16 changed files with 32 additions and 6 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

@@ -0,0 +1 @@
<svg height="100" viewBox="-5 -10 100 100" width="100" xmlns="http://www.w3.org/2000/svg"><g fill="#ffbaba"><path d="m45.168769-2.1797647c11.133 0 21.812 4.4219 29.684 12.2969997 7.875 7.8711 12.297 18.551 12.297 29.684s-4.4219 21.812-12.297 29.684c-7.8711 7.875-18.551 12.297-29.684 12.297s-21.812-4.4219-29.684-12.297c-7.8749996-7.8711-12.2969996-18.551-12.2969996-29.684.011719-11.129 4.4414-21.801 12.3089996-29.672 7.8711-7.8671997 18.543-12.2969997 29.672-12.3089997zm0 75.9609997c9.0117 0 17.656-3.582 24.027-9.9531s9.9531-15.016 9.9531-24.027-3.582-17.656-9.9531-24.027c-6.3711-6.3709997-15.016-9.9530997-24.027-9.9530997s-17.656 3.582-24.027 9.9530997c-6.371 6.3711-9.9531 15.016-9.9531 24.027.01172 9.0078 3.5938 17.645 9.9648 24.016s15.008 9.9531 24.016 9.9648z"/><path d="m59.488769 25.480735c-1.5625-1.5625-4.0977-1.5625-5.6562 0l-8.6641 8.6641-8.6641-8.6641c-1.5586-1.5625-4.0938-1.5625-5.6562 0s-1.5625 4.0977 0 5.6562l8.6641 8.6641-8.6641 8.6641c-1.5625 1.5586-1.5625 4.0938 0 5.6562s4.0977 1.5625 5.6562 0l8.6641-8.6641 8.6641 8.6641c1.5586 1.5625 4.0938 1.5625 5.6562 0s1.5625-4.0977 0-5.6562l-8.6641-8.6641 8.6641-8.6641c1.5625-1.5586 1.5625-4.0938 0-5.6562z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1 @@
<svg height="100" viewBox="0 0 100 100" width="100" xmlns="http://www.w3.org/2000/svg"><g fill="#bde5f8" stroke-width=".999996"><path d="m49.847796 5.9426952c-24.052564 0-43.622116 19.9597898-43.622116 44.4919878 0 24.532196 19.569552 44.491983 43.622116 44.491983s43.622117-19.959787 43.622117-44.491983c0-24.532198-19.569553-44.4919878-43.622117-44.4919878zm0 82.1390538c-20.352514 0-36.911021-16.888702-36.911021-37.647066s16.558507-37.647067 36.911021-37.647067c20.352515 0 36.911023 16.888703 36.911023 37.647067s-16.558508 37.647066-36.911023 37.647066z"/><path d="m55.363192 67.818183h-1.363192v-23.636366c0-2.302461-1.832129-4.171125-4.089572-4.171125h-5.452765c-2.257446 0-4.089574 1.868664-4.089574 4.171125 0 2.30246 1.832128 4.171123 4.089574 4.171123h1.36319v19.465243h-1.36319c-2.257446 0-4.089574 1.868663-4.089574 4.171124 0 2.30246 1.832128 4.171123 4.089574 4.171123h10.905529c2.257443 0 4.089578-1.868663 4.089578-4.171123 0-2.302461-1.832135-4.171124-4.089578-4.171124z"/><ellipse cx="49.148602" cy="31.996174" rx="4.362212" ry="4.449198"/></g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1 @@
<svg height="100" viewBox="0 0 100 100" width="100" xmlns="http://www.w3.org/2000/svg"><g fill="#feefb3"><path d="m94.9 70.8-33-55.6c-2.5-4.3-6.9-6.8-11.8-6.8s-9.4 2.5-11.8 6.8l-33 55.6c-2.8 4.3-2.8 9.5-.3 13.8s6.9 6.9 12 6.9h65.9c5.1 0 9.5-2.6 12-6.9 2.6-4.3 2.6-9.5 0-13.8zm-7.9 9.4c-.5.8-1.5 2.3-4 2.3h-66c-2.5 0-3.5-1.7-4-2.3-.5-.8-1.2-2.6 0-4.6l33-55.6c1.2-2 3.2-2.3 4-2.3s2.8.2 4 2.3l33 55.6c1.3 2 .3 3.8 0 4.6z"/><path d="m50 30.4c-2.6 0-4.6 2-4.6 4.6v24.6c0 2.6 2 4.6 4.6 4.6s4.6-2 4.6-4.6v-24.6c0-2.4-2-4.6-4.6-4.6z"/><path d="m50 66.7c-2.6 0-4.6 2-4.6 4.6v1.5c0 2.6 2 4.6 4.6 4.6s4.6-2 4.6-4.6v-1.5c0-2.6-2-4.6-4.6-4.6z"/></g></svg>

After

Width:  |  Height:  |  Size: 642 B

@@ -0,0 +1 @@
<svg height="100" viewBox="-5 -10 100 100" width="100" xmlns="http://www.w3.org/2000/svg"><g fill="#7a0006"><path d="m45.168769-2.1797647c11.133 0 21.812 4.4219 29.684 12.2969997 7.875 7.8711 12.297 18.551 12.297 29.684s-4.4219 21.812-12.297 29.684c-7.8711 7.875-18.551 12.297-29.684 12.297s-21.812-4.4219-29.684-12.297c-7.8749996-7.8711-12.2969996-18.551-12.2969996-29.684.011719-11.129 4.4414-21.801 12.3089996-29.672 7.8711-7.8671997 18.543-12.2969997 29.672-12.3089997zm0 75.9609997c9.0117 0 17.656-3.582 24.027-9.9531s9.9531-15.016 9.9531-24.027-3.582-17.656-9.9531-24.027c-6.3711-6.3709997-15.016-9.9530997-24.027-9.9530997s-17.656 3.582-24.027 9.9530997c-6.371 6.3711-9.9531 15.016-9.9531 24.027.01172 9.0078 3.5938 17.645 9.9648 24.016s15.008 9.9531 24.016 9.9648z"/><path d="m59.488769 25.480735c-1.5625-1.5625-4.0977-1.5625-5.6562 0l-8.6641 8.6641-8.6641-8.6641c-1.5586-1.5625-4.0938-1.5625-5.6562 0s-1.5625 4.0977 0 5.6562l8.6641 8.6641-8.6641 8.6641c-1.5625 1.5586-1.5625 4.0938 0 5.6562s4.0977 1.5625 5.6562 0l8.6641-8.6641 8.6641 8.6641c1.5586 1.5625 4.0938 1.5625 5.6562 0s1.5625-4.0977 0-5.6562l-8.6641-8.6641 8.6641-8.6641c1.5625-1.5586 1.5625-4.0938 0-5.6562z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1 @@
<svg height="100" viewBox="0 0 100 100" width="100" xmlns="http://www.w3.org/2000/svg"><g fill="#004785" stroke-width=".999996"><path d="m49.847796 5.9426952c-24.052564 0-43.622116 19.9597898-43.622116 44.4919878 0 24.532196 19.569552 44.491983 43.622116 44.491983s43.622117-19.959787 43.622117-44.491983c0-24.532198-19.569553-44.4919878-43.622117-44.4919878zm0 82.1390538c-20.352514 0-36.911021-16.888702-36.911021-37.647066s16.558507-37.647067 36.911021-37.647067c20.352515 0 36.911023 16.888703 36.911023 37.647067s-16.558508 37.647066-36.911023 37.647066z"/><path d="m55.363192 67.818183h-1.363192v-23.636366c0-2.302461-1.832129-4.171125-4.089572-4.171125h-5.452765c-2.257446 0-4.089574 1.868664-4.089574 4.171125 0 2.30246 1.832128 4.171123 4.089574 4.171123h1.36319v19.465243h-1.36319c-2.257446 0-4.089574 1.868663-4.089574 4.171124 0 2.30246 1.832128 4.171123 4.089574 4.171123h10.905529c2.257443 0 4.089578-1.868663 4.089578-4.171123 0-2.302461-1.832135-4.171124-4.089578-4.171124z"/><ellipse cx="49.148602" cy="31.996174" rx="4.362212" ry="4.449198"/></g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1 @@
<svg height="100" viewBox="0 0 100 100" width="100" xmlns="http://www.w3.org/2000/svg"><g fill="#704300"><path d="m94.9 70.8-33-55.6c-2.5-4.3-6.9-6.8-11.8-6.8s-9.4 2.5-11.8 6.8l-33 55.6c-2.8 4.3-2.8 9.5-.3 13.8s6.9 6.9 12 6.9h65.9c5.1 0 9.5-2.6 12-6.9 2.6-4.3 2.6-9.5 0-13.8zm-7.9 9.4c-.5.8-1.5 2.3-4 2.3h-66c-2.5 0-3.5-1.7-4-2.3-.5-.8-1.2-2.6 0-4.6l33-55.6c1.2-2 3.2-2.3 4-2.3s2.8.2 4 2.3l33 55.6c1.3 2 .3 3.8 0 4.6z"/><path d="m50 30.4c-2.6 0-4.6 2-4.6 4.6v24.6c0 2.6 2 4.6 4.6 4.6s4.6-2 4.6-4.6v-24.6c0-2.4-2-4.6-4.6-4.6z"/><path d="m50 66.7c-2.6 0-4.6 2-4.6 4.6v1.5c0 2.6 2 4.6 4.6 4.6s4.6-2 4.6-4.6v-1.5c0-2.6-2-4.6-4.6-4.6z"/></g></svg>

After

Width:  |  Height:  |  Size: 642 B

+3
View File
@@ -82,6 +82,7 @@ private:
Link<Edit&,void> maAutocompleteHdl;
Link<Edit&,bool> maActivateHdl;
std::unique_ptr<VclBuilder> mpUIBuilder;
sal_uInt8 maEntryMessageType;
css::uno::Reference<css::i18n::XBreakIterator> mxBreakIterator;
css::uno::Reference<css::i18n::XExtendedInputSequenceChecker> mxISC;
@@ -246,6 +247,8 @@ public:
bool IsPassword() const { return mbPassword; }
bool IsActivePopup() const { return mbActivePopup; }
void SetEntryMessageType(sal_uInt8 aEntryMessageType) { maEntryMessageType = aEntryMessageType; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+4
View File
@@ -227,4 +227,8 @@ inline constexpr OUString CHEVRON = u"sfx2/res/chevron.png"_ustr;
inline constexpr OUString RID_UPDATE_AVAILABLE_16 = u"extensions/res/update/ui/onlineupdate_16.png"_ustr;
inline constexpr OUString RID_UPDATE_AVAILABLE_26 = u"extensions/res/update/ui/onlineupdate_26.png"_ustr;
inline constexpr OUString RID_MSGTYPE_INFO = u"vcl/res/information.png"_ustr;
inline constexpr OUString RID_MSGTYPE_WARN = u"vcl/res/warning.png"_ustr;
inline constexpr OUString RID_MSGTYPE_ERR = u"vcl/res/error.png"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
+7 -5
View File
@@ -3213,14 +3213,14 @@ void set_message_type(Edit* pEntry, weld::EntryMessageType eType)
switch (eType)
{
case weld::EntryMessageType::Normal:
case weld::EntryMessageType::Info:
pEntry->SetForceControlBackground(false);
pEntry->SetControlForeground();
pEntry->SetControlBackground();
break;
case weld::EntryMessageType::Info:
pEntry->SetForceControlBackground(true);
pEntry->SetControlForeground(COL_BLACK);
pEntry->SetControlBackground(0xb4c7dc); // light blue 3
if (eType == weld::EntryMessageType::Normal)
pEntry->SetEntryMessageType(0);
else
pEntry->SetEntryMessageType(1);
break;
case weld::EntryMessageType::Warning:
// tdf#114603: enable setting the background to a different color;
@@ -3228,6 +3228,7 @@ void set_message_type(Edit* pEntry, weld::EntryMessageType eType)
pEntry->SetForceControlBackground(true);
pEntry->SetControlForeground(COL_BLACK);
pEntry->SetControlBackground(0xffffa6); // "light yellow 3"
pEntry->SetEntryMessageType(2);
break;
case weld::EntryMessageType::Error:
// tdf#114603: enable setting the background to a different color;
@@ -3235,6 +3236,7 @@ void set_message_type(Edit* pEntry, weld::EntryMessageType eType)
pEntry->SetForceControlBackground(true);
pEntry->SetControlForeground(COL_BLACK); // contrast of 5.87 to the red background
pEntry->SetControlBackground(0xffa6a6); // "light red 3"
pEntry->SetEntryMessageType(3);
break;
}
}
+12 -1
View File
@@ -43,6 +43,7 @@
#include <window.h>
#include <svdata.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
@@ -253,6 +254,7 @@ void Edit::ImplInitEditData()
mpDDInfo = nullptr;
mpIMEInfos = nullptr;
mcEchoChar = 0;
maEntryMessageType = 0;
// no default mirroring for Edit controls
// note: controls that use a subedit will revert this (SpinField, ComboBox)
@@ -483,7 +485,16 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl
ImplPaintBorder(rRenderContext);
bool bDrawSelection = maSelection.Len() && (HasFocus() || (GetStyle() & WB_NOHIDESELECTION) || mbActivePopup);
if (maEntryMessageType > 0)
{
const OUString sType( maEntryMessageType == 1 ? RID_MSGTYPE_INFO
: maEntryMessageType == 2 ? RID_MSGTYPE_WARN
: RID_MSGTYPE_ERR);
const Point aPoint(rRectangle.Right() - 18, rRectangle.Bottom() / 2 - 8);
rRenderContext.DrawImage(aPoint, Image(StockImage::Yes, sType));
}
bool bDrawSelection
= maSelection.Len() && (HasFocus() || (GetStyle() & WB_NOHIDESELECTION) || mbActivePopup);
aPos.setX( mnXOffset + ImplGetExtraXOffset() );
if (bPaintPlaceholderText)