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