1 /* 2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef SET_TITLE_DIALOG_H 6 #define SET_TITLE_DIALOG_H 7 8 9 #include <String.h> 10 #include <Window.h> 11 12 13 class BButton; 14 class BTextControl; 15 16 17 class SetTitleDialog : public BWindow { 18 public: 19 class Listener; 20 21 public: 22 SetTitleDialog(const char* dialogTitle, 23 const char* label, const char* toolTip); 24 virtual ~SetTitleDialog(); 25 26 void Go(const BString& title, bool titleUserDefined, 27 Listener* listener); 28 void Finish(); 29 // window must be locked 30 31 virtual void MessageReceived(BMessage* message); 32 33 private: 34 Listener* fListener; 35 BTextControl* fTitleTextControl; 36 BButton* fOKButton; 37 BButton* fCancelButton; 38 BButton* fDefaultButton; 39 BString fOldTitle; 40 BString fTitle; 41 bool fOldTitleUserDefined; 42 bool fTitleUserDefined; 43 }; 44 45 46 class SetTitleDialog::Listener { 47 public: 48 virtual ~Listener(); 49 50 // hooks called in the dialog thread with the window locked 51 virtual void TitleChanged(SetTitleDialog* dialog, 52 const BString& title, 53 bool titleUserDefined) = 0; 54 virtual void SetTitleDialogDone(SetTitleDialog* dialog) = 0; 55 }; 56 57 58 #endif // SET_TITLE_DIALOG_H 59