Added optional _r (corner radius) parameter for imguiBeginScrollArea().

This commit is contained in:
Dario Manesku 2014-08-11 10:59:49 +01:00
parent a7cc06499b
commit 6388d1a657
2 changed files with 23 additions and 11 deletions

View file

@ -670,7 +670,7 @@ struct Imgui
nvgEndFrame(m_nvg); nvgEndFrame(m_nvg);
} }
bool beginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, int32_t* _scroll, bool _enabled) bool beginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, int32_t* _scroll, int32_t _r, bool _enabled)
{ {
m_areaId++; m_areaId++;
m_widgetId = 0; m_widgetId = 0;
@ -681,13 +681,25 @@ struct Imgui
setEnabled(m_areaId); setEnabled(m_areaId);
} }
drawRoundedRect( (float)_x if (0 == _r)
, (float)_y {
, (float)_width drawRect( (float)_x
, (float)_height , (float)_y
, 6 , (float)_width
, imguiRGBA(0, 0, 0, 192) , (float)_height + 0.3f /*border fix for seamlessly joining two scroll areas*/
); , imguiRGBA(0, 0, 0, 192)
);
}
else
{
drawRoundedRect( (float)_x
, (float)_y
, (float)_width
, (float)_height
, (float)_r
, imguiRGBA(0, 0, 0, 192)
);
}
const bool hasTitle = (NULL != _name && '\0' != _name[0]); const bool hasTitle = (NULL != _name && '\0' != _name[0]);
@ -2433,9 +2445,9 @@ bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled)
return s_imgui.borderButton(_border, _checked, _enabled); return s_imgui.borderButton(_border, _checked, _enabled);
} }
bool imguiBeginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, int32_t* _scroll, bool _enabled) bool imguiBeginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, int32_t* _scroll, int32_t _r, bool _enabled)
{ {
return s_imgui.beginScrollArea(_name, _x, _y, _width, _height, _scroll, _enabled); return s_imgui.beginScrollArea(_name, _x, _y, _width, _height, _scroll, _r, _enabled);
} }
void imguiEndScrollArea() void imguiEndScrollArea()

View file

@ -90,7 +90,7 @@ void imguiEndFrame();
/// Notice: this function is not to be called between imguiBeginScrollArea() and imguiEndScrollArea(). /// Notice: this function is not to be called between imguiBeginScrollArea() and imguiEndScrollArea().
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); bool imguiBeginScrollArea(const char* _name, int _x, int _y, int _width, int _height, int* _scroll, int32_t _r = 6, bool _enabled = true);
void imguiEndScrollArea(); void imguiEndScrollArea();
void imguiIndent(uint16_t _width = 16); void imguiIndent(uint16_t _width = 16);