xref: /haiku/src/apps/cortex/support/TextControlFloater.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
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 BTextControl;
19 
20 #include "cortex_defs.h"
21 __BEGIN_CORTEX_NAMESPACE
22 
23 class TextControlFloater :
24 	public	BWindow {
25 	typedef	BWindow _inherited;
26 
27 public:												// dtor/ctors
28 	virtual ~TextControlFloater();
29 
30 	TextControlFloater(
31 		BRect											frame,
32 		alignment									align,
33 		const BFont*							font,
34 		const char*								text,
35 		const BMessenger&					target,
36 		BMessage*									message,
37 		BMessage*									cancelMessage=0);
38 
39 public:												// BWindow
40 	virtual void WindowActivated(
41 		bool											activated);
42 
43 	virtual bool QuitRequested();
44 
45 public:												// BHandler
46 	virtual void MessageReceived(
47 		BMessage*									message);
48 
49 private:
50 	BTextControl*								m_control;
51 
52 	BMessenger									m_target;
53 	const BMessage*							m_message;
54 	BMessage*										m_cancelMessage;
55 
56 	// true if a message has been sent indicating the
57 	// user modified the text
58 	bool												m_sentUpdate;
59 };
60 
61 __END_CORTEX_NAMESPACE
62 #endif /*__TextControlFloater_H__*/
63 
64