2 * Copyright (c) 2018 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.
18 #include <dali-toolkit/devel-api/layouting/layout-controller.h>
21 #include <dali/devel-api/adaptor-framework/singleton-service.h>
24 #include <dali-toolkit/internal/layouting/layout-controller-impl.h>
32 LayoutController::LayoutController()
36 LayoutController::~LayoutController()
40 LayoutController LayoutController::Get()
42 LayoutController layoutController;
44 SingletonService singletonService( SingletonService::Get() );
45 if ( singletonService )
47 Dali::BaseHandle handle = singletonService.GetSingleton( typeid(LayoutController) );
50 // If so, downcast the handle of singleton to layout controller
51 layoutController = LayoutController( dynamic_cast<Internal::LayoutController*>( handle.GetObjectPtr() ) );
54 if( !layoutController )
56 // If not, create the layout controller and register it as a singleton
57 Internal::LayoutController* impl = new Internal::LayoutController();
58 layoutController = LayoutController( impl );
61 // Registering the singleton will automatically register the processor with Core.
62 singletonService.Register( typeid(layoutController), layoutController );
66 return layoutController;
69 void LayoutController::RequestLayout( LayoutItem layout )
71 GetImpl( *this ).RequestLayout( GetImplementation( layout ), -1 );
74 void LayoutController::RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutTransitionType )
76 GetImpl( *this ).RequestLayout( GetImplementation( layout ), layoutTransitionType );
79 LayoutController::LayoutController( Internal::LayoutController *impl )