diff --git a/demo/app/assets/views/documentation.xml b/demo/app/assets/views/documentation.xml index 3fc5c19..42554c4 100644 --- a/demo/app/assets/views/documentation.xml +++ b/demo/app/assets/views/documentation.xml @@ -100,6 +100,11 @@ Message + + + Notification + + Modal diff --git a/demo/demo.vcxproj b/demo/demo.vcxproj index 3bbb944..ce0a2d7 100644 --- a/demo/demo.vcxproj +++ b/demo/demo.vcxproj @@ -192,6 +192,7 @@ xcopy "$(SolutionDir)dist\assets" "$(ProjectDir)app\assets" /S /Y + diff --git a/demo/demo.vcxproj.filters b/demo/demo.vcxproj.filters index a3f967a..1925406 100644 --- a/demo/demo.vcxproj.filters +++ b/demo/demo.vcxproj.filters @@ -36,6 +36,9 @@ 源文件 + + 源文件 + diff --git a/demo/include/ui.h b/demo/include/ui.h index 6e1cd01..b363808 100644 --- a/demo/include/ui.h +++ b/demo/include/ui.h @@ -22,3 +22,4 @@ void HomeView_Init(void); void HomeView_Free(void); void UI_InitMessageView(void); +void UI_InitNotificationView(void); diff --git a/demo/src/main.c b/demo/src/main.c index 7263a11..3654807 100644 --- a/demo/src/main.c +++ b/demo/src/main.c @@ -24,6 +24,7 @@ int main(int argc, char **argv) Widget_SetTitleW(root, L"LC Design - A UI component framework for building LCUI application."); Navigation_Init(); UI_InitMessageView(); + UI_InitNotificationView(); Navbar_Init(); return LCUI_Main(); } diff --git a/demo/src/ui/views/notification-view.c b/demo/src/ui/views/notification-view.c new file mode 100644 index 0000000..0d15be6 --- /dev/null +++ b/demo/src/ui/views/notification-view.c @@ -0,0 +1,182 @@ +#include +#include +#include +#include + +static LCUI_WidgetPrototype notification_view_proto; + +static void OpenBasicNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenNotificationAtTopLeft(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "top-left", 4500); +} + +static void OpenNotificationAtTopRight(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "top-right", 4500); +} + +static void OpenNotificationAtBottomLeft(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "bottom-left", 4500); +} + +static void OpenNotificationAtBottomRight(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "bottom-right", 4500); +} + +static void OpenNotificationCustomDuration(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 0); +} + +static void OpenSuccessNotification(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenSuccessNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenInfoNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenInfoNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenWarningNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenWarningNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenErrorNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenErrorNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenNotificationCustomIcon(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCUI_Widget icon; + LCDesign_NotificationConfigRec config; + + icon = LCUIWidget_New("icon"); + Icon_SetName(icon, "emoticon-happy-outline"); + Widget_SetStyleString(icon, "color", "#108ee9"); + + config.icon = icon; + config.duration = 4500; + config.placement = NULL; + config.title = L"Notification Title"; + config.description = + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification."; + LCDesign_OpenNotification(&config); +} + +static void NotificationView_OnReady(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + Dict *dict; + LCUI_Widget btn; + + dict = Widget_CollectReferences(w); + + btn = Dict_FetchValue(dict, "notification-basic"); + Widget_BindEvent(btn, "click", OpenBasicNotification, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-top-left"); + Widget_BindEvent(btn, "click", OpenNotificationAtTopLeft, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-top-right"); + Widget_BindEvent(btn, "click", OpenNotificationAtTopRight, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-bottom-left"); + Widget_BindEvent(btn, "click", OpenNotificationAtBottomLeft, NULL, + NULL); + + btn = Dict_FetchValue(dict, "notification-bottom-right"); + Widget_BindEvent(btn, "click", OpenNotificationAtBottomRight, NULL, + NULL); + + btn = Dict_FetchValue(dict, "notification-custom-duration"); + Widget_BindEvent(btn, "click", OpenNotificationCustomDuration, NULL, + NULL); + + btn = Dict_FetchValue(dict, "notification-success"); + Widget_BindEvent(btn, "click", OpenSuccessNotification, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-info"); + Widget_BindEvent(btn, "click", OpenInfoNotification, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-warning"); + Widget_BindEvent(btn, "click", OpenWarningNotification, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-error"); + Widget_BindEvent(btn, "click", OpenErrorNotification, NULL, NULL); + + btn = Dict_FetchValue(dict, "notification-custom-icon"); + Widget_BindEvent(btn, "click", OpenNotificationCustomIcon, NULL, NULL); + + Dict_Release(dict); + Widget_UnbindEvent(w, "ready", NotificationView_OnReady); +} + +static void NotificationView_OnInit(LCUI_Widget w) +{ + Widget_BindEvent(w, "ready", NotificationView_OnReady, NULL, NULL); +} + +void UI_InitNotificationView(void) +{ + notification_view_proto = + LCUIWidget_NewPrototype("notification-view", NULL); + notification_view_proto->init = NotificationView_OnInit; +} diff --git a/docs/components/notification.md b/docs/components/notification.md new file mode 100644 index 0000000..f7d299a --- /dev/null +++ b/docs/components/notification.md @@ -0,0 +1,260 @@ +# Notification + +Display a notification message globally. + +## Basic + +The simplest usage that close the notification box after 4.5s. + +``` embedded-xml + + + +``` + +``` c +#include +#include +#include + +static void OpenNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +// ... other code + + LCUI_Widget btn = LCUIWidget_GetById("btn-open-notification"); + Widget_BindEvent(btn, "click", OpenNotification, NULL, NULL); + +// ... other code +``` + +## Placement + +A notification box can appear from the `top right`, `bottom-right`, `bottom-left` or `top-left` of the viewport. + +``` embedded-xml + + + + + + +``` + +``` c +#include +#include +#include + +static void OpenNotificationAtTopLeft(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "top-left", 4500); +} + +static void OpenNotificationAtTopRight(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "top-right", 4500); +} + +static void OpenNotificationAtBottomLeft(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "bottom-left", 4500); +} + +static void OpenNotificationAtBottomRight(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + "bottom-right", 4500); +} + +// ... other code + + LCUI_Widget btn; + + btn = LCUIWidget_GetById("btn-open-at-top-left"); + Widget_BindEvent(btn, "click", OpenNotificationAtTopLeft, NULL, NULL); + + btn = LCUIWidget_GetById("btn-open-at-top-right"); + Widget_BindEvent(btn, "click", OpenNotificationAtTopRight, NULL, NULL); + + btn = LCUIWidget_GetById("btn-open-at-bottom-left"); + Widget_BindEvent(btn, "click", OpenNotificationAtBottomLeft, NULL, NULL); + + btn = LCUIWidget_GetById("btn-open-at-bottom-right"); + Widget_BindEvent(btn, "click", OpenNotificationAtBottomRight, NULL, NULL); + +// ... other code +``` + +## Customize duration + +`Duration` can be used to specify how long the notification stays open. After the duration time elapses, the notification closes automatically. If you set the value to 0, the notification box will never close automatically. + +``` embedded-xml + + + +``` + +``` c +#include +#include +#include + +static void OpenNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenNormalNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 0); +} + +// ... other code + + LCUI_Widget btn = LCUIWidget_GetById("btn-open-notification"); + Widget_BindEvent(btn, "click", OpenNotification, NULL, NULL); + +// ... other code +``` + +## Notification with icon + +A notification box with a icon at the left side. + +``` embedded-xml + + + + + + +``` + +``` c +#include +#include +#include + +static void OpenSuccessNotification(LCUI_Widget w, LCUI_WidgetEvent e, + void *arg) +{ + LCDesign_OpenSuccessNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenInfoNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenInfoNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenWarningNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenWarningNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +static void OpenErrorNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_OpenErrorNotification( + L"Notification Title", + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification.", + NULL, 4500); +} + +// ... other code + + LCUI_Widget btn; + + btn = LCUIWidget_GetById("btn-open-success-notification"); + Widget_BindEvent(btn, "click", OpenSuccessNotification, NULL, NULL); + + btn = LCUIWidget_GetById("btn-open-info-notification"); + Widget_BindEvent(btn, "click", OpenInfoNotification, NULL, NULL); + + btn = LCUIWidget_GetById("btn-open-warning-notification"); + Widget_BindEvent(btn, "click", OpenWarningNotification, NULL, NULL); + + btn = LCUIWidget_GetById("btn-open-error-notification"); + Widget_BindEvent(btn, "click", OpenErrorNotification, NULL, NULL); + +// ... other code +``` + +## Customized Icon + +The icon can be customized to any widget. + +``` embedded-xml + + + +``` + +``` c +#include +#include +#include + +static void OpenNotification(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCUI_Widget icon; + LCDesign_NotificationConfigRec config; + + icon = LCUIWidget_New("icon"); + Icon_SetName(icon, "emoticon-happy-outline"); + Widget_SetStyleString(icon, "color", "#108ee9"); + + config.icon = icon; + config.duration = 4500; + config.placement = NULL; + config.title = L"Notification Title"; + config.description = + L"This is the content of the notification. This is the content of " + L"the notification. This is the content of the notification."; + LCDesign_OpenNotification(&config); +} + +// ... other code + + LCUI_Widget btn = LCUIWidget_GetById("btn-open-notification"); + Widget_BindEvent(btn, "click", OpenNotification, NULL, NULL); + +// ... other code +``` diff --git a/include/LCDesign/ui/components/notification.h b/include/LCDesign/ui/components/notification.h new file mode 100644 index 0000000..cd9e553 --- /dev/null +++ b/include/LCDesign/ui/components/notification.h @@ -0,0 +1,50 @@ +#ifndef LCDESIGN_NOTIFICATION_H +#define LCDESIGN_NOTIFICATION_H + +typedef struct LCDesign_NotificationConfigRec_ { + /** Customized Icon */ + LCUI_Widget icon; + + /** The title of notification box (required) */ + const wchar_t *title; + + /** The content of notification box (required) */ + const wchar_t *description; + + /** Position of Notification, can be one of top-left, top-right, + * bottom-left, bottom-right */ + const char *placement; + + /** time(milliseconds) before auto-dismiss, don't dismiss if set to 0 */ + long duration; +} LCDesign_NotificationConfigRec, *LCDesign_NotificationConfig; + +LCUI_API LCUI_Widget +LCDesign_OpenNotification(LCDesign_NotificationConfig config); + +LCUI_API void LCDesign_CloseNotification(LCUI_Widget message); + +LCUI_API LCUI_Widget LCDesign_OpenNormalNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, + long duration); + +LCUI_API LCUI_Widget LCDesign_OpenSuccessNotification( + const wchar_t *title, const wchar_t *description, const char *placement, + long duration); + +LCUI_API LCUI_Widget LCDesign_OpenInfoNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, + long duration); + +LCUI_API LCUI_Widget LCDesign_OpenWarningNotification( + const wchar_t *title, const wchar_t *description, const char *placement, + long duration); + +LCUI_API LCUI_Widget LCDesign_OpenErrorNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, + long duration); + +#endif diff --git a/main.vcxproj b/main.vcxproj index 441b658..2a4f7bb 100644 --- a/main.vcxproj +++ b/main.vcxproj @@ -169,6 +169,7 @@ + @@ -191,6 +192,7 @@ + diff --git a/main.vcxproj.filters b/main.vcxproj.filters index ed5e388..f930119 100644 --- a/main.vcxproj.filters +++ b/main.vcxproj.filters @@ -20,6 +20,7 @@ + @@ -42,5 +43,6 @@ + \ No newline at end of file diff --git a/src/scss/_notification.scss b/src/scss/_notification.scss new file mode 100644 index 0000000..151bc2d --- /dev/null +++ b/src/scss/_notification.scss @@ -0,0 +1,92 @@ +.notification-container { + width: 100%; + max-width: 384px; + padding: map-get($spacers, 3); + z-index: $zindex-notification-notice; + position: absolute; + pointer-events: none; +} + +.notification-notice { + padding: $notification-notice-padding-y $notification-notice-padding-x; + background-color: $notification-notice-bg; + border: $notification-notice-border; + border-radius: $border-radius; + pointer-events: auto; + margin-bottom: $notification-margin-bottom; +} + +.notification-notice-close { + top: $notification-notice-padding-y; + right: $notification-notice-padding-x; + position: absolute; + opacity: .5; + line-height: 1; + color: $close-color; + font-size: $close-font-size; + + @include hover-focus { + color: $close-color; + opacity: .75; + } +} + +.notification-notice-title { + font-size: $notification-notice-title-size; + margin-bottom: $notification-notice-title-margin-bottom; +} + +.notification-notice-description { + color: $notification-color; +} + +.notification-notice-icon { + width: $notification-notice-icon-size; + height: $notification-notice-icon-size; + font-size: $notification-notice-icon-size; + line-height: $notification-notice-icon-size; + top: $notification-notice-padding-y; + left: $notification-notice-padding-x; + position: absolute; +} + +.notification-has-icon .notification-notice-content { + padding-left: $notification-notice-icon-size + map-get($spacers, 2); +} + +.notification-notice-icon-success { + color: $green; +} + +.notification-notice-icon-info { + color: $blue; +} + +.notification-notice-icon-warning { + color: $orange; +} + +.notification-notice-icon-error { + color: $red; +} + +.notification-container-top-left { + top: 0; + left: 0; +} + +.notification-container-top-right { + top: 0; + right: 0; +} + +.notification-container-bottom-left { + bottom: 0; + left: 0; +} + +.notification-container-bottom-right { + bottom: 0; + right: 0; +} + diff --git a/src/scss/_variables.scss b/src/scss/_variables.scss index 2e08d66..0971dc1 100644 --- a/src/scss/_variables.scss +++ b/src/scss/_variables.scss @@ -95,7 +95,7 @@ $yiq-text-light: $white !default; // Quickly modify global styling by enabling or disabling optional features. $enable-caret: true !default; -$enable-rounded: true !default; +$enable-rounded: false !default; $enable-shadows: true !default; $enable-gradients: false !default; $enable-transitions: false !default; @@ -414,6 +414,7 @@ $zindex-dropdown: 1000 !default; $zindex-modal-backdrop: 1040 !default; $zindex-modal: 1050 !default; $zindex-message-notice: 1060 !default; +$zindex-notification-notice: 1060 !default; $zindex-tooltip: 1070 !default; // Navs @@ -591,3 +592,15 @@ $message-notice-icon-size: $font-size-base * 1.5; $message-notice-padding-x: map-get($spacers, 3); $message-notice-padding-y: map-get($spacers, 2); $message-notice-border: $border-width solid $border-color; + +// Notification + +$notification-color: $gray-600; +$notification-margin-bottom: map-get($spacers, 3); +$notification-notice-bg: $white; +$notification-notice-icon-size: $font-size-base * 1.725; +$notification-notice-title-size: 16px; +$notification-notice-title-margin-bottom: map-get($spacers, 2); +$notification-notice-padding-x: map-get($spacers, 4); +$notification-notice-padding-y: map-get($spacers, 3); +$notification-notice-border: $border-width solid $border-color; diff --git a/src/scss/lc-design.scss b/src/scss/lc-design.scss index ca59861..d239a37 100644 --- a/src/scss/lc-design.scss +++ b/src/scss/lc-design.scss @@ -20,5 +20,6 @@ @import "close"; @import "modal"; @import "message"; +@import "notification"; @import "tooltip"; @import "utilities"; diff --git a/src/ui/components/notification.c b/src/ui/components/notification.c new file mode 100644 index 0000000..0688939 --- /dev/null +++ b/src/ui/components/notification.c @@ -0,0 +1,199 @@ +#include +#include +#include +#include +#include +#include + +struct LCDesign_Notification { + LCUI_Widget top_left_container; + LCUI_Widget top_right_container; + LCUI_Widget bottom_left_container; + LCUI_Widget bottom_right_container; +} self; + +static void OnClickCloseButton(LCUI_Widget w, LCUI_WidgetEvent e, void *arg) +{ + LCDesign_CloseNotification(e->data); +} + +LCUI_Widget LCDesign_OpenNotification(LCDesign_NotificationConfig config) +{ + LCUI_Widget box; + LCUI_Widget title; + LCUI_Widget description; + LCUI_Widget close; + LCUI_Widget content; + LCUI_Widget container; + + const char *placement = config->placement; + + if (!placement) { + placement = "top-right"; + } + if (strcmp(placement, "top-left") == 0) { + container = self.top_left_container; + if (!container) { + container = LCUIWidget_New(NULL); + self.top_left_container = container; + Widget_AddClass(container, + "notification-container " + "notification-container-top-left"); + } + } else if (strcmp(placement, "bottom-left") == 0) { + container = self.bottom_left_container; + if (!container) { + container = LCUIWidget_New(NULL); + self.bottom_left_container = container; + Widget_AddClass(container, + "notification-container " + "notification-container-bottom-left"); + } + } else if (strcmp(placement, "bottom-right") == 0) { + container = self.bottom_right_container; + if (!container) { + container = LCUIWidget_New(NULL); + self.bottom_right_container = container; + Widget_AddClass(container, + "notification-container " + "notification-container-bottom-right"); + } + } else { + container = self.top_right_container; + if (!container) { + container = LCUIWidget_New(NULL); + self.top_right_container = container; + Widget_AddClass(container, + "notification-container " + "notification-container-top-right"); + } + } + box = LCUIWidget_New(NULL); + content = LCUIWidget_New(NULL); + title = LCUIWidget_New("text"); + close = LCUIWidget_New("icon"); + description = LCUIWidget_New("text"); + Icon_SetName(close, "close"); + TextView_SetTextW(title, config->title); + TextView_SetTextW(description, config->description); + if (config->icon) { + Widget_AddClass(box, "notification-has-icon"); + Widget_AddClass(config->icon, "notification-notice-icon"); + Widget_Append(box, config->icon); + } + Widget_AddClass(box, "notification-notice"); + Widget_AddClass(close, "notification-notice-close"); + Widget_AddClass(title, "notification-notice-title"); + Widget_AddClass(description, "notification-notice-description"); + Widget_AddClass(content, "notification-notice-content"); + Widget_BindEvent(close, "click", OnClickCloseButton, box, NULL); + Widget_Append(content, title); + Widget_Append(content, description); + Widget_Append(box, content); + Widget_Append(box, close); + Widget_Append(container, box); + Widget_Append(LCUIWidget_GetRoot(), container); + if (config->duration > 0) { + LCUI_SetTimeout(config->duration, + (TimerCallback)LCDesign_CloseNotification, box); + } + return box; +} + +void LCDesign_CloseNotification(LCUI_Widget noti) +{ + Widget_Destroy(noti); +} + +LCUI_Widget LCDesign_OpenNormalNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, + long duration) +{ + LCDesign_NotificationConfigRec config; + + config.icon = NULL; + config.title = title; + config.placement = placement; + config.description = description; + config.duration = duration; + return LCDesign_OpenNotification(&config); +} + +LCUI_Widget LCDesign_OpenSuccessNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, + long duration) +{ + LCUI_Widget icon; + LCDesign_NotificationConfigRec config; + + icon = LCUIWidget_New("icon"); + Icon_SetName(icon, "check-circle-outline"); + Widget_AddClass(icon, "notification-notice-icon-success"); + + config.icon = icon; + config.title = title; + config.placement = placement; + config.description = description; + config.duration = duration; + return LCDesign_OpenNotification(&config); +} + +LCUI_Widget LCDesign_OpenInfoNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, long duration) +{ + LCUI_Widget icon; + LCDesign_NotificationConfigRec config; + + icon = LCUIWidget_New("icon"); + Icon_SetName(icon, "information-outline"); + Widget_AddClass(icon, "notification-notice-icon-info"); + + config.icon = icon; + config.title = title; + config.placement = placement; + config.description = description; + config.duration = duration; + return LCDesign_OpenNotification(&config); +} + +LCUI_Widget LCDesign_OpenWarningNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, + long duration) +{ + LCUI_Widget icon; + LCDesign_NotificationConfigRec config; + + icon = LCUIWidget_New("icon"); + Icon_SetName(icon, "alert-circle-outline"); + Widget_AddClass(icon, "notification-notice-icon-warning"); + + config.icon = icon; + config.title = title; + config.placement = placement; + config.description = description; + config.duration = duration; + return LCDesign_OpenNotification(&config); +} + +LCUI_Widget LCDesign_OpenErrorNotification(const wchar_t *title, + const wchar_t *description, + const char *placement, long duration) +{ + LCUI_Widget icon; + LCDesign_NotificationConfigRec config; + + icon = LCUIWidget_New("icon"); + Icon_SetName(icon, "close-circle-outline"); + Widget_AddClass(icon, "notification-notice-icon-error"); + + config.icon = icon; + config.title = title; + config.placement = placement; + config.description = description; + config.duration = duration; + return LCDesign_OpenNotification(&config); +}