[glade--]Re: BUG FIX for: Re: Doesn't seem to be handling button box packing correctly



Oops, just spotted something in it that I meant to comment on.  I actually do want you to make a decision about it and how I handle it even if this is the correct spot for the bug fix, there is still a small decision to make:

> 
>       bool
> spread(w.getProperty("layout_style")=="GTK_BUTTONBOX_SPREAD");
>       bool edge(w.getProperty("layout_style")=="GTK_BUTTONBOX_EDGE");
>       bool start(w.getProperty("layout_style")=="GTK_BUTTONBOX_START");
>       bool end(w.getProperty("layout_style")=="GTK_BUTTONBOX_END");
> 
>       f.Statement() << instance << "set_layout" << "(Gtk::";
>       if ( spread )
>           f << "BUTTONBOX_SPREAD";
>       else if ( edge )
>           f << "BUTTONBOX_EDGE";
>       else if ( start )
>           f << "BUTTONBOX_START";
>       else
>           f << "BUTTONBOX_END";

As you can see above, the boolean "end" is never used actually, so it could be deleted.  I didn't know if it was better to do it as above (except not declare it even since it isn't used) or to have it do something like:

bool spread(w.getProperty("layout_style")=="GTK_BUTTONBOX_SPREAD");
bool edge(w.getProperty("layout_style")=="GTK_BUTTONBOX_EDGE");
bool start(w.getProperty("layout_style")=="GTK_BUTTONBOX_START");
bool end(w.getProperty("layout_style")=="GTK_BUTTONBOX_END");

if ( spread || edge || start || end )
{
   f.Statement() << instance << "set_layout" << "(Gtk::";
   if ( spread )
      f << "BUTTONBOX_SPREAD";
   else if ( edge )
      f << "BUTTONBOX_EDGE";
   else if ( start )
      f << "BUTTONBOX_START";
   else if ( end )
      f << "BUTTONBOX_END";
}

And, that way, if the property is not equal to one of those 4, it writes absolutely nothing out, instead of defaulting to BUTTONBOX_END layout style.  But, you may want to enclose either of these within a "if (GTKMM2){ }" also.

Mark





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