PCSX2 Documentation/WxWidgets Coding Strategies: Difference between revisions

Jump to navigation Jump to search
Line 25: Line 25:
PCSX2 opts for the "hand-made" approach to dialog box design, rather than using form designers and resource files. This reduces the number of external library and application dependencies needed to build or contribute to PCSX2, and is often an ideal approach to GUI design via sizers and spacers (which is the preferred layout system in wxwidgets). Make sure to always create a new dialog/UI as one or more **Panels**, rather than adding controls directly to a Dialog window. Panels are much more flexable devices and they allow us the option of adding dockable panel features to PCSX2's UI at a later date. Panels also make re-arranging the window contents of the current static GUI a lot easier (if necessary).
PCSX2 opts for the "hand-made" approach to dialog box design, rather than using form designers and resource files. This reduces the number of external library and application dependencies needed to build or contribute to PCSX2, and is often an ideal approach to GUI design via sizers and spacers (which is the preferred layout system in wxwidgets). Make sure to always create a new dialog/UI as one or more **Panels**, rather than adding controls directly to a Dialog window. Panels are much more flexable devices and they allow us the option of adding dockable panel features to PCSX2's UI at a later date. Panels also make re-arranging the window contents of the current static GUI a lot easier (if necessary).


PCSX2 also has several home-brew helper classes and functions, which are typically prefixed with `px`. These are usually designed to accomodate for shortcomings in wxWidgets API, such as providing properly word-wrapped tooltips and/or static text (wxWidgets has a general lack of built-in word wrapping ability). In particular, be sure to use these replacements for common wxWidgets classes:
PCSX2 also has several home-brew helper classes and functions, which are typically prefixed with <code>px</code>. These are usually designed to accomodate for shortcomings in wxWidgets API, such as providing properly word-wrapped tooltips and/or static text (wxWidgets has a general lack of built-in word wrapping ability). In particular, be sure to use these replacements for common wxWidgets classes:


wxAppWithHelpers wxDialogWithHelpers wxPanelWithHelpers pxCheckBox pxRadioPanel pxStaticText
<code>wxAppWithHelpers wxDialogWithHelpers wxPanelWithHelpers pxCheckBox pxRadioPanel pxStaticText</code>


... If using native wxWidgets controls with tooltips, use `pxSetToolTip` instead of the control's built in `SetToolTip.` This ensures proper tooltip length on win32 platforms. Custom px-based controls override the SetToolTip internally to do word wrapping as needed, so you can use their built-in `SetToolTip` methods.
... If using native wxWidgets controls with tooltips, use <code>pxSetToolTip</code> instead of the control's built in <code>SetToolTip.</code> This ensures proper tooltip length on win32 platforms. Custom px-based controls override the SetToolTip internally to do word wrapping as needed, so you can use their built-in <code>SetToolTip</code> methods.


==wxPanelWithHelpers==
==wxPanelWithHelpers==