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 BAR_APP_H 36 #define BAR_APP_H 37 38 39 #include <Application.h> 40 #include <Catalog.h> 41 #include <List.h> 42 #include "BarWindow.h" 43 #include "PreferencesWindow.h" 44 45 46 /* ------------------------------------ */ 47 // Private app_server defines that I need to use 48 49 #define _DESKTOP_W_TYPE_ 1024 50 #define _FLOATER_W_TYPE_ 4 51 #define _STD_W_TYPE_ 0 52 53 54 class BarTeamInfo { 55 public: 56 BarTeamInfo(BList* teams, uint32 flags, char* sig, BBitmap* icon, 57 char* name); 58 BarTeamInfo(const BarTeamInfo &info); 59 ~BarTeamInfo(); 60 61 BList* teams; 62 uint32 flags; 63 char* sig; 64 BBitmap* icon; 65 char* name; 66 }; 67 68 const uint32 kWin95 = 'Bill'; 69 const uint32 kAmiga = 'Ncro'; 70 const uint32 kMac = 'WcOS'; 71 const uint32 kBe = 'Tabs'; 72 const uint32 kAlwaysTop = 'TTop'; 73 const uint32 kToggleDraggers = 'TDra'; 74 const uint32 kUnsubscribe = 'Unsb'; 75 const uint32 kAddTeam = 'AdTm'; 76 const uint32 kRemoveTeam = 'RmTm'; 77 const uint32 kRestart = 'Rtrt'; 78 const uint32 kShutDown = 'ShDn'; 79 const uint32 kTrackerFirst = 'TkFt'; 80 const uint32 kSortRunningApps = 'SAps'; 81 const uint32 kSuperExpando = 'SprE'; 82 const uint32 kExpandNewTeams = 'ExTm'; 83 const uint32 kAutoRaise = 'AtRs'; 84 const uint32 kAutoHide = 'AtHd'; 85 const uint32 kRestartTracker = 'Trak'; 86 87 // from roster_private.h 88 const uint32 kShutdownSystem = 301; 89 const uint32 kRebootSystem = 302; 90 const uint32 kSuspendSystem = 304; 91 92 /* --------------------------------------------- */ 93 94 struct desk_settings { 95 bool vertical; 96 bool left; 97 bool top; 98 bool ampmMode; 99 bool showTime; 100 uint32 state; 101 float width; 102 BPoint switcherLoc; 103 int32 recentAppsCount; 104 int32 recentDocsCount; 105 bool timeShowSeconds; 106 int32 recentFoldersCount; 107 bool alwaysOnTop; 108 bool timeFullDate; 109 bool trackerAlwaysFirst; 110 bool sortRunningApps; 111 bool superExpando; 112 bool expandNewTeams; 113 bool autoRaise; 114 bool autoHide; 115 bool recentAppsEnabled; 116 bool recentDocsEnabled; 117 bool recentFoldersEnabled; 118 }; 119 120 121 class TBarView; 122 class BFile; 123 124 using namespace BPrivate; 125 126 class TBarApp : public BApplication { 127 public: 128 TBarApp(); 129 virtual ~TBarApp(); 130 131 virtual bool QuitRequested(); 132 virtual void MessageReceived(BMessage* message); 133 virtual void RefsReceived(BMessage* refs); 134 135 desk_settings* Settings() 136 { return &fSettings; } 137 TBarView* BarView() const 138 { return fBarWindow->BarView(); } 139 TBarWindow* BarWindow() const 140 { return fBarWindow; } 141 142 static void Subscribe(const BMessenger &subscriber, BList*); 143 static void Unsubscribe(const BMessenger &subscriber); 144 145 private: 146 void AddTeam(team_id team, uint32 flags, const char* sig, entry_ref*); 147 void RemoveTeam(team_id); 148 149 void InitSettings(); 150 void SaveSettings(); 151 152 void ShowPreferencesWindow(); 153 154 TBarWindow* fBarWindow; 155 BMessenger fSwitcherMessenger; 156 BMessenger fStatusViewMessenger; 157 BFile* fSettingsFile; 158 desk_settings fSettings; 159 160 PreferencesWindow* fPreferencesWindow; 161 162 static BLocker sSubscriberLock; 163 static BList sBarTeamInfoList; 164 static BList sSubscribers; 165 }; 166 167 #endif // BAR_APP_H 168 169