xref: /haiku/src/apps/cortex/TipManager/TipWindow.h (revision 2600324b57fa31cdea1627d584d314f2a579c4a8)
1 // TipWindow.h
2 // * PURPOSE
3 //   A floating window used to display floating tips
4 //   (aka 'ToolTips'.)  May be subclassed to provide
5 //   a custom tip view or to extend the window's
6 //   behavior.
7 //
8 // * HISTORY
9 //   e.moon		17oct99		Begun (based on TipFloater.)
10 
11 #ifndef __TipWindow_H__
12 #define __TipWindow_H__
13 
14 #include <String.h>
15 #include <Window.h>
16 
17 #include "cortex_defs.h"
18 __BEGIN_CORTEX_NAMESPACE
19 
20 class TipView;
21 
22 class TipWindow :
23 	public	BWindow {
24 	typedef	BWindow _inherited;
25 
26 public:											// *** dtor/ctors
27 	virtual ~TipWindow();
28 	TipWindow(
29 		const char*							text=0);
30 
31 public:											// *** operations (LOCK REQUIRED)
32 
33 	const char* text() const;
34 	virtual void setText(
35 		const char*							text);
36 
37 protected:									// *** hooks
38 	// override to substitute your own view class
39 	virtual TipView* createTipView();
40 
41 public:											// *** BWindow
42 
43 	// initializes the tip view
44 	virtual void Show();
45 
46 	// remove tip view? +++++
47 	virtual void Hide();
48 
49 	// hides the window when the user switches workspaces
50 	// +++++ should it be restored when the user switches back?
51 	virtual void WorkspaceActivated(
52 		int32										workspace,
53 		bool										active);
54 
55 private:										// implementation
56 	TipView*									m_tipView;
57 	BString										m_text;
58 
59 	void _createTipView();
60 	void _destroyTipView();
61 };
62 
63 __END_CORTEX_NAMESPACE
64 #endif /*__TipWindow_H__*/
65