1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include "view_abstract.h"
16 
17 #include "core/components_ng/base/view_abstract.h"
18 #include "core/components_ng/base/view_abstract_model.h"
19 #include "core/components_ng/base/view_stack_processor.h"
20 #include "core/components_v2/extensions/events/on_area_change_extension.h"
21 #include "core/gestures/long_press_gesture.h"
22 
23 namespace OHOS::Ace::Framework {
GetThemeConstants()24 RefPtr<ThemeConstants> ViewAbstract::GetThemeConstants()
25 {
26     auto currentObj = Container::Current();
27     if (!currentObj) {
28         LOGW("container is null");
29         return nullptr;
30     }
31     auto pipelineContext = currentObj->GetPipelineContext();
32     if (!pipelineContext) {
33         LOGE("pipeline context is null!");
34         return nullptr;
35     }
36     auto themeManager = pipelineContext->GetThemeManager();
37     if (!themeManager) {
38         LOGE("theme manager is null!");
39         return nullptr;
40     }
41     return themeManager->GetThemeConstants();
42 }
43 
CjEnabled(bool enabled)44 void ViewAbstract::CjEnabled(bool enabled)
45 {
46     ViewAbstractModel::GetInstance()->SetEnabled(enabled);
47 }
48 
49 } // namespace OHOS::Ace::Framework
50