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_MSGBOX_H 17 #define HI_GV_MSGBOX_H 18 19 /* add include here */ 20 #include "hi_gv_conf.h" 21 #include "hi_type.h" 22 #include "hi_gv_widget.h" 23 24 #ifdef HIGV_USE_WIDGET_MSGBOX 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 #define MAXBUTTONNUM 4 31 32 /* Standard Message button ID */ 33 #define MSG_BUTTONID_INVALID 0 34 #define MSG_BUTTONID_OK 1 35 #define MSG_BUTTONID_CANCEL 2 36 #define MSG_BUTTONID_ABORT 3 37 #define MSG_BUTTONID_RETRY 4 38 #define MSG_BUTTONID_IGNORE 5 39 #define MSG_BUTTONID_YES 6 40 #define MSG_BUTTONID_NO 7 41 42 /* customized style */ 43 typedef enum { 44 MSGBOX_STYLE_NONE = 0, /* None button */ 45 MSGBOX_STYLE_OK = 1, /* Only OK */ 46 MSGBOX_STYLE_OKCANCEL = 2, /* OK+cancel */ 47 MSGBOX_STYLE_RETRYCANCEL = 3, /* Retry+cancel */ 48 MSGBOX_STYLE_ABORTRETRYIGNORE = 4, /* Abort+retry+ignore */ 49 MSGBOX_STYLE_YESNOCANCEL = 5, /* Yes+no+cancel */ 50 MSGBOX_STYLE_USERDEF = 6 /* User-Defined */ 51 } HigvMsgBoxStyle; 52 53 54 /* MessageBox title info struction */ 55 typedef struct { 56 HI_U32 titleHeight; /* Title height */ 57 HI_U32 titleAlignment; /* Title alignment */ 58 HI_RESID titleSkin; /* Title skin style */ 59 HIGV_HANDLE titleFont; /* Text font of title */ 60 } HigvMsgBoxTitle; 61 62 63 /* MessageBox button info struction */ 64 typedef struct { 65 HI_U32 buttonAreaHeight; /* Button area height */ 66 HI_U32 buttonCount; /* Button count */ 67 HI_U32 buttonHeight; /* Button widget height */ 68 HI_U32 buttonWidth; /* Button widget width */ 69 HI_RESID buttonNormalSkin; /* Button widget normal skin style */ 70 HI_RESID buttonActiveSkin; /* Button widget active skin style */ 71 HI_RESID buttonHighlightSkin; /* Button widget highlight skin style */ 72 HI_RESID buttonMouseDownSkin; /* Button widget mouse down skin style */ 73 HI_RESID buttonAreaSkin; /* Button area skin style */ 74 HIGV_HANDLE buttonFont; /* Text font of button widget */ 75 } HigvMsgBoxButton; 76 77 78 /* MessageBox info struction for create */ 79 typedef struct { 80 HigvMsgBoxStyle msgBoxStyle; /* Message box style */ 81 HigvMsgBoxTitle titleInfo; /* Title info */ 82 HigvMsgBoxButton buttonInfo; /* Button info */ 83 HI_U32 showTimes; /* Show times */ 84 HI_RESID icon; /* Icon res ID */ 85 } HigvMsgBoxCreateInfo; 86 87 /* 88 \brief Init Message box. 89 \attention \n 90 N/A. 91 \param[in] handle Message box handle. 92 \param[in] createInfo Create information. 93 94 \retval ::HI_SUCCESS 95 \retval ::HI_ERR_COMM_LOST 96 \retval ::HI_ERR_COMM_INVAL 97 98 \see \ 99 N/A. 100 */ 101 HI_S32 HI_GV_MSGBOX_Init(HIGV_HANDLE handle, const HigvMsgBoxCreateInfo* createInfo); 102 103 /* 104 \brief Set title text. 105 \attention \n 106 N/A. 107 \param[in] handle Msg box handle. 108 \param[in] text Text of Message box title.Cncomment:ı 109 110 \retval ::HI_SUCCESS 111 \retval ::HI_ERR_COMM_LOST 112 \retval ::HI_ERR_COMM_INVAL 113 \retval ::HI_ERR_COMM_NOTREADY 114 115 \see \ 116 :: HI_GV_MSGBOX_GetTitleText 117 */ 118 HI_S32 HI_GV_MSGBOX_SetTitleText(HIGV_HANDLE handle, const HI_CHAR* text); 119 120 /* 121 \brief Get title text. 122 \attention \n 123 N/A. 124 \param[in] handle Widget handle. 125 \param[out] buf Text content. 126 \param[in] bufLen Buffer length. 127 128 \retval ::HI_SUCCESS 129 \retval ::HI_ERR_COMM_LOST 130 \retval ::HI_ERR_COMM_INVAL 131 \retval ::HI_ERR_COMM_NOTREADY 132 \see \n 133 :: HI_GV_MSGBOX_SetTitleText 134 */ 135 HI_S32 HI_GV_MSGBOX_GetTitleText(HIGV_HANDLE handle, HI_CHAR* buf, HI_U32 bufLen); 136 137 /* 138 \brief Set title text by ID. 139 \attention \n 140 N/A. 141 \param[in] handle Widget handle. 142 \param[in] strID String ID. 143 144 \retval ::HI_SUCCESS 145 \retval ::HI_ERR_COMM_LOST 146 \retval ::HI_ERR_COMM_NOTREADY 147 \see \n 148 ::HI_GV_MSGBOX_GetTitleTextID 149 */ 150 HI_S32 HI_GV_MSGBOX_SetTitleTextByID(HIGV_HANDLE handle, const HI_U32 strID); 151 152 /* 153 \brief Get title text by ID. 154 \attention \n 155 N/A. 156 \param[in] handle Widget handle. 157 \param[out] strID String ID. 158 159 \retval ::HI_SUCCESS 160 \retval ::HI_ERR_COMM_LOST 161 \retval ::HI_ERR_COMM_INVAL 162 \retval ::HI_ERR_COMM_NOTREADY 163 \see \n 164 :: HI_GV_ MSGBOX_SetTitleTextByID 165 */ 166 HI_S32 HI_GV_MSGBOX_GetTitleTextID(HIGV_HANDLE handle, HI_U32* strID); 167 168 /* 169 \brief Set icon res. 170 \attention \n 171 N/A. 172 \param[in] handle Widget handle. 173 \param[in] icon Icon res ID. 174 175 \retval ::HI_SUCCESS 176 \retval ::HI_ERR_COMM_LOST 177 \retval:: HI_ERR_COMM_NOTREADY 178 179 \see \n 180 N/A. 181 */ 182 HI_S32 HI_GV_MSGBOX_SetIcon(HIGV_HANDLE handle, HI_RESID icon); 183 184 /* 185 \brief Set button layout. 186 \attention \n 187 Only User-Defined style can availability. 188 The button index from left to right. 189 \param[in] handle Widget handle. 190 \param[in] Button[] The button ID array. 191 \param[in] length The length of button ID array. 192 193 \retval ::HI_SUCCESS 194 \retval ::HI_ERR_COMM_LOST 195 \retval ::HI_ERR_COMM_NOTREADY 196 197 \see \n 198 N/A. 199 */ 200 HI_S32 HI_GV_MSGBOX_ButtonLayout(HIGV_HANDLE handle, const HI_S32 buttonID[MAXBUTTONNUM], HI_S32 length); 201 202 /* 203 \brief Set inchoative button index. 204 \attention \n 205 N/A. 206 \param[in] handle Widget handle. 207 \param[in] buttonID Button ID. 208 209 \retval ::HI_SUCCESS 210 \retval ::HI_ERR_COMM_LOST 211 \retval ::HI_ERR_COMM_INVAL 212 \retval ::HI_ERR_COMM_NOTREADY 213 214 \see \n 215 N/A. 216 */ 217 HI_S32 HI_GV_MSGBOX_SetInitFocusButton(HIGV_HANDLE handle, HI_S32 buttonID); 218 219 /* 220 \brief Get child button handle. 221 \attention \n 222 N/A. 223 \param[in] handle Widget handle. 224 \param[out] buttonArray Button Handle Array. 225 \param[in] length The length of Button Handle Array. 226 227 \retval ::HI_SUCCESS 228 \retval ::HI_ERR_COMM_LOST 229 \retval ::HI_ERR_COMM_INVAL 230 \retval ::HI_ERR_COMM_NOTREADY 231 232 \see \n 233 N/A. 234 */ 235 HI_S32 HI_GV_MSGBOX_GetButtonHandle(HIGV_HANDLE handle, HIGV_HANDLE buttonArray[MAXBUTTONNUM], HI_S32 length); 236 237 /* 238 \brief Sync get key down button index. 239 \attention \n 240 N/A. 241 \param[in] handle Msg box handle. 242 243 \retval :: MSG_BUTTONID 244 \retval :: MSG_BUTTONID_INVALID 245 246 \see \n 247 N/A. 248 */ 249 HI_S32 HI_GV_MSGBOX_Show(HIGV_HANDLE handle); 250 251 #ifdef __cplusplus 252 } 253 #endif 254 #endif 255 #endif /* HI_GV_MSGBOX_H */ 256