mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-02 23:50:50 +00:00
closes #10
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@570 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user