From c3fe4d263580378922a88d5e6192de207a737cd5 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Tue, 10 Oct 2017 22:12:52 +0300 Subject: [PATCH 01/14] doc fixed --- src/Widget.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Widget.h b/src/Widget.h index e3ef2bde..233e1084 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -172,8 +172,8 @@ namespace PhWidgets enum eArgPChar { help_topic = Pt_ARG_HELP_TOPIC //!< The meaning of this resource depends on the bits set in Pt_ARG_EFLAGS: - //!< If Pt_INTERNAL_HELP isn't set, Pt_ARG_HELP_TOPIC is used to set the topic position within the HTML help file. - //!< If Pt_INTERNAL_HELP is set, Pt_ARG_HELP_TOPIC is the help information to be displayed. + //!< If Pt_INTERNAL_HELP isn't set, Widget::ArgPChar::help_topic is used to set the topic position within the HTML help file. + //!< If Pt_INTERNAL_HELP is set, Widget::ArgPChar::help_topic is the help information to be displayed. }; }; From 679677adbebee4632c9ac85c7c9f0d41e16e691b Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Wed, 11 Oct 2017 12:34:28 +0300 Subject: [PATCH 02/14] events now can be raised directly --- src/Basic.cpp | 14 +++++++------- src/Timer.cpp | 2 +- src/Widget.cpp | 23 ++++++----------------- src/Widget.h | 39 ++++++++++++++++++++++++++++----------- src/WidgetResource.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 36 deletions(-) diff --git a/src/Basic.cpp b/src/Basic.cpp index cb04d30b..d3553f68 100644 --- a/src/Basic.cpp +++ b/src/Basic.cpp @@ -94,35 +94,35 @@ PgColor_t Basic::getFillColor() const void PhWidgets::Basic::OnActivated(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::activate].get(), info); + resource.callback[Callback::activate].raise(info); } void PhWidgets::Basic::OnArmed(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::arm].get(), info); + resource.callback[Callback::arm].raise(info); } void PhWidgets::Basic::OnDisarmed(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::disarm].get(), info); + resource.callback[Callback::disarm].raise(info); } void PhWidgets::Basic::OnGotFocused(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::got_focus].get(), info); + resource.callback[Callback::got_focus].raise(info); } void PhWidgets::Basic::OnLostFocus(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::lost_focus].get(), info); + resource.callback[Callback::lost_focus].raise(info); } void PhWidgets::Basic::OnMenu(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::menu].get(), info); + resource.callback[Callback::menu].raise(info); } void PhWidgets::Basic::OnRepeat(PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::repeat].get(), info); + resource.callback[Callback::repeat].raise(info); } diff --git a/src/Timer.cpp b/src/Timer.cpp index 7fa1a530..0f41eff0 100644 --- a/src/Timer.cpp +++ b/src/Timer.cpp @@ -79,5 +79,5 @@ unsigned long Timer::getRepeat() const void Timer::OnActivate(PtCallbackInfo_t *info) { - onEvent(resource.callback[Callback::timer_activate].get(), info); + resource.callback[Callback::timer_activate].raise(info); } \ No newline at end of file diff --git a/src/Widget.cpp b/src/Widget.cpp index af138c61..c7e52fbc 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -266,45 +266,34 @@ Widget::operator const PtWidget_t*() const return widget(); } -void Widget::onEvent(PtCallbackList_t *cl, PtCallbackInfo_t * info) -{ - - if (nullptr == cl) - return; - - PtWidget_t *w = widget(); - - PtInvokeCallbackList(cl, w, info); -} - void Widget::OnDestroyed( PtCallbackInfo_t * info) { - onEvent( resource.callback[Callback::destroyed].get(), info); + resource.callback[Callback::destroyed].raise(info); } void PhWidgets::Widget::OnBlocked( PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::blocked].get(), info); + resource.callback[Callback::blocked].raise(info); } void PhWidgets::Widget::OnDragDrop( PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::dnd].get(), info); + resource.callback[Callback::dnd].raise(info); } void PhWidgets::Widget::OnOutbound( PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::outbound].get(), info); + resource.callback[Callback::outbound].raise(info); } void PhWidgets::Widget::OnRealized( PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::realized].get(), info); + resource.callback[Callback::realized].raise(info); } void PhWidgets::Widget::OnUnrealized( PtCallbackInfo_t * info) { - onEvent(resource.callback[Callback::unrealized].get(), info); + resource.callback[Callback::unrealized].raise(info); } //for properties: diff --git a/src/Widget.h b/src/Widget.h index 233e1084..1d20e35b 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -38,36 +38,55 @@ namespace PhWidgets //! An event, which raise a notification to registered subscribers (event handlers) that something of interest has occurred. //! Event handlers must be Widget::callback_t type or convertable to it. - template + template class phwidgets_event { - typedef phevent::ph_callback_t value_t; - + public: phwidgets_event(ParentT *parent) : _obj(parent) {} - inline void add(value_t value) + //! add an event handler + inline void add(callback_t value) { - _obj->resource.callback[callback].add(value); + _obj->resource.callback[CallbackID].add(value); } - inline void remove(value_t value) + //! remove an event handler + inline void remove(callback_t value) { - _obj->resource.callback[callback].remove(value); + _obj->resource.callback[CallbackID].remove(value); } - inline void operator+=(value_t value) + //! raise an event + + //! invokes all event handlers that are subscribed to this event + inline void raise(PtCallbackInfo_t * info) const + { + _ob->resource.callback[CallbackID].raise(info); + } + + //! add an event handler + inline void operator+=(callback_t value) { add(value); } - inline void operator-=(value_t value) + //! remove an event handler + inline void operator-=(callback_t value) { remove(value); } + //! raise an event + + //! invokes all event handlers that are subscribed to this event + inline void operator()(PtCallbackInfo_t * info) const + { + raise(info); + } + private: ParentT *_obj; @@ -487,8 +506,6 @@ namespace PhWidgets void setLocation(PhPoint_t); PhPoint_t getLocation() const; - - void onEvent(PtCallbackList_t *cl, PtCallbackInfo_t * info); public: //! (constructor) diff --git a/src/WidgetResource.hpp b/src/WidgetResource.hpp index e4ca3073..6aecf72c 100644 --- a/src/WidgetResource.hpp +++ b/src/WidgetResource.hpp @@ -293,6 +293,18 @@ namespace PhWidgets return cl; } + inline void emitLink(PtCallbackInfo_t *info) const + { + PtCallbackList_t *cl = this->getLink(); + + if (nullptr == cl) + return; + + PtWidget_t *w = _rwidget->widget(); + + PtInvokeCallbackList(cl, w, info); + } + public: @@ -775,6 +787,11 @@ namespace PhWidgets { return this->getLink(); } + + inline void raise(PtCallbackInfo_t * info) const + { + this->emitLink(info); + } }; template @@ -816,6 +833,11 @@ namespace PhWidgets { return this->getLink(); } + + inline void raise(PtCallbackInfo_t * info) const + { + this->emitLink(info); + } }; template @@ -858,6 +880,11 @@ namespace PhWidgets { return this->getLink(); } + + inline void raise(PtCallbackInfo_t * info) const + { + this->emitLink(info); + } }; template @@ -900,6 +927,11 @@ namespace PhWidgets { return this->getLink(); } + + inline void raise(PtCallbackInfo_t * info) const + { + this->emitLink(info); + } }; template @@ -931,6 +963,11 @@ namespace PhWidgets { return this->getLink(); } + + inline void raise(PtCallbackInfo_t * info) const + { + this->emitLink(info); + } }; template @@ -962,6 +999,11 @@ namespace PhWidgets { return this->getLink(); } + + inline void raise(PtCallbackInfo_t * info) const + { + this->emitLink(info); + } }; struct WidgetCallbacksBase From f92e58815669f901bef3d17ee460921152f18751 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Wed, 11 Oct 2017 12:39:00 +0300 Subject: [PATCH 03/14] fixed typo --- src/Widget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Widget.h b/src/Widget.h index 1d20e35b..679ae943 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -64,7 +64,7 @@ namespace PhWidgets //! invokes all event handlers that are subscribed to this event inline void raise(PtCallbackInfo_t * info) const { - _ob->resource.callback[CallbackID].raise(info); + _obj->resource.callback[CallbackID].raise(info); } //! add an event handler From 669018fcf10ad99b2233b04e9c8510cef933a1db Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Wed, 11 Oct 2017 17:33:27 +0300 Subject: [PATCH 04/14] + photon properties --- src/Widget.h | 20 ++++++- src/service/phproperty.hpp | 118 +++++++++++++++++++++++++++++++++++++ src/service/property.hpp | 2 +- 3 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 src/service/phproperty.hpp diff --git a/src/Widget.h b/src/Widget.h index 679ae943..efc4c505 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -13,7 +13,7 @@ #include "./service/mystd/my_exception.h" #include "./service/stdex/stdex.h" -#include "./service/property.hpp" +#include "./service/phproperty.hpp" #include "./service/phevent.hpp" #include "./WidgetResource.hpp" @@ -33,6 +33,8 @@ namespace PhWidgets protected detail::IPtWidget { public: + + typedef phevent::ph_callback_t callback_t;//!< An event handler that is raised when an \link Widget::phwidgets_event event \endlink occur. //! An event, which raise a notification to registered subscribers (event handlers) that something of interest has occurred. @@ -506,6 +508,18 @@ namespace PhWidgets void setLocation(PhPoint_t); PhPoint_t getLocation() const; + + template + ReturnT getArgument() const + { + return static_cast(this)->resource[ArgumentID].get(); + } + + template + void setArgument(ValueT val) + { + static_cast(this)->resource[ArgumentID].set(val); + } public: //! (constructor) @@ -549,7 +563,7 @@ namespace PhWidgets WidgetResourcesSingleton resource; property::bind Enabled;//!< Gets or sets a value indicating whether the widget can respond to user interaction. - property::bind Width;//!< Gets or sets the width of the widget. + //property::bind Width;//!< Gets or sets the width of the widget. property::bind Height;//!< Gets or sets the hight of the widget. property::bind Size;//!< Gets or sets the size of the widget. property::bind BevelWidth;//!< Gets or sets the bevel width of the widget. @@ -571,6 +585,8 @@ namespace PhWidgets void OnRealized(PtCallbackInfo_t *info);//!< Raises the Widget::Realized event. void OnUnrealized(PtCallbackInfo_t *info);//!< Raises the Widget::Unrealized event. + phwidgets_property::bind Width; + }; diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp new file mode 100644 index 00000000..b2cec03e --- /dev/null +++ b/src/service/phproperty.hpp @@ -0,0 +1,118 @@ +#ifndef PH_PROPERTY_HPP +#define PH_PROPERTY_HPP + +#include "property.hpp" + +namespace PhWidgets +{ + template::flag)> + class phwidgets_property{}; + + //phwidgets_property: + template<> + class phwidgets_property : + public cppproperties::detail::property_flag + { + public: + typedef cppproperties::detail::property_flag flags; + }; + + template<> + class phwidgets_property : + public cppproperties::detail::property_flag + { + public: + typedef cppproperties::detail::property_flag flags; + }; + + template<> + class phwidgets_property : + public cppproperties::detail::property_flag + { + public: + typedef cppproperties::detail::property_flag flags; + }; + + //phwidgets_property: + template + class phwidgets_property//ValueT == const... + { + typedef cppproperties::property cpp_property_t; + + public: + template + class bind: + public cpp_property_t::bind) > + { + + public: + typedef cpp_property_t::bind) > cpp_bind_t; + + public: + bind(WidgetClassT *parent) : + cpp_bind_t(parent) + {} + + }; + }; + + + template + class phwidgets_property//ValueT != const... + { + typedef cppproperties::property cpp_property_t; + + + + public: + + template + class bind: + public cpp_property_t::bind< + WidgetClassT, + &(WidgetClassT::getArgument), + &(WidgetClassT::setArgument) > + { + typedef cpp_property_t::bind< + WidgetClassT, + &(WidgetClassT::getArgument), + &(WidgetClassT::setArgument)> + cpp_bind_t; + + public: + bind(WidgetClassT *parent) : + cpp_bind_t(parent) + {} + }; + + }; + + template + class phwidgets_property//ValueT != const... + { + typedef cppproperties::property cpp_property_t; + + public: + + template + class bind: + public cpp_property_t::bind< + WidgetClassT, + &(WidgetClassT::setArgument) > + { + typedef cpp_property_t::bind< + WidgetClassT, + &(WidgetClassT::setArgument) > + cpp_bind_t; + + public: + bind(WidgetClassT *parent) : + cpp_bind_t(parent) + {} + }; + + }; +} + +#endif \ No newline at end of file diff --git a/src/service/property.hpp b/src/service/property.hpp index 4c1b0073..2cc93962 100644 --- a/src/service/property.hpp +++ b/src/service/property.hpp @@ -69,7 +69,7 @@ namespace cppproperties { }; - template + template struct flag_chooser : public flag_chooser_helper { From 74c7a757e1d88b2c80ee45384755adb0092c9d8e Mon Sep 17 00:00:00 2001 From: Alexander <0oktonion0@gmail.com> Date: Wed, 11 Oct 2017 18:16:00 +0300 Subject: [PATCH 05/14] broken since this commit --- src/service/phproperty.hpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp index b2cec03e..3986e31e 100644 --- a/src/service/phproperty.hpp +++ b/src/service/phproperty.hpp @@ -40,14 +40,18 @@ namespace PhWidgets { typedef cppproperties::property cpp_property_t; + template::getter_t Getter> + struct bind_internal: + public cpp_property_t::template bind + { + }; + public: template class bind: - public cpp_property_t::bind) > + public bind_internal) > { - - public: - typedef cpp_property_t::bind) > cpp_bind_t; + typedef bind_internal) > cpp_bind_t; public: bind(WidgetClassT *parent) : @@ -63,21 +67,19 @@ namespace PhWidgets { typedef cppproperties::property cpp_property_t; - - public: template class bind: - public cpp_property_t::bind< + public cpp_property_t::template bind< WidgetClassT, - &(WidgetClassT::getArgument), - &(WidgetClassT::setArgument) > + &(WidgetClassT::template getArgument), + &(WidgetClassT::template setArgument) > { - typedef cpp_property_t::bind< + typedef cpp_property_t::template bind< WidgetClassT, - &(WidgetClassT::getArgument), - &(WidgetClassT::setArgument)> + &(WidgetClassT::template getArgument), + &(WidgetClassT::template setArgument)> cpp_bind_t; public: @@ -97,13 +99,13 @@ namespace PhWidgets template class bind: - public cpp_property_t::bind< + public cpp_property_t::template bind< WidgetClassT, - &(WidgetClassT::setArgument) > + &(WidgetClassT::template setArgument) > { - typedef cpp_property_t::bind< + typedef cpp_property_t::template bind< WidgetClassT, - &(WidgetClassT::setArgument) > + &(WidgetClassT::template setArgument) > cpp_bind_t; public: From a2b94f9bb231c0f1b5795f6cee5bb74a2893d71f Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Thu, 12 Oct 2017 17:14:50 +0300 Subject: [PATCH 06/14] interface for phproperties --- src/Widget.h | 15 +----- src/service/phproperty.hpp | 94 ++++++++++++++++++++++++++++---------- 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/src/Widget.h b/src/Widget.h index efc4c505..165a2583 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -30,7 +30,8 @@ namespace PhWidgets using namespace phevents; class Widget: - protected detail::IPtWidget + protected detail::IPtWidget, + public IPhWidgetsProperty { public: @@ -508,18 +509,6 @@ namespace PhWidgets void setLocation(PhPoint_t); PhPoint_t getLocation() const; - - template - ReturnT getArgument() const - { - return static_cast(this)->resource[ArgumentID].get(); - } - - template - void setArgument(ValueT val) - { - static_cast(this)->resource[ArgumentID].set(val); - } public: //! (constructor) diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp index 3986e31e..a7cdf3f2 100644 --- a/src/service/phproperty.hpp +++ b/src/service/phproperty.hpp @@ -5,6 +5,22 @@ namespace PhWidgets { + struct IPhWidgetsProperty + { + protected: + template + ReturnT getArgument() const + { + return static_cast(this)->resource[ArgumentID].get(); + } + + template + void setArgument(ValueT val) + { + static_cast(this)->resource[ArgumentID].set(val); + } + }; + template::flag)> class phwidgets_property{}; @@ -41,23 +57,32 @@ namespace PhWidgets typedef cppproperties::property cpp_property_t; template::getter_t Getter> - struct bind_internal: + struct bind_internal : public cpp_property_t::template bind { + bind_internal(WidgetClassT *parent) : + cpp_property_t::template bind(parent) + {} }; public: template - class bind: - public bind_internal) > + class bind : + public bind_internal< + IPhWidgetsProperty, + &(IPhWidgetsProperty::getArgument) + > { - typedef bind_internal) > cpp_bind_t; + typedef bind_internal< + IPhWidgetsProperty, + &(IPhWidgetsProperty::getArgument) + > cpp_bind_t; public: bind(WidgetClassT *parent) : cpp_bind_t(parent) {} - + }; }; @@ -67,25 +92,36 @@ namespace PhWidgets { typedef cppproperties::property cpp_property_t; + template::getter_t Getter, typename cppproperties::detail::get_parent_func::setter_t Setter> + struct bind_internal : + public cpp_property_t::template bind + { + bind_internal(WidgetClassT *parent) : + cpp_property_t::template bind(parent) + {} + }; + public: template - class bind: - public cpp_property_t::template bind< - WidgetClassT, - &(WidgetClassT::template getArgument), - &(WidgetClassT::template setArgument) > + class bind : + public bind_internal< + IPhWidgetsProperty, + &(IPhWidgetsProperty::getArgument), + &(IPhWidgetsProperty::setArgument) + > { - typedef cpp_property_t::template bind< - WidgetClassT, - &(WidgetClassT::template getArgument), - &(WidgetClassT::template setArgument)> - cpp_bind_t; + typedef bind_internal< + IPhWidgetsProperty, + &(IPhWidgetsProperty::getArgument), + &(IPhWidgetsProperty::setArgument) + > cpp_bind_t; public: bind(WidgetClassT *parent) : cpp_bind_t(parent) {} + }; }; @@ -95,23 +131,33 @@ namespace PhWidgets { typedef cppproperties::property cpp_property_t; - public: + template::setter_t Setter> + struct bind_internal : + public cpp_property_t::template bind + { + bind_internal(WidgetClassT *parent) : + cpp_property_t::template bind(parent) + {} + }; + public: template - class bind: - public cpp_property_t::template bind< - WidgetClassT, - &(WidgetClassT::template setArgument) > + class bind : + public bind_internal< + IPhWidgetsProperty, + &(IPhWidgetsProperty::setArgument) + > { - typedef cpp_property_t::template bind< - WidgetClassT, - &(WidgetClassT::template setArgument) > - cpp_bind_t; + typedef bind_internal< + IPhWidgetsProperty, + &(IPhWidgetsProperty::setArgument) + > cpp_bind_t; public: bind(WidgetClassT *parent) : cpp_bind_t(parent) {} + }; }; From 9a126f71f46f78bbddb957d2a7b003d9cf0ddc5a Mon Sep 17 00:00:00 2001 From: Alexander <0oktonion0@gmail.com> Date: Thu, 12 Oct 2017 17:31:27 +0300 Subject: [PATCH 07/14] properties compiling now --- src/Widget.h | 2 +- src/service/phproperty.hpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Widget.h b/src/Widget.h index 165a2583..143b3a2c 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -96,7 +96,7 @@ namespace PhWidgets phwidgets_event(const phwidgets_event &rhs); - inline phwidgets_event &operator=(value_t); + inline phwidgets_event &operator=(callback_t); inline phwidgets_event &operator=(phwidgets_event const &); }; diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp index a7cdf3f2..f65543e7 100644 --- a/src/service/phproperty.hpp +++ b/src/service/phproperty.hpp @@ -7,17 +7,17 @@ namespace PhWidgets { struct IPhWidgetsProperty { - protected: template ReturnT getArgument() const { - return static_cast(this)->resource[ArgumentID].get(); + return ReturnT(); + //return static_cast(this)->resource[ArgumentID].get(); } template void setArgument(ValueT val) { - static_cast(this)->resource[ArgumentID].set(val); + //static_cast(this)->resource[ArgumentID].set(val); } }; @@ -70,12 +70,12 @@ namespace PhWidgets class bind : public bind_internal< IPhWidgetsProperty, - &(IPhWidgetsProperty::getArgument) + &IPhWidgetsProperty::getArgument > { typedef bind_internal< IPhWidgetsProperty, - &(IPhWidgetsProperty::getArgument) + &IPhWidgetsProperty::getArgument > cpp_bind_t; public: @@ -107,14 +107,14 @@ namespace PhWidgets class bind : public bind_internal< IPhWidgetsProperty, - &(IPhWidgetsProperty::getArgument), - &(IPhWidgetsProperty::setArgument) + &IPhWidgetsProperty::getArgument, + &IPhWidgetsProperty::setArgument > { typedef bind_internal< IPhWidgetsProperty, - &(IPhWidgetsProperty::getArgument), - &(IPhWidgetsProperty::setArgument) + &IPhWidgetsProperty::getArgument, + &IPhWidgetsProperty::setArgument > cpp_bind_t; public: @@ -145,12 +145,12 @@ namespace PhWidgets class bind : public bind_internal< IPhWidgetsProperty, - &(IPhWidgetsProperty::setArgument) + &IPhWidgetsProperty::setArgument > { typedef bind_internal< IPhWidgetsProperty, - &(IPhWidgetsProperty::setArgument) + &IPhWidgetsProperty::setArgument > cpp_bind_t; public: From 949e0bcbdd2cd7386459ab159c8502ee3197471c Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Thu, 12 Oct 2017 19:19:27 +0300 Subject: [PATCH 08/14] phproperties are working now + unix eos format --- src/Text.h | 2 +- src/Widget.h | 5 ++++- src/service/phproperty.hpp | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Text.h b/src/Text.h index 206530d7..0c501763 100644 --- a/src/Text.h +++ b/src/Text.h @@ -94,7 +94,7 @@ namespace PhWidgets phwidgets_event MotionVerify; phwidgets_event TextChanged; }; - + } diff --git a/src/Widget.h b/src/Widget.h index 143b3a2c..9a25259d 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -33,6 +33,8 @@ namespace PhWidgets protected detail::IPtWidget, public IPhWidgetsProperty { + using IPhWidgetsProperty::setArgument; + using IPhWidgetsProperty::getArgument; public: @@ -577,7 +579,8 @@ namespace PhWidgets phwidgets_property::bind Width; }; - + + }//namespace PhWidgets diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp index f65543e7..1b0ef20e 100644 --- a/src/service/phproperty.hpp +++ b/src/service/phproperty.hpp @@ -10,14 +10,13 @@ namespace PhWidgets template ReturnT getArgument() const { - return ReturnT(); - //return static_cast(this)->resource[ArgumentID].get(); + return static_cast(this)->resource.argument[ArgumentID].get(); } template void setArgument(ValueT val) { - //static_cast(this)->resource[ArgumentID].set(val); + static_cast(this)->resource.argument[ArgumentID].set(val); } }; From 0c9cf95e8bf30b980f6ca8bc4a1bdc788e34a748 Mon Sep 17 00:00:00 2001 From: Alexander <0oktonion0@gmail.com> Date: Fri, 13 Oct 2017 10:12:22 +0300 Subject: [PATCH 09/14] phproperties are working now tested on QNX 6 --- src/Widget.h | 4 ++-- src/service/phproperty.hpp | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Widget.h b/src/Widget.h index 9a25259d..0e8e5cee 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -554,7 +554,7 @@ namespace PhWidgets WidgetResourcesSingleton resource; property::bind Enabled;//!< Gets or sets a value indicating whether the widget can respond to user interaction. - //property::bind Width;//!< Gets or sets the width of the widget. + phwidgets_property::bind Width;//!< Gets or sets the width of the widget. property::bind Height;//!< Gets or sets the hight of the widget. property::bind Size;//!< Gets or sets the size of the widget. property::bind BevelWidth;//!< Gets or sets the bevel width of the widget. @@ -576,7 +576,7 @@ namespace PhWidgets void OnRealized(PtCallbackInfo_t *info);//!< Raises the Widget::Realized event. void OnUnrealized(PtCallbackInfo_t *info);//!< Raises the Widget::Unrealized event. - phwidgets_property::bind Width; + }; diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp index 1b0ef20e..66364782 100644 --- a/src/service/phproperty.hpp +++ b/src/service/phproperty.hpp @@ -8,13 +8,13 @@ namespace PhWidgets struct IPhWidgetsProperty { template - ReturnT getArgument() const + inline ReturnT getArgument() const { return static_cast(this)->resource.argument[ArgumentID].get(); } template - void setArgument(ValueT val) + inline void setArgument(ValueT val) { static_cast(this)->resource.argument[ArgumentID].set(val); } @@ -62,6 +62,10 @@ namespace PhWidgets bind_internal(WidgetClassT *parent) : cpp_property_t::template bind(parent) {} + + private: + inline bind_internal &operator=(ValueT const &); + inline bind_internal &operator=(bind_internal const &); }; public: @@ -82,6 +86,9 @@ namespace PhWidgets cpp_bind_t(parent) {} + private: + inline bind &operator=(ValueT const &); + inline bind &operator=(bind const &); }; }; @@ -98,6 +105,8 @@ namespace PhWidgets bind_internal(WidgetClassT *parent) : cpp_property_t::template bind(parent) {} + + using cpp_property_t::template bind::operator=; }; public: @@ -120,7 +129,8 @@ namespace PhWidgets bind(WidgetClassT *parent) : cpp_bind_t(parent) {} - + + using cpp_bind_t::operator=; }; }; @@ -137,6 +147,8 @@ namespace PhWidgets bind_internal(WidgetClassT *parent) : cpp_property_t::template bind(parent) {} + + using cpp_property_t::template bind::operator=; }; public: @@ -156,7 +168,8 @@ namespace PhWidgets bind(WidgetClassT *parent) : cpp_bind_t(parent) {} - + + using cpp_bind_t::operator=; }; }; From 9c9829d62f69c60eea0af28024d99cb88c40f401 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Fri, 13 Oct 2017 11:09:37 +0300 Subject: [PATCH 10/14] + phproperties for Widget class --- src/Widget.cpp | 73 +++----------------------------------- src/Widget.h | 33 +++++------------ src/service/phproperty.hpp | 18 +++++----- 3 files changed, 22 insertions(+), 102 deletions(-) diff --git a/src/Widget.cpp b/src/Widget.cpp index c7e52fbc..3cbcfe49 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -296,6 +296,11 @@ void PhWidgets::Widget::OnUnrealized( PtCallbackInfo_t * info) resource.callback[Callback::unrealized].raise(info); } +Widget::operator PtWidget_t*() +{ + return widget(); +} + //for properties: void Widget::setEnabled(bool val) { @@ -305,72 +310,4 @@ void Widget::setEnabled(bool val) bool Widget::getEnabled() const { return resource.argument[Arguments::flags].get(Pt_BLOCKED); -} - -void Widget::setWidth(unsigned short val) -{ - resource.argument[Arguments::width].set(val); -} - -unsigned short Widget::getWidth() const -{ - return resource.argument[Arguments::width].get(); -} - -void Widget::setHeight(unsigned short val) -{ - resource.argument[Arguments::height].set(val); -} - -unsigned short Widget::getHeight() const -{ - return resource.argument[Arguments::height].get(); -} - -void Widget::setDim(PhDim_t val) -{ - resource.argument[Arguments::dim].set(val); -} - -PhDim_t Widget::getDim() const -{ - return resource.argument[Arguments::dim].get(); -} - -void Widget::setBevelWidth(unsigned short val) -{ - resource.argument[Arguments::bevel_width].set(val); -} - -unsigned short Widget::getBevelWidth() const -{ - return resource.argument[Arguments::bevel_width].get(); -} - -void Widget::setHelpTopic(std::string val) -{ - resource.argument[Arguments::help_topic].set(val.c_str()); -} - -std::string Widget::getHelpTopic() const -{ - return resource.argument[Arguments::help_topic].get(); -} - -void Widget::setLocation(PhPoint_t val) -{ - resource.argument[Arguments::pos].set(val); -} - - -PhPoint_t Widget::getLocation() const -{ - return resource.argument[Arguments::pos].get(); -} - - - -Widget::operator PtWidget_t*() -{ - return widget(); } \ No newline at end of file diff --git a/src/Widget.h b/src/Widget.h index 0e8e5cee..7d76b319 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -493,24 +493,6 @@ namespace PhWidgets void setEnabled(bool); bool getEnabled() const; - - void setWidth(unsigned short); - unsigned short getWidth() const; - - void setHeight(unsigned short); - unsigned short getHeight() const; - - void setDim(PhDim_t); - PhDim_t getDim() const; - - void setBevelWidth(unsigned short); - unsigned short getBevelWidth() const; - - void setHelpTopic(std::string); - std::string getHelpTopic() const; - - void setLocation(PhPoint_t); - PhPoint_t getLocation() const; public: //! (constructor) @@ -553,13 +535,14 @@ namespace PhWidgets //! Resources of the Widget WidgetResourcesSingleton resource; - property::bind Enabled;//!< Gets or sets a value indicating whether the widget can respond to user interaction. - phwidgets_property::bind Width;//!< Gets or sets the width of the widget. - property::bind Height;//!< Gets or sets the hight of the widget. - property::bind Size;//!< Gets or sets the size of the widget. - property::bind BevelWidth;//!< Gets or sets the bevel width of the widget. - property::bind HelpTopic;//!< Gets or sets the help topic of the widget. - property::bind Location;//!< Gets or sets the location of the widget. + property::bind Enabled;//!< Gets or sets a value indicating whether the widget can respond to user interaction. + + phproperty::bind Width;//!< Gets or sets the width of the widget. + phproperty::bind Height;//!< Gets or sets the hight of the widget. + phproperty::bind BevelWidth;//!< Gets or sets the bevel width of the widget. + phproperty::bind Size;//!< Gets or sets the size of the widget. + phproperty::bind HelpTopic;//!< Gets or sets the help topic of the widget. + phproperty::bind Location;//!< Gets or sets the position of the widget. phwidgets_event Destroyed;//!< Occurs when the widget is destroyed. phwidgets_event Blocked;//!< Occurs when the widget is blocked. diff --git a/src/service/phproperty.hpp b/src/service/phproperty.hpp index 66364782..e9fcdd31 100644 --- a/src/service/phproperty.hpp +++ b/src/service/phproperty.hpp @@ -22,11 +22,11 @@ namespace PhWidgets template::flag)> - class phwidgets_property{}; + class phproperty{}; - //phwidgets_property: + //phproperty: template<> - class phwidgets_property : + class phproperty : public cppproperties::detail::property_flag { public: @@ -34,7 +34,7 @@ namespace PhWidgets }; template<> - class phwidgets_property : + class phproperty : public cppproperties::detail::property_flag { public: @@ -42,16 +42,16 @@ namespace PhWidgets }; template<> - class phwidgets_property : + class phproperty : public cppproperties::detail::property_flag { public: typedef cppproperties::detail::property_flag flags; }; - //phwidgets_property: + //phproperty: template - class phwidgets_property//ValueT == const... + class phproperty//ValueT == const... { typedef cppproperties::property cpp_property_t; @@ -94,7 +94,7 @@ namespace PhWidgets template - class phwidgets_property//ValueT != const... + class phproperty//ValueT != const... { typedef cppproperties::property cpp_property_t; @@ -136,7 +136,7 @@ namespace PhWidgets }; template - class phwidgets_property//ValueT != const... + class phproperty//ValueT != const... { typedef cppproperties::property cpp_property_t; From 32140be3ea1ef61d6321a45d33dac556870ed401 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Fri, 13 Oct 2017 11:54:56 +0300 Subject: [PATCH 11/14] commets spacings --- src/Widget.h | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Widget.h b/src/Widget.h index 7d76b319..aeb72e5b 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -535,29 +535,29 @@ namespace PhWidgets //! Resources of the Widget WidgetResourcesSingleton resource; - property::bind Enabled;//!< Gets or sets a value indicating whether the widget can respond to user interaction. - - phproperty::bind Width;//!< Gets or sets the width of the widget. - phproperty::bind Height;//!< Gets or sets the hight of the widget. - phproperty::bind BevelWidth;//!< Gets or sets the bevel width of the widget. - phproperty::bind Size;//!< Gets or sets the size of the widget. - phproperty::bind HelpTopic;//!< Gets or sets the help topic of the widget. - phproperty::bind Location;//!< Gets or sets the position of the widget. - - phwidgets_event Destroyed;//!< Occurs when the widget is destroyed. - phwidgets_event Blocked;//!< Occurs when the widget is blocked. - phwidgets_event DragDrop;//!< Occurs when a drag-and-drop operation is completed. - phwidgets_event IsDestroyed;//!< Occurs when the widget's resources are being released. - phwidgets_event Outbound;//!< Occurs when you press the pointer button on the widget and then move out of the "hot spot" with the button still depressed. - phwidgets_event Realized;//!< Occurs when the widget is realized. - phwidgets_event Unrealized;//!< Occurs when the widget is unrealized. - - void OnDestroyed(PtCallbackInfo_t *info);//!< Raises the Widget::Destroyed event. - void OnBlocked(PtCallbackInfo_t *info);//!< Raises the Widget::Blocked event. - void OnDragDrop(PtCallbackInfo_t *info);//!< Raises the Widget::DragDrop event. - void OnOutbound(PtCallbackInfo_t *info);//!< Raises the Widget::Outbound event. - void OnRealized(PtCallbackInfo_t *info);//!< Raises the Widget::Realized event. - void OnUnrealized(PtCallbackInfo_t *info);//!< Raises the Widget::Unrealized event. + property::bind Enabled; //!< Gets or sets a value indicating whether the widget can respond to user interaction. + + phproperty::bind Width; //!< Gets or sets the width of the widget. + phproperty::bind Height; //!< Gets or sets the hight of the widget. + phproperty::bind BevelWidth; //!< Gets or sets the bevel width of the widget. + phproperty::bind Size; //!< Gets or sets the size of the widget. + phproperty::bind HelpTopic; //!< Gets or sets the help topic of the widget. + phproperty::bind Location; //!< Gets or sets the position of the widget. + + phwidgets_event Destroyed; //!< Occurs when the widget is destroyed. + phwidgets_event Blocked; //!< Occurs when the widget is blocked. + phwidgets_event DragDrop; //!< Occurs when a drag-and-drop operation is completed. + phwidgets_event IsDestroyed; //!< Occurs when the widget's resources are being released. + phwidgets_event Outbound; //!< Occurs when you press the pointer button on the widget and then move out of the "hot spot" with the button still depressed. + phwidgets_event Realized; //!< Occurs when the widget is realized. + phwidgets_event Unrealized; //!< Occurs when the widget is unrealized. + + void OnDestroyed(PtCallbackInfo_t *info); //!< Raises the Widget::Destroyed event. + void OnBlocked(PtCallbackInfo_t *info); //!< Raises the Widget::Blocked event. + void OnDragDrop(PtCallbackInfo_t *info); //!< Raises the Widget::DragDrop event. + void OnOutbound(PtCallbackInfo_t *info); //!< Raises the Widget::Outbound event. + void OnRealized(PtCallbackInfo_t *info); //!< Raises the Widget::Realized event. + void OnUnrealized(PtCallbackInfo_t *info); //!< Raises the Widget::Unrealized event. From 1930e47384ac30533ef7e7919e6b3d1b55517c54 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Fri, 13 Oct 2017 21:33:37 +0300 Subject: [PATCH 12/14] moved set and get to private --- src/Widget.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Widget.h b/src/Widget.h index 9a25259d..f7772c46 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -33,8 +33,6 @@ namespace PhWidgets protected detail::IPtWidget, public IPhWidgetsProperty { - using IPhWidgetsProperty::setArgument; - using IPhWidgetsProperty::getArgument; public: @@ -455,6 +453,8 @@ namespace PhWidgets int _abn; mutable PtWidget_t *_widget; + using IPhWidgetsProperty::setArgument; + using IPhWidgetsProperty::getArgument; protected: From bb43dfdc97bfb48ca9540bafee052b374cc05b67 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Sat, 14 Oct 2017 02:31:22 +0300 Subject: [PATCH 13/14] phproperties for all widgets --- src/Basic.cpp | 20 -------------------- src/Basic.h | 10 ++-------- src/Button.cpp | 10 ---------- src/Button.h | 5 +---- src/Label.cpp | 10 ---------- src/Label.h | 6 ++---- src/NumericInteger.cpp | 31 ------------------------------- src/NumericInteger.h | 16 ++++------------ src/OnOffButton.cpp | 9 --------- src/OnOffButton.h | 9 +++------ src/Timer.cpp | 20 -------------------- src/Timer.h | 10 ++-------- src/ToggleButton.h | 4 ++-- src/Widget.cpp | 12 +++++++++++- src/Widget.h | 5 ++++- 15 files changed, 31 insertions(+), 146 deletions(-) diff --git a/src/Basic.cpp b/src/Basic.cpp index d3553f68..50b316ad 100644 --- a/src/Basic.cpp +++ b/src/Basic.cpp @@ -72,26 +72,6 @@ Basic &Basic::operator=(const Basic &rhs) return *this; } -void Basic::setColor(PgColor_t val) -{ - resource.argument[Arguments::color].set(val); -} - -PgColor_t Basic::getColor() const -{ - return resource.argument[Arguments::color].get(); -} - -void Basic::setFillColor(PgColor_t val) -{ - resource.argument[Arguments::fill_color].set(val); -} - -PgColor_t Basic::getFillColor() const -{ - return resource.argument[Arguments::fill_color].get(); -} - void PhWidgets::Basic::OnActivated(PtCallbackInfo_t * info) { resource.callback[Callback::activate].raise(info); diff --git a/src/Basic.h b/src/Basic.h index 44d3e0ed..59d253db 100644 --- a/src/Basic.h +++ b/src/Basic.h @@ -186,12 +186,6 @@ namespace PhWidgets resource_type WidgetResourcesSingleton; virtual void check(); - - void setColor(PgColor_t); - PgColor_t getColor() const; - - void setFillColor(PgColor_t); - PgColor_t getFillColor() const; public: Basic(int abn); @@ -203,8 +197,8 @@ namespace PhWidgets WidgetResourcesSingleton resource; - property::bind Color; - property::bind FillColor; + phproperty::bind Color; + phproperty::bind FillColor; phwidgets_event Activate; phwidgets_event Arm; diff --git a/src/Button.cpp b/src/Button.cpp index aaa42b76..0bd73f00 100644 --- a/src/Button.cpp +++ b/src/Button.cpp @@ -40,14 +40,4 @@ Button &Button::operator=(const Button &rhs) static_cast(*this) = static_cast(rhs); return *this; -} - -void Button::setArmColor(PgColor_t val) -{ - resource.argument[Arguments::arm_color].set(val); -} - -PgColor_t Button::getArmColor() const -{ - return resource.argument[Arguments::arm_color].get(); } \ No newline at end of file diff --git a/src/Button.h b/src/Button.h index 96b6111b..8ed0f288 100644 --- a/src/Button.h +++ b/src/Button.h @@ -83,9 +83,6 @@ namespace PhWidgets virtual void check(); - void setArmColor(PgColor_t); - PgColor_t getArmColor() const; - public: WidgetResourcesSingleton resource; @@ -97,7 +94,7 @@ namespace PhWidgets Button &operator=(const Button &rhs); - property::bind ArmColor; + phproperty::bind ArmColor; }; } diff --git a/src/Label.cpp b/src/Label.cpp index f1c6b9db..19d9dac5 100644 --- a/src/Label.cpp +++ b/src/Label.cpp @@ -54,13 +54,3 @@ void Label::setCaption(std::string caption) resource.argument[Arguments::text_string].set(caption.c_str()); } -void Label::setBalloonColor(PgColor_t val) -{ - resource.argument[Arguments::balloon_color].set(val); -} - -PgColor_t Label::getBalloonColor() const -{ - return resource.argument[Arguments::balloon_color].get(); -} - diff --git a/src/Label.h b/src/Label.h index ff74537d..384404e2 100644 --- a/src/Label.h +++ b/src/Label.h @@ -207,9 +207,6 @@ namespace PhWidgets std::string getCaption() const; void setCaption(std::string caption); - void setBalloonColor(PgColor_t); - PgColor_t getBalloonColor() const; - virtual void check(); public: @@ -223,7 +220,8 @@ namespace PhWidgets Label &operator=(const Label &rhs); property::bind Caption; - property::bind BalloonColor; + + phproperty::bind BalloonColor; }; } diff --git a/src/NumericInteger.cpp b/src/NumericInteger.cpp index eb498cee..c6b34f9c 100644 --- a/src/NumericInteger.cpp +++ b/src/NumericInteger.cpp @@ -59,36 +59,5 @@ NumericInteger &NumericInteger::operator=(const NumericInteger &rhs) return *this; } -int NumericInteger::getValue() const -{ - return resource.argument[Arguments::numeric_value].get(); -} - -void NumericInteger::setValue(int val) -{ - resource.argument[Arguments::numeric_value].set(val); -} - -int NumericInteger::getMaxValue() const -{ - return resource.argument[Arguments::numeric_max].get(); -} - -void NumericInteger::setMaxValue(int val) -{ - resource.argument[Arguments::numeric_max].set(val); -} - - -int NumericInteger::getMinValue() const -{ - return resource.argument[Arguments::numeric_min].get(); -} - -void NumericInteger::setMinValue(int val) -{ - resource.argument[Arguments::numeric_min].set(val); -} - diff --git a/src/NumericInteger.h b/src/NumericInteger.h index def9c8cd..1cc79281 100644 --- a/src/NumericInteger.h +++ b/src/NumericInteger.h @@ -75,15 +75,7 @@ namespace PhWidgets resource_type WidgetResourcesSingleton; virtual void check(); - - int getValue() const; - void setValue(int); - - int getMaxValue() const; - void setMaxValue(int); - - int getMinValue() const; - void setMinValue(int); + public: WidgetResourcesSingleton resource; @@ -95,9 +87,9 @@ namespace PhWidgets NumericInteger &operator=(const NumericInteger &rhs); - property::bind Value; - property::bind MaxValue; - property::bind MinValue; + phproperty::bind Value; + phproperty::bind MaxValue; + phproperty::bind MinValue; phwidgets_event NumericChanged; }; diff --git a/src/OnOffButton.cpp b/src/OnOffButton.cpp index ebc6c544..432eeb21 100644 --- a/src/OnOffButton.cpp +++ b/src/OnOffButton.cpp @@ -61,13 +61,4 @@ void OnOffButton::Uncheck(bool val) resource.argument[Arguments::onoff_state].set(false); } -void OnOffButton::setChecked(bool val) -{ - resource.argument[Arguments::onoff_state].set(val); -} - -bool OnOffButton::getChecked() const -{ - return resource.argument[Arguments::onoff_state].get(); -} diff --git a/src/OnOffButton.h b/src/OnOffButton.h index 14e6c80b..a0cabb56 100644 --- a/src/OnOffButton.h +++ b/src/OnOffButton.h @@ -70,9 +70,6 @@ namespace PhWidgets resource_type WidgetResourcesSingleton; virtual void check(); - - void setChecked(bool val); - bool getChecked() const; public: WidgetResourcesSingleton resource; @@ -84,10 +81,10 @@ namespace PhWidgets OnOffButton &operator=(const OnOffButton &rhs); - void Check(bool val); - void Uncheck(bool val); + void Check(bool val = true); + void Uncheck(bool val = true); - property::bind Checked; + phproperty::bind Checked; phwidgets_event NewValue; }; diff --git a/src/Timer.cpp b/src/Timer.cpp index 0f41eff0..c737d72d 100644 --- a/src/Timer.cpp +++ b/src/Timer.cpp @@ -57,26 +57,6 @@ Timer &Timer::operator=(const Timer &rhs) return *this; } -void Timer::setInitial(unsigned long val) -{ - resource.argument[Arguments::timer_initial].set(val); -} - -unsigned long Timer::getInitial() const -{ - return resource.argument[Arguments::timer_initial].get(); -} - -void Timer::setRepeat(unsigned long val) -{ - resource.argument[Arguments::timer_repeat].set(val); -} - -unsigned long Timer::getRepeat() const -{ - return resource.argument[Arguments::timer_repeat].get(); -} - void Timer::OnActivate(PtCallbackInfo_t *info) { resource.callback[Callback::timer_activate].raise(info); diff --git a/src/Timer.h b/src/Timer.h index 308fc165..ade8f701 100644 --- a/src/Timer.h +++ b/src/Timer.h @@ -83,12 +83,6 @@ namespace PhWidgets resource_type WidgetResourcesSingleton; virtual void check(); - - void setInitial(unsigned long); - unsigned long getInitial() const; - - void setRepeat(unsigned long); - unsigned long getRepeat() const; public: WidgetResourcesSingleton resource; @@ -106,8 +100,8 @@ namespace PhWidgets using Widget::operator PtWidget_t*; using Widget::operator const PtWidget_t*; - property::bind Initial; - property::bind Interval; + phproperty::bind Initial; + phproperty::bind Interval; Widget::Enabled; phwidgets_event Activate; diff --git a/src/ToggleButton.h b/src/ToggleButton.h index 4000de9e..c5f17bfb 100644 --- a/src/ToggleButton.h +++ b/src/ToggleButton.h @@ -82,8 +82,8 @@ namespace PhWidgets ToggleButton &operator=(const ToggleButton &rhs); - void Check(bool val); - void Uncheck(bool val); + void Check(bool val = true); + void Uncheck(bool val = true); property::bind Checked; }; diff --git a/src/Widget.cpp b/src/Widget.cpp index 3cbcfe49..0e6a3306 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -310,4 +310,14 @@ void Widget::setEnabled(bool val) bool Widget::getEnabled() const { return resource.argument[Arguments::flags].get(Pt_BLOCKED); -} \ No newline at end of file +} + +void PhWidgets::Widget::setHelpTopic(std::string val) +{ + resource.argument[Arguments::help_topic].set(val.c_str()); +} + +std::string PhWidgets::Widget::getHelpTopic() const +{ + return resource.argument[Arguments::help_topic].get(); +} diff --git a/src/Widget.h b/src/Widget.h index 9878d447..dba94519 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -493,6 +493,9 @@ namespace PhWidgets void setEnabled(bool); bool getEnabled() const; + + void setHelpTopic(std::string); + std::string getHelpTopic() const; public: //! (constructor) @@ -536,12 +539,12 @@ namespace PhWidgets WidgetResourcesSingleton resource; property::bind Enabled; //!< Gets or sets a value indicating whether the widget can respond to user interaction. + property::bind HelpTopic; //!< Gets or sets the help topic of the widget. phproperty::bind Width; //!< Gets or sets the width of the widget. phproperty::bind Height; //!< Gets or sets the hight of the widget. phproperty::bind BevelWidth; //!< Gets or sets the bevel width of the widget. phproperty::bind Size; //!< Gets or sets the size of the widget. - phproperty::bind HelpTopic; //!< Gets or sets the help topic of the widget. phproperty::bind Location; //!< Gets or sets the position of the widget. phwidgets_event Destroyed; //!< Occurs when the widget is destroyed. From 9f2848bc378e55db73623a6685fc482e1ece50a7 Mon Sep 17 00:00:00 2001 From: oktonion <0oktonion0@gmail.com> Date: Sat, 14 Oct 2017 03:13:35 +0300 Subject: [PATCH 14/14] phproperties implemented for all widgets tested on QNX 6 --- src/Basic.h | 10 +++++----- src/Button.h | 6 +++--- src/Container.h | 8 ++++---- src/Label.h | 10 +++++----- src/Numeric.h | 4 ++-- src/NumericFloat.h | 2 +- src/NumericInteger.h | 2 +- src/OnOffButton.h | 2 +- src/Text.h | 2 +- src/Timer.h | 6 ++++-- src/ToggleButton.h | 4 ++-- src/Widget.cpp | 12 ++++++------ 12 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/Basic.h b/src/Basic.h index 59d253db..4cbe3371 100644 --- a/src/Basic.h +++ b/src/Basic.h @@ -106,21 +106,21 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgUnsignedShort { - using ThisArgs::ArgUnsignedShort::eArgUnsignedShort; + typedef ThisArgs::ArgUnsignedShort::eArgUnsignedShort eArgUnsignedShort; }; struct ArgUnsignedLong: public ArgumentsEx, public ThisArgs::ArgUnsignedLong { - using ThisArgs::ArgUnsignedLong::eArgUnsignedLong; + typedef ThisArgs::ArgUnsignedLong::eArgUnsignedLong eArgUnsignedLong; }; struct ArgColor: public ArgumentsEx, public ThisArgs::ArgColor { - using ThisArgs::ArgColor::eArgColor; + typedef ThisArgs::ArgColor::eArgColor eArgColor; }; struct ArgChar: @@ -142,14 +142,14 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgPChar { - using ThisArgs::ArgPChar::eArgPChar; + typedef ThisArgs::ArgPChar::eArgPChar eArgPChar; }; struct Callback: public ArgumentsEx, public Widget::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; struct Arguments: diff --git a/src/Button.h b/src/Button.h index 8ed0f288..20a56e3e 100644 --- a/src/Button.h +++ b/src/Button.h @@ -46,21 +46,21 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgColor { - using ThisArgs::ArgColor::eArgColor; + typedef ThisArgs::ArgColor::eArgColor eArgColor; }; struct ArgUnsignedChar: public ArgumentsEx, public ThisArgs::ArgUnsignedChar { - using ThisArgs::ArgUnsignedChar::eArgUnsignedChar; + typedef ThisArgs::ArgUnsignedChar::eArgUnsignedChar eArgUnsignedChar; }; struct ArgPImage: public ArgumentsEx, public ThisArgs::ArgPImage { - using ThisArgs::ArgPImage::eArgPImage; + typedef ThisArgs::ArgPImage::eArgPImage eArgPImage; }; diff --git a/src/Container.h b/src/Container.h index 46367ed7..b49fdfc0 100644 --- a/src/Container.h +++ b/src/Container.h @@ -114,7 +114,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgLong { - using ThisArgs::ArgLong::eArgLong; + typedef ThisArgs::ArgLong::eArgLong eArgLong; }; struct ArgInt: @@ -142,7 +142,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgPVoid { - using ThisArgs::ArgPVoid::eArgPVoid; + typedef ThisArgs::ArgPVoid::eArgPVoid eArgPVoid; }; struct ArgPRowLayoutInfo: @@ -155,14 +155,14 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgPChar { - using ThisArgs::ArgPChar::eArgPChar; + typedef ThisArgs::ArgPChar::eArgPChar eArgPChar; }; struct Callback: public ArgumentsEx, public Basic::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; struct Arguments: diff --git a/src/Label.h b/src/Label.h index 384404e2..a1ba0e7d 100644 --- a/src/Label.h +++ b/src/Label.h @@ -118,14 +118,14 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgPChar { - using ThisArgs::ArgPChar::eArgPChar; + typedef ThisArgs::ArgPChar::eArgPChar eArgPChar; }; struct ArgColor: public ArgumentsEx, public ThisArgs::ArgColor { - using ThisArgs::ArgColor::eArgColor; + typedef ThisArgs::ArgColor::eArgColor eArgColor; }; struct ArgShort: @@ -137,7 +137,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgUnsignedShort { - using ThisArgs::ArgUnsignedShort::eArgUnsignedShort; + typedef ThisArgs::ArgUnsignedShort::eArgUnsignedShort eArgUnsignedShort; }; struct ArgSignedShort: @@ -149,7 +149,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgUnsignedChar { - using ThisArgs::ArgUnsignedChar::eArgUnsignedChar; + typedef ThisArgs::ArgUnsignedChar::eArgUnsignedChar eArgUnsignedChar; }; struct ArgPWidget: @@ -161,7 +161,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgChar { - using ThisArgs::ArgChar::eArgChar; + typedef ThisArgs::ArgChar::eArgChar eArgChar; }; struct ArgPImage: diff --git a/src/Numeric.h b/src/Numeric.h index 9550d660..b0ba13ca 100644 --- a/src/Numeric.h +++ b/src/Numeric.h @@ -52,7 +52,7 @@ namespace PhWidgets public ThisArgs::ArgUnsignedShort, public ThisArgs::ArgUnsignedShortFlag { - using ThisArgs::ArgUnsignedShort::eArgUnsignedShort; + typedef ThisArgs::ArgUnsignedShort::eArgUnsignedShort eArgUnsignedShort; }; @@ -61,7 +61,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgPChar { - using ThisArgs::ArgPChar::eArgPChar; + typedef ThisArgs::ArgPChar::eArgPChar eArgPChar; }; struct Arguments: diff --git a/src/NumericFloat.h b/src/NumericFloat.h index 01a59bb0..a029642b 100644 --- a/src/NumericFloat.h +++ b/src/NumericFloat.h @@ -63,7 +63,7 @@ namespace PhWidgets public ArgumentsEx, public Numeric::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; diff --git a/src/NumericInteger.h b/src/NumericInteger.h index 1cc79281..8e4a8da8 100644 --- a/src/NumericInteger.h +++ b/src/NumericInteger.h @@ -49,7 +49,7 @@ namespace PhWidgets public ArgumentsEx, public Numeric::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; diff --git a/src/OnOffButton.h b/src/OnOffButton.h index a0cabb56..a0302c01 100644 --- a/src/OnOffButton.h +++ b/src/OnOffButton.h @@ -45,7 +45,7 @@ namespace PhWidgets public ArgumentsEx, public Button::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; diff --git a/src/Text.h b/src/Text.h index 0c501763..46e74727 100644 --- a/src/Text.h +++ b/src/Text.h @@ -52,7 +52,7 @@ namespace PhWidgets public ArgumentsEx, public Label::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; diff --git a/src/Timer.h b/src/Timer.h index ade8f701..66786edd 100644 --- a/src/Timer.h +++ b/src/Timer.h @@ -14,6 +14,7 @@ namespace PhWidgets protected Widget { public: + using Widget::IPhWidgetsProperty; struct ThisArgs { @@ -57,7 +58,7 @@ namespace PhWidgets public ArgumentsEx, public Widget::Callback { - using ThisCallbacks::Callback::eCallback; + typedef ThisCallbacks::Callback::eCallback eCallback; }; struct Arguments: @@ -73,7 +74,8 @@ namespace PhWidgets { }; - + private: + protected: typedef ResourceFrom:: Define::Scalar:: diff --git a/src/ToggleButton.h b/src/ToggleButton.h index c5f17bfb..4a2f36f5 100644 --- a/src/ToggleButton.h +++ b/src/ToggleButton.h @@ -40,7 +40,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgUnsignedChar { - using ThisArgs::ArgUnsignedChar::eArgUnsignedChar; + typedef ThisArgs::ArgUnsignedChar::eArgUnsignedChar eArgUnsignedChar; }; @@ -49,7 +49,7 @@ namespace PhWidgets public ArgumentsEx, public ThisArgs::ArgColor { - using ThisArgs::ArgColor::eArgColor; + typedef ThisArgs::ArgColor::eArgColor eArgColor; }; struct Arguments: diff --git a/src/Widget.cpp b/src/Widget.cpp index 0e6a3306..50a1a957 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -121,11 +121,11 @@ Widget::Widget(int abn): resource(this), //properties: Enabled(this), + HelpTopic(this), Width(this), Height(this), - Size(this), BevelWidth(this), - HelpTopic(this), + Size(this), Location(this), //callbacks: Destroyed(this), @@ -148,11 +148,11 @@ Widget::Widget(PtWidget_t* wdg): resource(this), //properties: Enabled(this), + HelpTopic(this), Width(this), Height(this), - Size(this), BevelWidth(this), - HelpTopic(this), + Size(this), Location(this), //callbacks: Destroyed(this), @@ -212,11 +212,11 @@ Widget::Widget(const Widget &rhs): resource(this), //properties: Enabled(this), + HelpTopic(this), Width(this), Height(this), - Size(this), BevelWidth(this), - HelpTopic(this), + Size(this), Location(this), //callbacks: Destroyed(this),