Skip to content

Commit

Permalink
Added comments on columns function; Added GetColumnIndex(), GetColumn…
Browse files Browse the repository at this point in the history
…sCount(), #154
  • Loading branch information
ocornut committed Mar 7, 2015
1 parent 6db6c0c commit e01500f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 12 additions & 0 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6465,6 +6465,18 @@ void ImGui::NextColumn()
}
}

int ImGui::GetColumnIndex()
{
ImGuiWindow* window = GetCurrentWindow();
return window->DC.ColumnsCurrent;
}

int ImGui::GetColumnsCount()
{
ImGuiWindow* window = GetCurrentWindow();
return window->DC.ColumnsCount;
}

float ImGui::GetColumnOffset(int column_index)
{
ImGuiState& g = *GImGui;
Expand Down
8 changes: 5 additions & 3 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ namespace ImGui
IMGUI_API void Spacing();
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns
IMGUI_API void NextColumn(); // next column
IMGUI_API float GetColumnOffset(int column_index = -1);
IMGUI_API void SetColumnOffset(int column_index, float offset);
IMGUI_API float GetColumnWidth(int column_index = -1);
IMGUI_API int GetColumnIndex(); // get current column index
IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this.
IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column.
IMGUI_API float GetColumnWidth(int column_index = -1); // column width (== GetColumnOffset(GetColumnIndex()+1) - GetColumnOffset(GetColumnOffset())
IMGUI_API int GetColumnsCount(); // number of columns (what was passed to Columns())
IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position
IMGUI_API float GetCursorPosX(); // "
IMGUI_API float GetCursorPosY(); // "
Expand Down

0 comments on commit e01500f

Please sign in to comment.