xref: /haiku/src/apps/cortex/support/TextControlFloater.h (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 // TextControlFloater.h
2 // * PURPOSE
3 //   Display an editable text field in a simple pop-up window
4 //   (which must automatically close when the user hits 'enter'
5 //   or the window loses focus).
6 // * TO DO +++++
7 //   escape key -> cancel
8 //
9 // * HISTORY
10 //   e.moon		23aug99		Begun
11 
12 #ifndef __TextControlFloater_H__
13 #define __TextControlFloater_H__
14 
15 #include <Messenger.h>
16 #include <Window.h>
17 
18 class BFont;
19 class BTextControl;
20 
21 #include "cortex_defs.h"
22 __BEGIN_CORTEX_NAMESPACE
23 
24 class TextControlFloater :
25 	public	BWindow {
26 	typedef	BWindow _inherited;
27 
28 public:												// dtor/ctors
29 	virtual ~TextControlFloater();
30 
31 	TextControlFloater(
32 		BRect											frame,
33 		alignment									align,
34 		const BFont*							font,
35 		const char*								text,
36 		const BMessenger&					target,
37 		BMessage*									message,
38 		BMessage*									cancelMessage=0);
39 
40 public:												// BWindow
41 	virtual void WindowActivated(
42 		bool											activated);
43 
44 	virtual bool QuitRequested();
45 
46 public:												// BHandler
47 	virtual void MessageReceived(
48 		BMessage*									message);
49 
50 private:
51 	BTextControl*								m_control;
52 
53 	BMessenger									m_target;
54 	const BMessage*							m_message;
55 	BMessage*										m_cancelMessage;
56 
57 	// true if a message has been sent indicating the
58 	// user modified the text
59 	bool												m_sentUpdate;
60 };
61 
62 __END_CORTEX_NAMESPACE
63 #endif /*__TextControlFloater_H__*/
64 
65