Skip to content

Commit bf78d2d

Browse files
committed
- added TabBarPool::indices
- adding support for Flag parsing in `bulletText` - fixed missing spread operator in `treeNodeEx` - removed legacy code from `TableSortSpecs` - removed misplaced `treePop` - fixed `radioButton` label casing
1 parent 439e9d6 commit bf78d2d

File tree

7 files changed

+8
-11
lines changed

7 files changed

+8
-11
lines changed

core/src/main/kotlin/imgui/api/demoDebugInformations.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,8 @@ interface demoDebugInformations {
338338

339339
// Details for TabBars
340340
treeNode("TabBars", "Tab Bars (${g.tabBars.size})") {
341-
for (n in 0 until g.tabBars.size)
341+
for (n in g.tabBars.indices)
342342
debugNodeTabBar(g.tabBars[n]!!, "TabBar")
343-
344343
}
345344

346345
treeNode("Tables", "Tables (${g.tables.size})") {

core/src/main/kotlin/imgui/api/widgetsText.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import glm_.max
44
import glm_.vec2.Vec2
55
import glm_.vec4.Vec4
66
import imgui.Col
7+
import imgui.Flag
78
import imgui.ImGui.calcItemWidth
89
import imgui.ImGui.calcTextSize
910
import imgui.ImGui.currentWindow
@@ -111,7 +112,7 @@ interface widgetsText {
111112
if (window.skipItems)
112113
return
113114

114-
val text = fmt.format(style.locale, *args)
115+
val text = fmt.format(style.locale, *args.map { if (it is Flag<*>) it.i else it }.toTypedArray())
115116
val labelSize = calcTextSize(text, hideTextAfterDoubleHash = false)
116117
val totalSize = Vec2(g.fontSize + if (labelSize.x > 0f) (labelSize.x + style.framePadding.x * 2) else 0f, labelSize.y) // Empty text doesn't add padding
117118
val pos = Vec2(window.dc.cursorPos)

core/src/main/kotlin/imgui/api/widgetsTrees.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ interface widgetsTrees {
5858
val window = currentWindow
5959
if (window.skipItems) return false
6060

61-
val labelEnd = formatStringToTempBuffer(fmt, args)
61+
val labelEnd = formatStringToTempBuffer(fmt, *args)
6262
return treeNodeBehavior(window.getID(strID), flags, g.tempBuffer, labelEnd)
6363
}
6464

core/src/main/kotlin/imgui/classes/misc.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ class TableColumnSortSpecs {
131131
class TableSortSpecs {
132132
/** Pointer to sort spec array. */
133133
var specs = ArrayList<TableColumnSortSpecs>()
134-
fun specs(n: Int) = specsArray[specsPtr + n]
135-
lateinit var specsArray: Array<TableColumnSortSpecs>
136-
var specsPtr = 0
137134

138135
/** Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled. */
139136
var specsCount = 0

core/src/main/kotlin/imgui/demo/ShowDemoWindowTables.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ object ShowDemoWindowTables {
203203
for (n in 0 until currentSortSpecs!!.specsCount) {
204204
// Here we identify columns using the ColumnUserID value that we ourselves passed to TableSetupColumn()
205205
// We could also choose to identify columns based on their index (sort_spec->ColumnIndex), which is simpler!
206-
val sortSpec = currentSortSpecs!!.specs(n)
206+
val sortSpec = currentSortSpecs!!.specs[n]
207207
val delta = when (sortSpec.columnUserID) {
208208
MyItemColumnID.ID.ordinal -> a.id - b.id
209209
MyItemColumnID.Name.ordinal -> a.name.compareTo(b.name)
@@ -1798,7 +1798,6 @@ object ShowDemoWindowTables {
17981798
text(": DrawCmd: +${tableDrawListDrawCmdCount - 1} (in child window), Scroll: (%.f/%.f) (%.f/%.f)",
17991799
tableScrollCur.x, tableScrollMax.x, tableScrollCur.y, tableScrollMax.y)
18001800
}
1801-
treePop()
18021801
}
18031802
}
18041803
}

core/src/main/kotlin/imgui/internal/api/color.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ internal interface color {
8484
if (allowOptInputs) {
8585
if (radioButton("RGB", opts has Cef.DisplayRGB)) opts = (opts wo Cef._DisplayMask) or Cef.DisplayRGB
8686
if (radioButton("HSV", opts has Cef.DisplayHSV)) opts = (opts wo Cef._DisplayMask) or Cef.DisplayHSV
87-
if (radioButton("HEX", opts has Cef.DisplayHEX)) opts = (opts wo Cef._DisplayMask) or Cef.DisplayHEX
87+
if (radioButton("Hex", opts has Cef.DisplayHEX)) opts = (opts wo Cef._DisplayMask) or Cef.DisplayHEX
8888
}
8989
if (allowOptDatatype) {
9090
if (allowOptInputs) separator()

core/src/main/kotlin/imgui/internal/classes/misc.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,14 @@ value class PoolIdx(val i: Int) {
557557
}
558558

559559
class TabBarPool {
560+
val indices get() = list.indices
560561
/** Contiguous data */
561562
val list = ArrayList<TabBar?>()
562563

563564
/** ID->Index */
564565
val map = mutableMapOf<ID, PoolIdx>()
565566

566-
/** ~GetByKey */
567+
/** ~GetByKey/~TryGetMapData */
567568
operator fun get(key: ID): TabBar? = map[key]?.let { list[it.i] }
568569

569570
/** ~GetByIndex */

0 commit comments

Comments
 (0)