[DEV] add button keep under element name, composer add register sub event with widget name, scroll add limit parameter
This commit is contained in:
parent
5c1fe0db5b
commit
3b5943c1b2
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit fe0d7ab99f7a1ac523ef595dedd309d7e9a985e0
|
||||
Subproject commit 4b07b0501793357ffe59333c5d1b2229b1334b54
|
@ -397,6 +397,27 @@ void widget::Button::PeriodicCall(int64_t _localTime)
|
||||
}
|
||||
|
||||
|
||||
ewol::Widget* widget::Button::GetWidgetNamed(const etk::UString& _widgetName)
|
||||
{
|
||||
if (GetName()==_widgetName) {
|
||||
return this;
|
||||
}
|
||||
if (m_subWidget[0]!= NULL) {
|
||||
ewol::Widget* tmpWidget = m_subWidget[0]->GetWidgetNamed(_widgetName);
|
||||
if (NULL != tmpWidget) {
|
||||
return tmpWidget;
|
||||
}
|
||||
}
|
||||
if (m_subWidget[1]!= NULL) {
|
||||
ewol::Widget* tmpWidget = m_subWidget[1]->GetWidgetNamed(_widgetName);
|
||||
if (NULL != tmpWidget) {
|
||||
return tmpWidget;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool widget::Button::LoadXML(TiXmlNode* _node)
|
||||
{
|
||||
if (NULL==_node) {
|
||||
|
@ -154,6 +154,7 @@ namespace widget {
|
||||
virtual bool OnEventInput(const ewol::EventInput& _event);
|
||||
virtual bool OnEventEntry(const ewol::EventEntry& _event);
|
||||
virtual bool LoadXML(TiXmlNode* _node);
|
||||
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
||||
private: // derived function
|
||||
virtual void PeriodicCall(int64_t _localTime);
|
||||
};
|
||||
|
@ -103,3 +103,16 @@ bool widget::Composer::CommonLoadXML(const char* data)
|
||||
}
|
||||
|
||||
|
||||
void widget::Composer::RegisterOnEventNameWidget(const etk::UString& _subWidgetName,
|
||||
const char * _eventId,
|
||||
const char * _eventIdgenerated,
|
||||
const etk::UString& _overloadData)
|
||||
{
|
||||
ewol::Widget* tmpWidget = GetWidgetNamed(_subWidgetName);
|
||||
if (NULL != tmpWidget) {
|
||||
//EWOL_DEBUG("Find widget named : \"" << _subWidgetName << "\" register event=\"" << _eventId << "\"");
|
||||
tmpWidget->RegisterOnEvent(this, _eventId, _eventIdgenerated, _overloadData);
|
||||
} else {
|
||||
EWOL_WARNING("Can not register event : \"" << _eventId << "\" the widget named=\"" << _subWidgetName << "\" does not exist");
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,17 @@ namespace widget
|
||||
* @return false ==> some error occured
|
||||
*/
|
||||
bool LoadFromString(const etk::UString& composerXmlString);
|
||||
/**
|
||||
* @brief Register an Event an named widget. @see RegisterOnEvent
|
||||
* @param[in] _subWidgetName Name of the subWidget.
|
||||
* @param[in] _eventId Event generate inside the object.
|
||||
* @param[in] _eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...)
|
||||
* @param[in] _overloadData When the user prever to receive a data specificly for this event ...
|
||||
*/
|
||||
void RegisterOnEventNameWidget(const etk::UString& _subWidgetName,
|
||||
const char * _eventId,
|
||||
const char * _eventIdgenerated = NULL,
|
||||
const etk::UString& _overloadData="");
|
||||
private:
|
||||
/**
|
||||
* @brief Load a composition with a file.
|
||||
|
@ -29,6 +29,8 @@ void widget::Scroll::UnInit(void)
|
||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
||||
}
|
||||
|
||||
const char* const widget::Scroll::configLimit = "limit";
|
||||
|
||||
widget::Scroll::Scroll(void) :
|
||||
m_limit(0.15,0.5),
|
||||
m_pixelScrolling(20),
|
||||
@ -37,6 +39,7 @@ widget::Scroll::Scroll(void) :
|
||||
m_highSpeedButton(-1),
|
||||
m_highSpeedType(ewol::keyEvent::typeUnknow)
|
||||
{
|
||||
RegisterConfig(configLimit, "vec2", NULL, "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end");
|
||||
|
||||
}
|
||||
|
||||
@ -348,3 +351,29 @@ ewol::Widget* widget::Scroll::GetWidgetAtPos(const vec2& _pos)
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
bool widget::Scroll::OnSetConfig(const ewol::EConfig& _conf)
|
||||
{
|
||||
if (true == widget::Container::OnSetConfig(_conf)) {
|
||||
return true;
|
||||
}
|
||||
if (_conf.GetConfig() == configLimit) {
|
||||
SetLimit(_conf.GetData());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool widget::Scroll::OnGetConfig(const char* _config, etk::UString& _result) const
|
||||
{
|
||||
if (true == widget::Container::OnGetConfig(_config, _result)) {
|
||||
return true;
|
||||
}
|
||||
if (_config == configLimit) {
|
||||
_result = GetLimit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,9 @@ namespace widget {
|
||||
|
||||
class Scroll : public widget::Container
|
||||
{
|
||||
public:
|
||||
// Cinfig parameter list:
|
||||
static const char* const configLimit;
|
||||
public:
|
||||
static void Init(void);
|
||||
static void UnInit(void);
|
||||
@ -53,7 +56,7 @@ namespace widget {
|
||||
* @brief Get the limit of scrolling
|
||||
* @return scrolling limit
|
||||
*/
|
||||
const vec2& GetLimit(void) { return m_limit; };
|
||||
const vec2& GetLimit(void) const { return m_limit; };
|
||||
|
||||
public: // Derived function
|
||||
virtual const char * const GetObjectType(void) { return "ewol::widget::Scroll"; };
|
||||
@ -64,6 +67,8 @@ namespace widget {
|
||||
virtual ewol::Widget* GetWidgetAtPos(const vec2& _pos);
|
||||
protected: // Derived function
|
||||
virtual void OnDraw(void);
|
||||
virtual bool OnSetConfig(const ewol::EConfig& _conf);
|
||||
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -180,7 +180,7 @@ bool widget::Sizer::LoadXML(TiXmlNode* _node)
|
||||
// parse generic properties :
|
||||
widget::ContainerN::LoadXML(_node);
|
||||
|
||||
const char* tmpAttributeValue = _node->ToElement()->Attribute("borderSize");
|
||||
const char* tmpAttributeValue = _node->ToElement()->Attribute("border");
|
||||
if (NULL != tmpAttributeValue) {
|
||||
m_borderSize = tmpAttributeValue;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace widget {
|
||||
*/
|
||||
const ewol::Dimension& GetBorderSize(void) { return m_borderSize; };
|
||||
public: // Derived function
|
||||
virtual const char * const GetObjectType(void) { return "Ewol::Sizer"; };
|
||||
virtual const char * const GetObjectType(void) { return "ewol::widget::sizer"; };
|
||||
virtual void CalculateSize(const vec2& _availlable);
|
||||
virtual void CalculateMinMaxSize(void);
|
||||
virtual bool LoadXML(TiXmlNode* _node);
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "Spacer"
|
||||
#define __class__ "Spacer"
|
||||
|
||||
static ewol::Widget* Create(void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user