xref: /haiku/src/apps/deskbar/TeamMenuItem.h (revision f2b4344867e97c3f4e742a1b4a15e6879644601a)
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 //	Individual team/application listing
39 //	item for TeamMenu in mini/vertical mode
40 // 	item for ExpandoMenuBar in vertical or horizontal expanded mode
41 
42 #include <MenuItem.h>
43 
44 #include "WindowMenuItem.h"
45 #include "BarMenuBar.h"
46 
47 
48 class BBitmap;
49 
50 
51 class TTeamMenuItem : public BMenuItem {
52 	public:
53 		TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
54 			float width = -1.0f, float height = -1.0f,
55 			bool drawLabel = true, bool vertical = true);
56 		TTeamMenuItem(float width = -1.0f, float height = -1.0f,
57 			bool vertical = true);
58 		virtual ~TTeamMenuItem();
59 
60 		status_t Invoke(BMessage* msg = NULL);
61 
62 		void SetOverrideWidth(float width);
63 		void SetOverrideHeight(float height);
64 		void SetOverrideSelected(bool selected);
65 
66 		bool IsExpanded();
67 		void ToggleExpandState(bool resizeWindow);
68 		BRect ExpanderBounds() const;
69 		TWindowMenuItem* ExpandedWindowItem(int32 id);
70 
71 		float LabelWidth() const;
72 		BList* Teams() const;
73 		const char* Signature() const;
74 		const char* Name() const;
75 
76 	protected:
77 		void GetContentSize(float* width, float* height);
78 		void Draw();
79 		void DrawContent();
80 		void DrawContentLabel();
81 
82 	private:
83 		friend class TExpandoMenuBar;
84 		void InitData(BList* team, BBitmap* icon, char* name, char* sig,
85 			float width = -1.0f, float height = -1.0f,
86 			bool drawLabel = true, bool vertical = true);
87 
88 		bool _IsSelected() const;
89 
90 		BList* fTeam;
91 		BBitmap* fIcon;
92 		char* fName;
93 		char* fSig;
94 		float fLabelWidth;
95 		float fLabelAscent;
96 		float fLabelDescent;
97 		float fOverrideWidth;
98 		float fOverrideHeight;
99 
100 		bool fDrawLabel;
101 		bool fVertical;
102 
103 		bool fExpanded;
104 		bool fOverriddenSelected;
105 };
106 
107 #endif /* TEAMMENUITEM_H */
108 
109