Files
MuditaOS/module-apps/widgets/WidgetsUtils.cpp
Mateusz Grzegorzek 8f0797218f [EGD-5312] Add Time selection window
- add ChangeDateAndTimeWindow,
- extract EventTimeItem to common widgets folder
  and rename it to TimeWidget,
- extract EventDateItem to common widgets folder
  and rename it to DateWidget,
- replace timeWidget with common TimeWidget
  in NightshiftWindow,
- refactor time setting in
  DesktopMainWindow and TopBar,
- Remove dead code from EventManager
  (GetNextAlarmTimestamp and HandleAlarmTrigger)
2021-02-23 15:59:51 +01:00

32 lines
1004 B
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "WidgetsUtils.hpp"
#include <module-gui/gui/core/BoundingBox.hpp>
#include <module-gui/gui/input/InputEvent.hpp>
#include <module-gui/gui/widgets/Item.hpp>
namespace gui
{
void passDefaultCallbacksFromListItem(Item *parent, Item *child)
{
parent->focusChangedCallback = [=](Item &) {
parent->setFocusItem(parent->focus ? child : nullptr);
return true;
};
parent->inputCallback = [=](Item &, const InputEvent &event) {
if (event.state != InputEvent::State::keyReleasedShort) {
return false;
}
return child->onInput(event);
};
parent->dimensionChangedCallback = [=](gui::Item &, const BoundingBox &newDim) -> bool {
child->setArea({0, 0, newDim.w, newDim.h});
return true;
};
}
} // namespace gui