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"
40 return Toolkit::Page::New();
43 TypeRegistration mType( typeid(Toolkit::Page), typeid(CustomActor), Create );
45 } // unnamed namespace
48 : Control( CONTROL_BEHAVIOUR_NONE ),
56 Toolkit::Page::ControlOnBarContainer::const_iterator iter;
58 if( !mToolBarControls.empty() )
60 for( iter = mToolBarControls.begin(); iter != mToolBarControls.end(); iter++ )
68 Toolkit::Page Page::New()
70 // Create the implementation, temporarily owned by this handle on stack
71 IntrusivePtr< Page > internalpage = new Page();
73 // Pass ownership to CustomActor handle
74 Toolkit::Page page( *internalpage );
76 // Second-phase init of the implementation
77 // This can only be done after the CustomActor connection has been made...
78 internalpage->Initialize();
84 void Page::SetTitle(const std::string& title)
89 const std::string& Page::GetTitle() const
94 void Page::SetSubTitle(const std::string& subtitle)
99 const std::string& Page::GetSubTitle() const
104 void Page::SetTitleIcon( Actor titleIcon)
106 mTitleIcon = titleIcon;
109 Actor Page::GetTitleIcon() const
114 bool Page::AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment)
116 if( !control || ( alignment!=Toolkit::Alignment::HorizontalLeft
117 && alignment!=Toolkit::Alignment::HorizontalCenter
118 && alignment!=Toolkit::Alignment::HorizontalRight ) )
124 mToolBarControls.push_back(new Toolkit::Page::ControlOnBar(control, alignment));
129 const Toolkit::Page::ControlOnBarContainer& Page::GetControlsOnToolBar() const
131 return mToolBarControls;
134 bool Page::AddControlToTitleBar(Actor control)
142 mTitleBarControls.push_back(control);
147 const ActorContainer& Page::GetControlsOnTitleBar() const
149 return mTitleBarControls;
152 void Page::SetPopupMenu( Toolkit::Popup popupMenu )
154 mPopupMenu = popupMenu;
157 Toolkit::Popup Page::GetPopupMenu() const
162 void Page::OnInitialize()
166 mPropertyTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_TITLE, "", Property::READ_WRITE );
167 mPropertySubTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_SUB_TITLE, "", Property::READ_WRITE );
170 void Page::OnPropertySet( Property::Index index, Property::Value propertyValue )
172 if( index == mPropertyTitle )
174 std::string title( propertyValue.Get<std::string>() );
177 else if( index == mPropertySubTitle )
179 std::string subTitle( propertyValue.Get<std::string>() );
180 SetSubTitle(subTitle);
184 } // namespace Internal
186 } // namespace Toolkit