1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 #ifndef HI_GV_BUTTON_H 17 #define HI_GV_BUTTON_H 18 19 /* add include here */ 20 #include "hi_gv_resm.h" 21 #include "hi_gv_conf.h" 22 23 #ifdef HIGV_USE_WIDGET_BUTTON 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 typedef struct { 29 HI_U32 buttonStyle; 30 HIGV_HANDLE checkedNormal; 31 HIGV_HANDLE checkedDisable; 32 HIGV_HANDLE checkedHighlight; 33 HIGV_HANDLE checkedActive; 34 HIGV_HANDLE checkedMouseDown; 35 HI_U32 textOn; 36 HI_U32 textOff; 37 HI_U32 switchLayout; 38 HI_COLOR toggleOnColor; 39 HI_COLOR toggleOffColor; 40 } HIGV_BUTTON_PRIVATE; 41 42 /* Normal button */ 43 #define HIGV_BS_PUSH HIGV_STYLE_DEFINE(HIGV_WIDGET_BUTTON, BUTTON_STYLE_PUSH) 44 45 /* Radio button */ 46 #define HIGV_BS_RADIO HIGV_STYLE_DEFINE(HIGV_WIDGET_BUTTON, BUTTON_STYLE_RADIO) 47 48 /* Check button */ 49 #define HIGV_BS_CHECK HIGV_STYLE_DEFINE(HIGV_WIDGET_BUTTON, BUTTON_STYLE_CHECK) 50 51 /* Softkey button */ 52 #define HIGV_BS_SOFTKEY HIGV_STYLE_DEFINE(HIGV_WIDGET_BUTTON, BUTTON_STYLE_SOFTKEY) 53 54 /* Switch button */ 55 #define HIGV_BS_SWITCH HIGV_STYLE_DEFINE(HIGV_WIDGET_BUTTON, BUTTON_STYLE_SWITCH) 56 57 /* Toggle button */ 58 #define HIGV_BS_TOGGLE HIGV_STYLE_DEFINE(HIGV_WIDGET_BUTTON, BUTTON_STYLE_TOGGLE) 59 60 /* Paint toggle min height */ 61 #define HIGV_BUTTON_TOGGLE_MIN_HEIGHT 5 62 63 /* Paint toggle min width */ 64 #define HIGV_BUTTON_TOGGLE_MIN_WIDTH 19 65 66 /* Button type */ 67 typedef enum { 68 BUTTON_STYLE_PUSH = 0, 69 /* Push button , */ 70 BUTTON_STYLE_RADIO, 71 /* Radio button , */ 72 BUTTON_STYLE_CHECK, 73 /* Check button , */ 74 BUTTON_STYLE_SOFTKEY, 75 /* Softkey button , */ 76 BUTTON_STYLE_SWITCH, 77 /* Switch button , */ 78 BUTTON_STYLE_TOGGLE, 79 /* Toggle button , */ 80 BUTTON_STYLE_BUTT 81 } HIGV_BUTTON_SYLE_E; 82 83 /* Button status , */ 84 typedef enum { 85 BUTTON_STATUS_UNCHECKED = 0, 86 /* Unchecked status , */ 87 BUTTON_STATUS_CHECKED, 88 /* Checked status , */ 89 BUTTON_STATUS_BUTT 90 } HIGV_BUTTON_STATUS_E; 91 92 /* Button switch status , */ 93 typedef enum { 94 BUTTON_SWITCH_OFF = 0, 95 /* Switch off , */ 96 BUTTON_SWITCH_ON, 97 /* Switch on , */ 98 BUTTON_SWITCH_BUTT 99 } HIGV_BUTTON_SWITCH_E; 100 101 /* Switch button text layout , */ 102 typedef enum { 103 BUTTON_SWITCHLAYOUT_OFF_ON = 0, 104 /* "off:on" layout , */ 105 BUTTON_SWITCHLAYOUT_ON_OFF, 106 /* "on:off" layout , */ 107 BUTTON_SWITCHLAYOUT_BUTT 108 } HIGV_BUTTON_SWITCHLAYOUT_E; 109 110 HI_S32 HI_GV_Button_SetCheck(HIGV_HANDLE buttonHandle, HIGV_BUTTON_STATUS_E status); 111 112 HI_S32 HI_GV_Button_GetCheck(HIGV_HANDLE buttonHandle, HIGV_BUTTON_STATUS_E *status); 113 114 HI_S32 HI_GV_Button_SetSwitch(HIGV_HANDLE buttonHandle, HIGV_BUTTON_SWITCH_E switchStatus); 115 116 HI_S32 HI_GV_Button_GetSwitch(HIGV_HANDLE buttonHandle, HIGV_BUTTON_SWITCH_E *switchStatus); 117 118 HI_S32 HI_GV_Button_SetToggleColor(HIGV_HANDLE buttonHandle, HI_COLOR toggleOnColor, HI_COLOR toggleOffColor); 119 120 HI_S32 HI_GV_Button_SetSwitchTextByID(HIGV_HANDLE buttonHandle, const HI_U32 onStrID, const HI_U32 offStrID); 121 122 HI_S32 HI_GV_Button_SetSwitchLayout(HIGV_HANDLE buttonHandle, HIGV_BUTTON_SWITCHLAYOUT_E textLayout); 123 124 #ifdef __cplusplus 125 } 126 #endif 127 #endif 128 #endif /* HI_GV_BUTTON_H */ 129