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 EXPANDO_MENU_BAR_H 35 #define EXPANDO_MENU_BAR_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, 62 bool vertical, 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 virtual void MouseUp(BPoint where); 70 71 virtual void Draw(BRect update); 72 virtual void DrawBackground(BRect update); 73 74 TTeamMenuItem* TeamItemAtPoint(BPoint location, 75 BMenuItem** _item = NULL); 76 bool InBeMenu(BPoint) const; 77 78 void CheckItemSizes(int32 delta); 79 80 menu_layout MenuLayout() const; 81 82 void SizeWindow(); 83 void CheckForSizeOverrun(); 84 85 private: 86 static int CompareByName( const void* first, const void* second); 87 static int32 monitor_team_windows(void* arg); 88 89 void AddTeam(BList* team, BBitmap* icon, char* name, char* signature); 90 void AddTeam(team_id team, const char* signature); 91 void RemoveTeam(team_id team, bool partial); 92 93 void _FinishedDrag(bool invoke = false); 94 95 bool fVertical : 1; 96 bool fOverflow : 1; 97 bool fDrawLabel : 1; 98 bool fIsScrolling : 1; 99 bool fShowTeamExpander : 1; 100 bool fExpandNewTeams : 1; 101 102 float fBeMenuWidth; 103 104 TBarView* fBarView; 105 int32 fFirstApp; 106 107 TBarMenuTitle* fBeMenuItem; 108 TTeamMenuItem* fSeparatorItem; 109 TTeamMenuItem* fPreviousDragTargetItem; 110 111 BMenuItem* fLastClickItem; 112 113 static bool sDoMonitor; 114 static thread_id sMonThread; 115 static BLocker sMonLocker; 116 }; 117 118 #endif /* EXPANDO_MENU_BAR_H */ 119 120