Skip to content

Commit

Permalink
core: more methods mapped
Browse files Browse the repository at this point in the history
  • Loading branch information
swistakm committed Nov 4, 2016
1 parent dc41654 commit 7b3271b
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![completion](https://img.shields.io/badge/completion-36%25%20%28128%20of%20347%29-blue.svg)](https://github.com/swistakm/pyimgui)
[![completion](https://img.shields.io/badge/completion-34%25%20%28134%20of%20390%29-blue.svg)](https://github.com/swistakm/pyimgui)

Builds:
* [![Build status](https://ci.appveyor.com/api/projects/status/s7pud6on7dww89iv?svg=true)](https://ci.appveyor.com/project/swistakm/pyimgui) (Windows)
Expand Down
37 changes: 37 additions & 0 deletions imgui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,40 @@
if hasattr(core, 'STYLE_BUTTON_TEXT_ALIGN'):
#: associated type: flags ImGuiAlign_*
STYLE_BUTTON_TEXT_ALIGN = core.STYLE_BUTTON_TEXT_ALIGN

#: Disable title-bar
WINDOW_NO_TITLE_BAR = core.WINDOW_NO_TITLE_BAR
#: Disable user resizing with the lower-right grip
WINDOW_NO_RESIZE = core.WINDOW_NO_RESIZE
#: Disable user moving the window
WINDOW_NO_MOVE = core.WINDOW_NO_MOVE
#: Disable scrollbars (window can still scroll with mouse or programatically)
WINDOW_NO_SCROLLBAR = core.WINDOW_NO_SCROLLBAR
#: Disable user vertically scrolling with mouse wheel
WINDOW_NO_SCROLL_WITH_MOUSE = core.WINDOW_NO_SCROLL_WITH_MOUSE
#: Disable user collapsing window by double-clicking on it
WINDOW_NO_COLLAPSE = core.WINDOW_NO_COLLAPSE
#: Resize every window to its content every frame
WINDOW_ALWAYS_AUTO_RESIZE = core.WINDOW_ALWAYS_AUTO_RESIZE
#: Show borders around windows and items
WINDOW_SHOW_BORDERS = core.WINDOW_SHOW_BORDERS
#: Never load/save settings in .ini file
WINDOW_NO_SAVED_SETTINGS = core.WINDOW_NO_SAVED_SETTINGS
#: Disable catching mouse or keyboard inputs
WINDOW_NO_INPUTS = core.WINDOW_NO_INPUTS
#: Has a menu-bar
WINDOW_MENU_BAR = core.WINDOW_MENU_BAR
#: Allow horizontal scrollbar to appear (off by default)
WINDOW_HORIZONTAL_SCROLLING_BAR = core.WINDOW_HORIZONTAL_SCROLLING_BAR
#: Disable taking focus when transitioning from hidden to visible state
WINDOW_NO_FOCUS_ON_APPEARING = core.WINDOW_NO_FOCUS_ON_APPEARING
#: Disable bringing window to front when taking focus (e.g. clicking on it or
#: programatically giving it focus)
WINDOW_NO_BRING_TO_FRONT_ON_FOCUS = core.WINDOW_NO_BRING_TO_FRONT_ON_FOCUS
#: Always show vertical scrollbar (even if ContentSize.y < Size.y)
WINDOW_ALWAYS_VERTICAL_SCROLLBAR = core.WINDOW_ALWAYS_VERTICAL_SCROLLBAR
#: Always show horizontal scrollbar (even if ContentSize.x < Size.x)
WINDOW_ALWAYS_HORIZONTAL_SCROLLBAR = core.WINDOW_ALWAYS_HORIZONTAL_SCROLLBAR
#: Ensure child windows without border uses style.WindowPadding (ignored by
#: default for non-bordered child windows, because more convenient)
WINDOW_ALWAYS_USE_WINDOW_PADDING = core.WINDOW_ALWAYS_USE_WINDOW_PADDING
172 changes: 118 additions & 54 deletions imgui/cimgui.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -242,66 +242,56 @@ cdef extern from "imgui.h":
pass

cdef extern from "imgui.h" namespace "ImGui":

# ====
# Main
ImGuiIO& GetIO() #
ImGuiStyle& GetStyle() #
ImDrawData* GetDrawData() #
ImDrawData* GetDrawData() #
void NewFrame() #

# note: Render runs callbacks that may be arbitrary Python code
# so we need to propagate exceptions from them
void Render() except + #

void Shutdown() #
void ShowUserGuide() #

void ShowStyleEditor(ImGuiStyle*) #
void ShowStyleEditor() #

void ShowTestWindow(bool*) #
void ShowTestWindow() #

void ShowMetricsWindow(bool*) #
void ShowMetricsWindow() #

# ====
# Window
bool Begin(const char*, bool*, ImGuiWindowFlags) #
bool Begin(const char*, bool*) #
bool Begin(const char*) #

# note: following API was deprecated
# bool Begin(const char*, bool*, const ImVec2&, float, ImGuiWindowFlags) # ✗
# bool Begin(const char*, bool*, const ImVec2&, float) # ✗
# bool Begin(const char*, bool*, const ImVec2&) # ✗

void End() #

bool BeginChild(const char*, const ImVec2&, bool, ImGuiWindowFlags) #
bool BeginChild(const char*, const ImVec2&, bool, ImGuiWindowFlags) #
bool BeginChild(const char*, const ImVec2&, bool) #
bool BeginChild(const char*, const ImVec2&) #
bool BeginChild(const char*) #

bool BeginChild(ImGuiID, const ImVec2&, bool, ImGuiWindowFlags) #
bool BeginChild(ImGuiID, const ImVec2&, bool, ImGuiWindowFlags) #
bool BeginChild(ImGuiID, const ImVec2&, bool) #
bool BeginChild(ImGuiID, const ImVec2&) #
bool BeginChild(ImGuiID) #

void EndChild() #

ImVec2 GetContentRegionMax() #
ImVec2 GetContentRegionAvail() #
float GetContentRegionAvailWidth() #
ImVec2 GetWindowContentRegionMin() #
ImVec2 GetWindowContentRegionMax() #
float GetWindowContentRegionWidth() #
ImDrawList* GetWindowDrawList() #
ImVec2 GetContentRegionMax() #
ImVec2 GetContentRegionAvail() #
float GetContentRegionAvailWidth() #
ImVec2 GetWindowContentRegionMin() #
ImVec2 GetWindowContentRegionMax() #
float GetWindowContentRegionWidth() #
ImDrawList* GetWindowDrawList() #
ImVec2 GetWindowPos() #
ImVec2 GetWindowSize() #
float GetWindowWidth() #
float GetWindowHeight() #
bool IsWindowCollapsed() #
void SetWindowFontScale(float scale) #
bool IsWindowCollapsed() #
void SetWindowFontScale(float scale) #

void SetNextWindowPos( # ✓ note: overrides ommited
const ImVec2& pos,
Expand All @@ -317,17 +307,14 @@ cdef extern from "imgui.h" namespace "ImGui":
# note: optional
ImGuiSetCond cond
)

# void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback, void* custom_callback_data) # ✗

void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback, void* custom_callback_data) #
void SetNextWindowContentSize(const ImVec2& size) #
void SetNextWindowContentWidth(float width) #
void SetNextWindowCollapsed( #
bool collapsed,
# note: optional
ImGuiSetCond cond
)

void SetNextWindowFocus() #
void SetWindowPos( #
const ImVec2& pos,
Expand Down Expand Up @@ -361,13 +348,109 @@ cdef extern from "imgui.h" namespace "ImGui":
)
void SetWindowFocus(const char* name) #

void SetWindowFontScale(float) #
ImVec2 GetWindowPos() #
ImVec2 GetWindowSize() #
float GetWindowWidth() #
float GetWindowHeight() #
bool IsWindowCollapsed() #
float setScrollX() #
float setScrollY() #
float setScrollMaxX() #
float setScrollMaxY() #
void getScrollX(float scroll_x) #
void getScrollY(float scroll_y) #
void getScrollHere( #
# note: optional
float center_y_ratio
)
void getScrollFromPosY( #
float pos_y,
# note: optional
float center_y_ratio
)
void getKeyboardFocusHere( #
# note: optional
int offset
)
void getStateStorage(ImGuiStorage* tree) #
ImGuiStorage* GetStateStorage() #

# ====
# Parameters stacks (shared)
void PushFont(ImFont*) #
void PopFont() #
void PushStyleColor(ImGuiCol, const ImVec4&) #
void PopStyleColor(int) #
void PushStyleVar(ImGuiStyleVar, float) except + #
void PushStyleVar(ImGuiStyleVar, const ImVec2&) except + #
void PopStyleVar(int) except + #
ImFont* GetFont() #
float GetFontSize() #
ImVec2 GetFontTexUvWhitePixel() #
ImU32 GetColorU32(ImGuiCol, float) #
ImU32 GetColorU32(const ImVec4& col) #

# ====
# Cursor / Layout
void Separator() #
void SameLine( #
# note: optional
float pos_x, float spacing_w)
void NewLine() #
void Spacing() #
void Dummy(const ImVec2& size) #
void Indent( #
# note: optional
float indent_w
)
void Unindent( #
# note: optional
float indent_w
)
void BeginGroup() #
void EndGroup() #
ImVec2 GetCursorPos() #
float GetCursorPosX() #
float GetCursorPosY() #
void SetCursorPos(const ImVec2& local_pos) #
void SetCursorPosX(float x) #
void SetCursorPosY(float y) #
ImVec2 GetCursorStartPos() #
ImVec2 GetCursorScreenPos() #
void SetCursorScreenPos(const ImVec2& pos) #
void AlignFirstTextHeightToWidgets() #
float GetTextLineHeight() #
float GetTextLineHeightWithSpacing() #
float GetItemsLineHeightWithSpacing() #

# ====
# Columns
void Columns( #
# note: optional
int count, const char* id, bool border
)
void NextColumn() #
int GetColumnIndex() #
float GetColumnOffset( #
# note: optional
int column_index
)
void SetColumnOffset(int column_index, float offset_x) #
float GetColumnWidth( #
# note: optional
int column_index
)
int GetColumnsCount() #

# ====
# ID scopes
void PushID(const char* str_id) #
void PushID(const char* str_id_begin, const char* str_id_end) #
void PushID(const void* ptr_id) #
void PushID(int int_id) #
void PopID() #
ImGuiID GetID(const char* str_id) #
ImGuiID GetID(const char* str_id_begin, const char* str_id_end) #
ImGuiID GetID(const void* ptr_id) #



# ====
# Widgets
# Widgets: text
void Text(const char*) #
Expand Down Expand Up @@ -919,6 +1002,7 @@ cdef extern from "imgui.h" namespace "ImGui":
bool capture
)

# ====
# Helpers functions to access functions pointers in ImGui::GetIO()
# void* MemAlloc(size_t sz)
# void MemFree(void* ptr)
Expand All @@ -934,23 +1018,3 @@ cdef extern from "imgui.h" namespace "ImGui":
void DestroyContext(ImGuiContext* ctx) #
ImGuiContext* GetCurrentContext() #
void SetCurrentContext(ImGuiContext* ctx) #

# Parameters stacks (shared)
void PushFont(ImFont*) #
void PopFont() #

void PushStyleColor(ImGuiCol, const ImVec4&) #
void PopStyleColor(int) #

void PushStyleVar(ImGuiStyleVar, float) except + #
void PushStyleVar(ImGuiStyleVar, const ImVec2&) except + #

void PopStyleVar(int) except + #

ImFont* GetFont() #
float GetFontSize() #

ImVec2 GetFontTexUvWhitePixel() #

ImU32 GetColorU32(ImGuiCol, float) #
ImU32 GetColorU32(const ImVec4& col) #

0 comments on commit 7b3271b

Please sign in to comment.