6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
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:
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.
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.
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.
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
43 #include "ObjectList.h"
46 const uint32 kStateChanged
= 'stch';
50 B_DESKBAR_ANY_SHELF
= 0,
61 const float kMiniHeight
= 46.0f
;
62 const float kHModeHeight
= 21.0f
;
63 const float kMenuBarHeight
= 21.0f
;
64 const float kStatusHeight
= 22.0f
;
65 const float kHiddenDimension
= 1.0f
;
66 const float kMaxPreventHidingDist
= 80.0f
;
72 class TExpandoMenuBar
;
76 class TInlineScrollView
;
79 class TBarView
: public BView
{
81 TBarView(BRect frame
, bool vertical
, bool left
,
82 bool top
, int32 state
, float width
);
85 virtual void AttachedToWindow();
86 virtual void DetachedFromWindow();
88 virtual void Draw(BRect updateRect
);
90 virtual void MessageReceived(BMessage
* message
);
92 virtual void MouseMoved(BPoint where
, uint32 transit
,
93 const BMessage
* dragMessage
);
94 virtual void MouseDown(BPoint where
);
98 void UpdatePlacement();
99 void ChangeState(int32 state
, bool vertical
, bool left
,
100 bool top
, bool aSync
= false);
102 void RaiseDeskbar(bool raise
);
103 void HideDeskbar(bool hide
);
105 // window placement methods
106 bool Vertical() const { return fVertical
; };
107 bool Left() const { return fLeft
; };
108 bool Top() const { return fTop
; };
109 bool AcrossTop() const { return fTop
&& !fVertical
; };
110 bool AcrossBottom() const
111 { return !fTop
&& !fVertical
; };
113 // window state methods
114 bool ExpandoState() const
115 { return fState
== kExpandoState
; };
116 bool FullState() const { return fState
== kFullState
; };
117 bool MiniState() const { return fState
== kMiniState
; };
118 int32
State() const { return fState
; };
120 // drag and drop methods
121 void CacheDragData(const BMessage
* incoming
);
122 status_t
DragStart();
123 static bool MenuTrackingHook(BMenu
* menu
, void* castToThis
);
124 void DragStop(bool full
= false);
125 TrackingHookData
* GetTrackingHookData();
126 bool Dragging() const;
127 const BMessage
* DragMessage() const;
128 BObjectList
<BString
>* CachedTypesList() const;
129 bool AppCanHandleTypes(const char* signature
);
130 void SetDragOverride(bool);
132 bool InvokeItem(const char* signature
);
134 void HandleDeskbarMenu(BMessage
* targetmessage
);
136 status_t
ItemInfo(int32 id
, const char** name
,
137 DeskbarShelf
* shelf
);
138 status_t
ItemInfo(const char* name
, int32
* id
,
139 DeskbarShelf
* shelf
);
141 bool ItemExists(int32 id
, DeskbarShelf shelf
);
142 bool ItemExists(const char* name
, DeskbarShelf shelf
);
144 int32
CountItems(DeskbarShelf shelf
);
146 status_t
AddItem(BMessage
* archive
, DeskbarShelf shelf
,
148 status_t
AddItem(BEntry
* entry
, DeskbarShelf shelf
,
151 void RemoveItem(int32 id
);
152 void RemoveItem(const char* name
, DeskbarShelf shelf
);
154 BRect
OffsetIconFrame(BRect rect
) const;
155 BRect
IconFrame(int32 id
) const;
156 BRect
IconFrame(const char* name
) const;
158 void GetPreferredWindowSize(BRect screenFrame
,
159 float* width
, float* height
);
160 void SizeWindow(BRect screenFrame
);
161 void PositionWindow(BRect screenFrame
);
163 void CheckForScrolling();
165 TExpandoMenuBar
* ExpandoMenuBar() const;
166 TBarMenuBar
* BarMenuBar() const;
167 TDragRegion
* DragRegion() const { return fDragRegion
; }
168 TReplicantTray
* ReplicantTray() const { return fReplicantTray
; }
171 friend class TBarApp
;
172 friend class TDeskbarMenu
;
173 friend class PreferencesWindow
;
175 status_t
SendDragMessage(const char* signature
,
176 entry_ref
* ref
= NULL
);
178 void PlaceDeskbarMenu();
179 void PlaceTray(bool vertSwap
, bool leftSwap
);
180 void PlaceApplicationBar();
182 void _ChangeState(BMessage
* message
);
185 TInlineScrollView
* fInlineScrollView
;
186 TBarMenuBar
* fBarMenuBar
;
187 TExpandoMenuBar
* fExpandoMenuBar
;
190 TDragRegion
* fDragRegion
;
191 TResizeControl
* fResizeControl
;
192 TReplicantTray
* fReplicantTray
;
199 bigtime_t fPulseRate
;
201 BMessage
* fDragMessage
;
202 BObjectList
<BString
>* fCachedTypesList
;
203 TrackingHookData fTrackingHookData
;
205 uint32 fMaxRecentDocs
;
206 uint32 fMaxRecentApps
;
208 TTeamMenuItem
* fLastDragItem
;
209 BMessageFilter
* fMouseFilter
;
213 inline TExpandoMenuBar
*
214 TBarView::ExpandoMenuBar() const
216 return fExpandoMenuBar
;
221 TBarView::BarMenuBar() const
228 TBarView::Dragging() const
230 return (fCachedTypesList
&& fDragMessage
);
234 inline const BMessage
*
235 TBarView::DragMessage() const
241 inline BObjectList
<BString
>*
242 TBarView::CachedTypesList() const
244 return fCachedTypesList
;