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