fix gdi and add dummy chart
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-09-13 22:10:40 +09:00
commit efd1d32801
7 changed files with 102 additions and 13 deletions

View file

@ -7,6 +7,7 @@
#define PaddingContent 2
MwWidget window, menu, table;
MwWidget wcal, wclock;
MwMenu e;
static void MWAPI resize(MwWidget handle, void* user, void* call) {
@ -21,6 +22,24 @@ static void MWAPI resize(MwWidget handle, void* user, void* call) {
NULL);
}
static void MWAPI tick(MwWidget handle, void* user, void* call) {
time_t t = time(NULL);
struct tm tm = *localtime(&t);
MwVaApply(wcal,
MwNyear, (int)tm.tm_year + 1900,
MwNmonth, (int)tm.tm_mon,
MwNdate, (int)tm.tm_mday,
MwNday, (int)tm.tm_wday,
NULL);
MwVaApply(wclock,
MwNhour, (int)tm.tm_hour,
MwNminute, (int)tm.tm_min,
MwNsecond, (int)tm.tm_sec,
NULL);
}
static void MWAPI resize_content(MwWidget handle, void* user, void* call) {
MwWidget* ws = MwGetChildren(handle);
if(ws != NULL) {
@ -241,17 +260,15 @@ int main() {
}
}
f = frame("Calendar", -PaddingContent, -PaddingContent, MwCalendarClass,
MwNscale, 1,
NULL);
f = frame("Calendar", -PaddingContent, -PaddingContent, MwCalendarClass,
MwNscale, 1,
NULL);
wcal = child(f);
f = frame("Clock", -PaddingContent, -PaddingContent, MwClockClass,
MwNhour, 15,
MwNminute, 0,
MwNsecond, 10,
NULL);
f = frame("Clock", -PaddingContent, -PaddingContent, MwClockClass, NULL);
wclock = child(f);
f = frame("Chart", -PaddingContent, -PaddingContent, MwCalendarClass,
f = frame("Chart", -PaddingContent, -PaddingContent, MwChartClass,
NULL);
f = frame("ComboBox", -PaddingContent, 24, MwComboBoxClass, NULL);
@ -321,7 +338,9 @@ int main() {
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
tick(window, NULL, NULL);
resize(window, NULL, NULL);
MwVaApply(table,

View file

@ -36,6 +36,7 @@
#include <Mw/Widget/Box.h>
#include <Mw/Widget/Button.h>
#include <Mw/Widget/Calendar.h>
#include <Mw/Widget/Chart.h>
#include <Mw/Widget/CheckBox.h>
#include <Mw/Widget/Clock.h>
#include <Mw/Widget/ComboBox.h>

24
include/Mw/Widget/Chart.h Normal file
View file

@ -0,0 +1,24 @@
/*!
* @file Mw/Widget/Chart.h
* @brief Chart widget
*/
#ifndef __MW_WIDGET_CHART_H__
#define __MW_WIDGET_CHART_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Chart widget class
*/
MWDECL MwClass MwChartClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1000,11 +1000,11 @@ static void MwLLMakeToolWindowImpl(MwLL handle) {
RECT rc;
int w, h;
GetClientRect(handle->gdi.hWnd, &rc);
SetWindowLongPtr(handle->gdi.hWnd, GWL_STYLE, (LPARAM)lp);
SetWindowLongPtr(handle->gdi.hWnd, GWL_EXSTYLE, (LPARAM)WS_EX_TOOLWINDOW);
GetClientRect(handle->gdi.hWnd, &rc);
w = rc.right - rc.left;
h = rc.bottom - rc.top;

View file

@ -1984,7 +1984,7 @@ static int MwLLWaylandCallInitImpl(void) {
#ifdef MW_OPENGL
if(getenv("WSLENV") || getenv("WSL_DISTRO_NAME")) {
loadWayland = 1;
loadWayland = 0;
}
#endif

View file

@ -5,7 +5,7 @@
#ifdef USE_COCOA
#define PERIODIC
#endif
//#define USE_CLASSIC_THEME
// #define USE_CLASSIC_THEME
#define RESIZE_ON_TICK
#define DRAW(handle) \

View file

@ -0,0 +1,45 @@
#include <Mw/Milsko.h>
static int wcreate(MwWidget handle) {
return 0;
}
static void draw(MwWidget handle) {
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwRect r;
r.x = 0;
r.y = 0;
r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight);
MwDrawRect(handle, &r, base);
MwLLFreeColor(base);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNhour) == 0 || strcmp(key, MwNminute) == 0 || strcmp(key, MwNsecond) == 0) MwForceRender(handle);
}
MwClassRec MwChartClassRec = {
wcreate, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
NULL, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL, /* props_change */
NULL,
NULL,
NULL};
MwClass MwChartClass = &MwChartClassRec;