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