From 4501e17f4b65be9ded63fa91146d86795970e145 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Mon, 11 Aug 2014 22:26:29 +0100 Subject: [PATCH] Added optional parameter for imguiEndScrollArea(). --- examples/common/imgui/imgui.cpp | 86 +++++++++++++++++++++++---------- examples/common/imgui/imgui.h | 2 +- 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index e4eaea6e..b0036d45 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -753,7 +753,7 @@ struct Imgui return m_insideScrollArea; } - void endScrollArea() + void endScrollArea(int32_t _r) { // Disable scissoring. m_scissor = UINT16_MAX; @@ -802,36 +802,72 @@ struct Imgui } // BG - drawRoundedRect( (float)xx - , (float)yy - , (float)width - , (float)height - , (float)width / 2 - 1 - , imguiRGBA(0, 0, 0, 196) - ); - - // Bar - if (isActive(hid) ) + if (0 == _r) { - drawRoundedRect( (float)hx - , (float)hy - , (float)hw - , (float)hh - , (float)width / 2 - 1 - , imguiRGBA(255, 196, 0, 196) + drawRect( (float)xx + , (float)yy + , (float)width + , (float)height + , imguiRGBA(0, 0, 0, 196) ); } else { - drawRoundedRect( (float)hx - , (float)hy - , (float)hw - , (float)hh - , (float)width / 2 - 1 - , isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64) + drawRoundedRect( (float)xx + , (float)yy + , (float)width + , (float)height + , (float)_r + , imguiRGBA(0, 0, 0, 196) ); } + // Bar + if (isActive(hid) ) + { + if (0 == _r) + { + drawRect( (float)hx + , (float)hy + , (float)hw + , (float)hh + , imguiRGBA(255, 196, 0, 196) + ); + } + else + { + drawRoundedRect( (float)hx + , (float)hy + , (float)hw + , (float)hh + , (float)_r + , imguiRGBA(255, 196, 0, 196) + ); + } + } + else + { + if (0 == _r) + { + drawRect( (float)hx + , (float)hy + , (float)hw + , (float)hh + , isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64) + ); + } + else + { + drawRoundedRect( (float)hx + , (float)hy + , (float)hw + , (float)hh + , (float)_r + , isHot(hid) ? imguiRGBA(255, 196, 0, 96) : imguiRGBA(255, 255, 255, 64) + ); + } + } + // Handle mouse scrolling. if (m_insideScrollArea) // && !anyActive() ) { @@ -2485,9 +2521,9 @@ bool imguiBeginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _wi return s_imgui.beginScrollArea(_name, _x, _y, _width, _height, _scroll, _enabled, _r); } -void imguiEndScrollArea() +void imguiEndScrollArea(int32_t _r) { - s_imgui.endScrollArea(); + s_imgui.endScrollArea(_r); } void imguiIndent(uint16_t _width) diff --git a/examples/common/imgui/imgui.h b/examples/common/imgui/imgui.h index 17d0f776..3363e852 100644 --- a/examples/common/imgui/imgui.h +++ b/examples/common/imgui/imgui.h @@ -91,7 +91,7 @@ void imguiEndFrame(); bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled = true); bool imguiBeginScrollArea(const char* _name, int _x, int _y, int _width, int _height, int* _scroll, bool _enabled = true, int32_t _r = 6); -void imguiEndScrollArea(); +void imguiEndScrollArea(int32_t _r = 5); void imguiIndent(uint16_t _width = 16); void imguiUnindent(uint16_t _width = 16);