Tracker: File panel misc style fixes
Change-Id: I6376e52d26ac05e0f591c2484a7c7301cee6166b Reviewed-on: https://review.haiku-os.org/c/haiku/+/9523 Tested-by: Commit checker robot <[email protected]> Reviewed-by: John Scipione <[email protected]>
This commit is contained in:
@@ -1163,44 +1163,43 @@ TFilePanel::SetButtonLabel(file_panel_button selector, const char* text)
|
|||||||
{
|
{
|
||||||
switch (selector) {
|
switch (selector) {
|
||||||
case B_CANCEL_BUTTON:
|
case B_CANCEL_BUTTON:
|
||||||
{
|
{
|
||||||
BButton* button
|
BButton* button = dynamic_cast<BButton*>(FindView("cancel button"));
|
||||||
= dynamic_cast<BButton*>(FindView("cancel button"));
|
if (button == NULL)
|
||||||
if (button == NULL)
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
|
float old_width = button->StringWidth(button->Label());
|
||||||
|
button->SetLabel(text);
|
||||||
|
float delta = old_width - button->StringWidth(text);
|
||||||
|
if (delta) {
|
||||||
|
button->MoveBy(delta, 0);
|
||||||
|
button->ResizeBy(-delta, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case B_DEFAULT_BUTTON:
|
||||||
|
{
|
||||||
|
fButtonText = text;
|
||||||
|
float delta = 0;
|
||||||
|
BButton* button = dynamic_cast<BButton*>(FindView("default button"));
|
||||||
|
if (button != NULL) {
|
||||||
float old_width = button->StringWidth(button->Label());
|
float old_width = button->StringWidth(button->Label());
|
||||||
button->SetLabel(text);
|
button->SetLabel(text);
|
||||||
float delta = old_width - button->StringWidth(text);
|
delta = old_width - button->StringWidth(text);
|
||||||
if (delta) {
|
if (delta) {
|
||||||
button->MoveBy(delta, 0);
|
button->MoveBy(delta, 0);
|
||||||
button->ResizeBy(-delta, 0);
|
button->ResizeBy(-delta, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case B_DEFAULT_BUTTON:
|
// now must move cancel button
|
||||||
{
|
button = dynamic_cast<BButton*>(FindView("cancel button"));
|
||||||
fButtonText = text;
|
if (button != NULL)
|
||||||
float delta = 0;
|
button->MoveBy(delta, 0);
|
||||||
BButton* button
|
|
||||||
= dynamic_cast<BButton*>(FindView("default button"));
|
|
||||||
if (button != NULL) {
|
|
||||||
float old_width = button->StringWidth(button->Label());
|
|
||||||
button->SetLabel(text);
|
|
||||||
delta = old_width - button->StringWidth(text);
|
|
||||||
if (delta) {
|
|
||||||
button->MoveBy(delta, 0);
|
|
||||||
button->ResizeBy(-delta, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now must move cancel button
|
|
||||||
button = dynamic_cast<BButton*>(FindView("cancel button"));
|
|
||||||
if (button != NULL)
|
|
||||||
button->MoveBy(delta, 0);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1211,8 +1210,7 @@ TFilePanel::SetSaveText(const char* text)
|
|||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BTextControl* textControl
|
BTextControl* textControl = dynamic_cast<BTextControl*>(FindView("text view"));
|
||||||
= dynamic_cast<BTextControl*>(FindView("text view"));
|
|
||||||
if (textControl != NULL) {
|
if (textControl != NULL) {
|
||||||
textControl->SetText(text);
|
textControl->SetText(text);
|
||||||
if (textControl->TextView() != NULL)
|
if (textControl->TextView() != NULL)
|
||||||
@@ -1410,6 +1408,7 @@ TFilePanel::MessageReceived(BMessage* message)
|
|||||||
HandleSaveButton();
|
HandleSaveButton();
|
||||||
} else
|
} else
|
||||||
HandleOpenButton();
|
HandleOpenButton();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_OBSERVER_NOTICE_CHANGE:
|
case B_OBSERVER_NOTICE_CHANGE:
|
||||||
|
|||||||
Reference in New Issue
Block a user