[DEV] update search access and unaccess

This commit is contained in:
Edouard DUPIN 2015-05-21 21:21:01 +02:00
parent 4e527931c7
commit 32b0b76fb9
4 changed files with 43 additions and 5 deletions

View File

@ -139,6 +139,7 @@ void MainWindows::init() {
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::create(); m_bufferManager = appl::BufferManager::create();
m_viewerManager = appl::ViewerManager::create();
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert); mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
mySizerVert->setName("plop 1111111"); mySizerVert->setName("plop 1111111");
@ -285,7 +286,17 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
m_widgetSearch->show(); m_widgetSearch->show();
m_widgetSearch->selectSearch(); m_widgetSearch->selectSearch();
} else { } else {
if (m_widgetSearch->isSelectSearch()) {
m_widgetSearch->hide(); m_widgetSearch->hide();
if (m_viewerManager != nullptr) {
std::shared_ptr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
}
} else {
m_widgetSearch->selectSearch();
}
} }
} else if (_value == "menu:replace") { } else if (_value == "menu:replace") {
if (m_widgetSearch == nullptr) { if (m_widgetSearch == nullptr) {
@ -295,7 +306,17 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
m_widgetSearch->show(); m_widgetSearch->show();
m_widgetSearch->selectReplace(); m_widgetSearch->selectReplace();
} else { } else {
if (m_widgetSearch->isSelectReplace()) {
m_widgetSearch->hide(); m_widgetSearch->hide();
if (m_viewerManager != nullptr) {
std::shared_ptr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
}
} else {
m_widgetSearch->selectReplace();
}
} }
} else if (_value == "menu:find:previous") { } else if (_value == "menu:find:previous") {
APPL_TODO("Event from Menu : " << _value); APPL_TODO("Event from Menu : " << _value);

View File

@ -17,7 +17,7 @@
#include <ewol/widget/Label.h> #include <ewol/widget/Label.h>
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <appl/Gui/Search.h> #include <appl/Gui/Search.h>
#include <appl/Gui/ViewerManager.h>
class MainWindows : public ewol::widget::Windows { class MainWindows : public ewol::widget::Windows {
private: private:
std::shared_ptr<ewol::widget::Label> m_widgetLabelFileName; std::shared_ptr<ewol::widget::Label> m_widgetLabelFileName;
@ -31,6 +31,7 @@ class MainWindows : public ewol::widget::Windows {
virtual ~MainWindows(); virtual ~MainWindows();
private: private:
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
/** /**
* @brief Display a pop-up to the select the name of the file. * @brief Display a pop-up to the select the name of the file.
* @param[in] _buffer Buffer that might be saved with a new name. * @param[in] _buffer Buffer that might be saved with a new name.

View File

@ -159,9 +159,23 @@ void appl::widget::Search::selectSearch() {
} }
} }
bool appl::widget::Search::isSelectSearch() {
if (m_searchEntry != nullptr) {
return m_searchEntry->getFocus();
}
return false;
}
void appl::widget::Search::selectReplace() { void appl::widget::Search::selectReplace() {
if (m_replaceEntry != nullptr) { if (m_replaceEntry != nullptr) {
m_replaceEntry->keepFocus(); m_replaceEntry->keepFocus();
} }
} }
bool appl::widget::Search::isSelectReplace() {
if (m_replaceEntry != nullptr) {
return m_replaceEntry->getFocus();
}
return false;
}

View File

@ -44,7 +44,9 @@ namespace appl {
void replace(); void replace();
public: public:
void selectSearch(); void selectSearch();
bool isSelectSearch();
void selectReplace(); void selectReplace();
bool isSelectReplace();
private: // callback functions private: // callback functions
void OnCallbackHide(); void OnCallbackHide();
void OnCallbackSearchValue(const std::string& _value); void OnCallbackSearchValue(const std::string& _value);