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
35 #ifndef __STATUS_VIEW__
36 #define __STATUS_VIEW__
49 const float kMaxReplicantHeight
= 16.0f
;
50 const float kMaxReplicantWidth
= 16.0f
;
51 const int32 kMinimumReplicantCount
= 6;
52 const int32 kIconGap
= 2;
53 const int32 kGutter
= 1;
54 const int32 kDragRegionWidth
= 6;
56 // 1 pixel for left gutter
57 // space for replicant tray (6 items)
58 // 6 pixel drag region
59 const float kMinimumTrayWidth
= kIconGap
60 + (kMinimumReplicantCount
* kIconGap
)
61 + (kMinimumReplicantCount
* kMaxReplicantWidth
) + kGutter
;
62 const float kMinimumTrayHeight
= kGutter
+ kMaxReplicantHeight
+ kGutter
;
64 extern float gMinimumWindowWidth
;
67 struct DeskbarItemInfo
{
68 bool isAddOn
; // attribute tagged item
69 int32 id
; // id given to replicant
70 entry_ref entryRef
; // entry_ref to item tagged
71 node_ref nodeRef
; // node_ref to boot vol item
75 class TReplicantShelf
;
77 class TReplicantTray
: public BView
{
79 TReplicantTray(TBarView
* barView
,
81 virtual ~TReplicantTray();
83 virtual void AttachedToWindow();
84 virtual void DetachedFromWindow();
85 virtual void MouseDown(BPoint point
);
86 virtual void MessageReceived(BMessage
*);
87 virtual void GetPreferredSize(float*, float*);
89 void AdjustPlacement();
90 void ShowReplicantMenu(BPoint
);
92 void SetMultiRow(bool state
);
93 bool IsMultiRow() const
94 { return fMultiRowMode
; }
96 TTimeView
* Time() const { return fTime
; }
99 status_t
ItemInfo(int32 target
, const char** name
);
100 status_t
ItemInfo(const char* name
, int32
* id
);
101 status_t
ItemInfo(int32 index
, const char** name
,
104 bool IconExists(int32 target
, bool byIndex
= false);
105 bool IconExists(const char* name
);
107 int32
IconCount() const;
109 status_t
AddIcon(BMessage
*, int32
* id
,
110 const entry_ref
* = NULL
);
112 void RemoveIcon(int32 target
,
113 bool byIndex
= false);
114 void RemoveIcon(const char* name
);
116 BRect
IconFrame(int32 target
,
117 bool byIndex
= false);
118 BRect
IconFrame(const char* name
);
120 bool AcceptAddon(BRect frame
,
122 void RealignReplicants(int32 startIndex
= -1);
124 void SaveTimeSettings();
127 status_t
LoadAddOn(BEntry
* entry
, int32
* id
,
128 bool addToSettings
= true);
132 BView
* ViewAt(int32
* index
, int32
* id
,
134 bool byIndex
= false);
135 BView
* ViewAt(int32
* index
, int32
* id
,
138 void RealReplicantAdjustment(int32 startindex
);
141 void InitAddOnSupport();
142 void DeleteAddOnSupport();
144 DeskbarItemInfo
* DeskbarItemFor(node_ref
&nodeRef
);
145 DeskbarItemInfo
* DeskbarItemFor(int32 id
);
146 bool NodeExists(node_ref
&nodeRef
);
148 void HandleEntryUpdate(BMessage
*);
149 status_t
AddItem(int32 id
, node_ref nodeRef
,
150 BEntry
&entry
, bool isAddon
);
152 void UnloadAddOn(node_ref
*, dev_t
*, bool which
,
154 void RemoveItem(int32 id
);
156 void MoveItem(entry_ref
*, ino_t toDirectory
);
159 BPoint
LocationForReplicant(int32 index
,
161 BShelf
* Shelf() const;
163 status_t
_SaveSettings();
165 friend class TReplicantShelf
;
169 TReplicantShelf
* fShelf
;
170 BRect fRightBottomReplicant
;
171 int32 fLastReplicant
;
174 float fMinimumTrayWidth
;
176 bool fAlignmentSupport
;
179 BMessage fAddOnSettings
;
187 kAutoPlaceDragRegion
,
194 class TDragRegion
: public BControl
{
196 TDragRegion(TBarView
*, BView
*);
198 virtual void AttachedToWindow();
199 virtual void GetPreferredSize(float*, float*);
200 virtual void Draw(BRect
);
201 virtual void FrameMoved(BPoint
);
202 virtual void MouseDown(BPoint
);
203 virtual void MouseUp(BPoint
);
204 virtual void MouseMoved(BPoint
, uint32
, const BMessage
*);
206 void DrawDragRegion();
207 BRect
DragRegion() const;
209 bool SwitchModeForRect(BPoint mouse
, BRect rect
,
210 bool newVertical
, bool newLeft
, bool newTop
, int32 newState
);
212 int32
DragRegionLocation() const;
213 void SetDragRegionLocation(int32
);
215 bool IsDragging() {return IsTracking();}
220 BPoint fPreviousPosition
;
225 #endif /* __STATUS_VIEW__ */