Selectable: add support for specifying text alignment on selectables (#2347)
Adds a style variable to Selectable that allows clients to specify the
text alignment within Selectables, adds a section in the demo to
demonstrate selectable text alignment, and a pair of sliders in the
style editor to change selectable alignment on the fly.

In terms of implementation, this one is extremely simple: Selectable was
already calling an API that supports text alignment, but had hard-coded
it to top-left. This changes that to just pass the style variable
straight through to RenderTextClipped. Backwards-compatibility is
preserved by defaulting the text_align parameter to (0, 0), i.e.,
top-left.

This also fixes a bug with selectable text rendering that caused
right-aligned text in a selectable to be clipped incorrectly, because
the wrong clipping rectangle was being used.
1 parent 93d1179 commit b277cfffc846976f15579ec5cca20cce3d76e6db
@haldean haldean authored on 13 Feb 2019
omar committed on 14 Feb 2019
Showing 4 changed files
View
imgui.cpp
View
imgui.h
View
imgui_demo.cpp
View
imgui_widgets.cpp