Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2020-03-14 21:05:09 +0300
committerHarley Acheson <harley.acheson@gmail.com>2020-03-14 21:05:09 +0300
commita210b8297f5afe6eaf2d001e57c1e8b7e8429c52 (patch)
treeb7760da467e778d34768183ea99cce590acbedd0 /source/blender/editors/interface/interface.c
parenta816a067ede6c8df3fc3a32bba2370a0ef179061 (diff)
UI: Larger Alert Icons
Adding a set of larger icons for use in informational dialogs. Differential Revision: https://developer.blender.org/D6859 Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index a0a3d0a3b85..b5fce7ea99f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -4439,6 +4439,48 @@ uiBut *uiDefBut(uiBlock *block,
return but;
}
+uiBut *uiDefButImage(
+ uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4])
+{
+ uiBut *but = ui_def_but(
+ block, UI_BTYPE_IMAGE, 0, "", x, y, width, height, imbuf, 0, 0, 0, 0, "");
+ if (color) {
+ copy_v4_v4_uchar(but->col, color);
+ }
+ else {
+ but->col[0] = 255;
+ but->col[1] = 255;
+ but->col[2] = 255;
+ but->col[3] = 255;
+ }
+ ui_but_update(but);
+ return but;
+}
+
+uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height)
+{
+ struct ImBuf *ibuf = UI_alert_image(icon);
+
+ if (icon == ALERT_ICON_BLENDER) {
+ return uiDefButImage(block, ibuf, x, y, width, height, NULL);
+ }
+ else {
+ uchar icon_color[4];
+ ThemeColorID color_id = TH_INFO_WARNING;
+ if (icon == ALERT_ICON_ERROR) {
+ color_id = TH_INFO_ERROR;
+ }
+ else if (icon == ALERT_ICON_INFO) {
+ color_id = TH_INFO_INFO;
+ }
+ else if (icon == ALERT_ICON_QUESTION) {
+ color_id = TH_INFO_PROPERTY;
+ }
+ UI_GetThemeColorType4ubv(color_id, SPACE_INFO, icon_color);
+ return uiDefButImage(block, ibuf, x, y, width, height, icon_color);
+ }
+}
+
/**
* if \a _x_ is a power of two (only one bit) return the power,
* otherwise return -1.