Roster-windows scaling, truncate account names
In the AccountsMenu, item labels are now truncated to ~15 characters, appending an ellipsis if the string is longer.
This commit is contained in:
parent
c7c02e79c9
commit
dfa92a8d9e
|
@ -54,9 +54,14 @@ AccountsMenu::_PopulateMenu()
|
||||||
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
|
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
|
||||||
AccountInstances accounts = server->GetActiveAccounts();
|
AccountInstances accounts = server->GetActiveAccounts();
|
||||||
|
|
||||||
for (int i = 0; i < accounts.CountItems(); i++)
|
for (int i = 0; i < accounts.CountItems(); i++) {
|
||||||
AddItem(new BMenuItem(accounts.KeyAt(i).String(),
|
BString label = accounts.KeyAt(i).String();
|
||||||
new BMessage(fAccountMessage)));
|
if (label.CountChars() > 15) {
|
||||||
|
label.RemoveChars(16, label.CountChars() - 16);
|
||||||
|
label << B_UTF8_ELLIPSIS;
|
||||||
|
}
|
||||||
|
AddItem(new BMenuItem(label.String(), new BMessage(fAccountMessage)));
|
||||||
|
}
|
||||||
|
|
||||||
if (CountItems() > 0)
|
if (CountItems() > 0)
|
||||||
ItemAt(0)->SetMarked(true);
|
ItemAt(0)->SetMarked(true);
|
||||||
|
|
|
@ -46,7 +46,8 @@ RosterEditWindow* RosterEditWindow::fInstance = NULL;
|
||||||
|
|
||||||
RosterEditWindow::RosterEditWindow(Server* server)
|
RosterEditWindow::RosterEditWindow(Server* server)
|
||||||
:
|
:
|
||||||
BWindow(BRect(0, 0, 300, 400), B_TRANSLATE("Roster"), B_FLOATING_WINDOW, 0),
|
BWindow(BRect(0, 0, 300, 400), B_TRANSLATE("Roster"), B_FLOATING_WINDOW,
|
||||||
|
B_AUTO_UPDATE_SIZE_LIMITS),
|
||||||
fServer(server),
|
fServer(server),
|
||||||
fEditingWindow(NULL)
|
fEditingWindow(NULL)
|
||||||
{
|
{
|
||||||
|
@ -61,6 +62,7 @@ RosterEditWindow::RosterEditWindow(Server* server)
|
||||||
fRosterView->GetFontHeight(&fontHeight);
|
fRosterView->GetFontHeight(&fontHeight);
|
||||||
int16 buttonHeight = int16(fontHeight.ascent + fontHeight.descent + 12);
|
int16 buttonHeight = int16(fontHeight.ascent + fontHeight.descent + 12);
|
||||||
BSize charButtonSize(buttonHeight, buttonHeight);
|
BSize charButtonSize(buttonHeight, buttonHeight);
|
||||||
|
|
||||||
BButton* fAddButton = new BButton("+", new BMessage(kAddMember));
|
BButton* fAddButton = new BButton("+", new BMessage(kAddMember));
|
||||||
BButton* fRemoveButton = new BButton("-", new BMessage(kRemoveMember));
|
BButton* fRemoveButton = new BButton("-", new BMessage(kRemoveMember));
|
||||||
fAddButton->SetExplicitSize(charButtonSize);
|
fAddButton->SetExplicitSize(charButtonSize);
|
||||||
|
|
|
@ -35,7 +35,8 @@ const uint32 kSelNoAccount = 'RWNA';
|
||||||
RosterWindow::RosterWindow(const char* title, BMessage* selectMsg,
|
RosterWindow::RosterWindow(const char* title, BMessage* selectMsg,
|
||||||
BMessenger* messenger, Server* server, bigtime_t instance)
|
BMessenger* messenger, Server* server, bigtime_t instance)
|
||||||
:
|
:
|
||||||
BWindow(BRect(0, 0, 300, 400), title, B_FLOATING_WINDOW, 0),
|
BWindow(BRect(0, 0, 300, 400), title, B_FLOATING_WINDOW,
|
||||||
|
B_AUTO_UPDATE_SIZE_LIMITS),
|
||||||
fTarget(messenger),
|
fTarget(messenger),
|
||||||
fMessage(selectMsg),
|
fMessage(selectMsg),
|
||||||
fServer(server)
|
fServer(server)
|
||||||
|
|
Ŝarĝante…
Reference in New Issue