Added uiColorButton. Let's implement this on OS X first.
This commit is contained in:
parent
2226c54430
commit
68ad5f53fa
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
static uiEntry *textString;
|
static uiEntry *textString;
|
||||||
static uiFontButton *textFontButton;
|
static uiFontButton *textFontButton;
|
||||||
|
static uiFontButton *textColorButton;
|
||||||
static uiEntry *textWidth;
|
static uiEntry *textWidth;
|
||||||
static uiButton *textApply;
|
static uiButton *textApply;
|
||||||
static uiCheckbox *addLeading;
|
static uiCheckbox *addLeading;
|
||||||
|
@ -27,6 +28,7 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp)
|
||||||
{
|
{
|
||||||
uiDrawTextFont *font;
|
uiDrawTextFont *font;
|
||||||
uiDrawTextLayout *layout;
|
uiDrawTextLayout *layout;
|
||||||
|
double, r, g, b, a;
|
||||||
|
|
||||||
font = uiFontButtonFont(textFontButton);
|
font = uiFontButtonFont(textFontButton);
|
||||||
|
|
||||||
|
@ -37,6 +39,10 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp)
|
||||||
uiDrawTextLayoutSetColor(layout,
|
uiDrawTextLayoutSetColor(layout,
|
||||||
8, 14,
|
8, 14,
|
||||||
1, 0, 0.5, 0.5);
|
1, 0, 0.5, 0.5);
|
||||||
|
uiColorButtonColor(textColorButton, &r, &g, &b, &a);
|
||||||
|
uiDrawTextLayoutSetColor(layout,
|
||||||
|
14, 18,
|
||||||
|
r, g, b, a);
|
||||||
uiDrawText(dp->Context, 10, 10, layout);
|
uiDrawText(dp->Context, 10, 10, layout);
|
||||||
uiDrawFreeTextLayout(layout);
|
uiDrawFreeTextLayout(layout);
|
||||||
|
|
||||||
|
@ -69,6 +75,11 @@ static void onFontChanged(uiFontButton *b, void *data)
|
||||||
uiAreaQueueRedrawAll(textArea);
|
uiAreaQueueRedrawAll(textArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void onColorChanged(uiColorButton *b, void *data)
|
||||||
|
{
|
||||||
|
uiAreaQueueRedrawAll(textArea);
|
||||||
|
}
|
||||||
|
|
||||||
static void onTextApply(uiButton *b, void *data)
|
static void onTextApply(uiButton *b, void *data)
|
||||||
{
|
{
|
||||||
uiAreaQueueRedrawAll(textArea);
|
uiAreaQueueRedrawAll(textArea);
|
||||||
|
@ -95,6 +106,10 @@ uiBox *makePage10(void)
|
||||||
uiFontButtonOnChanged(textFontButton, onFontChanged, NULL);
|
uiFontButtonOnChanged(textFontButton, onFontChanged, NULL);
|
||||||
uiBoxAppend(hbox, uiControl(textFontButton), 1);
|
uiBoxAppend(hbox, uiControl(textFontButton), 1);
|
||||||
|
|
||||||
|
textColorButton = uiNewColorButton();
|
||||||
|
uiColorButtonOnChanged(textColorButton, onColorChanged, NULL);
|
||||||
|
uiBoxAppend(hbox, uiControl(textColorButton), 1);
|
||||||
|
|
||||||
hbox = newHorizontalBox();
|
hbox = newHorizontalBox();
|
||||||
uiBoxAppend(vbox, uiControl(hbox), 0);
|
uiBoxAppend(vbox, uiControl(hbox), 0);
|
||||||
|
|
||||||
|
@ -122,6 +137,7 @@ uiBox *makePage10(void)
|
||||||
hbox = newHorizontalBox();
|
hbox = newHorizontalBox();
|
||||||
uiBoxAppend(vbox, uiControl(hbox), 0);
|
uiBoxAppend(vbox, uiControl(hbox), 0);
|
||||||
uiBoxAppend(hbox, uiControl(uiNewFontButton()), 1);
|
uiBoxAppend(hbox, uiControl(uiNewFontButton()), 1);
|
||||||
|
uiBoxAppend(hbox, uiControl(uiNewColorButton()), 1);
|
||||||
|
|
||||||
return page10;
|
return page10;
|
||||||
}
|
}
|
||||||
|
|
7
ui.h
7
ui.h
|
@ -590,6 +590,13 @@ _UI_EXTERN uiDrawTextFont *uiFontButtonFont(uiFontButton *b);
|
||||||
_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data);
|
_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data);
|
||||||
_UI_EXTERN uiFontButton *uiNewFontButton(void);
|
_UI_EXTERN uiFontButton *uiNewFontButton(void);
|
||||||
|
|
||||||
|
typedef struct uiColorButton uiColorButton;
|
||||||
|
#define uiColorButton(this) ((uiColorButton *) (this))
|
||||||
|
_UI_EXTERN void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a);
|
||||||
|
_UI_EXTERN void uiColorButtonSetColor(uiColorButton *b, double r, double g, double b, double a);
|
||||||
|
_UI_EXTERN void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data);
|
||||||
|
_UI_EXTERN uiColorButton *uiNewColorButton(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue