mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-24 23:48:31 -04:00
Added new window for text editing.
This commit is contained in:
1 parent
0208d065c3
commit
ffa538944c
8 files changed
+167
-3
No files matched your search
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* @file NotesEditWindow.cpp
|
||||
* @author Robert Borzecki (robert.borzecki@mudita.com)
|
||||
* @date 13 sie 2019
|
||||
* @brief
|
||||
* @copyright Copyright (C) 2019 mudita.com
|
||||
* @details
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
#include "service-appmgr/ApplicationManager.hpp"
|
||||
|
||||
#include "../ApplicationNotes.hpp"
|
||||
|
||||
#include "service-db/messages/DBMessage.hpp"
|
||||
#include "i18/i18.hpp"
|
||||
|
||||
#include "Label.hpp"
|
||||
#include "Margins.hpp"
|
||||
#include "Text.hpp"
|
||||
#include "NotesEditWindow.hpp"
|
||||
|
||||
namespace gui {
|
||||
|
||||
NotesEditWindow::NotesEditWindow( app::Application* app ) :
|
||||
AppWindow(app,"EditWindow") {
|
||||
setSize( 480, 600 );
|
||||
|
||||
buildInterface();
|
||||
}
|
||||
|
||||
void NotesEditWindow::rebuild() {
|
||||
destroyInterface();
|
||||
buildInterface();
|
||||
}
|
||||
void NotesEditWindow::buildInterface() {
|
||||
AppWindow::buildInterface();
|
||||
|
||||
bottomBar->setActive( BottomBar::Side::CENTER, true );
|
||||
bottomBar->setActive( BottomBar::Side::RIGHT, true );
|
||||
bottomBar->setText( BottomBar::Side::CENTER, utils::localize.get("common_open"));
|
||||
bottomBar->setText( BottomBar::Side::RIGHT, utils::localize.get("common_back"));
|
||||
|
||||
gui::Label* title = new gui::Label(this, 0, 108, 480, 42 );
|
||||
title->setFilled( false );
|
||||
title->setBorderColor( gui::ColorNoColor );
|
||||
title->setFont("gt_pressura_light_24");
|
||||
title->setText("New Note");
|
||||
title->setAlignement( gui::Alignment(gui::Alignment::ALIGN_HORIZONTAL_RIGHT, gui::Alignment::ALIGN_VERTICAL_BOTTOM));
|
||||
|
||||
text = new gui::Text( this, 0, 150, 480, 400 );
|
||||
|
||||
topBar->setActive(TopBar::Elements::TIME, true );
|
||||
|
||||
}
|
||||
void NotesEditWindow::destroyInterface() {
|
||||
AppWindow::destroyInterface();
|
||||
children.clear();
|
||||
}
|
||||
|
||||
NotesEditWindow::~NotesEditWindow() {
|
||||
destroyInterface();
|
||||
}
|
||||
|
||||
void NotesEditWindow::onBeforeShow( ShowMode mode, uint32_t command, SwitchData* data ) {
|
||||
}
|
||||
|
||||
bool NotesEditWindow::onInput( const InputEvent& inputEvent ) {
|
||||
//check if any of the lower inheritance onInput methods catch the event
|
||||
bool ret = AppWindow::onInput( inputEvent );
|
||||
if( ret ) {
|
||||
//refresh window only when key is other than enter
|
||||
if( inputEvent.keyCode != KeyCode::KEY_ENTER )
|
||||
application->render( RefreshModes::GUI_REFRESH_FAST );
|
||||
return true;
|
||||
}
|
||||
|
||||
//process only if key is released
|
||||
if(( inputEvent.state != InputEvent::State::keyReleasedShort ) &&
|
||||
(( inputEvent.state != InputEvent::State::keyReleasedLong )))
|
||||
return false;
|
||||
|
||||
if( inputEvent.keyCode == KeyCode::KEY_ENTER ) {
|
||||
LOG_INFO("Enter pressed");
|
||||
}
|
||||
else if( inputEvent.keyCode == KeyCode::KEY_RF ) {
|
||||
application->switchWindow( "MainWindow", 0, nullptr );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} /* namespace gui */
|
||||
|
||||
|
||||
Reference in new issue
Block a user