-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Modernize wxButtons and add button styling management #8184
base: main
Are you sure you want to change the base?
Conversation
This looks much better! Good job! That's a very clean and clever way of dealing with code duplication and management. I'd say we could even call the |
Can you check this logic
As an alternative way adding msw_rescale() duplicate of Rescale() can reduce code changes. But im not sure how many of them exist. Also maybe this can lead confusion on button type
|
@Noisyfox you may want to check changes • added SetStyle("Default") to button::create. That caused less issues than expected only i saw step box has issues with it. • Still might be better chose to not using SetStyle() on main constructer because some areas also uses button widget like tabbar. Also using SetStyle("Default") show code a bit more organized on some areas • Merged all styles in single function as SetStyle("Default") / SetStyle("Alert") / SetStyle("Confirm") / SetStyle("Disabled") • Code also has too many repeats for size definitions like below. I will try to include it on SetStyle with optional parameter
• Applied code to much more places to get an idea about how that will show |
I see, that make sense. Let's not call setstyle in constructors then. |
Then how about instead of using the name "Default", "Confirm", we name those styles as "primary", "secondary" etc., like what bootstrap does? Because "default" implies... default, really. I'd expect it to be the style without calling anything. |
am i getting right? as an alternative we can use like this i assume 4 styles will be enough, btw do we need any more styles? also i will create predefined sizes since many buttons uses them
"Compact"
"Paramater"
i will add an optional 3rd parameter for it maybe only Wide will enough for Paramater related buttons |
Yeah I think this alone should be sufficient.
I think this should cover most of the common cases. For those edge cases (if any), it won't be worth making a style for.
Could you post some screenshots as examples on where these get used and how they look like? |
you can find many for "Compact" few for "Wide" but i use them for buttons that related with parameter boxes (like ramming params set, printable area set ...) |
btw updated commit with latest changes. looks like there is no standard/format for window OK/CANCEL buttons. almost all uses different width and font size. probably will fix that too |
Modernizes buttons on several places
I can apply this change to all buttons on UI if approved. Currently limited commit with wxButtons
@SoftFever @Noisyfox this will turn a big commit since it will effect almost all buttons. Can you review logic before i apply it to all files. But at the end, it will make easier to managing, controlling styling and adding new buttons will be easier
Fixes #3730
TODO
• Standardize Ok/Cancel buttons on all windows
• Use Choice/Window/Parameter for button types instead Compact/Wide
• ok_btn->SetFocus(); for confirm buttons
• border color on focused items
• Main tab bar alignment broken new alignment additions on constructor
PROBLEM
• Current buttons rendered differently on all platforms
• There is no standard for button sizes,
• wxButtons doesnt support dark mode properly
SOLUTION / ADVANTAGES
• Makes buttons looks same on all platforms
• Improves dark mode compatibility
• Improves UI consistency
• This method gives better control on styling with less code since color and size properties came from single document
• All buttons styled with SetStyleDefault can be controlled from one place(buttons.cpp). I did 4 different styles as SetStyleDefault, SetStyleConfirm, SetStyleAlert, SetStyleDisabled on my previous commit and applied too all buttons on UI that made styling much more easier
• Used same width for buttons with parameter input boxes

CODE COMPARISON WITH STYLE MANAGEMENT
before (BedShapeDialog.cpp)


after - Less lines & more organized
CHANGED BUTTONS
Ramming settings




before
after
Printable Area > set button


before
after
Connection dialog buttons


before
after
Bed shape dialog


before
after