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:
parent
f74b3ec2d0
commit
28e96d8542
@ -101,30 +101,24 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
|
|||||||
|
|
||||||
BRect bounds = list->ItemFrame(list->IndexOf(this));
|
BRect bounds = list->ItemFrame(list->IndexOf(this));
|
||||||
|
|
||||||
rgb_color oldviewcolor = owner->ViewColor();
|
rgb_color black= { 0,0,0,255 };
|
||||||
rgb_color oldlowcolor = owner->LowColor();
|
|
||||||
rgb_color oldcolor = owner->HighColor();
|
|
||||||
|
|
||||||
rgb_color color = oldviewcolor;
|
if ( IsSelected() || complete ) {
|
||||||
if ( IsSelected() )
|
if (IsSelected()) {
|
||||||
color = tint_color(color, B_HIGHLIGHT_BACKGROUND_TINT);
|
owner->SetHighColor(tint_color(owner->ViewColor() , B_HIGHLIGHT_BACKGROUND_TINT));
|
||||||
|
} else {
|
||||||
|
owner->SetHighColor(owner->LowColor());
|
||||||
|
}
|
||||||
|
|
||||||
owner->SetViewColor( color );
|
owner->FillRect(bounds);
|
||||||
owner->SetHighColor( color );
|
}
|
||||||
owner->SetLowColor( color );
|
|
||||||
owner->FillRect(bounds);
|
|
||||||
|
|
||||||
owner->SetViewColor( oldviewcolor);
|
|
||||||
owner->SetLowColor( oldlowcolor );
|
|
||||||
owner->SetHighColor( oldcolor );
|
|
||||||
|
|
||||||
BPoint iconPt = bounds.LeftTop() + BPoint(4,4);
|
BPoint iconPt = bounds.LeftTop() + BPoint(4,4);
|
||||||
BPoint namePt = BPoint(32+12, fFirstlineOffset);
|
BPoint namePt = BPoint(32+12, fFirstlineOffset);
|
||||||
BPoint driverPt = BPoint(32+12, fSecondlineOffset);
|
BPoint v4addrPt = BPoint(32+12, fSecondlineOffset);
|
||||||
BPoint commentPt = BPoint(32+12, fThirdlineOffset);
|
BPoint v6addrPt = BPoint(32+12, fThirdlineOffset);
|
||||||
|
|
||||||
drawing_mode mode = owner->DrawingMode();
|
if ( fSettings->IsDisabled() ) {
|
||||||
if (fSettings->IsDisabled()) {
|
|
||||||
owner->SetDrawingMode(B_OP_ALPHA);
|
owner->SetDrawingMode(B_OP_ALPHA);
|
||||||
owner->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
|
owner->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
|
||||||
owner->SetHighColor(0, 0, 0, 32);
|
owner->SetHighColor(0, 0, 0, 32);
|
||||||
@ -133,27 +127,31 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
|
|||||||
|
|
||||||
owner->DrawBitmapAsync(fIcon, iconPt);
|
owner->DrawBitmapAsync(fIcon, iconPt);
|
||||||
|
|
||||||
if (fSettings->IsDisabled())
|
if ( fSettings->IsDisabled() )
|
||||||
owner->SetHighColor(tint_color(oldcolor, B_LIGHTEN_1_TINT));
|
owner->SetHighColor(tint_color(black, B_LIGHTEN_1_TINT));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(black);
|
||||||
|
|
||||||
owner->SetFont(be_bold_font);
|
owner->SetFont(be_bold_font);
|
||||||
owner->DrawString(Name(), namePt);
|
owner->DrawString(Name(), namePt);
|
||||||
owner->SetFont(be_plain_font);
|
owner->SetFont(be_plain_font);
|
||||||
|
|
||||||
if (fSettings->IsDisabled())
|
if (fSettings->IsDisabled())
|
||||||
owner->DrawString("Disabled.", driverPt);
|
owner->DrawString("Disabled", v4addrPt);
|
||||||
else {
|
else {
|
||||||
BString str("Enabled, IPv4 address: ");
|
BString v4str("IPv4: ");
|
||||||
str << fSettings->IP();
|
v4str << fSettings->IP();
|
||||||
owner->DrawString(str.String(), driverPt);
|
v4str << " (";
|
||||||
if (fSettings->AutoConfigure())
|
if ( fSettings->AutoConfigure() )
|
||||||
owner->DrawString("DHCP enabled", commentPt);
|
v4str << "DHCP";
|
||||||
else
|
else
|
||||||
owner->DrawString("DHCP disabled, use static IP address", commentPt);
|
v4str << "manual";
|
||||||
}
|
v4str << ")";
|
||||||
|
owner->DrawString(v4str.String(), v4addrPt);
|
||||||
|
|
||||||
owner->SetHighColor(oldcolor);
|
owner->DrawString("IPv6: none (auto)", v6addrPt);
|
||||||
owner->SetDrawingMode(mode);
|
// TODO : where will we keep this?
|
||||||
|
}
|
||||||
|
|
||||||
owner->PopState();
|
owner->PopState();
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
B_TRANSLATE("Profile:"), profilesPopup);
|
B_TRANSLATE("Profile:"), profilesPopup);
|
||||||
profilesMenuField->SetFont(be_bold_font);
|
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
|
// ---- Settings section
|
||||||
|
|
||||||
fPanel = new BTabView("showview_box");
|
fPanel = new BTabView("showview_box");
|
||||||
@ -69,7 +65,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
.AddGroup(B_HORIZONTAL, 5)
|
.AddGroup(B_HORIZONTAL, 5)
|
||||||
.Add(profilesMenuField)
|
.Add(profilesMenuField)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(button)
|
|
||||||
.End()
|
.End()
|
||||||
.Add(fPanel)
|
.Add(fPanel)
|
||||||
.Add(bottomDivider)
|
.Add(bottomDivider)
|
||||||
@ -197,6 +192,8 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
|
|||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(NEW_PROFILE_MSG)));
|
new BMessage(NEW_PROFILE_MSG)));
|
||||||
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Manage" B_UTF8_ELLIPSIS),
|
||||||
|
new BMessage(MANAGE_PROFILES_MSG)));
|
||||||
|
|
||||||
if (strlen(current_profile)) {
|
if (strlen(current_profile)) {
|
||||||
item = menu->FindItem(current_profile);
|
item = menu->FindItem(current_profile);
|
||||||
@ -223,7 +220,7 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
|
|||||||
if (!search_paths)
|
if (!search_paths)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fMinAddonViewRect.Set(0, 0, 200, 200); // Minimum size
|
fMinAddonViewRect.Set(0, 0, 350, 200); // Minimum size
|
||||||
|
|
||||||
search_paths = strdup(search_paths);
|
search_paths = strdup(search_paths);
|
||||||
char* next_path_token;
|
char* next_path_token;
|
||||||
|
Loading…
Reference in New Issue
Block a user