roundabout,
created on Friday, 21 March 2025, 21:17:35 (1742591855),
received on Sunday, 23 March 2025, 21:04:54 (1742763894)
Author identity: vlad <vlad.muntoiu@gmail.com>
b90ad71369276820178e7bff5ff214f932e8b6c7
gpanthera.cc
@@ -459,8 +459,9 @@ namespace gPanthera {
return true;
}
auto new_stack = Gtk::make_managed<ContentStack>(this->content_manager);
auto new_switcher = Gtk::make_managed<ContentTabBar>(new_stack, Gtk::Orientation::HORIZONTAL);
auto new_notebook = Gtk::make_managed<ContentNotebook>(new_stack, new_switcher);
auto this_notebook = dynamic_cast<ContentNotebook*>(this->get_parent());
auto new_switcher = Gtk::make_managed<ContentTabBar>(new_stack, this_notebook ? this_notebook->get_switcher()->get_orientation() : Gtk::Orientation::HORIZONTAL);
auto new_notebook = Gtk::make_managed<ContentNotebook>(new_stack, new_switcher, this_notebook ? this_notebook->get_tab_position() : Gtk::PositionType::TOP);
new_stack->add_page(*page);
new_stack->set_visible_child(*page);
if(this->get_first_child()) {
@@ -493,9 +494,23 @@ namespace gPanthera {
}, false);
}
ContentNotebook::ContentNotebook(ContentStack *stack, ContentTabBar *switcher) : Gtk::Box(Gtk::Orientation::VERTICAL), stack(stack), switcher(switcher) {
this->prepend(*switcher);
ContentNotebook::ContentNotebook(ContentStack *stack, ContentTabBar *switcher, Gtk::PositionType tab_position) : Gtk::Box(), stack(stack), switcher(switcher), tab_position(tab_position) {
this->append(*stack);
if(tab_position == Gtk::PositionType::TOP || tab_position == Gtk::PositionType::BOTTOM) {
this->set_orientation(Gtk::Orientation::VERTICAL);
if(tab_position == Gtk::PositionType::TOP) {
this->prepend(*switcher);
} else if(tab_position == Gtk::PositionType::BOTTOM) {
this->append(*switcher);
}
} else if(tab_position == Gtk::PositionType::LEFT || tab_position == Gtk::PositionType::RIGHT) {
this->set_orientation(Gtk::Orientation::HORIZONTAL);
if(tab_position == Gtk::PositionType::LEFT) {
this->prepend(*switcher);
} else if(tab_position == Gtk::PositionType::RIGHT) {
this->append(*switcher);
}
}
}
void ContentStack::make_paned(Gtk::Orientation orientation, Gtk::PackType pack_type) {
@@ -791,4 +806,16 @@ namespace gPanthera {
this->set_decorated(true);
this->set_resizable(true);
}
Gtk::PositionType ContentNotebook::get_tab_position() const {
return this->tab_position;
}
ContentTabBar *ContentNotebook::get_switcher() const {
return this->switcher;
}
ContentStack *ContentNotebook::get_stack() const {
return this->stack;
}
} // namespace gPanthera
gpanthera.hh
@@ -178,8 +178,12 @@ namespace gPanthera {
private:
ContentStack *stack;
ContentTabBar *switcher;
Gtk::PositionType tab_position;
public:
ContentNotebook(ContentStack *stack, ContentTabBar *switcher);
ContentNotebook(ContentStack *stack, ContentTabBar *switcher, Gtk::PositionType tab_position = Gtk::PositionType::TOP);
Gtk::PositionType get_tab_position() const;
ContentStack *get_stack() const;
ContentTabBar *get_switcher() const;
};
class ContentWindow : public Gtk::Window {
panthera-www.cc
@@ -64,7 +64,6 @@ protected:
auto page_2_tab = new Gtk::Label("Page 2");
auto page_2 = Gtk::make_managed<gPanthera::ContentPage>(content_manager, content_stack, page_2_content, page_2_tab);
content_stack->signal_detach.connect([](gPanthera::ContentPage *widget) {
std::cout << "Detaching " << widget->get_name() << std::endl;
auto new_stack = Gtk::make_managed<gPanthera::ContentStack>(widget->content_manager);
auto new_switcher = Gtk::make_managed<gPanthera::ContentTabBar>(new_stack, Gtk::Orientation::HORIZONTAL);
auto new_notebook = Gtk::make_managed<gPanthera::ContentNotebook>(new_stack, new_switcher);
@@ -78,7 +77,7 @@ protected:
return true;
});
content->set_name("content_box");
auto content_notebook = Gtk::make_managed<gPanthera::ContentNotebook>(content_stack, content_stack_switcher);
auto content_notebook = Gtk::make_managed<gPanthera::ContentNotebook>(content_stack, content_stack_switcher, Gtk::PositionType::TOP);
content->append(*content_notebook);
inner_paned->set_start_child(*content);
inner_paned->set_end_child(*dock_stack_1);