2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
19 #include "page-impl.h"
39 return Toolkit::Page::New();
42 TypeRegistration mType( typeid(Toolkit::Page), typeid(CustomActor), Create );
44 } // unnamed namespace
55 Toolkit::Page::ControlOnBarContainer::const_iterator iter;
57 if( !mToolBarControls.empty() )
59 for( iter = mToolBarControls.begin(); iter != mToolBarControls.end(); iter++ )
67 Toolkit::Page Page::New()
69 // Create the implementation, temporarily owned by this handle on stack
70 IntrusivePtr< Page > internalpage = new Page();
72 // Pass ownership to CustomActor handle
73 Toolkit::Page page( *internalpage );
75 // Second-phase init of the implementation
76 // This can only be done after the CustomActor connection has been made...
77 internalpage->Initialize();
83 void Page::SetTitle(const std::string& title)
88 const std::string& Page::GetTitle() const
93 void Page::SetSubTitle(const std::string& subtitle)
98 const std::string& Page::GetSubTitle() const
103 void Page::SetTitleIcon( Actor titleIcon)
105 mTitleIcon = titleIcon;
108 Actor Page::GetTitleIcon() const
113 bool Page::AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment)
115 if( !control || ( alignment!=Toolkit::Alignment::HorizontalLeft
116 && alignment!=Toolkit::Alignment::HorizontalCenter
117 && alignment!=Toolkit::Alignment::HorizontalRight ) )
123 mToolBarControls.push_back(new Toolkit::Page::ControlOnBar(control, alignment));
128 const Toolkit::Page::ControlOnBarContainer& Page::GetControlsOnToolBar() const
130 return mToolBarControls;
133 bool Page::AddControlToTitleBar(Actor control)
141 mTitleBarControls.push_back(control);
146 const ActorContainer& Page::GetControlsOnTitleBar() const
148 return mTitleBarControls;
151 void Page::SetPopupMenu( Toolkit::Popup popupMenu )
153 mPopupMenu = popupMenu;
156 Toolkit::Popup Page::GetPopupMenu() const
161 void Page::OnInitialize()
165 mPropertyTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_TITLE, "", Property::READ_WRITE );
166 mPropertySubTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_SUB_TITLE, "", Property::READ_WRITE );
169 void Page::OnPropertySet( Property::Index index, Property::Value propertyValue )
171 if( index == mPropertyTitle )
173 std::string title( propertyValue.Get<std::string>() );
176 else if( index == mPropertySubTitle )
178 std::string subTitle( propertyValue.Get<std::string>() );
179 SetSubTitle(subTitle);
183 } // namespace Internal
185 } // namespace Toolkit