git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@570 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-02 19:15:38 +00:00
parent 92db649bda
commit 971ef1b827
15 changed files with 767 additions and 796 deletions

View File

@@ -2,13 +2,33 @@
#include <Mw/Milsko.h>
int main() {
MwWidget w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT,
MwDEFAULT, 640, 480, MwNtitle, "test", NULL);
MwWidget cpicker;
MwWidget window;
MwWidget button;
MwWidget cpicker = MwColorPicker(w, "cpicker");
void color_callback(MwRGB rgb) {
char hexColor[8];
(void)cpicker;
MwLoop(w);
sprintf(hexColor, "#%02X%02X%02X", rgb.r, rgb.g, rgb.b);
MwSetText(window, MwNbackground, hexColor);
}
void color_picker(MwWidget handle, void* user_data, void* call_data) {
MwWidget cpicker = MwColorPicker(window, "cpicker", color_callback);
MwSetText(cpicker, MwNbackground, MwDefaultBackground);
}
int main() {
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT,
MwDEFAULT, 640, 480, MwNtitle, "color picker", NULL);
MwSetText(window, MwNbackground, "#000000");
button = MwVaCreateWidget(MwButtonClass, "button", window, 160, 180, 320, 120,
MwNtext, "change window background",
NULL);
MwSetText(button, MwNbackground, MwDefaultBackground);
MwAddUserHandler(button, MwNactivateHandler, color_picker, NULL);
MwLoop(window);
}