1 /*
2  * Copyright (c) 2020-2021 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 
16 #include "themes/theme.h"
17 #include "components/root_view.h"
18 #include "components/ui_view.h"
19 
20 namespace OHOS {
Theme()21 Theme::Theme()
22 {
23     InitBasicStyle();
24     InitButtonStyle();
25     InitLabelStyle();
26     InitEditTextStyle();
27     InitPickerStyle();
28     InitProgressStyle();
29     InitSliderStyle();
30 };
31 
InitBasicStyle()32 void Theme::InitBasicStyle()
33 {
34     basicStyle_ = StyleDefault::GetDefaultStyle();
35 }
36 
InitButtonStyle()37 void Theme::InitButtonStyle()
38 {
39     buttonStyle_.released = StyleDefault::GetButtonReleasedStyle();
40     buttonStyle_.pressed = StyleDefault::GetButtonPressedStyle();
41 }
42 
InitLabelStyle()43 void Theme::InitLabelStyle()
44 {
45     labelStyle_ = StyleDefault::GetLabelStyle();
46 }
47 
InitEditTextStyle()48 void Theme::InitEditTextStyle()
49 {
50     editTextStyle_ = StyleDefault::GetEditTextStyle();
51 }
52 
InitPickerStyle()53 void Theme::InitPickerStyle()
54 {
55     pickerBackgroundStyle_ = StyleDefault::GetPickerBackgroundStyle();
56     pickerHighlightStyle_ = StyleDefault::GetPickerHighlightStyle();
57 }
58 
InitProgressStyle()59 void Theme::InitProgressStyle()
60 {
61     progressBackgroundStyle_ = StyleDefault::GetProgressBackgroundStyle();
62     progressForegroundStyle_ = StyleDefault::GetProgressForegroundStyle();
63 }
64 
InitSliderStyle()65 void Theme::InitSliderStyle()
66 {
67     sliderKnobStyle_ = StyleDefault::GetPickerBackgroundStyle();
68 }
69 } // namespace OHOS
70