diff --git a/headers/private/shared/PromptWindow.h b/headers/private/shared/PromptWindow.h index 80d376fd26..3ab547a2b9 100644 --- a/headers/private/shared/PromptWindow.h +++ b/headers/private/shared/PromptWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef PROMPT_WINDOW_H_ @@ -10,6 +10,7 @@ #include +class BStringView; class BTextControl; @@ -17,8 +18,9 @@ class PromptWindow : public BWindow { public: // PromptWindow takes ownership of message - PromptWindow(const char* title, const char* label, BMessenger target, - BMessage* message = NULL); + PromptWindow(const char* title, + const char* label, const char* info, + BMessenger target, BMessage* message = NULL); ~PromptWindow(); virtual void MessageReceived(BMessage* message); @@ -27,6 +29,7 @@ public: status_t SetMessage(BMessage* message); private: BTextControl* fTextControl; + BStringView* fInfoView; BMessenger fTarget; BMessage* fMessage; }; diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 4d0b3416bf..a055780a22 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -1517,7 +1517,8 @@ VariablesView::MessageReceived(BMessage* message) promptMessage->AddPointer("node", fVariableTable ->SelectionModel()->NodeAt(0)); PromptWindow* promptWindow = new(std::nothrow) PromptWindow( - "Specify Type", "Type: ", BMessenger(this), promptMessage); + "Specify Type", "Type: ", NULL, BMessenger(this), + promptMessage); if (promptWindow == NULL) return; diff --git a/src/kits/shared/PromptWindow.cpp b/src/kits/shared/PromptWindow.cpp index 33a36c7d0d..53ce2f0956 100644 --- a/src/kits/shared/PromptWindow.cpp +++ b/src/kits/shared/PromptWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #include "PromptWindow.h" @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -14,13 +15,14 @@ static const uint32 kAcceptInput = 'acin'; PromptWindow::PromptWindow(const char* title, const char* label, - BMessenger target, BMessage* message) + const char* info, BMessenger target, BMessage* message) : BWindow(BRect(), title, B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE), fTarget(target), fMessage(message) { + fInfoView = new BStringView("info", info); fTextControl = new BTextControl("promptcontrol", label, NULL, new BMessage(kAcceptInput)); BButton* cancelButton = new BButton("Cancel", new @@ -28,11 +30,15 @@ PromptWindow::PromptWindow(const char* title, const char* label, BButton* acceptButton = new BButton("Accept", new BMessage(kAcceptInput)); BLayoutBuilder::Group<>(this, B_VERTICAL) + .Add(fInfoView) .Add(fTextControl) .AddGroup(B_HORIZONTAL) .Add(acceptButton) .Add(cancelButton); + if (info == NULL) + fInfoView->Hide(); + fTextControl->TextView()->SetExplicitMinSize(BSize( fTextControl->TextView()->StringWidth("1234567890"), B_SIZE_UNSET)); fTextControl->SetTarget(this);