2 * Copyright (c) 2023 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 "slim-custom-view-impl.h"
22 #include <dali/devel-api/object/handle-devel.h>
23 #include <dali/public-api/object/type-registry.h>
24 #include <dali-toolkit/dali-toolkit.h>
27 #include "nui-view-accessible.h"
29 SlimCustomViewImpl::SlimCustomViewImpl(ControlBehaviour behaviourFlags) : Control(behaviourFlags)
33 Dali::Toolkit::Control SlimCustomViewImpl::New(ControlBehaviour additionalBehaviour)
35 // Create the implementation, temporarily owned on stack
36 Dali::IntrusivePtr<SlimCustomViewImpl> controlImpl = new SlimCustomViewImpl(Control::ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour));
38 // Pass ownership to handle
39 Dali::Toolkit::Control handle(*controlImpl);
41 // Second-phase init of the implementation
42 // This can only be done after the CustomActor connection has been made...
43 controlImpl->Initialize();
45 // Impersonate Control by adopting its TypeInfo. Without this, many things don't work.
46 Dali::TypeInfo typeInfo = Dali::TypeRegistry::Get().GetTypeInfo(typeid(Control));
49 Dali::DevelHandle::SetTypeInfo(handle, typeInfo);
55 Dali::Toolkit::DevelControl::ControlAccessible* SlimCustomViewImpl::CreateAccessibleObject()
57 return new NUIViewAccessible(Self());