2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "page-impl.h"
23 #include <dali/public-api/object/type-registry.h>
41 return Toolkit::Page::New();
44 TypeRegistration mType( typeid(Toolkit::Page), typeid(CustomActor), Create );
46 } // unnamed namespace
49 : Control( CONTROL_BEHAVIOUR_NONE ),
52 mPropertyTitle(Property::INVALID_INDEX),
53 mPropertySubTitle(Property::INVALID_INDEX)
59 Toolkit::Page::ControlOnBarContainer::const_iterator iter;
61 if( !mToolBarControls.empty() )
63 for( iter = mToolBarControls.begin(); iter != mToolBarControls.end(); iter++ )
71 Toolkit::Page Page::New()
73 // Create the implementation, temporarily owned by this handle on stack
74 IntrusivePtr< Page > internalpage = new Page();
76 // Pass ownership to CustomActor handle
77 Toolkit::Page page( *internalpage );
79 // Second-phase init of the implementation
80 // This can only be done after the CustomActor connection has been made...
81 internalpage->Initialize();
87 void Page::SetTitle(const std::string& title)
92 const std::string& Page::GetTitle() const
97 void Page::SetSubTitle(const std::string& subtitle)
102 const std::string& Page::GetSubTitle() const
107 void Page::SetTitleIcon( Actor titleIcon)
109 mTitleIcon = titleIcon;
112 Actor Page::GetTitleIcon() const
117 bool Page::AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment)
119 if( !control || ( alignment!=Toolkit::Alignment::HorizontalLeft
120 && alignment!=Toolkit::Alignment::HorizontalCenter
121 && alignment!=Toolkit::Alignment::HorizontalRight ) )
127 mToolBarControls.push_back(new Toolkit::Page::ControlOnBar(control, alignment));
132 const Toolkit::Page::ControlOnBarContainer& Page::GetControlsOnToolBar() const
134 return mToolBarControls;
137 bool Page::AddControlToTitleBar(Actor control)
145 mTitleBarControls.push_back(control);
150 const ActorContainer& Page::GetControlsOnTitleBar() const
152 return mTitleBarControls;
155 void Page::SetPopupMenu( Toolkit::Popup popupMenu )
157 mPopupMenu = popupMenu;
160 Toolkit::Popup Page::GetPopupMenu() const
165 void Page::OnInitialize()
169 mPropertyTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_TITLE, "", Property::READ_WRITE );
170 mPropertySubTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_SUB_TITLE, "", Property::READ_WRITE );
173 void Page::OnPropertySet( Property::Index index, Property::Value propertyValue )
175 if( index == mPropertyTitle )
177 std::string title( propertyValue.Get<std::string>() );
180 else if( index == mPropertySubTitle )
182 std::string subTitle( propertyValue.Get<std::string>() );
183 SetSubTitle(subTitle);
187 } // namespace Internal
189 } // namespace Toolkit