}
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Page, Toolkit::Control, Create )
+DALI_PROPERTY_REGISTRATION( Toolkit, Page, "title", STRING, TITLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Page, "sub-title", STRING, SUB_TITLE )
DALI_TYPE_REGISTRATION_END()
} // unnamed namespace
Page::Page()
: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
mTitle(""),
- mSubTitle(""),
- mPropertyTitle(Property::INVALID_INDEX),
- mPropertySubTitle(Property::INVALID_INDEX)
+ mSubTitle("")
{
}
return mPopupMenu;
}
-void Page::OnInitialize()
+void Page::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
{
- Actor self = Self();
+ Toolkit::Page page = Toolkit::Page::DownCast( Dali::BaseHandle( object ) );
- mPropertyTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_TITLE, "", Property::READ_WRITE );
- mPropertySubTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_SUB_TITLE, "", Property::READ_WRITE );
+ if ( page )
+ {
+ switch ( index )
+ {
+ case Toolkit::Page::Property::TITLE:
+ {
+ GetImpl( page ).SetTitle( value.Get< std::string >() );
+ break;
+ }
+
+ case Toolkit::Page::Property::SUB_TITLE:
+ {
+ GetImpl( page ).SetSubTitle( value.Get< std::string >() );
+ break;
+ }
+ }
+ }
}
-void Page::OnPropertySet( Property::Index index, Property::Value propertyValue )
+Property::Value Page::GetProperty( BaseObject* object, Property::Index propertyIndex )
{
- if( index == mPropertyTitle )
- {
- std::string title( propertyValue.Get<std::string>() );
- SetTitle(title);
- }
- else if( index == mPropertySubTitle )
+ Property::Value value;
+
+ Toolkit::Page page = Toolkit::Page::DownCast( Dali::BaseHandle( object ) );
+
+ if ( page )
{
- std::string subTitle( propertyValue.Get<std::string>() );
- SetSubTitle(subTitle);
+ switch ( propertyIndex )
+ {
+ case Toolkit::Page::Property::TITLE:
+ {
+ value = GetImpl( page ).mTitle;
+ break;
+ }
+
+ case Toolkit::Page::Property::SUB_TITLE:
+ {
+ value = GetImpl( page ).mSubTitle;
+ break;
+ }
+ }
}
+
+ return value;
}
} // namespace Internal
*/
Toolkit::Popup GetPopupMenu() const;
-private: // From Control
+ // Properties
/**
- * @copydoc Toolkit::Control::OnInitialize()
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
*/
- virtual void OnInitialize();
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
/**
- * @copydoc Dali::CustomActorImpl::OnPropertySet()
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
+ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
private:
ActorContainer mTitleBarControls;
Toolkit::Page::ControlOnBarContainer mToolBarControls;
-
- Property::Index mPropertyTitle; ///< Property index for title.
- Property::Index mPropertySubTitle; ///< Property index for sub title.
};
} // namespace Internal
public:
/**
- * The names of custom properties installed by this control.
+ * @brief The start and end property ranges for this control.
*/
- // Property Names
- static const char* const PROPERTY_TITLE; ///< name "title", type std::string
- static const char* const PROPERTY_SUB_TITLE; ///< name "sub-title", type std::string
+ enum PropertyRange
+ {
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
+ };
+
+ /**
+ * @brief An enumeration of properties belonging to the Page class.
+ */
+ struct Property
+ {
+ enum
+ {
+ TITLE = PROPERTY_START_INDEX, ///< name "title", @see SetTitle(), type string
+ SUB_TITLE, ///< name "sub-title", @see SetSubTitle(), type string
+ };
+ };
/**
* Structure to indicate a control on the navigation tool bar and its group (HorizontalLeft, HorizontalRight or HorizontalCenter)