PCSX2 Documentation/WxWidgets Coding Strategies: Difference between revisions

Jump to navigation Jump to search
Line 33: Line 33:
==wxPanelWithHelpers==
==wxPanelWithHelpers==


The primary purpose of wxPanelWithHelpers is to compensate for wxWidgets inability to resize panels and dialogs with static text word wrapping in mind. (****see below for details on why) So instead we specify the ideal or maximum width of the dialog to wxPanelWithHelpers, and then use our own `pxStaticText` widget to add wrappable text to the panel, which will be wrapped to fit to the ideal width of the panel. Child panels of the wxPanelWithHelpers automatically inherit the maximum width from that panel, and automatically guesstimate their own width based on typical borders offrames and static group boxes.
The primary purpose of wxPanelWithHelpers is to compensate for wxWidgets inability to resize panels and dialogs with static text word wrapping in mind. (****see below for details on why) So instead we specify the ideal or maximum width of the dialog to wxPanelWithHelpers, and then use our own <code>pxStaticText</code> widget to add wrappable text to the panel, which will be wrapped to fit to the ideal width of the panel. Child panels of the wxPanelWithHelpers automatically inherit the maximum width from that panel, and automatically guesstimate their own width based on typical borders offrames and static group boxes.


This system is _not_ perfect, as there is quite a bit of rough guesstimation involved. But typically it is sufficient enough, and it also ensures that text will always be readable, even if the user's desktop has a non-standard DPI setting.
This system is ''not'' perfect, as there is quite a bit of rough guesstimation involved. But typically it is sufficient enough, and it also ensures that text will always be readable, even if the user's desktop has a non-standard DPI setting.


**** The wxWidgets sizers system does not fully support the concept of controls having an arbitrary width with a fixed height. A wrappable textbox, which is usually configured to stretch to fit width, needs to be able to change its minimum height setting based upon the "final" width setting its given, and have the sizers recalculate the dialog layout based on that new height.
The wxWidgets sizers system does not fully support the concept of controls having an arbitrary width with a fixed height. A wrappable textbox, which is usually configured to stretch to fit width, needs to be able to change its minimum height setting based upon the "final" width setting its given, and have the sizers recalculate the dialog layout based on that new height.


TODO: In the future it might work best to have the ideal/maximum width be a function of the user's dialog font size, to allow for the dialog to expand to accomodte the real-estire of larger fonts.
TODO: In the future it might work best to have the ideal/maximum width be a function of the user's dialog font size, to allow for the dialog to expand to accomodte the real-estire of larger fonts.