Skip to content

Commit 85669b6

Browse files
committed
#256 card should not show item on display as selected.
1 parent 40eaae1 commit 85669b6

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/graphics/GraphicsDeviceRenderer.cpp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ namespace tcgfx {
1818
static unsigned char rendererUpArrowXbm[] = { 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03 };
1919
static unsigned char rendererDownArrowXbm[] = { 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0 };
2020

21-
bool GraphicsDeviceRenderer::isActiveOrEditing(MenuItem* pItem, const DrawingFlags& drawingFlags) {
21+
bool GraphicsDeviceRenderer::isActiveOrEditing(MenuItem* pItem, const DrawingFlags& drawingFlags) const {
22+
// in card layout we should not select.
23+
if(cardLayoutPane != nullptr && cardLayoutPane->isSubMenuCardLayout(menuMgr.getCurrentSubMenu())) return false;
24+
2225
auto mt = pItem->getMenuType();
2326
return (drawingFlags.isEditing() || drawingFlags.isActive()) && mt != MENUTYPE_TITLE_ITEM && mt != MENUTYPE_BACK_VALUE;
2427
}
@@ -506,7 +509,7 @@ namespace tcgfx {
506509
int outsideAreaX = maximumSliderArea - filledAreaX;
507510
helper.getDrawable()->setDrawColor(props->getColor(ItemDisplayProperties::HIGHLIGHT1));
508511
helper.getDrawable()->drawBox(Coord(where.x, where.y), Coord(filledAreaX, size.y), true);
509-
auto mainBg = (drawingFlags.isActive() || drawingFlags.isEditing()) ? propertiesFactory.getSelectedColor(ItemDisplayProperties::BACKGROUND) : props->getColor(ItemDisplayProperties::BACKGROUND);
512+
auto mainBg = isActiveOrEditing(pItem, drawingFlags) ? propertiesFactory.getSelectedColor(ItemDisplayProperties::BACKGROUND) : props->getColor(ItemDisplayProperties::BACKGROUND);
510513
helper.getDrawable()->setDrawColor(mainBg);
511514
helper.getDrawable()->drawBox(Coord(where.x + filledAreaX, where.y), Coord(outsideAreaX, size.y), true);
512515
internalDrawText(entry, Coord(where.x, where.y), Coord(size.x, size.y), drawingFlags);

‎src/graphics/GraphicsDeviceRenderer.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ namespace tcgfx {
166166
* @param forceDrawWidgets reference to if the widgets are to be force drawn, may be updated
167167
*/
168168
void subMenuRender(MenuItem* rootItem, uint8_t& locRedrawMode, bool& forceDrawWidgets) override;
169-
bool isActiveOrEditing(MenuItem* pItem, const DrawingFlags& drawingFlags);
169+
bool isActiveOrEditing(MenuItem* pItem, const DrawingFlags& drawingFlags) const;
170170
private:
171171
int calculateSpaceBetween(const void* font, uint8_t mag, const char* buffer, int start, int end);
172172
void internalDrawText(GridPositionRowCacheEntry* pEntry, const Coord& where, const Coord& size, const DrawingFlags& drawingFlags);

0 commit comments

Comments
 (0)