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 bool showSeconds; 79 bool showDayOfWeek; 80 uint32 state; 81 float width; 82 BPoint switcherLoc; 83 int32 recentAppsCount; 84 int32 recentDocsCount; 85 bool timeShowSeconds; 86 int32 recentFoldersCount; 87 bool alwaysOnTop; 88 bool timeFullDate; 89 bool trackerAlwaysFirst; 90 bool sortRunningApps; 91 bool superExpando; 92 bool expandNewTeams; 93 bool hideLabels; 94 int32 iconSize; 95 bool autoRaise; 96 bool autoHide; 97 bool recentAppsEnabled; 98 bool recentDocsEnabled; 99 bool recentFoldersEnabled; 100 }; 101 102 class BFile; 103 class BList; 104 class BBitmap; 105 class PreferencesWindow; 106 class TBarView; 107 class TBarWindow; 108 109 110 class BarTeamInfo { 111 public: 112 BarTeamInfo(BList* teams, uint32 flags, char* sig, BBitmap* icon, 113 char* name); 114 BarTeamInfo(const BarTeamInfo &info); 115 ~BarTeamInfo(); 116 117 BList* teams; 118 uint32 flags; 119 char* sig; 120 BBitmap* icon; 121 char* name; 122 }; 123 124 125 class TBarApp : public BApplication { 126 public: 127 TBarApp(); 128 virtual ~TBarApp(); 129 130 virtual bool QuitRequested(); 131 virtual void MessageReceived(BMessage* message); 132 virtual void RefsReceived(BMessage* refs); 133 134 desk_settings* Settings() { return &fSettings; } 135 TBarView* BarView() const { return fBarView; } 136 TBarWindow* BarWindow() const { return fBarWindow; } 137 138 static void Subscribe(const BMessenger &subscriber, BList*); 139 static void Unsubscribe(const BMessenger &subscriber); 140 int32 IconSize(); 141 142 private: 143 void AddTeam(team_id team, uint32 flags, const char* sig, entry_ref*); 144 void RemoveTeam(team_id); 145 146 void InitSettings(); 147 void SaveSettings(); 148 149 void ShowPreferencesWindow(); 150 void ResizeTeamIcons(); 151 void FetchAppIcon(const char* signature, BBitmap* icon); 152 BRect IconRect(); 153 154 TBarWindow* fBarWindow; 155 TBarView* fBarView; 156 BMessenger fSwitcherMessenger; 157 BMessenger fStatusViewMessenger; 158 BFile* fSettingsFile; 159 desk_settings fSettings; 160 161 PreferencesWindow* fPreferencesWindow; 162 163 static BLocker sSubscriberLock; 164 static BList sBarTeamInfoList; 165 static BList sSubscribers; 166 }; 167 168 169 #endif /* BAR_APP_H */ 170