update the focus metode to the search windows
This commit is contained in:
parent
750e663eca
commit
e10e633949
@ -341,3 +341,17 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void MainWindows::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
ewol::Windows::OnObjectRemove(removeObject);
|
||||
if (m_widgetLabelFileName == removeObject) {
|
||||
m_widgetLabelFileName = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,13 @@ class MainWindows : public ewol::Windows
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
|
||||
#define EDN_CAST_MAIN_WINDOWS(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_MAIN_WINDOWS,MainWindows,curentPointer)
|
||||
|
@ -31,21 +31,7 @@
|
||||
#include "MainWindows.h"
|
||||
#include "appl/globalMsg.h"
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/ButtonImage.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widgetMeta/FileChooser.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
@ -54,8 +40,10 @@
|
||||
extern const char * const TYPE_EOBJECT_APPL_SEARCH = __class__;
|
||||
|
||||
|
||||
const char* const l_eventSearchEntry = "appl-search-entry";
|
||||
const char* const l_eventReplaceEntry = "appl-replace-entry";
|
||||
const char* const l_eventSearchEntry = "appl-search-entry";
|
||||
const char* const l_eventSearchEntryEnter = "appl-search-entry-enter";
|
||||
const char* const l_eventReplaceEntry = "appl-replace-entry";
|
||||
const char* const l_eventReplaceEntryEnter = "appl-replace-entry-enter";
|
||||
const char* const l_eventSearchBt = "appl-search-button";
|
||||
const char* const l_eventReplaceBt = "appl-replace-button";
|
||||
const char* const l_eventCaseCb = "appl-case-sensitive-CheckBox";
|
||||
@ -63,63 +51,98 @@ const char* const l_eventWrapCb = "appl-wrap-CheckBox";
|
||||
const char* const l_eventForwardCb = "appl-forward-CheckBox";
|
||||
const char* const l_eventHideBt = "appl-hide-button";
|
||||
|
||||
Search::Search(void)
|
||||
Search::Search(void) :
|
||||
m_searchEntry(NULL),
|
||||
m_replaceEntry(NULL)
|
||||
{
|
||||
m_forward = false;
|
||||
|
||||
ewol::Entry * myEntry = NULL;
|
||||
ewol::ButtonImage * myButtonImage = NULL;
|
||||
|
||||
myEntry = new ewol::Entry();
|
||||
myEntry->RegisterOnEvent(this, ewolEventEntryModify, l_eventSearchEntry);
|
||||
myEntry->SetExpendX(true);
|
||||
myEntry->SetFillX(true);
|
||||
SubWidgetAdd(myEntry);
|
||||
m_searchEntry = new ewol::Entry();
|
||||
if (NULL == m_searchEntry) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
m_searchEntry->RegisterOnEvent(this, ewolEventEntryModify, l_eventSearchEntry);
|
||||
m_searchEntry->RegisterOnEvent(this, ewolEventEntryEnter, l_eventSearchEntryEnter);
|
||||
m_searchEntry->SetExpendX(true);
|
||||
m_searchEntry->SetFillX(true);
|
||||
SubWidgetAdd(m_searchEntry);
|
||||
}
|
||||
|
||||
myButtonImage = new ewol::ButtonImage("icon/Search.svg");
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventSearchBt);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
if (NULL == myButtonImage) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventSearchBt);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
}
|
||||
|
||||
myEntry = new ewol::Entry();
|
||||
myEntry->RegisterOnEvent(this, ewolEventEntryModify, l_eventReplaceEntry);
|
||||
myEntry->SetExpendX(true);
|
||||
myEntry->SetFillX(true);
|
||||
SubWidgetAdd(myEntry);
|
||||
m_replaceEntry = new ewol::Entry();
|
||||
if (NULL == m_replaceEntry) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
m_replaceEntry->RegisterOnEvent(this, ewolEventEntryModify, l_eventReplaceEntry);
|
||||
m_replaceEntry->RegisterOnEvent(this, ewolEventEntryEnter, l_eventReplaceEntryEnter);
|
||||
m_replaceEntry->SetExpendX(true);
|
||||
m_replaceEntry->SetFillX(true);
|
||||
SubWidgetAdd(m_replaceEntry);
|
||||
}
|
||||
|
||||
myButtonImage = new ewol::ButtonImage("icon/Replace.svg");
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventReplaceBt);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
if (NULL == myButtonImage) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventReplaceBt);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
}
|
||||
|
||||
myButtonImage = new ewol::ButtonImage("icon/CaseSensitive.svg");
|
||||
myButtonImage->SetImageSelected("icon/CaseSensitive.svg", 0xFFFFFF5F);
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->SetToggleMode(true);
|
||||
myButtonImage->SetValue(SearchData::GetCase());
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventCaseCb);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
if (NULL == myButtonImage) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
myButtonImage->SetImageSelected("icon/CaseSensitive.svg", 0xFFFFFF5F);
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->SetToggleMode(true);
|
||||
myButtonImage->SetValue(SearchData::GetCase());
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventCaseCb);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
}
|
||||
|
||||
myButtonImage = new ewol::ButtonImage("icon/WrapAround.svg");
|
||||
myButtonImage->SetImageSelected("icon/WrapAround.svg", 0xFFFFFF5F);
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->SetToggleMode(true);
|
||||
myButtonImage->SetValue(SearchData::GetWrap());
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventWrapCb);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
if (NULL == myButtonImage) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
myButtonImage->SetImageSelected("icon/WrapAround.svg", 0xFFFFFF5F);
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->SetToggleMode(true);
|
||||
myButtonImage->SetValue(SearchData::GetWrap());
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventWrapCb);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
}
|
||||
|
||||
myButtonImage = new ewol::ButtonImage("icon/Up.svg");
|
||||
myButtonImage->SetImageSelected("icon/Down.svg");
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->SetToggleMode(true);
|
||||
myButtonImage->SetValue(m_forward);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventForwardCb);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
if (NULL == myButtonImage) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
myButtonImage->SetImageSelected("icon/Down.svg");
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->SetToggleMode(true);
|
||||
myButtonImage->SetValue(m_forward);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventForwardCb);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
}
|
||||
|
||||
myButtonImage = new ewol::ButtonImage("icon/Forbidden.svg");
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventHideBt);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
if (NULL == myButtonImage) {
|
||||
APPL_ERROR("Widget allocation error ==> it will missing in the display");
|
||||
} else {
|
||||
myButtonImage->SetMinSize(32,32);
|
||||
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventHideBt);
|
||||
SubWidgetAdd(myButtonImage);
|
||||
}
|
||||
|
||||
RegisterMultiCast(ednMsgGuiSearch);
|
||||
// basicly hiden ...
|
||||
@ -178,8 +201,23 @@ void Search::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId
|
||||
//APPL_INFO("Search receive message : \"" << eventId << "\" data=\"" << data << "\"");
|
||||
if ( eventId == l_eventSearchEntry) {
|
||||
SearchData::SetSearch(data);
|
||||
} else if ( eventId == l_eventSearchEntryEnter) {
|
||||
SearchData::SetSearch(data);
|
||||
if (true==m_forward) {
|
||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
||||
} else {
|
||||
SendMultiCast(ednMsgGuiFind, "Next");
|
||||
}
|
||||
} else if ( eventId == l_eventReplaceEntry) {
|
||||
SearchData::SetReplace(data);
|
||||
} else if ( eventId == l_eventReplaceEntryEnter) {
|
||||
SearchData::SetReplace(data);
|
||||
SendMultiCast(ednMsgGuiReplace, "Normal");
|
||||
if (true==m_forward) {
|
||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
||||
} else {
|
||||
SendMultiCast(ednMsgGuiFind, "Next");
|
||||
}
|
||||
} else if ( eventId == l_eventSearchBt) {
|
||||
if (true==m_forward) {
|
||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
||||
@ -216,10 +254,36 @@ void Search::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId
|
||||
} else if ( eventId == ednMsgGuiSearch) {
|
||||
if (true == IsHide()) {
|
||||
Show();
|
||||
if (m_searchEntry!= NULL) {
|
||||
m_searchEntry->KeepFocus();
|
||||
}
|
||||
} else {
|
||||
Hide();
|
||||
if( (m_searchEntry!=NULL && true==m_searchEntry->GetFocus())
|
||||
|| (m_replaceEntry!=NULL && true==m_replaceEntry->GetFocus()) ) {
|
||||
Hide();
|
||||
} else if (m_searchEntry!= NULL) {
|
||||
m_searchEntry->KeepFocus();
|
||||
} else {
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void Search::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
ewol::SizerHori::OnObjectRemove(removeObject);
|
||||
if (removeObject == m_searchEntry) {
|
||||
m_searchEntry = NULL;
|
||||
}
|
||||
if (removeObject == m_replaceEntry) {
|
||||
m_replaceEntry = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
|
||||
extern const char * const TYPE_EOBJECT_APPL_SEARCH;
|
||||
|
||||
@ -59,8 +60,17 @@ class Search : public ewol::SizerHori
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
private:
|
||||
bool m_forward;
|
||||
ewol::Entry * m_searchEntry;
|
||||
ewol::Entry * m_replaceEntry;
|
||||
};
|
||||
|
||||
#define EDN_CAST_APPL_SEARCH(curentPointer) EWOL_CAST(TYPE_EOBJECT_APPL_SEARCH,Search,curentPointer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user