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>
This commit is contained in:
Máximo Castañeda 2022-11-15 18:01:45 +01:00 committed by waddlesplash
parent d2875e7b28
commit 5728bdf606

View File

@ -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 @@ TAlertView::Archive(BMessage* archive, bool deep) const
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;
}