mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 06:50:06 +00:00 
			
		
		
		
	Wrap hover text, default to 80 characters
This commit is contained in:
		
							parent
							
								
									24c919afb6
								
							
						
					
					
						commit
						23732cef48
					
				
					 7 changed files with 21 additions and 2 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
								
							|  | @ -34,3 +34,6 @@ | |||
| [submodule "external/units"] | ||||
| 	path = external/units | ||||
| 	url = https://github.com/nholthaus/units.git | ||||
| [submodule "external/textflowcpp"] | ||||
| 	path = external/textflowcpp | ||||
| 	url = https://github.com/catchorg/textflowcpp.git | ||||
|  |  | |||
|  | @ -36,6 +36,8 @@ Supercell Wx uses code from the following dependencies: | |||
| | [spdlog](https://github.com/gabime/spdlog) | [MIT License](https://spdx.org/licenses/MIT.html) | | ||||
| | [SQLite](https://www.sqlite.org/) | Public Domain | | ||||
| | [stb](https://github.com/nothings/stb) | Public Domain | | ||||
| | [TextFlowCpp](https://github.com/catchorg/textflowcpp) | [Boost Software License 1.0](https://spdx.org/licenses/BSL-1.0.html) | | ||||
| | [Units](https://github.com/nholthaus/units) | [MIT License](https://spdx.org/licenses/MIT.html) | | ||||
| | [Vulkan SDK](https://www.vulkan.org/) | [Apache License 2.0](https://spdx.org/licenses/Apache-2.0.html) | | ||||
| | [zlib](https://zlib.net/) | [zlib License](https://spdx.org/licenses/Zlib.html) | | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										2
									
								
								external/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								external/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							|  | @ -11,6 +11,7 @@ set_property(DIRECTORY | |||
|              imgui.cmake | ||||
|              mapbox-gl-native.cmake | ||||
|              stb.cmake | ||||
|              textflowcpp.cmake | ||||
|              units.cmake) | ||||
| 
 | ||||
| include(aws-sdk-cpp.cmake) | ||||
|  | @ -20,4 +21,5 @@ include(hsluv-c.cmake) | |||
| include(imgui.cmake) | ||||
| include(mapbox-gl-native.cmake) | ||||
| include(stb.cmake) | ||||
| include(textflowcpp.cmake) | ||||
| include(units.cmake) | ||||
|  |  | |||
							
								
								
									
										1
									
								
								external/textflowcpp
									
										
									
									
										vendored
									
									
										Submodule
									
								
							
							
						
						
									
										1
									
								
								external/textflowcpp
									
										
									
									
										vendored
									
									
										Submodule
									
								
							|  | @ -0,0 +1 @@ | |||
| Subproject commit 12010ddc8d15538ceea20622d22977e7c5a25da5 | ||||
							
								
								
									
										4
									
								
								external/textflowcpp.cmake
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								external/textflowcpp.cmake
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| cmake_minimum_required(VERSION 3.20) | ||||
| set(PROJECT_NAME scwx-textflowcpp) | ||||
| 
 | ||||
| set(TEXTFLOWCPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/textflowcpp PARENT_SCOPE) | ||||
|  | @ -418,7 +418,8 @@ target_include_directories(scwx-qt PUBLIC ${scwx-qt_SOURCE_DIR}/source | |||
|                                           ${FTGL_INCLUDE_DIR} | ||||
|                                           ${IMGUI_INCLUDE_DIRS} | ||||
|                                           ${MBGL_INCLUDE_DIR} | ||||
|                                           ${STB_INCLUDE_DIR}) | ||||
|                                           ${STB_INCLUDE_DIR} | ||||
|                                           ${TEXTFLOWCPP_INCLUDE_DIR}) | ||||
| 
 | ||||
| target_include_directories(supercell-wx PUBLIC ${scwx-qt_SOURCE_DIR}/source) | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| 
 | ||||
| #include <mutex> | ||||
| 
 | ||||
| #include <TextFlow.hpp> | ||||
| #include <imgui.h> | ||||
| 
 | ||||
| namespace scwx | ||||
|  | @ -85,11 +86,16 @@ void ImGui::Impl::UpdateMonospaceFont() | |||
| 
 | ||||
| void ImGui::DrawTooltip(const std::string& hoverText) | ||||
| { | ||||
|    static constexpr std::size_t kDefaultWidth = 80u; | ||||
| 
 | ||||
|    p->Initialize(); | ||||
| 
 | ||||
|    auto wrappedText = | ||||
|       TextFlow::Column(hoverText).width(kDefaultWidth).toString(); | ||||
| 
 | ||||
|    ::ImGui::BeginTooltip(); | ||||
|    ::ImGui::PushFont(p->monospaceFont_); | ||||
|    ::ImGui::TextUnformatted(hoverText.c_str()); | ||||
|    ::ImGui::TextUnformatted(wrappedText.c_str()); | ||||
|    ::ImGui::PopFont(); | ||||
|    ::ImGui::EndTooltip(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat