refactor: try table for buttons
This commit is contained in:
parent
8eed38b67f
commit
da918e4bf4
|
@ -109,23 +109,37 @@ internal class QuestionsTab {
|
|||
}
|
||||
}
|
||||
|
||||
// page buttons
|
||||
using (ImGuiHelper.WithDisabled(loading || this.Plugin.Manager.Page == 1)) {
|
||||
if (ImGuiHelper.IconButton(FontAwesomeIcon.ArrowLeft)) {
|
||||
this.Plugin.Manager.Page -= 1;
|
||||
}
|
||||
var heightLeft = ImGui.GetContentRegionAvail().Y;
|
||||
if (heightLeft > 0) {
|
||||
heightLeft -= ImGuiHelpers.GetButtonSize("A").Y;
|
||||
ImGui.Dummy(new Vector2(1, heightLeft));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.BeginTable("##pagination-controls", 3)) {
|
||||
ImGui.TableSetupColumn("##prev", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableSetupColumn("##page", ImGuiTableColumnFlags.WidthFixed);
|
||||
ImGui.TableSetupColumn("##next", ImGuiTableColumnFlags.WidthStretch);
|
||||
|
||||
ImGui.TextUnformatted($"{this.Plugin.Manager.Page:N0}");
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
using (ImGuiHelper.WithDisabled(loading || !this.Plugin.Manager.HasNext)) {
|
||||
if (ImGuiHelper.IconButton(FontAwesomeIcon.ArrowRight)) {
|
||||
this.Plugin.Manager.Page += 1;
|
||||
ImGui.TableNextRow();
|
||||
if (ImGui.TableSetColumnIndex(0)) {
|
||||
using var endDisabled = ImGuiHelper.WithDisabled(loading || this.Plugin.Manager.Page == 1);
|
||||
if (ImGuiHelper.IconButton(FontAwesomeIcon.ArrowLeft)) {
|
||||
this.Plugin.Manager.Page -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.TableSetColumnIndex(1)) {
|
||||
ImGui.TextUnformatted($"{this.Plugin.Manager.Page:N0}");
|
||||
}
|
||||
|
||||
if (ImGui.TableSetColumnIndex(2)) {
|
||||
using var endDisabled = ImGuiHelper.WithDisabled(loading || !this.Plugin.Manager.HasNext);
|
||||
if (ImGuiHelper.IconButton(FontAwesomeIcon.ArrowRight)) {
|
||||
this.Plugin.Manager.Page += 1;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue