xref: /haiku/src/apps/deskbar/Switcher.h (revision 445d4fd926c569e7b9ae28017da86280aaecbae2)
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
30 trademarks of Be Incorporated in the United States and other countries. Other
31 brand product names are registered trademarks or trademarks of their respective
32 holders.
33 All rights reserved.
34 */
35 #ifndef SWITCHER_H
36 #define SWITCHER_H
37 
38 
39 #include <Box.h>
40 #include <List.h>
41 #include <OS.h>
42 #include <StringView.h>
43 #include <Window.h>
44 
45 
46 class TTeamGroup;
47 class TIconView;
48 class TBox;
49 class TWindowView;
50 class TSwitcherWindow;
51 struct client_window_info;
52 
53 class TSwitchManager : public BHandler {
54 public:
55 							TSwitchManager();
56 	virtual					~TSwitchManager();
57 
58 	virtual void			MessageReceived(BMessage* message);
59 
60 			void			Stop(bool doAction, uint32 modifiers);
61 			void			Unblock();
62 			int32			CurrentIndex();
63 			int32			CurrentWindow();
64 			int32			CurrentSlot();
65 			BList*			GroupList();
66 
67 			void			QuitApp();
68 			void			HideApp();
69 			void			CycleApp(bool forward, bool activate = false);
70 			void			CycleWindow(bool forward, bool wrap = true);
71 			void			SwitchToApp(int32 prevIndex, int32 newIndex,
72 								bool forward);
73 
74 			client_window_info* WindowInfo(int32 groupIndex, int32 windowIndex);
75 			int32			CountWindows(int32 groupIndex,
76 								bool inCurrentWorkspace = false);
77 			TTeamGroup*		FindTeam(team_id, int32* index);
78 
79 			int32			LargeIconSize() { return fLargeIconSize; }
80 			int32			SmallIconSize() { return fSmallIconSize; }
81 			int32			SlotSize() { return fSlotSize; }
82 			int32			ScrollStep() { return fScrollStep; }
83 			int32			SlotCount() { return fSlotCount; }
84 			int32			CenterSlot() { return fCenterSlot; }
85 			BRect			CenterRect();
86 
87 private:
88 			void			MainEntry(BMessage* message);
89 			void			Process(bool forward, bool byWindow = false);
90 			void			QuickSwitch(BMessage* message);
91 			void			SwitchWindow(team_id team, bool forward,
92 								bool activate);
93 			bool			ActivateApp(bool forceShow,
94 								bool allowWorkspaceSwitch);
95 			void			ActivateWindow(int32 windowID = -1);
96 			void			_SortApps();
97 
98 			bool			_FindNextValidApp(bool forward);
99 
100 			TSwitcherWindow* fWindow;
101 			sem_id			fMainMonitor;
102 			bool			fBlock;
103 			bigtime_t		fSkipUntil;
104 			bigtime_t		fLastSwitch;
105 			int32			fQuickSwitchIndex;
106 			int32			fQuickSwitchWindow;
107 			BList			fGroupList;
108 			int32			fCurrentIndex;
109 			int32			fCurrentWindow;
110 			int32			fCurrentSlot;
111 			int32			fWindowID;
112 
113 			int32			fLargeIconSize;
114 			int32			fSmallIconSize;
115 			int32			fSlotSize;
116 			int32			fScrollStep;
117 			int32			fSlotCount;
118 			int32			fCenterSlot;
119 };
120 
121 
122 #endif	/* SWITCHER_H */
123