[DEV] add capability of pop-up
This commit is contained in:
parent
149405880d
commit
f73a5b80c4
@ -216,3 +216,30 @@ void ewol::Windows::setTitle(const etk::UString& _title) {
|
||||
etk::UString title = _title;
|
||||
getContext().setTitle(title);
|
||||
}
|
||||
|
||||
|
||||
void ewol::Windows::createPopUpMessage(enum popUpMessageType _type, const etk::UString& _message)
|
||||
{
|
||||
widget::StdPopUp* tmpPopUp = new widget::StdPopUp();
|
||||
if (tmpPopUp == NULL) {
|
||||
EWOL_ERROR("Can not create a simple pop-up");
|
||||
return;
|
||||
}
|
||||
switch(_type) {
|
||||
case messageTypeInfo:
|
||||
tmpPopUp->setTitle("Info");
|
||||
break;
|
||||
case messageTypeWarning:
|
||||
tmpPopUp->setTitle("Warning");
|
||||
break;
|
||||
case messageTypeError:
|
||||
tmpPopUp->setTitle("Error");
|
||||
break;
|
||||
case messageTypeCritical:
|
||||
tmpPopUp->setTitle("Critical");
|
||||
break;
|
||||
}
|
||||
tmpPopUp->setComment(_message);
|
||||
tmpPopUp->setButtonLabel(0, "close");
|
||||
popUpWidgetPush(tmpPopUp);
|
||||
}
|
||||
|
@ -71,8 +71,20 @@ namespace ewol {
|
||||
virtual void calculateSize(const vec2& _availlable);
|
||||
virtual ewol::Widget * getWidgetAtPos(const vec2& _pos);
|
||||
void setTitle(const etk::UString& _title);
|
||||
public:
|
||||
enum popUpMessageType {
|
||||
messageTypeInfo, //!< information message pop-up
|
||||
messageTypeWarning, //!< warning message pop-up
|
||||
messageTypeError, //!< Error message pop-up
|
||||
messageTypeCritical //!< Critical message pop-up
|
||||
};
|
||||
/**
|
||||
* @brief Create a simple pop-up message on the screen for application error.
|
||||
* @param[in] _type Type of the error.
|
||||
* @param[in] _message message to display (decorated)
|
||||
*/
|
||||
virtual void createPopUpMessage(enum popUpMessageType _type, const etk::UString& _message);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -18,24 +18,13 @@
|
||||
#undef __class__
|
||||
#define __class__ "ewol::StdPopUp"
|
||||
|
||||
extern const char * const ewolEventFileStdPopUpCancel = "ewol event std_pop_up cancel";
|
||||
extern const char * const ewolEventFileStdPopUpValidate = "ewol event std_pop_up validate";
|
||||
extern const char * const ewolEventFileStdPopUpButton1 = "ewol event std_pop_up BT1";
|
||||
extern const char * const ewolEventFileStdPopUpButton2 = "ewol event std_pop_up BT2";
|
||||
extern const char * const ewolEventFileStdPopUpButton3 = "ewol event std_pop_up BT3";
|
||||
extern const char * const ewolEventFileStdPopUpButton4 = "ewol event std_pop_up BT4";
|
||||
const char * const widget::StdPopUp::eventButton = "ewol-event-pop-up-button";
|
||||
|
||||
widget::StdPopUp::StdPopUp(void) {
|
||||
addEventId(ewolEventFileStdPopUpCancel);
|
||||
addEventId(ewolEventFileStdPopUpValidate);
|
||||
addEventId(ewolEventFileStdPopUpButton1);
|
||||
addEventId(ewolEventFileStdPopUpButton2);
|
||||
addEventId(ewolEventFileStdPopUpButton3);
|
||||
addEventId(ewolEventFileStdPopUpButton4);
|
||||
widget::StdPopUp::StdPopUp(void) :
|
||||
m_title(NULL),
|
||||
m_comment(NULL) {
|
||||
addEventId(eventButton);
|
||||
|
||||
m_widgetTitleId = -1;
|
||||
m_widgetValidateId = -1;
|
||||
m_widgetCancelId = -1;
|
||||
|
||||
|
||||
ewol::sizerVert * mySizerVert = NULL;
|
||||
@ -105,7 +94,7 @@ widget::StdPopUp::~StdPopUp(void) {
|
||||
|
||||
}
|
||||
|
||||
void widget::StdPopUp::setTitle(etk::UString _label) {
|
||||
void widget::StdPopUp::setTitle(const etk::UString& _label) {
|
||||
ewol::Label * tmpWidget = (ewol::Label*)ewol::widgetManager::get(m_widgetTitleId);
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
@ -113,7 +102,7 @@ void widget::StdPopUp::setTitle(etk::UString _label) {
|
||||
tmpWidget->setLabel(_label);
|
||||
}
|
||||
|
||||
void widget::StdPopUp::setValidateLabel(etk::UString _label) {
|
||||
void widget::StdPopUp::setValidateLabel(const etk::UString& _label) {
|
||||
ewol::Button * tmpWidget = (ewol::Button*)ewol::widgetManager::get(m_widgetValidateId);
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
@ -121,7 +110,7 @@ void widget::StdPopUp::setValidateLabel(etk::UString _label) {
|
||||
tmpWidget->setLabel(_label);
|
||||
}
|
||||
|
||||
void widget::StdPopUp::setCancelLabel(etk::UString _label) {
|
||||
void widget::StdPopUp::setCancelLabel(const etk::UString& _label) {
|
||||
ewol::Button * tmpWidget = (ewol::Button*)ewol::widgetManager::get(m_widgetCancelId);
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
@ -129,10 +118,6 @@ void widget::StdPopUp::setCancelLabel(etk::UString _label) {
|
||||
tmpWidget->setLabel(_label);
|
||||
}
|
||||
|
||||
void widget::StdPopUp::setFolder(etk::UString _folder) {
|
||||
m_folder = _folder;
|
||||
}
|
||||
|
||||
bool widget::StdPopUp::onEventAreaExternal(int32_t _widgetID, const char *_generateEventId, const char *_eventExternId, float _x, float _y) {
|
||||
EWOL_INFO("Receive Event from the BT ... : widgetid=" << _widgetID << "\"" << _generateEventId << "\" == > internalEvent=\"" << _eventExternId << "\"" );
|
||||
if (ewolEventFileChooserCancel == _eventExternId) {
|
||||
|
@ -15,28 +15,25 @@
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
|
||||
extern const char * const ewolEventFileStdPopUpButton1;
|
||||
extern const char * const ewolEventFileStdPopUpButton2;
|
||||
extern const char * const ewolEventFileStdPopUpButton3;
|
||||
extern const char * const ewolEventFileStdPopUpButton4;
|
||||
extern const char * const ewolEventFileStdPopUpButton5;
|
||||
extern const char * const ewolEventFileStdPopUpButton6;
|
||||
|
||||
namespace widget {
|
||||
class StdPopUp : public widget::PopUp {
|
||||
public:
|
||||
// Event list of properties
|
||||
static const char * const eventButton;
|
||||
public:
|
||||
StdPopUp(void);
|
||||
~StdPopUp(void);
|
||||
// Derived function
|
||||
virtual const char * const getObjectType(void) { return "EwolPopUp"; };
|
||||
virtual bool onEventAreaExternal(int32_t _widgetID, const char *_generateEventId, const char *_eventExternId, float _x, float _y);
|
||||
void setTitle(etk::UString _text);
|
||||
void setComment(etk::UString _text);
|
||||
void setButtonLabel(int32_t _btId, etk::UString _text); // note : if no label no bt...
|
||||
virtual const char * const getObjectType(void) {
|
||||
return "ewol::StdPopUp";
|
||||
};
|
||||
void setTitle(const etk::UString& _text);
|
||||
void setComment(const etk::UString& _text);
|
||||
void addButton(const etk::UString& _text);
|
||||
private:
|
||||
ewol::widget::Label* m_title;
|
||||
ewol::widget::Label* m_comment;
|
||||
ewol::widget::Button* m_button[6];
|
||||
widget::Label* m_title;
|
||||
widget::Label* m_comment;
|
||||
etk::Vector<widget::Button*> m_button;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -110,6 +110,7 @@ def Create(target):
|
||||
'ewol/widget/WSlider.cpp',
|
||||
'ewol/widget/Spacer.cpp',
|
||||
'ewol/widget/WidgetScrolled.cpp',
|
||||
'ewol/widget/meta/StdPopUp.cpp',
|
||||
'ewol/widget/meta/FileChooser.cpp',
|
||||
'ewol/widget/meta/ColorChooser.cpp',
|
||||
'ewol/widget/meta/Parameter.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user