xref: /haiku/src/apps/debuganalyzer/gui/SubWindow.h (revision 5147963dcd57fefa4f63c484eb88e9eaf4002976)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef SUB_WINDOW_H
6 #define SUB_WINDOW_H
7 
8 #include <Window.h>
9 
10 #include <util/OpenHashTable.h>
11 
12 
13 class SubWindowManager;
14 
15 
16 class SubWindowKey {
17 public:
18 	virtual						~SubWindowKey();
19 
20 	virtual	bool				Equals(const SubWindowKey* other) const = 0;
21 	virtual	size_t				HashCode() const = 0;
22 };
23 
24 
25 class ObjectSubWindowKey : public SubWindowKey {
26 public:
27 								ObjectSubWindowKey(void* object);
28 
29 	virtual	bool				Equals(const SubWindowKey* other) const;
30 	virtual	size_t				HashCode() const;
31 
32 private:
33 			void*				fObject;
34 };
35 
36 
37 class SubWindow : public BWindow {
38 public:
39 								SubWindow(SubWindowManager* manager,
40 									BRect frame, const char* title,
41 									window_type type, uint32 flags,
42 									uint32 workspace = B_CURRENT_WORKSPACE);
43 	virtual						~SubWindow();
44 
45 	inline	SubWindowKey*		GetSubWindowKey() const;
46 
47 			bool				AddToSubWindowManager(SubWindowKey* key);
48 			bool				RemoveFromSubWindowManager();
49 
50 protected:
51 			SubWindowManager*	fSubWindowManager;
52 			SubWindowKey*		fSubWindowKey;
53 
54 public:
55 			SubWindow*			fNext;
56 };
57 
58 
59 SubWindowKey*
GetSubWindowKey()60 SubWindow::GetSubWindowKey() const
61 {
62 	return fSubWindowKey;
63 }
64 
65 
66 #endif	// SUB_WINDOW_H
67