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 trademarks 30 of Be Incorporated in the United States and other countries. Other brand product 31 names are registered trademarks or trademarks of their respective holders. 32 All rights reserved. 33 */ 34 #ifndef EXPANDOMENUBAR_H 35 #define EXPANDOMENUBAR_H 36 37 // application list 38 // top level at window 39 // in expanded mode horizontal and vertical 40 41 42 #include <MenuBar.h> 43 #include <Locker.h> 44 45 class BBitmap; 46 class TBarView; 47 class TBarMenuTitle; 48 class TTeamMenuItem; 49 50 //#define DOUBLECLICKBRINGSTOFRONT 51 52 enum drag_and_drop_selection { 53 kNoSelection, 54 kBeMenuSelection, 55 kAppMenuSelection, 56 kAnyMenuSelection 57 }; 58 59 class TExpandoMenuBar : public BMenuBar { 60 public: 61 TExpandoMenuBar(TBarView *bar, BRect frame, const char *name, bool vertical, 62 bool drawLabel = true); 63 64 virtual void AttachedToWindow(); 65 virtual void DetachedFromWindow(); 66 virtual void MessageReceived(BMessage *message); 67 virtual void MouseDown(BPoint where); 68 virtual void MouseMoved(BPoint where, uint32 code, const BMessage *); 69 70 virtual void Draw(BRect update); 71 virtual void DrawBackground(BRect update); 72 73 bool InBeMenu(BPoint) const; 74 TTeamMenuItem *ItemAtPoint(BPoint loc); 75 76 void CheckItemSizes(int32 delta); 77 78 menu_layout MenuLayout() const; 79 80 void SizeWindow(); 81 void CheckForSizeOverrun(); 82 83 private: 84 static int CompareByName( const void *first, const void *second); 85 static int32 monitor_team_windows(void *arg); 86 87 void AddTeam(BList *team, BBitmap *icon, char *name, char *signature); 88 void AddTeam(team_id team, const char *signature); 89 void RemoveTeam(team_id team, bool partial); 90 91 void Hilite(drag_and_drop_selection which); 92 93 bool fVertical; 94 bool fOverflow; 95 bool fDrawLabel; 96 bool fIsScrolling; 97 bool fShowTeamExpander; 98 bool fExpandNewTeams; 99 100 TBarView *fBarView; 101 int32 fFirstApp; 102 103 TBarMenuTitle *fBeMenuItem; 104 TTeamMenuItem *fSeparatorItem; 105 106 #ifdef DOUBLECLICKBRINGSTOFRONT 107 int32 fLastClickItem; 108 bigtime_t fLastClickTime; 109 #endif 110 111 static bool sDoMonitor; 112 static thread_id sMonThread; 113 static BLocker sMonLocker; 114 }; 115 116 #endif /* EXPANDOMENUBAR_H */ 117