color wheel: have the color display show the color hex

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@385 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
IoIxD
2025-10-16 23:28:24 +00:00
parent bac934b0e6
commit 6e6077a351

View File

@@ -61,6 +61,7 @@ typedef struct {
MwWidget value_slider;
MwWidget alpha_slider;
MwWidget color_display;
MwWidget color_display_text;
MwLLPixmap color_wheel_pixmap;
MwLLPixmap color_display_pixmap;
double value;
@@ -128,6 +129,8 @@ static void color_wheel_click(MwWidget handle, void* user, void* call) {
char* hexColor = malloc(8);
snprintf(hexColor, 8, "#%02X%02X%02X", r, g, b);
MwSetText(wheel->color_display, MwNbackground, hexColor);
MwSetText(wheel->color_display_text, MwNbackground, hexColor);
MwSetText(wheel->color_display_text, MwNtext, hexColor);
free(hexColor);
}
static void color_wheel_on_change_value(MwWidget handle, void* user, void* call) {
@@ -172,6 +175,8 @@ void color_wheel_setup(MwWidget parent, color_wheel* wheel) {
MwSetInteger(wheel->color_display, MwnhasBorder, 1);
MwSetInteger(wheel->color_display, MwNinverted, 1);
wheel->color_display_text = MwCreateWidget(MwLabelClass, "colorDisplayFrameText", wheel->color_display, MwDefaultBorderWidth, MwDefaultBorderWidth, PICKER_SIZE - MwDefaultBorderWidth, (PICKER_SIZE / 16) - (MwDefaultBorderWidth * 2));
wheel->value_slider = MwVaCreateWidget(MwScrollBarClass, "value-slider", wheel->parent,
// x
IMG_POS +