xref: /haiku/src/apps/deskbar/TeamMenuItem.h (revision 1687edd0fde594cd6f7c88f58a264c4787b4327d)
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 
29*1687edd0SFredrik Holmqvist Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
30*1687edd0SFredrik Holmqvist trademarks of Be Incorporated in the United States and other countries. Other
31*1687edd0SFredrik Holmqvist brand product names are registered trademarks or trademarks of their respective
32*1687edd0SFredrik Holmqvist holders.
3341281cf3SAxel Dörfler All rights reserved.
3441281cf3SAxel Dörfler */
3541281cf3SAxel Dörfler #ifndef TEAMMENUITEM_H
3641281cf3SAxel Dörfler #define TEAMMENUITEM_H
3741281cf3SAxel Dörfler 
3841281cf3SAxel Dörfler //	Individual team/application listing
3941281cf3SAxel Dörfler //	item for TeamMenu in mini/vertical mode
4041281cf3SAxel Dörfler // 	item for ExpandoMenuBar in vertical or horizontal expanded mode
4141281cf3SAxel Dörfler 
4241281cf3SAxel Dörfler #include <MenuItem.h>
4341281cf3SAxel Dörfler 
4441281cf3SAxel Dörfler #include "WindowMenuItem.h"
4541281cf3SAxel Dörfler #include "BarMenuBar.h"
4641281cf3SAxel Dörfler 
4741281cf3SAxel Dörfler 
4841281cf3SAxel Dörfler class BBitmap;
4941281cf3SAxel Dörfler 
5041281cf3SAxel Dörfler 
5141281cf3SAxel Dörfler class TTeamMenuItem : public BMenuItem {
5241281cf3SAxel Dörfler 	public:
5341281cf3SAxel Dörfler 		TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
5441281cf3SAxel Dörfler 			float width = -1.0f, float height = -1.0f,
5541281cf3SAxel Dörfler 			bool drawLabel = true, bool vertical = true);
5671bd3ba5SJonas Sundström 		TTeamMenuItem(float width = -1.0f, float height = -1.0f,
5771bd3ba5SJonas Sundström 			bool vertical = true);
5841281cf3SAxel Dörfler 		virtual ~TTeamMenuItem();
5941281cf3SAxel Dörfler 
6041281cf3SAxel Dörfler 		status_t Invoke(BMessage* msg = NULL);
6141281cf3SAxel Dörfler 
6241281cf3SAxel Dörfler 		void SetOverrideWidth(float width);
6341281cf3SAxel Dörfler 		void SetOverrideHeight(float height);
64249a4a18SStephan Aßmus 		void SetOverrideSelected(bool selected);
6541281cf3SAxel Dörfler 
6641281cf3SAxel Dörfler 		bool IsExpanded();
6741281cf3SAxel Dörfler 		void ToggleExpandState(bool resizeWindow);
6841281cf3SAxel Dörfler 		BRect ExpanderBounds() const;
6941281cf3SAxel Dörfler 		TWindowMenuItem* ExpandedWindowItem(int32 id);
7041281cf3SAxel Dörfler 
7141281cf3SAxel Dörfler 		float LabelWidth() const;
7241281cf3SAxel Dörfler 		BList* Teams() const;
7341281cf3SAxel Dörfler 		const char* Signature() const;
7441281cf3SAxel Dörfler 		const char* Name() const;
7541281cf3SAxel Dörfler 
7641281cf3SAxel Dörfler 	protected:
7741281cf3SAxel Dörfler 		void GetContentSize(float* width, float* height);
7841281cf3SAxel Dörfler 		void Draw();
7941281cf3SAxel Dörfler 		void DrawContent();
8041281cf3SAxel Dörfler 		void DrawContentLabel();
8141281cf3SAxel Dörfler 
8241281cf3SAxel Dörfler 	private:
8341281cf3SAxel Dörfler 		friend class TExpandoMenuBar;
8441281cf3SAxel Dörfler 		void InitData(BList* team, BBitmap* icon, char* name, char* sig,
8541281cf3SAxel Dörfler 			float width = -1.0f, float height = -1.0f,
8641281cf3SAxel Dörfler 			bool drawLabel = true, bool vertical = true);
8741281cf3SAxel Dörfler 
88249a4a18SStephan Aßmus 		bool _IsSelected() const;
89249a4a18SStephan Aßmus 
9041281cf3SAxel Dörfler 		BList* fTeam;
9141281cf3SAxel Dörfler 		BBitmap* fIcon;
9241281cf3SAxel Dörfler 		char* fName;
9341281cf3SAxel Dörfler 		char* fSig;
9441281cf3SAxel Dörfler 		float fLabelWidth;
9541281cf3SAxel Dörfler 		float fLabelAscent;
9641281cf3SAxel Dörfler 		float fLabelDescent;
9741281cf3SAxel Dörfler 		float fOverrideWidth;
9841281cf3SAxel Dörfler 		float fOverrideHeight;
9941281cf3SAxel Dörfler 
10041281cf3SAxel Dörfler 		bool fDrawLabel;
10141281cf3SAxel Dörfler 		bool fVertical;
10241281cf3SAxel Dörfler 
10341281cf3SAxel Dörfler 		bool fExpanded;
104249a4a18SStephan Aßmus 		bool fOverriddenSelected;
10541281cf3SAxel Dörfler };
10641281cf3SAxel Dörfler 
10741281cf3SAxel Dörfler #endif /* TEAMMENUITEM_H */
10871bd3ba5SJonas Sundström 
109