Git Product home page Git Product logo

Comments (2)

pthom avatar pthom commented on June 26, 2024 1

Hello,

This is actually a good idea. I just added this feature.

See f5c6f82 (inside Hello ImGui)

And pthom/imgui_bundle@90298ce (inside ImGui Bundle)

image

from hello_imgui.

colesnicov avatar colesnicov commented on June 26, 2024

I modified part of the code from imgui demo.cpp.
Specifically from the 'Style Editor':

static void Push(ImGuiStyle *_style_from) {
//	Main
	ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, _style_from->WindowPadding);
	ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, _style_from->FramePadding);
	ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, _style_from->ItemSpacing);
	ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, _style_from->ItemInnerSpacing);
	ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, _style_from->IndentSpacing);
	ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, _style_from->ScrollbarSize);
	ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, _style_from->GrabMinSize);
//	Borders
	ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, _style_from->WindowBorderSize);
	ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, _style_from->ChildBorderSize);
	ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, _style_from->PopupBorderSize);
	ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, _style_from->FrameBorderSize);
	ImGui::PushStyleVar(ImGuiStyleVar_TabBorderSize, _style_from->TabBorderSize);
	ImGui::PushStyleVar(ImGuiStyleVar_TabBarBorderSize, _style_from->TabBarBorderSize);
//	Rounding
	ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, _style_from->WindowRounding);
	ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, _style_from->ChildRounding);
	ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, _style_from->FrameRounding);
	ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, _style_from->PopupRounding);
	ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarRounding, _style_from->ScrollbarRounding);
	ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, _style_from->GrabRounding);
	ImGui::PushStyleVar(ImGuiStyleVar_TabRounding, _style_from->TabRounding);
//	Tables
	ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, _style_from->CellPadding);
	ImGui::PushStyleVar(ImGuiStyleVar_TableAngledHeadersAngle,
			_style_from->TableAngledHeadersAngle);
//	Widgets
	ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, _style_from->WindowTitleAlign);
	ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, _style_from->ButtonTextAlign);
	ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, _style_from->SelectableTextAlign);
	ImGui::PushStyleVar(ImGuiStyleVar_SeparatorTextBorderSize,
			_style_from->SeparatorTextBorderSize);
	ImGui::PushStyleVar(ImGuiStyleVar_SeparatorTextAlign, _style_from->SeparatorTextAlign);
	ImGui::PushStyleVar(ImGuiStyleVar_SeparatorTextPadding, _style_from->SeparatorTextPadding);

//	Rendering
	ImGui::PushStyleVar(ImGuiStyleVar_Alpha, _style_from->Alpha);
	ImGui::PushStyleVar(ImGuiStyleVar_DisabledAlpha, _style_from->DisabledAlpha);

	//	Colors
	for (int i = 0; i < ImGuiCol_COUNT; i++) {
		ImGui::PushStyleColor(i, _style_from->Colors[i]);
	}
}

and

void Pop() {
	ImGui::PopStyleVar(ImGuiStyleVar_COUNT - 2);
	ImGui::PopStyleColor(ImGuiCol_COUNT);
}

Not all variables are set, some are global to the entire application. For example ImGuiStyleVar_TaouchExtraPadding and ImGuiStyleVar_AntiAliasedLines or Docking...

from hello_imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.