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 class BFile; 107 class BList; 108 class BBitmap; 109 class PreferencesWindow; 110 class TBarView; 111 class TBarWindow; 112 113 114 class BarTeamInfo { 115 public: 116 BarTeamInfo(BList* teams, uint32 flags, char* sig, BBitmap* icon, 117 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 129 class TBarApp : public BApplication { 130 public: 131 TBarApp(); 132 virtual ~TBarApp(); 133 134 virtual bool QuitRequested(); 135 virtual void MessageReceived(BMessage* message); 136 virtual void RefsReceived(BMessage* refs); 137 138 desk_settings* Settings() { return &fSettings; } 139 clock_settings* ClockSettings() { return &fClockSettings; } 140 TBarView* BarView() const { return fBarView; } 141 TBarWindow* BarWindow() const { return fBarWindow; } 142 143 static void Subscribe(const BMessenger &subscriber, BList*); 144 static void Unsubscribe(const BMessenger &subscriber); 145 int32 IconSize(); 146 147 private: 148 void AddTeam(team_id team, uint32 flags, const char* sig, entry_ref*); 149 void RemoveTeam(team_id); 150 151 void InitSettings(); 152 void SaveSettings(); 153 154 void ShowPreferencesWindow(); 155 void ResizeTeamIcons(); 156 void FetchAppIcon(const char* signature, BBitmap* icon); 157 BRect IconRect(); 158 159 TBarWindow* fBarWindow; 160 TBarView* fBarView; 161 BMessenger fSwitcherMessenger; 162 BMessenger fStatusViewMessenger; 163 BFile* fSettingsFile; 164 BFile* fClockSettingsFile; 165 desk_settings fSettings; 166 clock_settings fClockSettings; 167 168 PreferencesWindow* fPreferencesWindow; 169 170 static BLocker sSubscriberLock; 171 static BList sBarTeamInfoList; 172 static BList sSubscribers; 173 }; 174 175 176 #endif /* BAR_APP_H */ 177