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 uiFontButton *textFontButton;
|
||||
static uiFontButton *textColorButton;
|
||||
static uiEntry *textWidth;
|
||||
static uiButton *textApply;
|
||||
static uiCheckbox *addLeading;
|
||||
|
@ -27,6 +28,7 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp)
|
|||
{
|
||||
uiDrawTextFont *font;
|
||||
uiDrawTextLayout *layout;
|
||||
double, r, g, b, a;
|
||||
|
||||
font = uiFontButtonFont(textFontButton);
|
||||
|
||||
|
@ -37,6 +39,10 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp)
|
|||
uiDrawTextLayoutSetColor(layout,
|
||||
8, 14,
|
||||
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);
|
||||
uiDrawFreeTextLayout(layout);
|
||||
|
||||
|
@ -69,6 +75,11 @@ static void onFontChanged(uiFontButton *b, void *data)
|
|||
uiAreaQueueRedrawAll(textArea);
|
||||
}
|
||||
|
||||
static void onColorChanged(uiColorButton *b, void *data)
|
||||
{
|
||||
uiAreaQueueRedrawAll(textArea);
|
||||
}
|
||||
|
||||
static void onTextApply(uiButton *b, void *data)
|
||||
{
|
||||
uiAreaQueueRedrawAll(textArea);
|
||||
|
@ -95,6 +106,10 @@ uiBox *makePage10(void)
|
|||
uiFontButtonOnChanged(textFontButton, onFontChanged, NULL);
|
||||
uiBoxAppend(hbox, uiControl(textFontButton), 1);
|
||||
|
||||
textColorButton = uiNewColorButton();
|
||||
uiColorButtonOnChanged(textColorButton, onColorChanged, NULL);
|
||||
uiBoxAppend(hbox, uiControl(textColorButton), 1);
|
||||
|
||||
hbox = newHorizontalBox();
|
||||
uiBoxAppend(vbox, uiControl(hbox), 0);
|
||||
|
||||
|
@ -122,6 +137,7 @@ uiBox *makePage10(void)
|
|||
hbox = newHorizontalBox();
|
||||
uiBoxAppend(vbox, uiControl(hbox), 0);
|
||||
uiBoxAppend(hbox, uiControl(uiNewFontButton()), 1);
|
||||
uiBoxAppend(hbox, uiControl(uiNewColorButton()), 1);
|
||||
|
||||
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 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
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue