Deskbar: some more style fixes, reorg methods
This commit is contained in:
parent
072c2dcde2
commit
6b65d934df
@ -1055,9 +1055,11 @@ TExpandoMenuBar::_FinishedDrag(bool invoke)
|
||||
if (fPreviousDragTargetItem != NULL) {
|
||||
if (invoke)
|
||||
fPreviousDragTargetItem->Invoke();
|
||||
|
||||
fPreviousDragTargetItem->SetOverrideSelected(false);
|
||||
fPreviousDragTargetItem = NULL;
|
||||
}
|
||||
|
||||
if (!invoke && fBarView->Dragging())
|
||||
fBarView->DragStop(true);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ TTeamMenuItem::GetContentSize(float* width, float* height)
|
||||
void
|
||||
TTeamMenuItem::Draw()
|
||||
{
|
||||
BRect frame(Frame());
|
||||
BRect frame = Frame();
|
||||
BMenu* menu = Menu();
|
||||
|
||||
menu->PushState();
|
||||
@ -229,9 +229,9 @@ TTeamMenuItem::DrawContent()
|
||||
} else
|
||||
menu->SetDrawingMode(B_OP_OVER);
|
||||
|
||||
BRect frame(Frame());
|
||||
BRect iconBounds(fIcon->Bounds());
|
||||
BRect dstRect(iconBounds);
|
||||
BRect frame = Frame();
|
||||
BRect iconBounds = fIcon->Bounds();
|
||||
BRect updateRect = iconBounds;
|
||||
float extra = fBarView->Vertical() ? 0.0f : -1.0f;
|
||||
BPoint contentLocation = ContentLocation();
|
||||
BPoint drawLocation = contentLocation + BPoint(kHPad, kVPad);
|
||||
@ -242,8 +242,8 @@ TTeamMenuItem::DrawContent()
|
||||
+ ((frame.Width() - iconBounds.Width()) / 2) + extra;
|
||||
float offsety = contentLocation.y + 3.0f + extra;
|
||||
|
||||
dstRect.OffsetTo(BPoint(offsetx, offsety));
|
||||
menu->DrawBitmapAsync(fIcon, dstRect);
|
||||
updateRect.OffsetTo(BPoint(offsetx, offsety));
|
||||
menu->DrawBitmapAsync(fIcon, updateRect);
|
||||
|
||||
drawLocation.x = ((frame.Width() - LabelWidth()) / 2);
|
||||
drawLocation.y = frame.top + iconBounds.Height() + kVPad * 2;
|
||||
@ -252,8 +252,8 @@ TTeamMenuItem::DrawContent()
|
||||
float offsety = contentLocation.y +
|
||||
((frame.Height() - iconBounds.Height()) / 2) + extra;
|
||||
|
||||
dstRect.OffsetTo(BPoint(offsetx, offsety));
|
||||
menu->DrawBitmapAsync(fIcon, dstRect);
|
||||
updateRect.OffsetTo(BPoint(offsetx, offsety));
|
||||
menu->DrawBitmapAsync(fIcon, updateRect);
|
||||
|
||||
float labelHeight = fLabelAscent + fLabelDescent;
|
||||
drawLocation.x += iconBounds.Width() + kLabelOffset;
|
||||
@ -304,7 +304,7 @@ void
|
||||
TTeamMenuItem::DrawExpanderArrow()
|
||||
{
|
||||
BMenu* menu = Menu();
|
||||
BRect frame(Frame());
|
||||
BRect frame = Frame();
|
||||
BRect rect(0.0f, 0.0f, kSwitchWidth, kHPad + 2.0f);
|
||||
|
||||
rect.OffsetTo(BPoint(frame.right - rect.Width(),
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
|
||||
bool IsExpanded() const { return fExpanded; };
|
||||
void ToggleExpandState(bool resizeWindow);
|
||||
|
||||
BRect ExpanderBounds() const;
|
||||
TWindowMenuItem* ExpandedWindowItem(int32 id);
|
||||
|
||||
@ -103,6 +104,7 @@ private:
|
||||
BBitmap* fIcon;
|
||||
char* fName;
|
||||
char* fSignature;
|
||||
|
||||
float fOverrideWidth;
|
||||
float fOverrideHeight;
|
||||
|
||||
|
@ -77,37 +77,6 @@ TWindowMenuItem::TWindowMenuItem(const char* label, int32 id, bool mini,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TWindowMenuItem::SetTo(const char* label, int32 id, bool mini,
|
||||
bool currentWorkspace, bool dragging)
|
||||
{
|
||||
fModified = fCurrentWorkSpace != currentWorkspace || fMini != mini;
|
||||
|
||||
fID = id;
|
||||
fMini = mini;
|
||||
fCurrentWorkSpace = currentWorkspace;
|
||||
fDragging = dragging;
|
||||
fRequireUpdate = false;
|
||||
|
||||
_Init(label);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ int32
|
||||
TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
|
||||
TWindowMenuItem* newItem)
|
||||
{
|
||||
for (int32 index = startIndex;; index++) {
|
||||
TWindowMenuItem* item
|
||||
= dynamic_cast<TWindowMenuItem*>(menu->ItemAt(index));
|
||||
if (item == NULL
|
||||
|| NaturalCompare(item->Label(), newItem->Label()) > 0) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TWindowMenuItem::GetContentSize(float* width, float* height)
|
||||
{
|
||||
@ -252,6 +221,37 @@ TWindowMenuItem::Invoke(BMessage* /*message*/)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TWindowMenuItem::SetTo(const char* label, int32 id, bool mini,
|
||||
bool currentWorkspace, bool dragging)
|
||||
{
|
||||
fModified = fCurrentWorkSpace != currentWorkspace || fMini != mini;
|
||||
|
||||
fID = id;
|
||||
fMini = mini;
|
||||
fCurrentWorkSpace = currentWorkspace;
|
||||
fDragging = dragging;
|
||||
fRequireUpdate = false;
|
||||
|
||||
_Init(label);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ int32
|
||||
TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
|
||||
TWindowMenuItem* newItem)
|
||||
{
|
||||
for (int32 index = startIndex;; index++) {
|
||||
TWindowMenuItem* item
|
||||
= dynamic_cast<TWindowMenuItem*>(menu->ItemAt(index));
|
||||
if (item == NULL
|
||||
|| NaturalCompare(item->Label(), newItem->Label()) > 0) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - private methods
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user