mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-28 03:03:59 -04:00
SD card status view inherits from new Image class.
This commit is contained in:
parent
84824a504f
commit
dd6d56cff8
4 changed files with 17 additions and 9 deletions
|
@ -111,6 +111,12 @@ const Color color_sd_card(const sd_card::Status status) {
|
|||
|
||||
} /* namespace detail */
|
||||
|
||||
SDCardStatusView::SDCardStatusView(
|
||||
const Rect parent_rect
|
||||
) : Image { parent_rect, &detail::bitmap_sd_card_unknown, detail::color_sd_card_unknown, Color::black() }
|
||||
{
|
||||
}
|
||||
|
||||
void SDCardStatusView::on_show() {
|
||||
sd_card_status_signal_token = sd_card::status_signal += [this](const sd_card::Status status) {
|
||||
this->on_status(status);
|
||||
|
@ -123,15 +129,14 @@ void SDCardStatusView::on_hide() {
|
|||
|
||||
void SDCardStatusView::paint(Painter& painter) {
|
||||
const auto status = sd_card::status();
|
||||
painter.draw_bitmap(
|
||||
screen_pos(),
|
||||
detail::bitmap_sd_card(status),
|
||||
detail::color_sd_card(status),
|
||||
style().background
|
||||
);
|
||||
set_bitmap(&detail::bitmap_sd_card(status));
|
||||
set_foreground(detail::color_sd_card(status));
|
||||
|
||||
Image::paint(painter);
|
||||
}
|
||||
|
||||
void SDCardStatusView::on_status(const sd_card::Status) {
|
||||
// Don't update image properties here, they might change. Wait until paint.
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue