1/* 2Open Tracker License 3 4Terms and Conditions 5 6Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 7 8Permission is hereby granted, free of charge, to any person obtaining a copy of 9this software and associated documentation files (the "Software"), to deal in 10the Software without restriction, including without limitation the rights to 11use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12of the Software, and to permit persons to whom the Software is furnished to do 13so, subject to the following conditions: 14 15The above copyright notice and this permission notice applies to all licensees 16and shall be included in all copies or substantial portions of the Software. 17 18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 23WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 25Except as contained in this notice, the name of Be Incorporated shall not be 26used in advertising or otherwise to promote the sale, use or other dealings in 27this Software without prior written authorization from Be Incorporated. 28 29Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered 30trademarks of Be Incorporated in the United States and other countries. Other 31brand product names are registered trademarks or trademarks of their respective 32holders. 33All 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 46class TTeamGroup; 47class TIconView; 48class TBox; 49class TWindowView; 50class TSwitcherWindow; 51struct client_window_info; 52 53class TSwitchManager : public BHandler { 54public: 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 87private: 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