Ticket #2043: network.diff

File network.diff, 2.4 KB (added by stpere, 13 years ago)
  • src/preferences/network/EthernetSettingsView.cpp

     
    153153{
    154154    float inset = ceilf(be_plain_font->Size() * 0.8);
    155155    frame.OffsetTo(inset, inset);
    156     frame.right = StringWidth("IP Address XXX.XXX.XXX.XXX") + 50;
    157156    frame.bottom = frame.top + 15; // just a starting point
    158157    BPoint spacing(0, inset);
    159158   
     
    180179   
    181180    fDeviceMenuField = new BMenuField(frame, "networkcards", "Adapter:", devmenu);
    182181    AddChild(fDeviceMenuField);
    183     fDeviceMenuField->ResizeToPreferred();
    184    
     182       
    185183    fTypeMenuField = new BMenuField(frame, "type", "Mode:", modemenu);
    186184    fTypeMenuField->MoveTo(fDeviceMenuField->Frame().LeftBottom() + spacing);
    187185    AddChild(fTypeMenuField);
     
    239237        + BPoint(-fApplyButton->Frame().Width(), 0));
    240238    AddChild(fApplyButton);
    241239
    242     ResizeTo(frame.Width() + 2 * inset, fApplyButton->Frame().bottom + inset);
    243 
    244240    // take care of label alignment
    245     float maxLabelWidth
     241    float maxLabelWidth 
    246242        = fDeviceMenuField->StringWidth(fDeviceMenuField->Label());
    247243    maxLabelWidth = max_c(maxLabelWidth,
    248244        fTypeMenuField->StringWidth(fTypeMenuField->Label()));
     
    258254        fSecondaryDNSTextControl->StringWidth(
    259255            fSecondaryDNSTextControl->Label()));
    260256
     257    float maxWidth = fDeviceMenuField->Bounds().Width() + 10;
     258    // TODO: find why the bound is smaller than the displayed widgets..
     259
    261260    fDeviceMenuField->SetDivider(maxLabelWidth + 8);
    262261    fTypeMenuField->SetDivider(maxLabelWidth + 8);
    263262
     
    266265    fGatewayTextControl->SetDivider(maxLabelWidth + 8);
    267266    fPrimaryDNSTextControl->SetDivider(maxLabelWidth + 8);
    268267    fSecondaryDNSTextControl->SetDivider(maxLabelWidth + 8);
     268
     269    // resize the window to make sure everything is fully shown...
     270    maxWidth = max_c(maxWidth, fTypeMenuField->Bounds().Width() + 10);
     271    maxWidth = max_c(maxWidth, fIPTextControl->Bounds().Width());
     272    maxWidth = max_c(maxWidth, fNetMaskTextControl->Bounds().Width());
     273    maxWidth = max_c(maxWidth, fGatewayTextControl->Bounds().Width());
     274    maxWidth = max_c(maxWidth, fPrimaryDNSTextControl->Bounds().Width());
     275    maxWidth = max_c(maxWidth, fSecondaryDNSTextControl->Bounds().Width());
     276
     277    ResizeTo(maxWidth + 2 * inset, fApplyButton->Frame().bottom + inset);
    269278}
    270279
    271280EthernetSettingsView::~EthernetSettingsView()