GUI: Introduce dynamic layouts
Prior to this change, a GUI layout was only affected by the screen size. Now, a layout can additionally be influenced by the GUI dialog and widgets that uses it. This capability is leveraged to implement the following features: * Layout elements that are not bound to a GUI widget do not take space. This means that dialogs where the widgets shown depend on for example a feature being enabled at configure time no longer have blank spaces. * Widgets can define a minimal required size for their contents not to be cut. For now this is only used for buttons so their width is always sufficient for their caption not to be cut. This mechanism could be applied to other widget types in the future.
This commit is contained in:
parent
303ee2694f
commit
c0d8b6d9fc
36 changed files with 326 additions and 177 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "gui/gui-manager.h"
|
||||
#include "gui/dialog.h"
|
||||
#include "gui/ThemeEval.h"
|
||||
#include "gui/widget.h"
|
||||
|
||||
namespace GUI {
|
||||
|
@ -104,6 +105,10 @@ void Dialog::reflowLayout() {
|
|||
// changed, so any cached image may be invalid. The subsequent redraw
|
||||
// should be treated as the very first draw.
|
||||
|
||||
if (!_name.empty()) {
|
||||
g_gui.xmlEval()->reflowDialogLayout(_name, _firstWidget);
|
||||
}
|
||||
|
||||
GuiObject::reflowLayout();
|
||||
|
||||
Widget *w = _firstWidget;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue