|
|
@@ -434,9 +434,18 @@ protected:
|
|
|
if (child1) paned->set_start_child(*child1);
|
|
|
if (child2) paned->set_end_child(*child2);
|
|
|
|
|
|
- // Set initial position based on ratio - use default 50/50 split for now
|
|
|
- // TODO: Calculate proper size after widget is allocated
|
|
|
- paned->set_position(300); // Reasonable default split position
|
|
|
+ // Set initial position based on ratio
|
|
|
+ // Use signal_map to set position when widget is ready
|
|
|
+ paned->signal_map().connect([paned, node](){
|
|
|
+ int width = paned->get_width();
|
|
|
+ int height = paned->get_height();
|
|
|
+ int size = (paned->get_orientation() == Gtk::Orientation::HORIZONTAL) ? width : height;
|
|
|
+
|
|
|
+ // Fallback if size not yet available
|
|
|
+ if (size <= 1) size = 1000; // Assume a reasonable default window size
|
|
|
+
|
|
|
+ paned->set_position(static_cast<int>(size * node->ratio));
|
|
|
+ });
|
|
|
|
|
|
return paned;
|
|
|
}
|