BAlert: invalidate icon view on icon change
Invalidating the layout may not be enough for an update.
Fixes: #18069
Change-Id: I93f6b0feb043c7f317a9ff1e7af11b2047fc7cd5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5821
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
(cherry picked from commit 5728bdf606fa4f339f79a411ae4f99b77570a27c)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5794
Diff
src/kits/interface/Alert.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -21,6 +21,7 @@
#include <Bitmap.h>
#include <Button.h>
#include <ControlLook.h>
#include <Debug.h>
#include <FindDirectory.h>
#include <IconUtils.h>
#include <LayoutBuilder.h>
@@ -747,14 +748,17 @@
void
TAlertView::SetBitmap(BBitmap* icon)
{
if (icon == NULL && fIconBitmap == NULL)
return;
ASSERT(icon != fIconBitmap);
BBitmap* oldBitmap = fIconBitmap;
fIconBitmap = icon;
Invalidate();
if (oldBitmap == NULL || (oldBitmap != NULL && icon == NULL)
|| (icon != NULL && oldBitmap->Bounds() != icon->Bounds())) {
if (oldBitmap == NULL || icon == NULL || oldBitmap->Bounds() != icon->Bounds())
InvalidateLayout();
} else
Invalidate();
delete oldBitmap;
}