[Glib::OptionGroup] How to add_entry() for custom data



Hello all,

I have a command line with an option "box" than is a Rectangle:
I would like to do :
$] prog --box="0 0 600 400"
Instead of :
$] prog --box-x="0"  --box-y="0" --box-width="600" --box-height="400"


I wrote my programme in Gtkmm, so I have subclassed Glib::OptionGroup and add this function :

void MyOptionGroup::add_entry(const Glib::OptionEntry& entry, Gdk::Rectangle& arg) {
    Glib::OptionGroup::add_entry(entry, sigc::mem_fun(*this, &OptionGroup::on_option_arg_rectangle));

}
bool MyOptionGroup::on_option_arg_rectangle(const Glib::ustring& option_name, const Glib::ustring& value, bool has_value)
{
    bool succes = true;
    // parse value to Gdk::Rectangle(0, 0, 600, 400);
    // How I can set MyOptionGroup->m_arg_box ?
    return succes;
}

How to store the parsed value in the function on_option_rectangle()


PS : I tried to show you the code that I did but maybe I have it all wrong



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]