xref: /haiku/src/apps/deskbar/WindowMenuItem.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
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 trademarks
30 of Be Incorporated in the United States and other countries. Other brand product
31 names are registered trademarks or trademarks of their respective holders.
32 All rights reserved.
33 */
34 
35 //	individual windows of an application
36 //	item for WindowMenu, sub of TeamMenuItem
37 //	all DB positions
38 
39 #ifndef WINDOWMENUITEM_H
40 #define WINDOWMENUITEM_H
41 
42 #include <MenuItem.h>
43 #include <String.h>
44 
45 
46 class BBitmap;
47 
48 
49 class TWindowMenuItem : public BMenuItem {
50 	public:
51 		TWindowMenuItem(const char *title, int32 id, bool mini,
52 			bool currentWorkSpace, bool dragging = false);
53 
54 		void ExpandedItem(bool state);
55 		void SetTo(const char *title, int32 id, bool mini,
56 			bool currentWorkSpace, bool dragging = false);
57 		int32 ID();
58 		void SetRequireUpdate();
59 		bool RequiresUpdate();
60 		bool ChangedState();
61 
62 	virtual	void	SetLabel(const char* string);
63 
64 	protected:
65 		void Initialize(const char *title);
66 		virtual	void GetContentSize(float *width, float *height);
67 		virtual void DrawContent();
68 		virtual status_t Invoke(BMessage *message = NULL);
69 		virtual void Draw();
70 
71 	private:
72 		int32			fID;
73 		bool			fMini;
74 		bool			fCurrentWorkSpace;
75 		const BBitmap*	fBitmap;
76 		float			fTitleWidth;
77 		float			fTitleAscent;
78 		float			fTitleDescent;
79 		bool			fDragging;
80 		bool			fExpanded;
81 		bool			fRequireUpdate;
82 		bool			fModified;
83 		BString			fFullTitle;
84 };
85 
86 /****************************************************************************
87 ** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING **
88 **                                                                         **
89 **                          DANGER, WILL ROBINSON!                         **
90 **                                                                         **
91 ** The rest of the interfaces contained here are part of BeOS's            **
92 **                                                                         **
93 **                     >> PRIVATE NOT FOR PUBLIC USE <<                    **
94 **                                                                         **
95 **                                                       implementation.   **
96 **                                                                         **
97 ** These interfaces              WILL CHANGE        in future releases.    **
98 ** If you use them, your app     WILL BREAK         at some future time.   **
99 **                                                                         **
100 ** (And yes, this does mean that binaries built from OpenTracker will not  **
101 ** be compatible with some future releases of the OS.  When that happens,  **
102 ** we will provide an updated version of this file to keep compatibility.) **
103 **                                                                         **
104 ** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING **
105 ****************************************************************************/
106 
107 // from interface_defs.h
108 struct window_info {
109 	team_id		team;
110     int32   	id;	  		  /* window's token */
111 
112 	int32		thread;
113 	int32		client_token;
114 	int32		client_port;
115 	uint32		workspaces;
116 
117 	int32		layer;
118     uint32	  	w_type;    	  /* B_TITLED_WINDOW, etc. */
119     uint32      flags;	  	  /* B_WILL_FLOAT, etc. */
120 	int32		window_left;
121 	int32		window_top;
122 	int32		window_right;
123 	int32		window_bottom;
124 	int32		show_hide_level;
125 	bool		is_mini;
126 	char		name[1];
127 };
128 
129 // from interface_misc.h
130 enum window_action {
131 	B_MINIMIZE_WINDOW,
132 	B_BRING_TO_FRONT
133 };
134 
135 // from interface_misc.h
136 void		do_window_action(int32 window_id, int32 action,
137 							 BRect zoomRect, bool zoom);
138 window_info	*get_window_info(int32 a_token);
139 int32		*get_token_list(team_id app, int32 *count);
140 void do_minimize_team(BRect zoomRect, team_id team, bool zoom);
141 void do_bring_to_front_team(BRect zoomRect, team_id app, bool zoom);
142 
143 
144 #endif /* WINDOWMENUITEM_H */
145