Comments (3)
I've been shy of adding too many new colors in the style system, while the expectation is that this will be boldly reworked. Admittedly this is a bit of a procrastination tactic at this point.
Hah, alright. Perhaps a version that takes colors as parameters, a la TextColored
, to start? (Though using the standard style system would be better ofc.)
It'd be awkward to implement/demo an "open browser" thing at least in the demo as that's quite OS dependent
A significant number of uses here have nothing to do with browers, but rather just replacing buttons for navigating within the app itself. That is, this is just a differently-styled button.
It certainly would be awesome to have an OpenExternal
kind of thing in imgui, I think that's entirely orthogonal.
A control that's actually built around opening links in browsers is slightly different in other ways. It needs both URL and optional label parameters. It needs default behaviours to show the URL in a tooltip (assuming the label is not omitted). It needs some way to easily copy the URL to clipboard, e.g. via a context menu. That's a lot more stuff and a lot more "opinion" the that a URL/browser-focused control needs to provide over the core UI functionality of having clickable hyperlinks.
It'd been hoping to include this as part of a larger rework of text functions, so it would be easily to include in wrapping text, markups etc. But arguably we would likely still need a helper API entry point similar to one you suggested.
👍🏼 Some work I'm doing right now on an experimental "advancing layout+styling in imgui" project makes me think you're right about that. Breaking up text into separate runs across line breaks, with each run having its own hitbox/etc. makes handling advanced behavior w/ wordwrap much easier. Leaving all the wordwrap to the DrawList limits flexibility substantially.
from imgui.
Some work I'm doing right now on an experimental "advancing layout+styling in imgui" project makes me think you're right about that. Breaking up text into separate runs across line breaks, with each run having its own hitbox/etc. makes handling advanced behavior w/ wordwrap much easier. Leaving all the wordwrap to the DrawList limits flexibility substantially.
I have work in progress new text functions which will be more flexible in many ways (and also faster) but they aren't ready yet.
One common issue is #2313 that wrapping offset is conflating with start offset.
from imgui.
I am puzzled because I thought there was a topic or PR exactly about this but I can't find one now.
Also note TextURL()
in https://gist.github.com/dougbinks/ef0962ef6ebe2cadae76c4e9f0586c69 for another reference (and generally https://github.com/ocornut/imgui/wiki/Useful-Extensions#rich-text).
Having something like this in dear imgui itself instead of being reimplemented (often poorly) would be a small win.
You are right.
The reasons something like this is not in yet:
- I've been shy of adding too many new colors in the style system, while the expectation is that this will be boldly reworked. Admittedly this is a bit of a procrastination tactic at this point.
- It'd be awkward to implement/demo an "open browser" thing at least in the demo as that's quite OS dependent. And it may be nice if links would open without user need to wrap link+action, but that's optional. See
ImOsOpenInShell()
in https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/imgui_te_utils.cpp. I wonder if if we should add this to dear imgui behind a function pointer stored inImGuiIO
, defaulting to a internal version ofImOsOpenInShell
but letting user override. - It'd been hoping to include this as part of a larger rework of text functions, so it would be easily to include in wrapping text, markups etc. But arguably we would likely still need a helper API entry point similar to one you suggested.
I'm going to keep this open and see if we can implement something simple.
from imgui.
Related Issues (20)
- compile error with docking branch and SDL3 HOT 1
- Text followed by SameLine and then SmallButton inside table cell disables SmallButton HOT 5
- Ctrl+Backspace behavior in TextInput HOT 4
- Restoring layout from memory rearranges windows and sometimes crashes. HOT 2
- Splitters weird padding HOT 6
- Hantverk'n Video Game Graphics and Testing Settings GUI HOT 3
- DX12 backend can't render into a multisampled frame buffer HOT 1
- Question: fine-tuning the window scrollbar HOT 5
- Trying to get a 3 part rendering pipeline working but events aren't processed. HOT 3
- Are there ImGui APIs that can throw? HOT 3
- Unable to checkout v1.89.8 from Jetbrains IDE using tag HOT 2
- Question: GetCurrentWindow internal function HOT 3
- LabelText can't auto set item size
- Mouse action functions (IsItemHovered, IsMouseClicked,IsMouseDown,IsMouseReleased, etc.) always return false for overlapped item. HOT 10
- Hang when destroying viewports in example_sdl2_opengl3 (only when vsync is deactivated) HOT 4
- Imgui for arm64
- Question: Auto tile panels HOT 1
- Weird ImGui::InputText behavior when encapsulated inside a struct HOT 3
- `WantSetMousePos` warping leaks mouse events from previous position into next frame HOT 3
- BeginDisable doesn't disable shortcuts HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.