Deskbar: some more style fixes, reorg methods
This commit is contained in:
@@ -1055,9 +1055,11 @@ TExpandoMenuBar::_FinishedDrag(bool invoke)
|
|||||||
if (fPreviousDragTargetItem != NULL) {
|
if (fPreviousDragTargetItem != NULL) {
|
||||||
if (invoke)
|
if (invoke)
|
||||||
fPreviousDragTargetItem->Invoke();
|
fPreviousDragTargetItem->Invoke();
|
||||||
|
|
||||||
fPreviousDragTargetItem->SetOverrideSelected(false);
|
fPreviousDragTargetItem->SetOverrideSelected(false);
|
||||||
fPreviousDragTargetItem = NULL;
|
fPreviousDragTargetItem = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!invoke && fBarView->Dragging())
|
if (!invoke && fBarView->Dragging())
|
||||||
fBarView->DragStop(true);
|
fBarView->DragStop(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ TTeamMenuItem::GetContentSize(float* width, float* height)
|
|||||||
void
|
void
|
||||||
TTeamMenuItem::Draw()
|
TTeamMenuItem::Draw()
|
||||||
{
|
{
|
||||||
BRect frame(Frame());
|
BRect frame = Frame();
|
||||||
BMenu* menu = Menu();
|
BMenu* menu = Menu();
|
||||||
|
|
||||||
menu->PushState();
|
menu->PushState();
|
||||||
@@ -229,9 +229,9 @@ TTeamMenuItem::DrawContent()
|
|||||||
} else
|
} else
|
||||||
menu->SetDrawingMode(B_OP_OVER);
|
menu->SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
BRect frame(Frame());
|
BRect frame = Frame();
|
||||||
BRect iconBounds(fIcon->Bounds());
|
BRect iconBounds = fIcon->Bounds();
|
||||||
BRect dstRect(iconBounds);
|
BRect updateRect = iconBounds;
|
||||||
float extra = fBarView->Vertical() ? 0.0f : -1.0f;
|
float extra = fBarView->Vertical() ? 0.0f : -1.0f;
|
||||||
BPoint contentLocation = ContentLocation();
|
BPoint contentLocation = ContentLocation();
|
||||||
BPoint drawLocation = contentLocation + BPoint(kHPad, kVPad);
|
BPoint drawLocation = contentLocation + BPoint(kHPad, kVPad);
|
||||||
@@ -242,8 +242,8 @@ TTeamMenuItem::DrawContent()
|
|||||||
+ ((frame.Width() - iconBounds.Width()) / 2) + extra;
|
+ ((frame.Width() - iconBounds.Width()) / 2) + extra;
|
||||||
float offsety = contentLocation.y + 3.0f + extra;
|
float offsety = contentLocation.y + 3.0f + extra;
|
||||||
|
|
||||||
dstRect.OffsetTo(BPoint(offsetx, offsety));
|
updateRect.OffsetTo(BPoint(offsetx, offsety));
|
||||||
menu->DrawBitmapAsync(fIcon, dstRect);
|
menu->DrawBitmapAsync(fIcon, updateRect);
|
||||||
|
|
||||||
drawLocation.x = ((frame.Width() - LabelWidth()) / 2);
|
drawLocation.x = ((frame.Width() - LabelWidth()) / 2);
|
||||||
drawLocation.y = frame.top + iconBounds.Height() + kVPad * 2;
|
drawLocation.y = frame.top + iconBounds.Height() + kVPad * 2;
|
||||||
@@ -252,8 +252,8 @@ TTeamMenuItem::DrawContent()
|
|||||||
float offsety = contentLocation.y +
|
float offsety = contentLocation.y +
|
||||||
((frame.Height() - iconBounds.Height()) / 2) + extra;
|
((frame.Height() - iconBounds.Height()) / 2) + extra;
|
||||||
|
|
||||||
dstRect.OffsetTo(BPoint(offsetx, offsety));
|
updateRect.OffsetTo(BPoint(offsetx, offsety));
|
||||||
menu->DrawBitmapAsync(fIcon, dstRect);
|
menu->DrawBitmapAsync(fIcon, updateRect);
|
||||||
|
|
||||||
float labelHeight = fLabelAscent + fLabelDescent;
|
float labelHeight = fLabelAscent + fLabelDescent;
|
||||||
drawLocation.x += iconBounds.Width() + kLabelOffset;
|
drawLocation.x += iconBounds.Width() + kLabelOffset;
|
||||||
@@ -304,7 +304,7 @@ void
|
|||||||
TTeamMenuItem::DrawExpanderArrow()
|
TTeamMenuItem::DrawExpanderArrow()
|
||||||
{
|
{
|
||||||
BMenu* menu = Menu();
|
BMenu* menu = Menu();
|
||||||
BRect frame(Frame());
|
BRect frame = Frame();
|
||||||
BRect rect(0.0f, 0.0f, kSwitchWidth, kHPad + 2.0f);
|
BRect rect(0.0f, 0.0f, kSwitchWidth, kHPad + 2.0f);
|
||||||
|
|
||||||
rect.OffsetTo(BPoint(frame.right - rect.Width(),
|
rect.OffsetTo(BPoint(frame.right - rect.Width(),
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public:
|
|||||||
|
|
||||||
bool IsExpanded() const { return fExpanded; };
|
bool IsExpanded() const { return fExpanded; };
|
||||||
void ToggleExpandState(bool resizeWindow);
|
void ToggleExpandState(bool resizeWindow);
|
||||||
|
|
||||||
BRect ExpanderBounds() const;
|
BRect ExpanderBounds() const;
|
||||||
TWindowMenuItem* ExpandedWindowItem(int32 id);
|
TWindowMenuItem* ExpandedWindowItem(int32 id);
|
||||||
|
|
||||||
@@ -103,6 +104,7 @@ private:
|
|||||||
BBitmap* fIcon;
|
BBitmap* fIcon;
|
||||||
char* fName;
|
char* fName;
|
||||||
char* fSignature;
|
char* fSignature;
|
||||||
|
|
||||||
float fOverrideWidth;
|
float fOverrideWidth;
|
||||||
float fOverrideHeight;
|
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
|
void
|
||||||
TWindowMenuItem::GetContentSize(float* width, float* height)
|
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
|
// #pragma mark - private methods
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user