xref: /haiku/src/apps/deskbar/TeamMenuItem.h (revision 4f97a431b966877dc688abbe106a2967a2c93653)
141281cf3SAxel Dörfler /*
241281cf3SAxel Dörfler Open Tracker License
341281cf3SAxel Dörfler 
441281cf3SAxel Dörfler Terms and Conditions
541281cf3SAxel Dörfler 
641281cf3SAxel Dörfler Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
741281cf3SAxel Dörfler 
841281cf3SAxel Dörfler Permission is hereby granted, free of charge, to any person obtaining a copy of
941281cf3SAxel Dörfler this software and associated documentation files (the "Software"), to deal in
1041281cf3SAxel Dörfler the Software without restriction, including without limitation the rights to
1141281cf3SAxel Dörfler use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
1241281cf3SAxel Dörfler of the Software, and to permit persons to whom the Software is furnished to do
1341281cf3SAxel Dörfler so, subject to the following conditions:
1441281cf3SAxel Dörfler 
1541281cf3SAxel Dörfler The above copyright notice and this permission notice applies to all licensees
1641281cf3SAxel Dörfler and shall be included in all copies or substantial portions of the Software.
1741281cf3SAxel Dörfler 
1841281cf3SAxel Dörfler THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1941281cf3SAxel Dörfler IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
2041281cf3SAxel Dörfler FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2141281cf3SAxel Dörfler BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
2241281cf3SAxel Dörfler AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
2341281cf3SAxel Dörfler WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2441281cf3SAxel Dörfler 
2541281cf3SAxel Dörfler Except as contained in this notice, the name of Be Incorporated shall not be
2641281cf3SAxel Dörfler used in advertising or otherwise to promote the sale, use or other dealings in
2741281cf3SAxel Dörfler this Software without prior written authorization from Be Incorporated.
2841281cf3SAxel Dörfler 
291687edd0SFredrik Holmqvist Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
301687edd0SFredrik Holmqvist trademarks of Be Incorporated in the United States and other countries. Other
311687edd0SFredrik Holmqvist brand product names are registered trademarks or trademarks of their respective
321687edd0SFredrik Holmqvist holders.
3341281cf3SAxel Dörfler All rights reserved.
3441281cf3SAxel Dörfler */
359f339a00SJohn Scipione #ifndef TEAM_MENU_ITEM_H
369f339a00SJohn Scipione #define TEAM_MENU_ITEM_H
3741281cf3SAxel Dörfler 
381cd61330SJohn Scipione 
3941281cf3SAxel Dörfler //	Individual team/application listing
4041281cf3SAxel Dörfler //	item for TeamMenu in mini/vertical mode
4141281cf3SAxel Dörfler //	item for ExpandoMenuBar in vertical or horizontal expanded mode
4241281cf3SAxel Dörfler 
431cd61330SJohn Scipione 
44c9363f78SJohn Scipione #include "TruncatableMenuItem.h"
4541281cf3SAxel Dörfler 
4641281cf3SAxel Dörfler 
4715eb397eSJohn Scipione const float kSwitchWidth = 12.0f;
4815eb397eSJohn Scipione 
49*4f97a431SJohn Scipione const uint32 kMinimizeTeam = 'mntm';
50*4f97a431SJohn Scipione const uint32 kBringTeamToFront = 'bftm';
51*4f97a431SJohn Scipione 
5215eb397eSJohn Scipione 
5341281cf3SAxel Dörfler class BBitmap;
54c9363f78SJohn Scipione class TBarView;
55c9363f78SJohn Scipione class TWindowMenuItem;
5641281cf3SAxel Dörfler 
57c9363f78SJohn Scipione class TTeamMenuItem : public TTruncatableMenuItem {
5841281cf3SAxel Dörfler public:
595b0fd10dSJohn Scipione 								TTeamMenuItem(BList* team, BBitmap* icon,
605af340efSJohn Scipione 									char* name, char* signature,
6118bcf77aSJohn Scipione 									float width = -1.0f, float height = -1.0f);
625b0fd10dSJohn Scipione 								TTeamMenuItem(float width = -1.0f,
6318bcf77aSJohn Scipione 									float height = -1.0f);
6441281cf3SAxel Dörfler 	virtual						~TTeamMenuItem();
6541281cf3SAxel Dörfler 
66*4f97a431SJohn Scipione 			bool				HandleMouseDown(BPoint where);
675e625eadSJohn Scipione 			status_t			Invoke(BMessage* message = NULL);
6841281cf3SAxel Dörfler 
SetOverrideWidth(float width)69c9d2a320SJohn Scipione 			void				SetOverrideWidth(float width)
70c9d2a320SJohn Scipione 									{ fOverrideWidth = width; };
SetOverrideHeight(float height)71c9d2a320SJohn Scipione 			void				SetOverrideHeight(float height)
72c9d2a320SJohn Scipione 									{ fOverrideHeight = height; };
73249a4a18SStephan Aßmus 			void				SetOverrideSelected(bool selected);
741f0c9f18SJohn Scipione 
ArrowDirection()75c9d2a320SJohn Scipione 			int32				ArrowDirection() const
76c9d2a320SJohn Scipione 									{ return fArrowDirection; };
SetArrowDirection(int32 direction)77c9d2a320SJohn Scipione 			void				SetArrowDirection(int32 direction)
78c9d2a320SJohn Scipione 									{ fArrowDirection = direction; };
791dccb7aaSJohn Scipione 
Icon()80c9d2a320SJohn Scipione 			BBitmap*			Icon() const { return fIcon; };
81c9d2a320SJohn Scipione 			void				SetIcon(BBitmap* icon);
8241281cf3SAxel Dörfler 
IsExpanded()831dccb7aaSJohn Scipione 			bool				IsExpanded() const { return fExpanded; };
8441281cf3SAxel Dörfler 			void				ToggleExpandState(bool resizeWindow);
856b65d934SJohn Scipione 
8641281cf3SAxel Dörfler 			BRect				ExpanderBounds() const;
8741281cf3SAxel Dörfler 			TWindowMenuItem*	ExpandedWindowItem(int32 id);
8841281cf3SAxel Dörfler 
LabelWidth()891dccb7aaSJohn Scipione 			float				LabelWidth() const { return fLabelWidth; };
Teams()901dccb7aaSJohn Scipione 			BList*				Teams() const { return fTeam; };
Signature()91c9363f78SJohn Scipione 			const char*			Signature() const { return fSignature; };
9241281cf3SAxel Dörfler 
9341281cf3SAxel Dörfler protected:
9441281cf3SAxel Dörfler 			void				GetContentSize(float* width, float* height);
9541281cf3SAxel Dörfler 			void				Draw();
9641281cf3SAxel Dörfler 			void				DrawContent();
971dccb7aaSJohn Scipione 			void				DrawExpanderArrow();
9841281cf3SAxel Dörfler 
9941281cf3SAxel Dörfler private:
100e9982f68SJohn Scipione 			void				_Init(BList* team, BBitmap* icon,
101c9363f78SJohn Scipione 									char* name, char* signature,
10218bcf77aSJohn Scipione 									float width = -1.0f, float height = -1.0f);
10341281cf3SAxel Dörfler 
104249a4a18SStephan Aßmus 			bool				_IsSelected() const;
105249a4a18SStephan Aßmus 
1065b0fd10dSJohn Scipione private:
10741281cf3SAxel Dörfler 			BList*				fTeam;
10841281cf3SAxel Dörfler 			BBitmap*			fIcon;
109c9363f78SJohn Scipione 			char*				fSignature;
1106b65d934SJohn Scipione 
11141281cf3SAxel Dörfler 			float				fOverrideWidth;
11241281cf3SAxel Dörfler 			float				fOverrideHeight;
11341281cf3SAxel Dörfler 
1141dccb7aaSJohn Scipione 			TBarView*			fBarView;
1151dccb7aaSJohn Scipione 			float				fLabelWidth;
1161dccb7aaSJohn Scipione 			float				fLabelAscent;
1171dccb7aaSJohn Scipione 			float				fLabelDescent;
11815eb397eSJohn Scipione 			float				fLabelHeight;
1191dccb7aaSJohn Scipione 
120249a4a18SStephan Aßmus 			bool				fOverriddenSelected;
1211dccb7aaSJohn Scipione 
1221dccb7aaSJohn Scipione 			bool				fExpanded;
1231dccb7aaSJohn Scipione 			int32				fArrowDirection;
12441281cf3SAxel Dörfler };
12541281cf3SAxel Dörfler 
12671bd3ba5SJonas Sundström 
1279f339a00SJohn Scipione #endif	// TEAM_MENU_ITEM_H
128