Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose more AcceptDialog theming options #3832

Open
stijn-h opened this issue Jan 19, 2022 · 3 comments
Open

Expose more AcceptDialog theming options #3832

stijn-h opened this issue Jan 19, 2022 · 3 comments

Comments

@stijn-h
Copy link

stijn-h commented Jan 19, 2022

Describe the project you are working on

Working on godotengine/godot#56772

Describe the problem or limitation you are having in your project

AcceptDialog has some baked in logic/theme options that are impossible to override. In my use case specifically:

  • The ability to hide the OK button.
  • The ability to change the dialog margins.

The issue is seen in the following image. Left is regular AcceptDialog, right is with disabled margin/OK button.

accept_dialog

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Both of these things should be customizable, atleast in engine, but it can't hurt to expose them.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It should be possible to hide all non-custom controls in AcceptDialog so that it is completely empty, while retaining the same behaviour. This method should be exposed as well, probably.

As for margins, i don't know that much about how themes work, but it would be best if it were constants that are overridable like others.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Can't be worked around.

Is there a reason why this should be core and not an add-on in the asset library?

Can't be worked around.

@YuriSizov
Copy link
Contributor

The ability to hide the OK button.

I think we just need to bring back WindowDialog. It was removed in master when Window was introduced, but Window is too abstract to be used directly, and AcceptDialog is too specific. So I think we just need to re-introduce a basic dialog type that would not have any buttons, but would set all the default values that are required by dialogs.

However, the button can be easily hidden with get_ok_button()->hide() even without that.

The ability to change the dialog margins.
As for margins, i don't know that much about how themes work, but it would be best if it were constants that are overridable like others.

This is controlled by styleboxes, not constants. There should already be a style for that.

@stijn-h
Copy link
Author

stijn-h commented Jan 20, 2022

However, the button can be easily hidden with get_ok_button()->hide() even without that.

Well, that's kinda stupid that I missed that.

This is controlled by styleboxes, not constants. There should already be a style for that.

Hmm, are you sure? Seems like that for Popup, but AcceptDialog seems to be getting its margin from the theme of an internal node.

image

This should be handled by a stylebox then, I think?

@YuriSizov
Copy link
Contributor

Hmm, are you sure? Seems like that for Popup, but AcceptDialog seems to be getting its margin from the theme of an internal node. This should be handled by a stylebox then, I think?

I was sure, but not anymore 🙃 But ideally, yes. Styleboxes define both styling and content paddings (or rather content margins). It is possible that this was changed in master because a dialog can be an actual window now, so there is less styling that can be applied to it, not sure.

There are definitely still styleboxes that affect the dialogs. Here's for example what they look like with the new default project theme if they are embedded and not separate windows:

FileDialog

Worth investigating, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants