roundabout,
created on Wednesday, 26 March 2025, 16:00:54 (1743004854),
received on Wednesday, 26 March 2025, 16:00:57 (1743004857)
Author identity: vlad <vlad.muntoiu@gmail.com>
b613de9f47fc70579dc75b65a83b3b184c9bf412
gpanthera.cc
@@ -495,7 +495,7 @@ namespace gPanthera {
} auto new_stack = Gtk::make_managed<ContentStack>(this->content_manager, this->detach_handler); 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_switcher = Gtk::make_managed<ContentTabBar>(new_stack, this_notebook ? this_notebook->get_switcher()->get_orientation() : Gtk::Orientation::HORIZONTAL, this_notebook->get_switcher()->get_extra_child_function());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);
@@ -578,7 +578,7 @@ namespace gPanthera {
} } ContentTabBar::ContentTabBar(ContentStack *stack, Gtk::Orientation orientation) : Gtk::Box(orientation), stack(stack) {ContentTabBar::ContentTabBar(ContentStack *stack, Gtk::Orientation orientation, std::function<Gtk::Widget*(Gtk::Widget*)> extra_child_function) : Gtk::Box(orientation), stack(stack), extra_child_function(extra_child_function) {this->get_style_context()->add_class("gpanthera-content-tab-bar"); this->set_margin_top(0); this->set_margin_bottom(0);
@@ -613,7 +613,13 @@ namespace gPanthera {
this->set_orientation(orientation); // TODO: Add a box with extra children provided by the applicationif(this->extra_child_function) { this->append(*this->extra_child_function(this)); } } std::function<Gtk::Widget*(Gtk::Widget*)> ContentTabBar::get_extra_child_function() const { return this->extra_child_function;} void ContentTabBar::set_orientation(Gtk::Orientation orientation) {
gpanthera.hh
@@ -177,12 +177,15 @@ namespace gPanthera {
std::shared_ptr<Gtk::DropTarget> drop_target; Gtk::ScrolledWindow *scrolled_window; Gtk::Box *tab_box; std::function<Gtk::Widget*(Gtk::Widget*)> extra_child_function;public: void update_buttons(); explicit ContentTabBar(ContentStack *stack, Gtk::Orientation orientation = Gtk::Orientation::HORIZONTAL);explicit ContentTabBar(ContentStack *stack, Gtk::Orientation orientation = Gtk::Orientation::HORIZONTAL, std::function<Gtk::Widget*(Gtk::Widget*)> extra_child_function = nullptr);void set_orientation(Gtk::Orientation orientation); void set_extra_child_function(std::function<Gtk::Widget(Gtk::Widget *)> function);ContentStack *get_stack() const; ~ContentTabBar() override; std::function<Gtk::Widget*(Gtk::Widget*)> get_extra_child_function() const;}; class ContentNotebook : public Gtk::Box {
panthera-www.cc
@@ -57,7 +57,7 @@ protected:
std::function<bool(gPanthera::ContentPage*)> detach_handler; detach_handler = [](gPanthera::ContentPage *widget) { auto new_stack = Gtk::make_managed<gPanthera::ContentStack>(widget->content_manager, widget->get_stack()->get_detach_handler()); auto new_switcher = Gtk::make_managed<gPanthera::ContentTabBar>(new_stack, Gtk::Orientation::HORIZONTAL);auto new_switcher = Gtk::make_managed<gPanthera::ContentTabBar>(new_stack, Gtk::Orientation::HORIZONTAL, dynamic_cast<gPanthera::ContentTabBar*>(widget->get_stack()->get_parent()->get_first_child())->get_extra_child_function());auto new_notebook = Gtk::make_managed<gPanthera::ContentNotebook>(new_stack, new_switcher); auto window = new gPanthera::ContentWindow(new_notebook); widget->redock(new_stack);
@@ -69,8 +69,12 @@ protected:
return true; }; auto return_extra_child = [](Gtk::Widget *switcher) { auto label = Gtk::make_managed<Gtk::Label>("Test"); return label; }; auto content_stack = Gtk::make_managed<gPanthera::ContentStack>(content_manager, detach_handler); auto content_stack_switcher = Gtk::make_managed<gPanthera::ContentTabBar>(content_stack, Gtk::Orientation::HORIZONTAL);auto content_stack_switcher = Gtk::make_managed<gPanthera::ContentTabBar>(content_stack, Gtk::Orientation::HORIZONTAL, return_extra_child);content_manager->add_stack(content_stack); auto page_1_content = Gtk::make_managed<Gtk::Label>("Page 1..."); auto page_1_tab = new Gtk::Label("Page 1");