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.
19 #include "page-impl.h"
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/public-api/object/type-registry-helper.h>
39 return Toolkit::Page::New();
42 DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Page, Toolkit::Control, Create )
43 DALI_PROPERTY_REGISTRATION( Toolkit, Page, "title", STRING, TITLE )
44 DALI_PROPERTY_REGISTRATION( Toolkit, Page, "sub-title", STRING, SUB_TITLE )
45 DALI_TYPE_REGISTRATION_END()
47 } // unnamed namespace
50 : Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
58 Toolkit::Page::ControlOnBarContainer::const_iterator iter;
60 if( !mToolBarControls.empty() )
62 for( iter = mToolBarControls.begin(); iter != mToolBarControls.end(); iter++ )
70 Toolkit::Page Page::New()
72 // Create the implementation, temporarily owned by this handle on stack
73 IntrusivePtr< Page > internalpage = new Page();
75 // Pass ownership to CustomActor handle
76 Toolkit::Page page( *internalpage );
78 // Second-phase init of the implementation
79 // This can only be done after the CustomActor connection has been made...
80 internalpage->Initialize();
86 void Page::SetTitle(const std::string& title)
91 const std::string& Page::GetTitle() const
96 void Page::SetSubTitle(const std::string& subtitle)
101 const std::string& Page::GetSubTitle() const
106 void Page::SetTitleIcon( Actor titleIcon)
108 mTitleIcon = titleIcon;
111 Actor Page::GetTitleIcon() const
116 bool Page::AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment)
118 if( !control || ( alignment!=Toolkit::Alignment::HorizontalLeft
119 && alignment!=Toolkit::Alignment::HorizontalCenter
120 && alignment!=Toolkit::Alignment::HorizontalRight ) )
126 mToolBarControls.push_back(new Toolkit::Page::ControlOnBar(control, alignment));
131 const Toolkit::Page::ControlOnBarContainer& Page::GetControlsOnToolBar() const
133 return mToolBarControls;
136 bool Page::AddControlToTitleBar(Actor control)
144 mTitleBarControls.push_back(control);
149 const ActorContainer& Page::GetControlsOnTitleBar() const
151 return mTitleBarControls;
154 void Page::SetPopupMenu( Toolkit::Popup popupMenu )
156 mPopupMenu = popupMenu;
159 Toolkit::Popup Page::GetPopupMenu() const
164 void Page::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
166 Toolkit::Page page = Toolkit::Page::DownCast( Dali::BaseHandle( object ) );
172 case Toolkit::Page::Property::TITLE:
174 GetImpl( page ).SetTitle( value.Get< std::string >() );
178 case Toolkit::Page::Property::SUB_TITLE:
180 GetImpl( page ).SetSubTitle( value.Get< std::string >() );
187 Property::Value Page::GetProperty( BaseObject* object, Property::Index propertyIndex )
189 Property::Value value;
191 Toolkit::Page page = Toolkit::Page::DownCast( Dali::BaseHandle( object ) );
195 switch ( propertyIndex )
197 case Toolkit::Page::Property::TITLE:
199 value = GetImpl( page ).mTitle;
203 case Toolkit::Page::Property::SUB_TITLE:
205 value = GetImpl( page ).mSubTitle;
214 } // namespace Internal
216 } // namespace Toolkit