2828#include < libfenster/label.hpp>
2929#include < libfenster/image.hpp>
3030#include < libfenster/listener/key_listener.hpp>
31+ #include < libfenster/layout/flex_layout_manager.hpp>
32+ #include < libfenster/layout/grid_layout_manager.hpp>
33+ #include < libfenster/layout/flow_layout_manager.hpp>
3134
3235using namespace fenster ;
3336struct file_entry_t
@@ -68,19 +71,19 @@ int main()
6871 window->setTitle (" Navigator" );
6972 window->onClose ([]() { g_exit (0 ); });
7073
71- window-> setLayout ( FENSTER_LAYOUT_MANAGER_FLEX );
72- window-> setFlexOrientation (false );
74+ auto windowLayout = FlexLayoutManager::create (window );
75+ windowLayout-> setHorizontal (false );
7376
7477 Panel* navBar = Panel::create ();
75- navBar-> setLayout ( FENSTER_LAYOUT_MANAGER_FLEX );
76- navBar-> setLayoutPadding (Insets (5 , 5 , 5 , 5 ));
77- navBar-> setFlexGap (10 );
78+ auto navBarLayout = FlexLayoutManager::create (navBar );
79+ navBarLayout-> setPadding (Insets (5 , 5 , 5 , 5 ));
80+ navBarLayout-> setSpace (10 );
7881 {
7982 navPrev = Button::create ();
8083 navPrev->setStyle (FENSTER_BUTTON_STYLE_GHOST );
8184 navPrev->setTitle (" <" );
8285 navBar->addChild (navPrev);
83- navBar-> setFlexComponentInfo (navPrev, 0 , 1 , 50 );
86+ navBarLayout-> setComponentInfo (navPrev, 0 , 1 , 50 );
8487 navPrev->setActionListener ([]()
8588 {
8689 if (historyCurrentPosition > 0 )
@@ -95,7 +98,7 @@ int main()
9598 navNext->setStyle (FENSTER_BUTTON_STYLE_GHOST );
9699 navNext->setTitle (" >" );
97100 navBar->addChild (navNext);
98- navBar-> setFlexComponentInfo (navNext, 0 , 1 , 50 );
101+ navBarLayout-> setComponentInfo (navNext, 0 , 1 , 50 );
99102 navNext->setActionListener ([]()
100103 {
101104 if (historyCurrentPosition >= 0 && historyCurrentPosition < (int ) history.size () - 1 )
@@ -108,7 +111,7 @@ int main()
108111
109112 navText = TextField::create ();
110113 navBar->addChild (navText);
111- navBar-> setFlexComponentInfo (navText, 1 , 1 , 0 );
114+ navBarLayout-> setComponentInfo (navText, 1 , 1 , 0 );
112115 navText->addKeyListener ([](KeyEvent& e)
113116 {
114117 // TODO: g_keyboard needs a layout right now, maybe key events should already send ASCII codes:
@@ -124,7 +127,7 @@ int main()
124127 navUp->setTitle (" ^" );
125128 navUp->setStyle (FENSTER_BUTTON_STYLE_GHOST );
126129 navBar->addChild (navUp);
127- navBar-> setFlexComponentInfo (navUp, 0 , 1 , 50 );
130+ navBarLayout-> setComponentInfo (navUp, 0 , 1 , 50 );
128131
129132 navUp->setActionListener ([]()
130133 {
@@ -135,24 +138,25 @@ int main()
135138 });
136139 }
137140 window->addChild (navBar);
138- window-> setFlexComponentInfo (navBar, 0 , 1 , 40 );
141+ windowLayout-> setComponentInfo (navBar, 0 , 1 , 40 );
139142
140143 Panel* centerPanel = Panel::create ();
141144 centerPanel->setBackground (_RGB (255 , 255 , 255 ));
142- centerPanel-> setLayout ( FENSTER_LAYOUT_MANAGER_GRID );
145+ GridLayoutManager::create (centerPanel );
143146 {
144147 scroller = ScrollPane::create ();
145148 content = Panel::create ();
146- content->setLayout (FENSTER_LAYOUT_MANAGER_FLOW );
147- content->setLayoutPadding (Insets (5 , 5 , 5 , 5 ));
149+
150+ auto contentLayout = FlowLayoutManager::create (content);
151+ contentLayout->setPadding (Insets (5 , 5 , 5 , 5 ));
148152
149153 scroller->setFixed (true , false );
150154 scroller->setContent (content);
151155
152156 centerPanel->addChild (scroller);
153157 }
154158 window->addChild (centerPanel);
155- window-> setFlexComponentInfo (centerPanel, 1 , 1 , 0 );
159+ windowLayout-> setComponentInfo (centerPanel, 1 , 1 , 0 );
156160
157161 window->setVisible (true );
158162 window->onClose ([]()
0 commit comments