Added optional parameter for imguiEndScrollArea().

This commit is contained in:
Dario Manesku 2014-08-11 22:26:29 +01:00
parent 762c423b42
commit 4501e17f4b
2 changed files with 62 additions and 26 deletions

View file

@ -753,7 +753,7 @@ struct Imgui
return m_insideScrollArea; return m_insideScrollArea;
} }
void endScrollArea() void endScrollArea(int32_t _r)
{ {
// Disable scissoring. // Disable scissoring.
m_scissor = UINT16_MAX; m_scissor = UINT16_MAX;
@ -802,22 +802,35 @@ struct Imgui
} }
// BG // BG
if (0 == _r)
{
drawRect( (float)xx
, (float)yy
, (float)width
, (float)height
, imguiRGBA(0, 0, 0, 196)
);
}
else
{
drawRoundedRect( (float)xx drawRoundedRect( (float)xx
, (float)yy , (float)yy
, (float)width , (float)width
, (float)height , (float)height
, (float)width / 2 - 1 , (float)_r
, imguiRGBA(0, 0, 0, 196) , imguiRGBA(0, 0, 0, 196)
); );
}
// Bar // Bar
if (isActive(hid) ) if (isActive(hid) )
{ {
drawRoundedRect( (float)hx if (0 == _r)
{
drawRect( (float)hx
, (float)hy , (float)hy
, (float)hw , (float)hw
, (float)hh , (float)hh
, (float)width / 2 - 1
, imguiRGBA(255, 196, 0, 196) , imguiRGBA(255, 196, 0, 196)
); );
} }
@ -827,10 +840,33 @@ struct Imgui
, (float)hy , (float)hy
, (float)hw , (float)hw
, (float)hh , (float)hh
, (float)width / 2 - 1 , (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) , 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. // Handle mouse scrolling.
if (m_insideScrollArea) // && !anyActive() ) 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); 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) void imguiIndent(uint16_t _width)

View file

@ -91,7 +91,7 @@ void imguiEndFrame();
bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled = true); 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); 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 imguiIndent(uint16_t _width = 16);
void imguiUnindent(uint16_t _width = 16); void imguiUnindent(uint16_t _width = 16);