Skip to content

Commit

Permalink
Add new lib ImCoolbar / Step 1: Reference the new library
Browse files Browse the repository at this point in the history
(was forced to fork the library to fix a missing include)
  • Loading branch information
pthom committed Oct 19, 2023
1 parent a44f76e commit 68e6f3b
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@
[submodule "external/imgui_test_engine/imgui_test_engine"]
path = external/imgui_test_engine/imgui_test_engine
url = https://github.com/pthom/imgui_test_engine.git
[submodule "external/ImCoolBar/ImCoolBar"]
path = external/ImCoolBar/ImCoolBar
url = https://github.com/pthom/ImCoolBar.git
1 change: 1 addition & 0 deletions bindings/imgui_bundle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from imgui_bundle._imgui_bundle import imgui_toggle as imgui_toggle
from imgui_bundle._imgui_bundle import portable_file_dialogs as portable_file_dialogs
from imgui_bundle._imgui_bundle import imgui_command_palette as imgui_command_palette
from imgui_bundle._imgui_bundle import im_cool_bar as im_cool_bar
from imgui_bundle import immapp as immapp
from imgui_bundle.immapp import icons_fontawesome as icons_fontawesome

Expand Down
1 change: 1 addition & 0 deletions bindings/imgui_bundle/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ from . import immapp as immapp
from . import imgui_toggle as imgui_toggle
from . import portable_file_dialogs as portable_file_dialogs
from .immapp import icons_fontawesome as icons_fontawesome
from . import im_cool_bar as im_cool_bar

from . import immapp as immapp

Expand Down
11 changes: 11 additions & 0 deletions bindings/imgui_bundle/im_cool_bar.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""ImCoolbar: A Cool bar for Dear ImGui
Python bindings for https://github.com/aiekick/ImCoolBar
"""

from typing import overload



# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# <litgen_stub> // Autogenerated code below! Do not edit!
# </litgen_stub> // Autogenerated code end!
2 changes: 2 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ target_sources(imgui_tex_inspect PRIVATE
add_library(portable_file_dialogs INTERFACE)
target_include_directories(portable_file_dialogs INTERFACE portable_file_dialogs)
target_link_libraries(imgui_bundle PUBLIC portable_file_dialogs)
# Add ImCoolBar
add_simple_external_library_with_sources(imcoolbar ImCoolBar)

target_include_directories(imgui_tex_inspect PRIVATE imgui_tex_inspect/imgui_tex_inspect)
target_include_directories(imgui_tex_inspect PRIVATE imgui/imgui/backends)
Expand Down
1 change: 1 addition & 0 deletions external/ImCoolBar/ImCoolBar
Submodule ImCoolBar added at 159747
36 changes: 36 additions & 0 deletions external/ImCoolBar/bindings/generate_imcoolbar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Part of ImGui Bundle - MIT License - Copyright (c) 2022-2023 Pascal Thomet - https://github.com/pthom/imgui_bundle
import os

import litgen


THIS_DIR = os.path.dirname(__file__)
PYDEF_DIR = THIS_DIR
STUB_DIR = THIS_DIR + "/../../../bindings/imgui_bundle/"

CPP_HEADERS_DIR = THIS_DIR + "/../ImCoolBar"


def main():
print("autogenerate_imcoolbar")
input_cpp_header = CPP_HEADERS_DIR + "/ImCoolbar.h"
output_cpp_pydef_file = PYDEF_DIR + "/pybind_imcoolbar.cpp"
output_stub_pyi_file = STUB_DIR + "/im_cool_bar.pyi"

# Configure options
options = litgen.LitgenOptions()
# options.namespace_root__regex = "LIBNAME"
# options.fn_params_output_modifiable_immutable_to_return__regex = r".*"
# options.python_run_black_formatter = True

litgen.write_generated_code_for_file(
options,
input_cpp_header_file=input_cpp_header,
output_cpp_pydef_file=output_cpp_pydef_file,
output_stub_pyi_file=output_stub_pyi_file,
omit_boxed_types=True,
)


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions external/ImCoolBar/bindings/im_cool_bar.pyi
27 changes: 27 additions & 0 deletions external/ImCoolBar/bindings/pybind_imcoolbar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Part of ImGui Bundle - MIT License - Copyright (c) 2022-2023 Pascal Thomet - https://github.com/pthom/imgui_bundle
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/functional.h>
#include <pybind11/numpy.h>

#include "ImCoolBar/ImCoolbar.h" // Change this include to the library you are binding

namespace py = pybind11;

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// <litgen_glue_code> // Autogenerated code below! Do not edit!

// </litgen_glue_code> // Autogenerated code end
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE END !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



void py_init_module_imcoolbar(py::module& m)
{
using namespace ImGui;

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// <litgen_pydef> // Autogenerated code below! Do not edit!
// </litgen_pydef> // Autogenerated code end
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE END !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
11 changes: 11 additions & 0 deletions external/bindings_generation/all_external_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ def lib_im_file_dialog() -> ExternalLibrary:
)


def lib_imcoolbar() -> ExternalLibrary:
return ExternalLibrary(
name="ImCoolBar",
official_git_url="https://github.com/aiekick/ImCoolBar.git",
official_branch="master",
fork_git_url="https://github.com/pthom/ImCoolBar.git",
fork_branch="imgui_bundle"
)


def lib_imgui() -> ExternalLibrary:
return ExternalLibrary(
name="imgui",
Expand Down Expand Up @@ -199,6 +209,7 @@ def lib_sdl() -> ExternalLibrary:
lib_imgui_test_engine(),
lib_glfw(),
lib_hello_imgui(),
lib_imcoolbar(),
lib_im_file_dialog(),
lib_imgui_command_palette(),
lib_imgui_knobs(),
Expand Down
1 change: 1 addition & 0 deletions external/bindings_generation/cpp/all_pybind_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(all_pybind_files
${external_dir}/imgui/bindings/pybind_imgui_test_engine.cpp
${external_dir}/imgui/bindings/pybind_imgui_internal.cpp
${external_dir}/hello_imgui/bindings/pybind_hello_imgui.cpp
${external_dir}/ImCoolBar/bindings/pybind_imcoolbar.cpp
${external_dir}/ImFileDialog/bindings/pybind_im_file_dialog.cpp
${external_dir}/imgui-command-palette/bindings/pybind_imgui_command_palette.cpp
${external_dir}/imgui-knobs/bindings/pybind_imgui_knobs.cpp
Expand Down
4 changes: 4 additions & 0 deletions external/bindings_generation/cpp/pybind_imgui_bundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void py_init_module_imgui_toggle(py::module& m);
void py_init_module_portable_file_dialogs(py::module& m);
void py_init_module_imgui_command_palette(py::module& m);
void py_init_module_implot_internal(py::module& m);
void py_init_module_imcoolbar(py::module& m);


void py_init_module_imgui_bundle(py::module& m)
Expand Down Expand Up @@ -95,6 +96,9 @@ void py_init_module_imgui_bundle(py::module& m)

auto module_imgui_command_palette = m.def_submodule("imgui_command_palette");
py_init_module_imgui_command_palette(module_imgui_command_palette);

auto module_imcooolbar = m.def_submodule("im_cool_bar");
py_init_module_imcoolbar(module_imcooolbar);
}


Expand Down

0 comments on commit 68e6f3b

Please sign in to comment.