about dialog
This commit is contained in:
parent
86cb181e36
commit
6a27bfaf28
9 changed files with 92 additions and 9 deletions
2
LICENSE
2
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
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
setup_lib(core Core)
|
||||
target_link_libraries(
|
||||
MDECore
|
||||
PRIVATE
|
||||
Mw
|
||||
)
|
||||
|
|
|
|||
59
core/aboutdialog.c
Normal file
59
core/aboutdialog.c
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include <MDE/Core/AboutDialog.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
18
include/MDE/Core/AboutDialog.h
Normal file
18
include/MDE/Core/AboutDialog.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __MDE_CORE_ABOUTIALOG_H__
|
||||
#define __MDE_CORE_ABOUTIALOG_H__
|
||||
|
||||
#include <MDE/MachDep.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
MwWidget MDEAboutDialog(MwWidget handle, const char* appname, const char* version, MwLLPixmap pixmap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __MDE_DIRECTORY_H__
|
||||
#define __MDE_DIRECTORY_H__
|
||||
#ifndef __MDE_CORE_DIRECTORY_H__
|
||||
#define __MDE_CORE_DIRECTORY_H__
|
||||
|
||||
#include <MDE/MachDep.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __MDE_FILE_H__
|
||||
#define __MDE_FILE_H__
|
||||
#ifndef __MDE_CORE_FILE_H__
|
||||
#define __MDE_CORE_FILE_H__
|
||||
|
||||
#include <MDE/MachDep.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __MDE_STRING_H__
|
||||
#define __MDE_STRING_H__
|
||||
#ifndef __MDE_CORE_STRING_H__
|
||||
#define __MDE_CORE_STRING_H__
|
||||
|
||||
#include <MDE/MachDep.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __MDE_USERS_H__
|
||||
#define __MDE_USERS_H__
|
||||
#ifndef __MDE_CORE_USERS_H__
|
||||
#define __MDE_CORE_USERS_H__
|
||||
|
||||
#include <MDE/MachDep.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <MDE/Core/String.h>
|
||||
#include <MDE/Core/Users.h>
|
||||
#include <MDE/Core/Directory.h>
|
||||
#include <MDE/Core/AboutDialog.h>
|
||||
|
||||
#include <MDE/Audio/Audio.h>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue