@@ -134,6 +134,19 @@ static void dialog_fit_overlay(lv_obj_t *dialog, dialog_style_t style,
134134 lv_obj_set_height (dialog , needed < max_h ? needed : max_h );
135135}
136136
137+ static void add_confirm_button (lv_obj_t * dialog , const char * text ,
138+ lv_align_t align , lv_color_t color ,
139+ lv_event_cb_t cb , void * ctx ) {
140+ lv_obj_t * btn = theme_create_button (dialog , text , true);
141+ lv_obj_set_size (btn , LV_PCT (40 ), theme_get_button_height ());
142+ lv_obj_align (btn , align , 0 , 0 );
143+ lv_obj_add_event_cb (btn , cb , LV_EVENT_CLICKED , ctx );
144+
145+ lv_obj_t * label = lv_obj_get_child (btn , 0 );
146+ if (label )
147+ lv_obj_set_style_text_color (label , color , 0 );
148+ }
149+
137150void dialog_show_info (const char * title , const char * message ,
138151 dialog_callback_t callback , void * user_data ,
139152 dialog_style_t style ) {
@@ -216,19 +229,6 @@ void dialog_show_error_timeout(const char *message,
216229 lv_timer_set_repeat_count (timer , 1 );
217230}
218231
219- static void add_confirm_button (lv_obj_t * dialog , const char * text ,
220- lv_align_t align , lv_color_t color ,
221- lv_event_cb_t cb , void * ctx ) {
222- lv_obj_t * btn = theme_create_button (dialog , text , true);
223- lv_obj_set_size (btn , LV_PCT (40 ), theme_get_button_height ());
224- lv_obj_align (btn , align , 0 , 0 );
225- lv_obj_add_event_cb (btn , cb , LV_EVENT_CLICKED , ctx );
226-
227- lv_obj_t * label = lv_obj_get_child (btn , 0 );
228- if (label )
229- lv_obj_set_style_text_color (label , color , 0 );
230- }
231-
232232static void show_confirm_internal (const char * message ,
233233 dialog_confirm_callback_t callback ,
234234 void * user_data , dialog_style_t style ,
@@ -245,19 +245,33 @@ static void show_confirm_internal(const char *message,
245245
246246 lv_obj_t * dialog = create_dialog_container (style , & ctx -> root );
247247
248- if (danger && style == DIALOG_STYLE_OVERLAY )
248+ if (danger && style == DIALOG_STYLE_OVERLAY ) {
249249 lv_obj_set_style_border_color (dialog , error_color (), 0 );
250+ lv_obj_set_style_border_width (dialog , 2 , 0 );
251+ }
252+
253+ int32_t msg_y = 10 ;
254+ if (danger ) {
255+ lv_obj_t * icon = lv_label_create (dialog );
256+ lv_obj_set_style_text_font (icon , theme_font_medium (), 0 );
257+ lv_obj_set_style_text_color (icon , error_color (), 0 );
258+ lv_label_set_text (icon , LV_SYMBOL_WARNING );
259+ lv_obj_align (icon , LV_ALIGN_TOP_MID , 0 , 0 );
260+ lv_obj_update_layout (icon );
261+ msg_y = lv_obj_get_height (icon ) + 6 ;
262+ }
250263
251264 lv_obj_t * msg_label = make_message_label (dialog , message , 90 );
252265 lv_label_set_recolor (msg_label , true);
253- lv_obj_align (msg_label , LV_ALIGN_TOP_MID , 0 , 10 );
266+ lv_obj_align (msg_label , LV_ALIGN_TOP_MID , 0 , msg_y );
254267
255268 add_confirm_button (dialog , "No" , LV_ALIGN_BOTTOM_LEFT ,
256269 danger ? yes_color () : no_color (), confirm_no_cb , ctx );
257270 add_confirm_button (dialog , "Yes" , LV_ALIGN_BOTTOM_RIGHT ,
258271 danger ? no_color () : yes_color (), confirm_yes_cb , ctx );
259272
260- dialog_fit_overlay (dialog , style , message , theme_get_button_height () + 20 );
273+ dialog_fit_overlay (dialog , style , message ,
274+ msg_y + theme_get_button_height () + 20 );
261275}
262276
263277void dialog_show_confirm (const char * message ,
0 commit comments