re-organize interface listitem drawing to be more efficent; move profile management button into profile drop-down

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40312 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-01-28 22:36:13 +00:00
parent f74b3ec2d0
commit 28e96d8542
2 changed files with 32 additions and 37 deletions

View File

@ -101,30 +101,24 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
BRect bounds = list->ItemFrame(list->IndexOf(this));
rgb_color oldviewcolor = owner->ViewColor();
rgb_color oldlowcolor = owner->LowColor();
rgb_color oldcolor = owner->HighColor();
rgb_color black= { 0,0,0,255 };
rgb_color color = oldviewcolor;
if ( IsSelected() )
color = tint_color(color, B_HIGHLIGHT_BACKGROUND_TINT);
if ( IsSelected() || complete ) {
if (IsSelected()) {
owner->SetHighColor(tint_color(owner->ViewColor() , B_HIGHLIGHT_BACKGROUND_TINT));
} else {
owner->SetHighColor(owner->LowColor());
}
owner->SetViewColor( color );
owner->SetHighColor( color );
owner->SetLowColor( color );
owner->FillRect(bounds);
owner->SetViewColor( oldviewcolor);
owner->SetLowColor( oldlowcolor );
owner->SetHighColor( oldcolor );
owner->FillRect(bounds);
}
BPoint iconPt = bounds.LeftTop() + BPoint(4,4);
BPoint namePt = BPoint(32+12, fFirstlineOffset);
BPoint driverPt = BPoint(32+12, fSecondlineOffset);
BPoint commentPt = BPoint(32+12, fThirdlineOffset);
BPoint v4addrPt = BPoint(32+12, fSecondlineOffset);
BPoint v6addrPt = BPoint(32+12, fThirdlineOffset);
drawing_mode mode = owner->DrawingMode();
if (fSettings->IsDisabled()) {
if ( fSettings->IsDisabled() ) {
owner->SetDrawingMode(B_OP_ALPHA);
owner->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
owner->SetHighColor(0, 0, 0, 32);
@ -133,27 +127,31 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
owner->DrawBitmapAsync(fIcon, iconPt);
if (fSettings->IsDisabled())
owner->SetHighColor(tint_color(oldcolor, B_LIGHTEN_1_TINT));
if ( fSettings->IsDisabled() )
owner->SetHighColor(tint_color(black, B_LIGHTEN_1_TINT));
else
owner->SetHighColor(black);
owner->SetFont(be_bold_font);
owner->DrawString(Name(), namePt);
owner->SetFont(be_plain_font);
if (fSettings->IsDisabled())
owner->DrawString("Disabled.", driverPt);
owner->DrawString("Disabled", v4addrPt);
else {
BString str("Enabled, IPv4 address: ");
str << fSettings->IP();
owner->DrawString(str.String(), driverPt);
if (fSettings->AutoConfigure())
owner->DrawString("DHCP enabled", commentPt);
BString v4str("IPv4: ");
v4str << fSettings->IP();
v4str << " (";
if ( fSettings->AutoConfigure() )
v4str << "DHCP";
else
owner->DrawString("DHCP disabled, use static IP address", commentPt);
}
v4str << "manual";
v4str << ")";
owner->DrawString(v4str.String(), v4addrPt);
owner->SetHighColor(oldcolor);
owner->SetDrawingMode(mode);
owner->DrawString("IPv6: none (auto)", v6addrPt);
// TODO : where will we keep this?
}
owner->PopState();
}

View File

@ -35,10 +35,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
B_TRANSLATE("Profile:"), profilesPopup);
profilesMenuField->SetFont(be_bold_font);
BButton *button = new BButton("manage_profiles",
B_TRANSLATE("Manage profiles" B_UTF8_ELLIPSIS),
new BMessage(MANAGE_PROFILES_MSG));
// ---- Settings section
fPanel = new BTabView("showview_box");
@ -69,7 +65,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
.AddGroup(B_HORIZONTAL, 5)
.Add(profilesMenuField)
.AddGlue()
.Add(button)
.End()
.Add(fPanel)
.Add(bottomDivider)
@ -197,6 +192,8 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
new BMessage(NEW_PROFILE_MSG)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Manage" B_UTF8_ELLIPSIS),
new BMessage(MANAGE_PROFILES_MSG)));
if (strlen(current_profile)) {
item = menu->FindItem(current_profile);
@ -223,7 +220,7 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
if (!search_paths)
return;
fMinAddonViewRect.Set(0, 0, 200, 200); // Minimum size
fMinAddonViewRect.Set(0, 0, 350, 200); // Minimum size
search_paths = strdup(search_paths);
char* next_path_token;