diff --git a/LICENSE b/LICENSE index d6a83e7..f8f56ca 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025, Milsko Desktop Experience development team +Copyright (c) 2025, MDE Development Team All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index d4127c6..47462f5 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1 +1,6 @@ setup_lib(core Core) +target_link_libraries( + MDECore + PRIVATE + Mw +) diff --git a/core/aboutdialog.c b/core/aboutdialog.c new file mode 100644 index 0000000..1c5fb98 --- /dev/null +++ b/core/aboutdialog.c @@ -0,0 +1,59 @@ +#include + +#define Copyright "Copyright (C) 2025 MDE Development Team" + +static void ok_activate(MwWidget handle, void* user, void* client) { + MwDestroyWidget(user); +} + +MwWidget MDEAboutDialog(MwWidget handle, const char* appname, const char* version, MwLLPixmap pixmap) { + MwWidget w, p, l, l2, l3, ok; + MwSizeHints sh; + int x = MwDEFAULT, y = MwDEFAULT; + const int iw = 64 + 32; + const int bh = 24, bw = bh * 3; + int ww = 320, wh = 5 + iw + 5 + (16 + 5) * 3 + 10 + bh + 5; + char buf[512]; + + if(handle != NULL) { + x = MwGetInteger(handle, MwNx) + (MwGetInteger(handle, MwNwidth) - ww) / 2; + y = MwGetInteger(handle, MwNy) + (MwGetInteger(handle, MwNheight) - wh) / 2; + } + + sh.min_width = sh.max_width = ww; + sh.min_height = sh.max_height = wh; + + w = MwVaCreateWidget(MwWindowClass, "about", NULL, x, y, ww, wh, + MwNtitle, "About", + MwNsizeHints, &sh, + NULL); + + p = MwVaCreateWidget(MwImageClass, "pic", w, (ww - iw) / 2, 5, iw, iw, + MwNpixmap, pixmap, + NULL); + + l = MwVaCreateWidget(MwLabelClass, "label", w, 5, 5 + iw + 5, ww - 5 * 2, 16, + MwNtext, appname, + MwNbold, 1, + NULL); + + sprintf(buf, "Version %s", version); + + l2 = MwVaCreateWidget(MwLabelClass, "label2", w, 5, 5 + iw + 5 + 16 + 5, ww - 5 * 2, 16, + MwNtext, buf, + NULL); + + l3 = MwVaCreateWidget(MwLabelClass, "label3", w, 5, 5 + iw + 5 + 16 + 5 + 16 + 5 + 10, ww - 5 * 2, 16, + MwNtext, Copyright, + NULL); + + ok = MwVaCreateWidget(MwButtonClass, "ok", w, ww - 5 - bw, 5 + iw + 5 + 16 + 5 + 16 + 5 + 10 + 16 + 5, bw, bh, + MwNtext, "OK", + NULL); + + MwAddUserHandler(ok, MwNactivateHandler, ok_activate, w); + + if(handle != NULL) MwReparent(w, handle); + + return w; +} diff --git a/include/MDE/Core/AboutDialog.h b/include/MDE/Core/AboutDialog.h new file mode 100644 index 0000000..3339a92 --- /dev/null +++ b/include/MDE/Core/AboutDialog.h @@ -0,0 +1,18 @@ +#ifndef __MDE_CORE_ABOUTIALOG_H__ +#define __MDE_CORE_ABOUTIALOG_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +MwWidget MDEAboutDialog(MwWidget handle, const char* appname, const char* version, MwLLPixmap pixmap); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/MDE/Core/Directory.h b/include/MDE/Core/Directory.h index fc56b49..67b4492 100644 --- a/include/MDE/Core/Directory.h +++ b/include/MDE/Core/Directory.h @@ -1,5 +1,5 @@ -#ifndef __MDE_DIRECTORY_H__ -#define __MDE_DIRECTORY_H__ +#ifndef __MDE_CORE_DIRECTORY_H__ +#define __MDE_CORE_DIRECTORY_H__ #include diff --git a/include/MDE/Core/File.h b/include/MDE/Core/File.h index f521df1..3a60f15 100644 --- a/include/MDE/Core/File.h +++ b/include/MDE/Core/File.h @@ -1,5 +1,5 @@ -#ifndef __MDE_FILE_H__ -#define __MDE_FILE_H__ +#ifndef __MDE_CORE_FILE_H__ +#define __MDE_CORE_FILE_H__ #include diff --git a/include/MDE/Core/String.h b/include/MDE/Core/String.h index 5b31ad0..a85e8b4 100644 --- a/include/MDE/Core/String.h +++ b/include/MDE/Core/String.h @@ -1,5 +1,5 @@ -#ifndef __MDE_STRING_H__ -#define __MDE_STRING_H__ +#ifndef __MDE_CORE_STRING_H__ +#define __MDE_CORE_STRING_H__ #include diff --git a/include/MDE/Core/Users.h b/include/MDE/Core/Users.h index f92406c..baf8247 100644 --- a/include/MDE/Core/Users.h +++ b/include/MDE/Core/Users.h @@ -1,5 +1,5 @@ -#ifndef __MDE_USERS_H__ -#define __MDE_USERS_H__ +#ifndef __MDE_CORE_USERS_H__ +#define __MDE_CORE_USERS_H__ #include diff --git a/include/MDE/Foundation.h b/include/MDE/Foundation.h index d881f6f..175c534 100644 --- a/include/MDE/Foundation.h +++ b/include/MDE/Foundation.h @@ -7,6 +7,7 @@ #include #include #include +#include #include