A art/phone/common/arrow_left_24px_W_G.png => art/phone/common/arrow_left_24px_W_G.png +0 -0
A art/phone/common/arrow_right_24px_W_G.png => art/phone/common/arrow_right_24px_W_G.png +0 -0
A art/phone/common/plus_32px_W_G.png => art/phone/common/plus_32px_W_G.png +0 -0
A art/phone/common/search_32px_W_G.png => art/phone/common/search_32px_W_G.png +0 -0
A image/assets/images/arrow_left_24px_W_G.vpi => image/assets/images/arrow_left_24px_W_G.vpi +0 -0
A image/assets/images/arrow_right_24px_W_G.vpi => image/assets/images/arrow_right_24px_W_G.vpi +0 -0
A image/assets/images/plus_32px_W_G.vpi => image/assets/images/plus_32px_W_G.vpi +0 -0
A image/assets/images/search_32px_W_G.vpi => image/assets/images/search_32px_W_G.vpi +0 -0
M module-apps/application-bell-main/windows/BellMainMenuWindow.cpp => module-apps/application-bell-main/windows/BellMainMenuWindow.cpp +3 -2
@@ 20,9 20,10 @@ namespace gui
void BellMainMenuWindow::buildInterface()
{
- bottomBar->setVisible(false);
statusBar->setVisible(false);
- title->visible = false;
+ header->setTitleVisibility(false);
+ bottomBar->setVisible(false);
+
optionsList->setPosition(bellMainStyle::mainMenuWindow::options_list_x,
bellMainStyle::mainMenuWindow::options_list_y);
optionsList->setMaximumWidth(bellMainStyle::mainMenuWindow::default_body_width);
M module-apps/application-meditation/windows/MeditationTimerWindow.cpp => module-apps/application-meditation/windows/MeditationTimerWindow.cpp +1 -1
@@ 129,7 129,7 @@ void MeditationTimerWindow::setWidgetVisible(bool sBar, bool bBar, bool counter)
return configuration;
});
- title->setVisible(sBar);
+ header->setTitleVisibility(sBar);
bottomBar->setActive(BottomBar::Side::CENTER, bBar);
bottomBar->setActive(BottomBar::Side::LEFT, bBar);
timer->setVisible(counter);
M module-apps/application-onboarding/windows/ConfigurationSuccessfulDialogWindow.cpp => module-apps/application-onboarding/windows/ConfigurationSuccessfulDialogWindow.cpp +2 -3
@@ 6,7 6,7 @@
#include <module-apps/application-onboarding/ApplicationOnBoarding.hpp>
#include <module-apps/application-onboarding/data/OnBoardingSwitchData.hpp>
#include <apps-common/messages/DialogMetadataMessage.hpp>
-#include <widgets/IceBox.hpp>
+#include <header/IceAction.hpp>
#include <service-appmgr/Controller.hpp>
#include <i18n/i18n.hpp>
@@ 17,10 17,9 @@ namespace app::onBoarding
ConfigurationSuccessfulDialogWindow::ConfigurationSuccessfulDialogWindow(app::Application *app)
: gui::Dialog(app, gui::window::name::onBoarding_configuration_successful)
{
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(style::strings::common::start));
bottomBar->setActive(gui::BottomBar::Side::RIGHT, false);
-
- new gui::IceBox(this);
}
bool ConfigurationSuccessfulDialogWindow::onInput(const gui::InputEvent &inputEvent)
M module-apps/application-onboarding/windows/NoConfigurationDialogWindow.cpp => module-apps/application-onboarding/windows/NoConfigurationDialogWindow.cpp +2 -3
@@ 6,7 6,7 @@
#include <module-apps/application-onboarding/ApplicationOnBoarding.hpp>
#include <module-apps/application-onboarding/data/OnBoardingSwitchData.hpp>
#include <apps-common/messages/DialogMetadataMessage.hpp>
-#include <widgets/IceBox.hpp>
+#include <header/IceAction.hpp>
#include <service-appmgr/Controller.hpp>
#include <i18n/i18n.hpp>
@@ 17,10 17,9 @@ namespace app::onBoarding
NoConfigurationDialogWindow::NoConfigurationDialogWindow(app::Application *app)
: gui::Dialog(app, gui::window::name::onBoarding_no_configuration)
{
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(style::strings::common::start));
bottomBar->setActive(gui::BottomBar::Side::RIGHT, false);
-
- new gui::IceBox(this);
}
bool NoConfigurationDialogWindow::onInput(const gui::InputEvent &inputEvent)
M module-apps/application-onboarding/windows/OnBoardingDateAndTimeWindow.cpp => module-apps/application-onboarding/windows/OnBoardingDateAndTimeWindow.cpp +2 -2
@@ 8,7 8,7 @@
#include <module-gui/gui/input/InputEvent.hpp>
#include <module-apps/application-onboarding/data/OnBoardingSwitchData.hpp>
#include <apps-common/messages/DialogMetadataMessage.hpp>
-#include <widgets/IceBox.hpp>
+#include <header/IceAction.hpp>
#include <service-appmgr/Controller.hpp>
namespace app::onBoarding
@@ 27,7 27,7 @@ namespace app::onBoarding
void OnBoardingDateAndTimeWindow::onBeforeShow(gui::ShowMode mode, gui::SwitchData *data)
{
DateAndTimeMainWindow::onBeforeShow(mode, data);
- new gui::IceBox(this);
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(style::strings::common::save));
bottomBar->setText(gui::BottomBar::Side::LEFT, utils::translate(style::strings::common::Switch));
M module-apps/application-onboarding/windows/OnBoardingLanguagesWindow.cpp => module-apps/application-onboarding/windows/OnBoardingLanguagesWindow.cpp +2 -2
@@ 4,7 4,7 @@
#include "OnBoardingLanguagesWindow.hpp"
#include <application-onboarding/ApplicationOnBoarding.hpp>
-#include <widgets/IceBox.hpp>
+#include <header/IceAction.hpp>
#include <module-gui/gui/input/InputEvent.hpp>
#include <service-appmgr/Controller.hpp>
@@ 16,8 16,8 @@ namespace app::onBoarding
void OnBoardingLanguagesWindow::onBeforeShow(gui::ShowMode mode, gui::SwitchData *data)
{
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
bottomBar->setActive(gui::BottomBar::Side::RIGHT, false);
- new gui::IceBox(this);
LanguagesWindow::onBeforeShow(mode, data);
}
M module-apps/application-onboarding/windows/OnBoardingSimSelectWindow.cpp => module-apps/application-onboarding/windows/OnBoardingSimSelectWindow.cpp +2 -4
@@ 7,7 7,7 @@
#include <application-onboarding/style/OnBoardingStyle.hpp>
#include <OptionSetting.hpp>
-#include <widgets/IceBox.hpp>
+#include <header/IceAction.hpp>
#include <service-appmgr/Controller.hpp>
#include <apps-common/messages/DialogMetadataMessage.hpp>
@@ 22,13 22,11 @@ namespace app::onBoarding
void OnBoardingSimSelectWindow::buildInterface()
{
setTitle(utils::translate("app_onboarding_select_sim"));
-
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(::style::strings::common::select));
bottomBar->setText(gui::BottomBar::Side::RIGHT, utils::translate(::style::strings::common::back));
bottomBar->setText(gui::BottomBar::Side::LEFT, utils::translate(::style::strings::common::skip));
- new gui::IceBox(this);
-
descriptionText = new gui::Text(this,
style::window::default_left_margin,
style::onboarding::sim_select::description_y,
M module-apps/application-onboarding/windows/StartConfigurationWindow.cpp => module-apps/application-onboarding/windows/StartConfigurationWindow.cpp +2 -2
@@ 8,7 8,7 @@
#include <apps-common/windows/DialogMetadata.hpp>
#include <apps-common/messages/DialogMetadataMessage.hpp>
-#include <widgets/IceBox.hpp>
+#include <header/IceAction.hpp>
#include <service-appmgr/Controller.hpp>
#include <i18n/i18n.hpp>
@@ 27,11 27,11 @@ namespace app::onBoarding
{
AppWindow::buildInterface();
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(::style::strings::common::start));
bottomBar->setText(gui::BottomBar::Side::RIGHT, utils::translate(::style::strings::common::back));
bottomBar->setText(gui::BottomBar::Side::LEFT, utils::translate(::style::strings::common::skip));
- new gui::IceBox(this);
new gui::Icon(this,
0,
0,
M module-apps/application-phonebook/windows/PhonebookContactDetails.cpp => module-apps/application-phonebook/windows/PhonebookContactDetails.cpp +2 -2
@@ 82,13 82,13 @@ namespace gui
contactFlagsWidget->setBlocked(contact->isOnBlocked());
contactFlagsWidget->setFavourites(contact->isOnFavourites());
if (contactFlagsWidget->visible) {
- title->setEdges(RectangleEdge::None);
+ header->setEdges(RectangleEdge::None);
bodyList->setY(phonebookStyle::contactDetailsWindow::contactDetailsList::y);
bodyList->setSize(phonebookStyle::contactDetailsWindow::contactDetailsList::w,
phonebookStyle::contactDetailsWindow::contactDetailsList::h);
}
else {
- title->setEdges(RectangleEdge::Bottom);
+ header->setEdges(RectangleEdge::Bottom);
bodyList->setY(phonebookStyle::contactDetailsWindow::contactDetailsListNoFlags::y);
bodyList->setSize(phonebookStyle::contactDetailsWindow::contactDetailsListNoFlags::w,
phonebookStyle::contactDetailsWindow::contactDetailsListNoFlags::h);
M module-apps/apps-common/CMakeLists.txt => module-apps/apps-common/CMakeLists.txt +0 -1
@@ 27,7 27,6 @@ target_sources(apps-common
widgets/BrightnessBox.cpp
widgets/ButtonOnOff.cpp
widgets/DateWidget.cpp
- widgets/IceBox.cpp
widgets/InputBox.cpp
widgets/ModesBox.cpp
widgets/TextWithIconsWidget.cpp
M module-apps/apps-common/locks/windows/LockInputWindow.cpp => module-apps/apps-common/locks/windows/LockInputWindow.cpp +14 -8
@@ 7,6 7,7 @@
#include <locks/widgets/Lock.hpp>
#include <service-appmgr/Controller.hpp>
+#include <header/IceAction.hpp>
#include <FontManager.hpp>
#include <i18n/i18n.hpp>
@@ 72,7 73,7 @@ namespace gui
void LockInputWindow::buildIceBox()
{
- iceBox = new gui::IceBox(this);
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
}
void LockInputWindow::buildPinBody()
@@ 138,14 139,13 @@ namespace gui
{
switch (type) {
case TextType::Title: {
- title->setVisible(true);
+ header->setTitleVisibility(true);
if (!tokens.empty()) {
TextFormat format(FontManager::getInstance().getFont(style::window::font::medium));
- title->setText(
- text::RichTextParser().parse(utils::translate(value), &format, std::move(tokens))->getText());
+ setTitle(text::RichTextParser().parse(utils::translate(value), &format, std::move(tokens))->getText());
}
else {
- title->setText(utils::translate(value));
+ setTitle(utils::translate(value));
}
break;
}
@@ 162,8 162,14 @@ namespace gui
void LockInputWindow::setTitleBar(bool titleVisible, bool iceVisible)
{
- title->setVisible(titleVisible);
- iceBox->setVisible(iceVisible);
+ header->setTitleVisibility(titleVisible);
+
+ if (iceVisible) {
+ header->navigationIndicatorAdd(new gui::header::IceAction(), gui::header::BoxSelection::Left);
+ }
+ else {
+ header->navigationIndicatorRemove(gui::header::BoxSelection::Left);
+ }
}
auto LockInputWindow::getToken(LockInputWindow::Token token) const -> std::string
@@ 216,7 222,7 @@ namespace gui
auto LockInputWindow::isIceVisible() const noexcept -> bool
{
- return iceBox->visible;
+ return header->navigationIndicatorVisible(header::BoxSelection::Left);
}
auto LockInputWindow::isInInputState() const noexcept -> bool
M module-apps/apps-common/locks/windows/LockInputWindow.hpp => module-apps/apps-common/locks/windows/LockInputWindow.hpp +0 -2
@@ 9,7 9,6 @@
#include <RichTextParser.hpp>
#include <Text.hpp>
#include <ImageBox.hpp>
-#include <widgets/IceBox.hpp>
namespace locks
{
@@ 67,7 66,6 @@ namespace gui
private:
gui::VBox *body = nullptr;
- gui::IceBox *iceBox = nullptr;
gui::ImageBox *infoImage = nullptr;
gui::Text *primaryText = nullptr;
gui::Text *secondaryText = nullptr;
D module-apps/apps-common/widgets/IceBox.hpp => module-apps/apps-common/widgets/IceBox.hpp +0 -32
@@ 1,32 0,0 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
-// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-
-#pragma once
-
-#include <BoxLayout.hpp>
-#include <Label.hpp>
-#include <Image.hpp>
-
-namespace style::window::ice
-{
- constexpr inline auto x = 25;
- constexpr inline auto y = 53;
- constexpr inline auto w = 60;
- constexpr inline auto h = 38;
-
- constexpr inline auto margin = 3;
-
- namespace text
- {
- constexpr inline auto w = 40;
- }
-} // namespace style::window::ice
-
-namespace gui
-{
- class IceBox : public HBox
- {
- public:
- explicit IceBox(Item *parent = nullptr);
- };
-} // namespace gui
M module-apps/apps-common/windows/AppWindow.cpp => module-apps/apps-common/windows/AppWindow.cpp +18 -22
@@ 24,12 24,12 @@ namespace gui
void AppWindow::destroyInterface()
{
- erase(bottomBar);
erase(statusBar);
- erase(title);
- title = nullptr;
- bottomBar = nullptr;
+ erase(header);
+ erase(bottomBar);
statusBar = nullptr;
+ header = nullptr;
+ bottomBar = nullptr;
}
void AppWindow::rebuild()
@@ 46,19 46,16 @@ namespace gui
status_bar::height);
statusBar->configure(std::move(config));
+ header = new gui::header::Header(this,
+ style::header::default_horizontal_pos,
+ style::header::default_vertical_pos,
+ style::header::width,
+ style::header::height);
+
bottomBar = new gui::BottomBar(this, 0, style::window_height - 51, style::window_width, 50);
bottomBar->setActive(BottomBar::Side::LEFT, false);
bottomBar->setActive(BottomBar::Side::CENTER, false);
bottomBar->setActive(BottomBar::Side::RIGHT, false);
-
- title = new gui::Label(this, 0, 52, style::window_width, 52);
- title->setFilled(false);
- title->setFont(font::title);
- title->clear();
- title->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Top));
- title->setEdges(RectangleEdge::Bottom);
- title->setEllipsis(Ellipsis::Right);
- title->visible = false;
}
status_bar::Configuration AppWindow::configureStatusBar(status_bar::Configuration appConfiguration)
@@ 132,13 129,12 @@ namespace gui
void AppWindow::setTitle(const UTF8 &text)
{
- if (title != nullptr) {
- title->setText(text);
- title->setVisible(text.length() != 0);
- }
- else {
- LOG_ERROR("cant set title - it doesn't exist!");
- }
+ header->setTitle(text);
+ }
+
+ UTF8 AppWindow::getTitle()
+ {
+ return header->getTitle();
}
bool AppWindow::onDatabaseMessage(sys::Message *msg)
@@ 265,9 261,9 @@ namespace gui
BoundingBox AppWindow::bodySize()
{
return {0,
- title->offset_h(),
+ header->offset_h(),
this->getWidth(),
- this->getHeight() - this->title->offset_h() - bottomBar->getHeight()};
+ this->getHeight() - this->header->offset_h() - bottomBar->getHeight()};
}
void AppWindow::setBottomBarActive(BottomBar::Side side, bool value)
M module-apps/apps-common/windows/AppWindow.hpp => module-apps/apps-common/windows/AppWindow.hpp +12 -7
@@ 4,6 4,7 @@
#pragma once
#include <gui/widgets/StatusBar.hpp>
+#include <gui/widgets/header/Header.hpp>
#include <gui/widgets/BottomBar.hpp>
#include <gui/widgets/Window.hpp>
#include <Service/Service.hpp>
@@ 31,17 32,19 @@ namespace gui
class AppWindow : public Window
{
protected:
- /// actual built window title
- gui::Label *title = nullptr;
- /**
- * Information bar for the buttons on the bottom of the page.
- */
- gui::BottomBar *bottomBar = nullptr;
/**
* Information bar for signal, battery and lock icon on the top of the screen.
*/
gui::status_bar::StatusBar *statusBar = nullptr;
/**
+ * Information bar for window title and additional action buttons.
+ */
+ gui::header::Header *header = nullptr;
+ /**
+ * Information bar for the buttons on the bottom of the page.
+ */
+ gui::BottomBar *bottomBar = nullptr;
+ /**
* Pointer to the application object that owns the window.
*/
app::Application *application = nullptr;
@@ 75,7 78,6 @@ namespace gui
void updatePhoneMode(sys::phone_modes::PhoneMode mode);
[[nodiscard]] bool preventsAutoLocking() const noexcept;
virtual bool updateTime();
- void setTitle(const UTF8 &text);
void rebuild() override;
void buildInterface() override;
@@ 96,6 98,9 @@ namespace gui
*/
void applyToStatusBar(StatusBarConfigurationChangeFunction configChange);
+ void setTitle(const UTF8 &text);
+ [[nodiscard]] UTF8 getTitle();
+
/// Setting bottom bar temporary text
/// @param text - bottomBar text
/// @param overwriteOthers - set or not other bottomBar texts to "" (default true)
M module-apps/apps-common/windows/NoEvents.cpp => module-apps/apps-common/windows/NoEvents.cpp +3 -5
@@ 58,7 58,7 @@ void NoEvents::onBeforeShow(ShowMode mode, SwitchData *data)
};
}
- if (title->getText() == utils::translate("app_calendar_title_main")) {
+ if (getTitle() == utils::translate("app_calendar_title_main")) {
bottomBar->setActive(gui::BottomBar::Side::LEFT, true);
bottomBar->setText(gui::BottomBar::Side::LEFT, utils::translate("app_calendar_bar_month"));
}
@@ 66,8 66,7 @@ void NoEvents::onBeforeShow(ShowMode mode, SwitchData *data)
bool NoEvents::onInput(const gui::InputEvent &inputEvent)
{
- if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF) &&
- title->getText() == utils::translate("app_calendar_title_main")) {
+ if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF) && getTitle() == utils::translate("app_calendar_title_main")) {
app::manager::Controller::switchBack(application);
return true;
}
@@ 76,8 75,7 @@ bool NoEvents::onInput(const gui::InputEvent &inputEvent)
return true;
}
- if (inputEvent.isShortRelease(gui::KeyCode::KEY_LF) &&
- title->getText() == utils::translate("app_calendar_title_main")) {
+ if (inputEvent.isShortRelease(gui::KeyCode::KEY_LF) && getTitle() == utils::translate("app_calendar_title_main")) {
application->switchWindow(gui::name::window::main_window);
return true;
}
M module-gui/WINDOW.md => module-gui/WINDOW.md +2 -2
@@ 13,9 13,9 @@ Window consist of 4 different segments presented on image below.
selected sim. Objects in status bar are not focusable and activeable.
* `Header` - Displaying selected window information. Mainly its title and in addition window particular input actions
descriptions. In example adding object to list, search and emergency calls action. Objects in header are not focusable
-and activeable. Currently that part is not clearly represented in Code and is being refactored.
+and activeable.
* `Body` - Main part of window responsible for displaying and manipulating window logic. In example: contact information,
sms list manipulations, alarm clock settings. Objects in Body are focusable and activeable.
* `NavBar` - Bottom part of window displaying input action descriptions assigned to main keyboard keys (Left Function key,
Enter Key, Right Function Key). In example: accepting prompt, going to previous window, selecting object. Objects in
-NavBar are not focusable and activeable. Currently that part is named BottomBar in Code. >
\ No newline at end of file
+NavBar are not focusable and activeable. Currently, that part is named BottomBar in Code. <
\ No newline at end of file
M module-gui/gui/widgets/CMakeLists.txt => module-gui/gui/widgets/CMakeLists.txt +8 -0
@@ 20,6 20,10 @@ target_sources( ${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/Window.cpp"
"${CMAKE_CURRENT_LIST_DIR}/BoxLayout.cpp"
"${CMAKE_CURRENT_LIST_DIR}/BoxLayoutSizeStore.cpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/Header.cpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/IceAction.cpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/AddElementAction.cpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/SearchAction.cpp"
"${CMAKE_CURRENT_LIST_DIR}/StatusBar.cpp"
"${CMAKE_CURRENT_LIST_DIR}/status-bar/SIM.cpp"
"${CMAKE_CURRENT_LIST_DIR}/status-bar/BatteryBase.cpp"
@@ 72,6 76,10 @@ target_sources( ${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/Layout.hpp"
"${CMAKE_CURRENT_LIST_DIR}/StatusBar.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Text.hpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/Header.hpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/IceAction.hpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/AddElementAction.hpp"
+ "${CMAKE_CURRENT_LIST_DIR}/header/SearchAction.hpp"
"${CMAKE_CURRENT_LIST_DIR}/CheckBoxWithLabel.hpp"
"${CMAKE_CURRENT_LIST_DIR}/CheckBoxWithLabel.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Lines.hpp"
A => +30 -0
@@ 0,0 1,30 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AddElementAction.hpp"
#include "Style.hpp"
#include <Text.hpp>
#include <Image.hpp>
namespace gui::header
{
AddElementAction::AddElementAction(Item *parent)
: HBox(parent, 0, 0, style::header::navigation_indicator::w, style::header::navigation_indicator::h)
{
setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
setEdges(RectangleEdge::None);
setMargins(Margins(style::header::navigation_indicator::right_left_margin,
style::header::navigation_indicator::top_margin,
0,
0));
auto arrow = new gui::Image("arrow_left_24px_W_G");
arrow->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
addWidget(arrow);
auto plus = new gui::Image("plus_32px_W_G");
plus->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
addWidget(plus);
}
} // namespace gui::header
A => +15 -0
@@ 0,0 1,15 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <BoxLayout.hpp>
namespace gui::header
{
class AddElementAction : public HBox
{
public:
explicit AddElementAction(Item *parent = nullptr);
};
} // namespace gui::header
A => +157 -0
@@ 0,0 1,157 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "Header.hpp"
#include "Style.hpp"
#include <Text.hpp>
namespace gui::header
{
Header::Header(Item *parent, Position x, Position y, Length w, Length h) : HBox(parent, x, y, w, h)
{
setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
setEdges(RectangleEdge::None);
leftBox = new HBox(this, 0, 0, 0, 0);
leftBox->setMinimumSize(style::header::navigation_indicator::box_width, h);
leftBox->setAlignment(Alignment(Alignment::Vertical::Top));
leftBox->setEdges(RectangleEdge::None);
leftBox->setVisible(false);
centerBox = new HBox(this, 0, 0, 0, 0);
centerBox->setEdges(RectangleEdge::None);
centerBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center));
centerBox->setMaximumSize(w, h);
rightBox = new HBox(this, 0, 0, 0, 0);
rightBox->setMinimumSize(style::header::navigation_indicator::box_width, h);
rightBox->setAlignment(Alignment(Alignment::Vertical::Top));
rightBox->setEdges(RectangleEdge::None);
rightBox->setVisible(false);
}
Item *Header::createTitle(const UTF8 &text)
{
title = new gui::Label(nullptr, 0, 0, 0, 0);
title->setMaximumSize(getWidth(), getHeight());
title->setFont(style::header::font::title);
title->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Top));
title->setPadding(gui::Padding(0, style::header::title::top_padding, 0, 0));
title->setEdges(RectangleEdge::None);
title->setEllipsis(Ellipsis::Right);
title->setVisible(true);
title->setText(text);
return title;
}
void Header::showOuterBoxes()
{
leftBox->setVisible(true);
rightBox->setVisible(true);
resizeItems();
}
void Header::hideOuterBoxes()
{
if (rightBox->empty() && leftBox->empty()) {
rightBox->setVisible(false);
leftBox->setVisible(false);
}
}
void Header::addToLeftBox(Item *item)
{
leftBox->erase();
showOuterBoxes();
leftBox->addWidget(item);
leftBox->resizeItems();
}
void Header::addToCenterBox(Item *item)
{
centerBox->erase();
centerBox->addWidget(item);
centerBox->resizeItems();
}
void Header::addToRightBox(Item *item)
{
rightBox->erase();
showOuterBoxes();
rightBox->addWidget(item);
rightBox->resizeItems();
}
void Header::setTitle(const UTF8 &text)
{
addToCenterBox(createTitle(text));
setEdges(RectangleEdge::Bottom);
resizeItems();
}
UTF8 Header::getTitle()
{
return title ? title->getText() : "";
}
void Header::setTitleVisibility(bool visibility)
{
if (title) {
visibility ? setEdges(RectangleEdge::Bottom) : setEdges(RectangleEdge::None);
title->setVisible(visibility);
}
}
void Header::navigationIndicatorAdd(Item *item, BoxSelection boxSelection)
{
switch (boxSelection) {
case BoxSelection::Left:
addToLeftBox(item);
break;
case BoxSelection::Center:
addToCenterBox(item);
break;
case BoxSelection::Right:
addToRightBox(item);
break;
}
resizeItems();
}
void Header::navigationIndicatorRemove(BoxSelection boxSelection)
{
switch (boxSelection) {
case BoxSelection::Left:
leftBox->erase();
break;
case BoxSelection::Center:
centerBox->erase();
break;
case BoxSelection::Right:
rightBox->erase();
break;
}
hideOuterBoxes();
resizeItems();
}
bool Header::navigationIndicatorVisible(BoxSelection boxSelection)
{
switch (boxSelection) {
case BoxSelection::Left:
return leftBox->visible;
case BoxSelection::Center:
return centerBox->visible;
case BoxSelection::Right:
return rightBox->visible;
}
return false;
}
} // namespace gui::header
A => +45 -0
@@ 0,0 1,45 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <BoxLayout.hpp>
#include <Label.hpp>
#include <Image.hpp>
namespace gui::header
{
enum class BoxSelection
{
Left,
Center,
Right
};
class Header : public HBox
{
private:
HBox *leftBox = nullptr;
HBox *centerBox = nullptr;
HBox *rightBox = nullptr;
Label *title = nullptr;
Item *createTitle(const UTF8 &text);
void hideOuterBoxes();
void showOuterBoxes();
void addToLeftBox(Item *item);
void addToCenterBox(Item *item);
void addToRightBox(Item *item);
public:
Header(Item *parent, Position x, Position y, Length w, Length h);
void setTitle(const UTF8 &text);
[[nodiscard]] UTF8 getTitle();
void setTitleVisibility(bool visibility);
void navigationIndicatorAdd(Item *item, BoxSelection position);
void navigationIndicatorRemove(BoxSelection position);
[[nodiscard]] bool navigationIndicatorVisible(BoxSelection position);
};
} // namespace gui::header
R module-apps/apps-common/widgets/IceBox.cpp => +14 -8
@@ 1,30 1,36 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#include "IceBox.hpp"
+#include "IceAction.hpp"
+#include "Style.hpp"
#include <Text.hpp>
+#include <Image.hpp>
#include <i18n/i18n.hpp>
-namespace gui
+namespace gui::header
{
- IceBox::IceBox(Item *parent)
- : HBox(parent, style::window::ice::x, style::window::ice::y, style::window::ice::w, style::window::ice::h)
+ IceAction::IceAction(Item *parent)
+ : HBox(parent, 0, 0, style::header::navigation_indicator::w, style::header::navigation_indicator::h)
{
setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
setEdges(RectangleEdge::None);
+ setMargins(Margins(style::header::navigation_indicator::right_left_margin,
+ style::header::navigation_indicator::top_margin,
+ 0,
+ 0));
- auto arrow = new gui::Image("left_label_arrow");
+ auto arrow = new gui::Image("arrow_left_24px_W_G");
arrow->activeItem = false;
arrow->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
- arrow->setMargins(Margins(0, 0, style::window::ice::margin, 0));
addWidget(arrow);
- auto iceText = new gui::Text(nullptr, 0, 0, style::window::ice::text::w, style::window::ice::h);
+ auto iceText = new gui::Text(nullptr, 0, 0, 0, 0);
+ iceText->setMaximumSize(style::header::navigation_indicator::ice_w, style::header::navigation_indicator::h);
iceText->activeItem = false;
iceText->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
iceText->setFont(style::window::font::verysmall);
iceText->setText(utils::translate("app_desktop_emergency"));
addWidget(iceText);
}
-} // namespace gui
+} // namespace gui::header
A => +15 -0
@@ 0,0 1,15 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <BoxLayout.hpp>
namespace gui::header
{
class IceAction : public HBox
{
public:
explicit IceAction(Item *parent = nullptr);
};
} // namespace gui::header
A => +31 -0
@@ 0,0 1,31 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "SearchAction.hpp"
#include "Style.hpp"
#include <Text.hpp>
#include <Image.hpp>
namespace gui::header
{
SearchAction::SearchAction(Item *parent)
: HBox(parent, 0, 0, style::header::navigation_indicator::w, style::header::navigation_indicator::h)
{
setAlignment(Alignment(Alignment::Horizontal::Right, Alignment::Vertical::Center));
setEdges(RectangleEdge::None);
setMargins(Margins(0,
style::header::navigation_indicator::top_margin,
style::header::navigation_indicator::right_left_margin,
0));
setReverseOrder(true);
auto arrow = new gui::Image("arrow_right_24px_W_G");
arrow->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
addWidget(arrow);
auto search = new gui::Image("search_32px_W_G");
search->setAlignment(Alignment(Alignment::Horizontal::Left, Alignment::Vertical::Center));
addWidget(search);
}
} // namespace gui::header
A => +15 -0
@@ 0,0 1,15 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <BoxLayout.hpp>
namespace gui::header
{
class SearchAction : public HBox
{
public:
explicit SearchAction(Item *parent = nullptr);
};
} // namespace gui::header
A => +26 -0
@@ 0,0 1,26 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <Style.hpp>
namespace style::header
{
namespace title
{
inline constexpr auto top_padding = 6u;
}; // namespace title
namespace navigation_indicator
{
inline constexpr auto h = 32u;
inline constexpr auto w = 60u;
inline constexpr auto ice_w = 40u;
inline constexpr auto top_margin = 7u;
inline constexpr auto right_left_margin = 22u;
inline constexpr auto box_width = w + right_left_margin;
} // namespace navigation_indicator
}; // namespace style::header