From 68bf78e01591cbef27b43698621d895c0ba6c14e Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Sat, 29 Jan 2005 20:47:37 +0000 Subject: [PATCH] Removed beep when Go() is called because Be's version doesn't beep, fixed button sizes in B_WIDTH_FROM_LABEL mode. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11136 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Alert.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp index 91ec8293c6..254a98a744 100644 --- a/src/kits/interface/Alert.cpp +++ b/src/kits/interface/Alert.cpp @@ -255,8 +255,6 @@ char BAlert::Shortcut(int32 index) const //------------------------------------------------------------------------------ int32 BAlert::Go() { - system_beep(NULL); // forces the "beep" event - fAlertSem = create_sem(0, "AlertSem"); if (fAlertSem < B_OK) { @@ -535,7 +533,11 @@ void BAlert::InitObject(const char* text, const char* button0, break; case B_WIDTH_FROM_LABEL: - fButtons[i]->ResizeToPreferred(); + fButtons[i]->GetPreferredSize(&buttonWidth, &buttonHeight); + // GetPreferredSize() does not return the minimum width required to + // fit the label. Thus, the width is computed here. + buttonWidth = fButtons[i]->StringWidth(fButtons[i]->Label()) + 20.0f; + fButtons[i]->ResizeTo(buttonWidth, buttonHeight); break; default: // B_WIDTH_AS_USUAL