diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-30 10:03:10 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-30 10:03:10 +0400 |
commit | 3612a8d3d4605cac1988d58b8af561e69f4130ab (patch) | |
tree | d17140e64c962897b50c77d4e52388aa0442f2a1 /source/blender/editors/screen | |
parent | 377d5232d4465ca23b06b6550c78b2fe1a697532 (diff) |
Deduplicate code used for drawing text information at the top of space region.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f7fe98edf02..7aacd9f7b86 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1776,3 +1776,38 @@ int ED_area_headersize(void) { return UI_UNIT_Y+6; } + +void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha) +{ + const int header_height = 18; + uiStyle *style= UI_GetStyle(); + int fontid= style->widget.uifont_id; + rcti rect; + + BLF_size(fontid, 11.0f, 72); + + /* background box */ + rect= ar->winrct; + rect.xmin= 0; + rect.ymin= ar->winrct.ymax - ar->winrct.ymin - header_height; + + if(block) { + rect.xmax= ar->winrct.xmax - ar->winrct.xmin; + } + else { + rect.xmax= rect.xmin + BLF_width(fontid, text) + 24; + } + + rect.ymax= ar->winrct.ymax - ar->winrct.ymin; + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.0f, 0.0f, 0.0f, alpha); + glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1); + glDisable(GL_BLEND); + + /* text */ + UI_ThemeColor(TH_TEXT_HI); + BLF_position(fontid, 12, rect.ymin + 5, 0.0f); + BLF_draw(fontid, text, strlen(text)); +} |