Hello
I'm creating an app with gtkmm using Gtk :: Builder according to the book
and I can make the app work.
I am now intending to derive this class which is already derived from Gtk
:: ApplicationWindow.
How do I start the constructor of the base class it has (BaseObjectType *
cobject, and const Glib :: RefPtr <Gtk :: Builder> & builder) in the
derived class?

Ex:
###### example.h ######

class GtimerGui : public Gtk::ApplicationWindow
{
public:
GtimerGui(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
builder);
 ~GtimerGui();
Gtk::ApplicationWindow *main_window;
Glib::RefPtr<Gtk::Builder> sp_FileBuilder;
};

###### example.cpp ######

GtimerGui::GtimerGui(BaseObjectType* cobject, const
Glib::RefPtr<Gtk::Builder> &builder)
: Gtk::ApplicationWindow(cobject), sp_FileBuilder(builder)
{
}

GtimerGui::~GtimerGui()
{
}
###### Main.cpp #######

nt main (int argc, char *argv[])
{
   auto app = Gtk::Application::create (argc, argv, "liomar.org.example");
   auto refFileBuilder = Gtk::Builder::create();
   try
   {
 
refFileBuilder->add_from_file("/home/suporte/Projeto_2019/GTimer/gtimer.glade");
  }
   catch(const Glib::FileError &ex)
   {
  std::cerr << "FileError: " << ex.what() << std::endl;

   }
   catch(const Glib::MarkupError& ex)
   {
  std::cerr << "MarkupError: " << ex.what() << std::endl;
   }
   catch(const Gtk::BuilderError& ex)
   {
  std::cerr << "BuilderError: " << ex.what() << std::endl;
   }
   GtimerGui *gtimer = nullptr;
   refFileBuilder->get_widget_derived("m_main_window", gtimer);
   if(gtimer)
   {
    app->run(*gtimer);
    }
   delete gtimer;
   return 0;
}

##### Derived_Class.h #####
class GtimerController : public GtimerGui
{
public:
 GtimerController();
 ~GtimerController();
};

##### Derived_Class.cpp ####
GtimerController::GtimerController()
{
}

GtimerController::~GtimerController()
{
}
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to