Skip to content

Commit

Permalink
IntFancyButton: Add buttonBackgroundEmpty option
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Aug 29, 2023
1 parent 5d4dd37 commit 09eb246
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions data/base/images/intfac.img
Expand Up @@ -444,3 +444,5 @@
0,0,image_specstatsup.png
0,0,image_volume_up.png
0,0,image_volume_mute.png
0,0,image_but_empty_up.png
0,0,image_but_empty_down.png
Binary file added data/base/images/intfac/image_but_empty_down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/base/images/intfac/image_but_empty_up.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 16 additions & 6 deletions src/intdisplay.cpp
Expand Up @@ -938,14 +938,24 @@ bool intInitialiseGraphics()
// Clear a button bitmap. ( copy the button background ).
void IntFancyButton::displayClear(int xOffset, int yOffset)
{
if (isDown())
{
iV_DrawImage(IntImages, IMAGE_BUT0_DOWN + buttonType * 2, xOffset + x(), yOffset + y());
}
else
UWORD buttonId = 0;
switch (buttonType)
{
iV_DrawImage(IntImages, IMAGE_BUT0_UP + buttonType * 2, xOffset + x(), yOffset + y());
case IntFancyButton::ButtonType::TOPBUTTON:
if (buttonBackgroundEmpty)
{
buttonId = (isDown() ? IMAGE_BUT_EMPTY_DOWN : IMAGE_BUT_EMPTY_UP);
}
else
{
buttonId = (isDown() ? IMAGE_BUT0_DOWN : IMAGE_BUT0_UP);
}
break;
case IntFancyButton::ButtonType::BTMBUTTON:
buttonId = (isDown() ? IMAGE_BUTB0_DOWN : IMAGE_BUTB0_UP);
break;
}
iV_DrawImage(IntImages, buttonId, xOffset + x(), yOffset + y());
}

// Create a button by rendering an IMD object into it.
Expand Down
1 change: 1 addition & 0 deletions src/intdisplay.h
Expand Up @@ -141,6 +141,7 @@ class IntFancyButton : public W_CLICKFORM
int rate;
} model;
ButtonType buttonType; // TOPBUTTON is square, BTMBUTTON has a little up arrow.
bool buttonBackgroundEmpty = false;
};

class IntObjectButton : public IntFancyButton
Expand Down
4 changes: 3 additions & 1 deletion src/intfac.h
Expand Up @@ -477,7 +477,9 @@ enum INTFAC_TYPE
IMAGE_SPECSTATS_DOWN,
IMAGE_SPECSTATS_UP,
IMAGE_INTFAC_VOLUME_UP,
IMAGE_INTFAC_VOLUME_MUTE
IMAGE_INTFAC_VOLUME_MUTE,
IMAGE_BUT_EMPTY_UP,
IMAGE_BUT_EMPTY_DOWN,
};

#endif //__INCLUDED_SRC_INTFAC_H__

0 comments on commit 09eb246

Please sign in to comment.