Listbox items can now change individual background colors

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6453 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2023-03-06 13:42:05 +00:00
parent b4b28c367c
commit 75d485b5cd
3 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- Listbox items can now change individual background colors
- Fix some bitfield sizes in SMaterial which were chosen too small for enums (PolygonOffsetDirection, ZWriteEnable, BlendOperation)
- Add ISceneNode::UpdateAbsolutePosBehavior variable to allow nodes to ignore the scale/rotation parts of their parents transformation.
- Add IGUISpinBox functions getValueFor and getOldValue

View File

@ -26,6 +26,11 @@ namespace gui
EGUI_LBC_ICON,
//! Color of selected icon
EGUI_LBC_ICON_HIGHLIGHT,
//! Color of background.
//! Note that this one is drawn over the listbox background and when not used there is no other default
EGUI_LBC_BACKGROUND,
//! Color of selected background
EGUI_LBC_BACKGROUND_HIGHLIGHT,
//! Not used, just counts the number of available colors
EGUI_LBC_COUNT
};

View File

@ -528,7 +528,13 @@ void CGUIListBox::draw()
frameRect.UpperLeftCorner.Y <= AbsoluteRect.LowerRightCorner.Y)
{
if (i == Selected && hl)
skin->draw2DRectangle(this, skin->getColor(EGDC_HIGH_LIGHT), frameRect, &clientClip);
{
skin->draw2DRectangle(this, hasItemOverrideColor(i, EGUI_LBC_BACKGROUND_HIGHLIGHT) ? getItemOverrideColor(i, EGUI_LBC_BACKGROUND_HIGHLIGHT) : getItemDefaultColor(EGUI_LBC_BACKGROUND_HIGHLIGHT), frameRect, &clientClip);
}
else if ( hasItemOverrideColor(i, EGUI_LBC_BACKGROUND ) )
{
skin->draw2DRectangle(this, getItemOverrideColor(i, EGUI_LBC_BACKGROUND), frameRect, &clientClip);
}
core::rect<s32> textRect = frameRect;
textRect.UpperLeftCorner.X += 3;
@ -671,6 +677,14 @@ bool CGUIListBox::getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::str
useColorLabel = "UseColIconHl";
colorLabel = "ColIconHl";
break;
case EGUI_LBC_BACKGROUND:
useColorLabel = "UseColBg";
colorLabel = "ColBg";
break;
case EGUI_LBC_BACKGROUND_HIGHLIGHT:
useColorLabel = "UseColBgHl";
colorLabel = "ColBgHl";
break;
default:
return false;
}
@ -887,6 +901,10 @@ video::SColor CGUIListBox::getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) con
return skin->getColor(EGDC_ICON);
case EGUI_LBC_ICON_HIGHLIGHT:
return skin->getColor(EGDC_ICON_HIGH_LIGHT);
case EGUI_LBC_BACKGROUND:
return skin->getColor(EGDC_3D_HIGH_LIGHT);
case EGUI_LBC_BACKGROUND_HIGHLIGHT:
return skin->getColor(EGDC_HIGH_LIGHT);
default:
return video::SColor();
}