xref: /haiku/src/apps/deskbar/TeamMenuItem.h (revision 90ae2e54f6ccaca73c011a2aa4cdd660417108ad)
1 /*
2 Open Tracker License
3 
4 Terms and Conditions
5 
6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy of
9 this software and associated documentation files (the "Software"), to deal in
10 the Software without restriction, including without limitation the rights to
11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 of the Software, and to permit persons to whom the Software is furnished to do
13 so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice applies to all licensees
16 and shall be included in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 Except as contained in this notice, the name of Be Incorporated shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings in
27 this Software without prior written authorization from Be Incorporated.
28 
29 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
30 trademarks of Be Incorporated in the United States and other countries. Other
31 brand product names are registered trademarks or trademarks of their respective
32 holders.
33 All rights reserved.
34 */
35 #ifndef TEAMMENUITEM_H
36 #define TEAMMENUITEM_H
37 
38 
39 //	Individual team/application listing
40 //	item for TeamMenu in mini/vertical mode
41 //	item for ExpandoMenuBar in vertical or horizontal expanded mode
42 
43 
44 #include <MenuItem.h>
45 
46 #include "WindowMenuItem.h"
47 #include "BarMenuBar.h"
48 
49 
50 class BBitmap;
51 
52 class TTeamMenuItem : public BMenuItem {
53 	public:
54 		TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
55 			float width = -1.0f, float height = -1.0f,
56 			bool drawLabel = true, bool vertical = true);
57 		TTeamMenuItem(float width = -1.0f, float height = -1.0f,
58 			bool vertical = true);
59 		virtual ~TTeamMenuItem();
60 
61 		status_t Invoke(BMessage* msg = NULL);
62 
63 		void SetOverrideWidth(float width);
64 		void SetOverrideHeight(float height);
65 		void SetOverrideSelected(bool selected);
66 
67 		bool HasLabel() const;
68 		void SetHasLabel(bool drawLabel);
69 
70 		bool IsExpanded();
71 		void ToggleExpandState(bool resizeWindow);
72 		BRect ExpanderBounds() const;
73 		TWindowMenuItem* ExpandedWindowItem(int32 id);
74 
75 		float LabelWidth() const;
76 		BList* Teams() const;
77 		const char* Signature() const;
78 		const char* Name() const;
79 
80 	protected:
81 		void GetContentSize(float* width, float* height);
82 		void Draw();
83 		void DrawContent();
84 		void DrawContentLabel();
85 
86 	private:
87 		friend class TExpandoMenuBar;
88 		void InitData(BList* team, BBitmap* icon, char* name, char* sig,
89 			float width = -1.0f, float height = -1.0f,
90 			bool drawLabel = true, bool vertical = true);
91 
92 		bool _IsSelected() const;
93 
94 		BList* fTeam;
95 		BBitmap* fIcon;
96 		char* fName;
97 		char* fSig;
98 		float fLabelWidth;
99 		float fLabelAscent;
100 		float fLabelDescent;
101 		float fOverrideWidth;
102 		float fOverrideHeight;
103 
104 		bool fDrawLabel;
105 		bool fVertical;
106 
107 		bool fExpanded;
108 		bool fOverriddenSelected;
109 };
110 
111 
112 #endif	/* TEAMMENUITEM_H */
113