* Give Deskbar a refreshed and cleaner look.
* Fixed a bunch of problems in layouting the various views. (For example, the last app menu entry is no longer one pixel too short, but there was more...) * Fixed Deskbar being not wide enough for the Haiku logo in certain modes. * Enabled the mount menu. I think it's a good idea to have at a more prominent location where new Haiku users may look for it (Gnome also has this in the main panel). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29631 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -33,10 +33,13 @@ All rights reserved.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
|
||||||
|
#include "BarMenuTitle.h"
|
||||||
|
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
|
|
||||||
#include "BarApp.h"
|
#include "BarApp.h"
|
||||||
#include "BarMenuTitle.h"
|
|
||||||
#include "BarView.h"
|
#include "BarView.h"
|
||||||
#include "BarWindow.h"
|
#include "BarWindow.h"
|
||||||
#include "ExpandoMenuBar.h"
|
#include "ExpandoMenuBar.h"
|
||||||
@@ -77,7 +80,31 @@ TBarMenuTitle::GetContentSize(float *width, float *height)
|
|||||||
void
|
void
|
||||||
TBarMenuTitle::Draw()
|
TBarMenuTitle::Draw()
|
||||||
{
|
{
|
||||||
BMenuItem::Draw();
|
if (be_control_look == NULL) {
|
||||||
|
BMenuItem::Draw();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill background if selected
|
||||||
|
rgb_color base = Menu()->LowColor();
|
||||||
|
BRect rect = Frame();
|
||||||
|
|
||||||
|
BRect windowBounds = Menu()->Window()->Bounds();
|
||||||
|
if (rect.right > windowBounds.right)
|
||||||
|
rect.right = windowBounds.right;
|
||||||
|
|
||||||
|
if (IsSelected()) {
|
||||||
|
be_control_look->DrawMenuItemBackground(Menu(), rect, rect, base,
|
||||||
|
BControlLook::B_ACTIVATED);
|
||||||
|
} else {
|
||||||
|
be_control_look->DrawButtonBackground(Menu(), rect, rect, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw content
|
||||||
|
DrawContent();
|
||||||
|
|
||||||
|
// make sure we restore state
|
||||||
|
Menu()->SetLowColor(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,6 +113,21 @@ TBarMenuTitle::DrawContent()
|
|||||||
{
|
{
|
||||||
BMenu *menu = Menu();
|
BMenu *menu = Menu();
|
||||||
BRect frame(Frame());
|
BRect frame(Frame());
|
||||||
|
|
||||||
|
if (be_control_look != NULL) {
|
||||||
|
menu->SetDrawingMode(B_OP_ALPHA);
|
||||||
|
|
||||||
|
if (fIcon != NULL) {
|
||||||
|
BRect dstRect(fIcon->Bounds());
|
||||||
|
dstRect.OffsetTo(frame.LeftTop());
|
||||||
|
dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2) - 1.0f),
|
||||||
|
rintf(((frame.Height() - dstRect.Height()) / 2) - 0.0f));
|
||||||
|
|
||||||
|
menu->DrawBitmapAsync(fIcon, dstRect);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rgb_color menuColor = menu->ViewColor();
|
rgb_color menuColor = menu->ViewColor();
|
||||||
rgb_color dark = tint_color(menuColor, B_DARKEN_1_TINT);
|
rgb_color dark = tint_color(menuColor, B_DARKEN_1_TINT);
|
||||||
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
||||||
@@ -94,7 +136,7 @@ TBarMenuTitle::DrawContent()
|
|||||||
bool inExpandoMode = dynamic_cast<TExpandoMenuBar*>(menu) != NULL;
|
bool inExpandoMode = dynamic_cast<TExpandoMenuBar*>(menu) != NULL;
|
||||||
|
|
||||||
BRect bounds(menu->Window()->Bounds());
|
BRect bounds(menu->Window()->Bounds());
|
||||||
if (bounds.right < frame.right)
|
if (bounds.right < frame.right)
|
||||||
frame.right = bounds.right;
|
frame.right = bounds.right;
|
||||||
|
|
||||||
menu->SetDrawingMode(B_OP_COPY);
|
menu->SetDrawingMode(B_OP_COPY);
|
||||||
@@ -108,7 +150,8 @@ TBarMenuTitle::DrawContent()
|
|||||||
menu->AddLine(frame.RightBottom(), frame.RightTop(), dark);
|
menu->AddLine(frame.RightBottom(), frame.RightTop(), dark);
|
||||||
if (inExpandoMode) {
|
if (inExpandoMode) {
|
||||||
frame.top += 1;
|
frame.top += 1;
|
||||||
menu->AddLine(frame.LeftTop(), frame.RightTop() + BPoint(-1, 0), light);
|
menu->AddLine(frame.LeftTop(), frame.RightTop() + BPoint(-1, 0),
|
||||||
|
light);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->EndLineArray();
|
menu->EndLineArray();
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ const int32 kDefaultRecentAppCount = 10;
|
|||||||
|
|
||||||
const int32 kMenuTrackMargin = 20;
|
const int32 kMenuTrackMargin = 20;
|
||||||
|
|
||||||
|
|
||||||
TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
||||||
bool showInterval, uint32 state, float, bool showTime)
|
bool showInterval, uint32 state, float, bool showTime)
|
||||||
: BView(frame, "BarView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
|
: BView(frame, "BarView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
|
||||||
@@ -86,7 +85,7 @@ TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
|
|||||||
fMaxRecentDocs(kDefaultRecentDocCount),
|
fMaxRecentDocs(kDefaultRecentDocCount),
|
||||||
fMaxRecentApps(kDefaultRecentAppCount),
|
fMaxRecentApps(kDefaultRecentAppCount),
|
||||||
fLastDragItem(NULL)
|
fLastDragItem(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,10 +93,6 @@ TBarView::~TBarView()
|
|||||||
{
|
{
|
||||||
delete fDragMessage;
|
delete fDragMessage;
|
||||||
delete fCachedTypesList;
|
delete fCachedTypesList;
|
||||||
|
|
||||||
// !! this should be done in DetachedFromWindow
|
|
||||||
// to be symetric
|
|
||||||
delete fTrackingHookData.fDragMessage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -124,6 +119,14 @@ TBarView::AttachedToWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TBarView::DetachedFromWindow()
|
||||||
|
{
|
||||||
|
delete fTrackingHookData.fDragMessage;
|
||||||
|
fTrackingHookData.fDragMessage = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TBarView::Draw(BRect)
|
TBarView::Draw(BRect)
|
||||||
{
|
{
|
||||||
@@ -220,7 +223,7 @@ TBarView::PlaceBeMenu()
|
|||||||
if (!fBarMenuBar)
|
if (!fBarMenuBar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float width = kMinimumWindowWidth;
|
float width = sMinimumWindowWidth;
|
||||||
BPoint loc(B_ORIGIN);
|
BPoint loc(B_ORIGIN);
|
||||||
BRect menuFrame(fBarMenuBar->Frame());
|
BRect menuFrame(fBarMenuBar->Frame());
|
||||||
if (fState == kFullState) {
|
if (fState == kFullState) {
|
||||||
@@ -276,7 +279,7 @@ TBarView::PlaceTray(bool, bool, BRect screenFrame)
|
|||||||
else
|
else
|
||||||
fReplicantTray->MoveTo(2, 2);
|
fReplicantTray->MoveTo(2, 2);
|
||||||
} else {
|
} else {
|
||||||
statusLoc.x = screenFrame.Width() - fDragRegion->Bounds().Width();
|
statusLoc.x = screenFrame.right - fDragRegion->Bounds().Width();
|
||||||
statusLoc.y = -1;
|
statusLoc.y = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,21 +303,21 @@ TBarView::PlaceApplicationBar(BRect screenFrame)
|
|||||||
if (fVertical) {
|
if (fVertical) {
|
||||||
// top left/right
|
// top left/right
|
||||||
if (fTrayLocation != 0)
|
if (fTrayLocation != 0)
|
||||||
expandoFrame.top = fDragRegion->Frame().bottom + 2;
|
expandoFrame.top = fDragRegion->Frame().bottom + 1;
|
||||||
else
|
else
|
||||||
expandoFrame.top = fBarMenuBar->Frame().bottom + 2;
|
expandoFrame.top = fBarMenuBar->Frame().bottom + 1;
|
||||||
|
|
||||||
expandoFrame.bottom = expandoFrame.top + 1;
|
expandoFrame.bottom = expandoFrame.top + 1;
|
||||||
if (fState == kFullState)
|
if (fState == kFullState)
|
||||||
expandoFrame.right = fBarMenuBar->Frame().Width();
|
expandoFrame.right = fBarMenuBar->Frame().Width();
|
||||||
else
|
else
|
||||||
expandoFrame.right = kMinimumWindowWidth;
|
expandoFrame.right = sMinimumWindowWidth;
|
||||||
} else {
|
} else {
|
||||||
// top or bottom
|
// top or bottom
|
||||||
expandoFrame.top = -1;
|
expandoFrame.top = 0;
|
||||||
expandoFrame.bottom = kHModeHeight;
|
expandoFrame.bottom = kHModeHeight;
|
||||||
if (fTrayLocation != 0)
|
if (fTrayLocation != 0)
|
||||||
expandoFrame.right = fDragRegion->Frame().left;
|
expandoFrame.right = fDragRegion->Frame().left - 1;
|
||||||
else
|
else
|
||||||
expandoFrame.right = screenFrame.Width();
|
expandoFrame.right = screenFrame.Width();
|
||||||
}
|
}
|
||||||
@@ -328,15 +331,15 @@ TBarView::PlaceApplicationBar(BRect screenFrame)
|
|||||||
void
|
void
|
||||||
TBarView::GetPreferredWindowSize(BRect screenFrame, float *width, float *height)
|
TBarView::GetPreferredWindowSize(BRect screenFrame, float *width, float *height)
|
||||||
{
|
{
|
||||||
float windowHeight = 0;
|
float windowHeight = 0;
|
||||||
float windowWidth = kMinimumWindowWidth;
|
float windowWidth = sMinimumWindowWidth;
|
||||||
if (fState == kFullState) {
|
if (fState == kFullState) {
|
||||||
windowHeight = screenFrame.bottom;
|
windowHeight = screenFrame.bottom;
|
||||||
windowWidth = fBarMenuBar->Frame().Width();
|
windowWidth = fBarMenuBar->Frame().Width();
|
||||||
} else if (fState == kExpandoState) {
|
} else if (fState == kExpandoState) {
|
||||||
if (fVertical) {
|
if (fVertical) {
|
||||||
// top left or right
|
// top left or right
|
||||||
windowHeight = fExpando->Frame().bottom - 1;
|
windowHeight = fExpando->Frame().bottom;
|
||||||
} else {
|
} else {
|
||||||
// top or bottom, full
|
// top or bottom, full
|
||||||
fExpando->CheckItemSizes(0);
|
fExpando->CheckItemSizes(0);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class TBarView : public BView {
|
|||||||
~TBarView();
|
~TBarView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
virtual void DetachedFromWindow();
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
@@ -148,11 +149,11 @@ class TBarView : public BView {
|
|||||||
TDragRegion *fDragRegion;
|
TDragRegion *fDragRegion;
|
||||||
TReplicantTray *fReplicantTray;
|
TReplicantTray *fReplicantTray;
|
||||||
|
|
||||||
bool fShowInterval;
|
bool fShowInterval : 1;
|
||||||
bool fShowClock;
|
bool fShowClock : 1;
|
||||||
bool fVertical;
|
bool fVertical : 1;
|
||||||
bool fTop;
|
bool fTop : 1;
|
||||||
bool fLeft;
|
bool fLeft : 1;
|
||||||
|
|
||||||
int32 fState;
|
int32 fState;
|
||||||
|
|
||||||
|
|||||||
@@ -33,12 +33,15 @@ All rights reserved.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Autolock.h>
|
||||||
|
#include <Bitmap.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Bitmap.h>
|
|
||||||
#include <Autolock.h>
|
|
||||||
|
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "icons_logo.h"
|
#include "icons_logo.h"
|
||||||
@@ -55,7 +58,7 @@ All rights reserved.
|
|||||||
#include "WindowMenu.h"
|
#include "WindowMenu.h"
|
||||||
#include "WindowMenuItem.h"
|
#include "WindowMenuItem.h"
|
||||||
|
|
||||||
const float kBeMenuWidth = 50.0f;
|
const float kDefaultBeMenuWidth = 50.0f;
|
||||||
const float kSepItemWidth = 5.0f;
|
const float kSepItemWidth = 5.0f;
|
||||||
|
|
||||||
const uint32 M_MINIMIZE_TEAM = 'mntm';
|
const uint32 M_MINIMIZE_TEAM = 'mntm';
|
||||||
@@ -77,6 +80,7 @@ TExpandoMenuBar::TExpandoMenuBar(TBarView *bar, BRect frame, const char *name,
|
|||||||
fIsScrolling(false),
|
fIsScrolling(false),
|
||||||
fShowTeamExpander(static_cast<TBarApp *>(be_app)->Settings()->superExpando),
|
fShowTeamExpander(static_cast<TBarApp *>(be_app)->Settings()->superExpando),
|
||||||
fExpandNewTeams(static_cast<TBarApp *>(be_app)->Settings()->expandNewTeams),
|
fExpandNewTeams(static_cast<TBarApp *>(be_app)->Settings()->expandNewTeams),
|
||||||
|
fBeMenuWidth(kDefaultBeMenuWidth),
|
||||||
fBarView(bar),
|
fBarView(bar),
|
||||||
fFirstApp(0),
|
fFirstApp(0),
|
||||||
fPreviousDragTargetItem(NULL)
|
fPreviousDragTargetItem(NULL)
|
||||||
@@ -88,7 +92,7 @@ TExpandoMenuBar::TExpandoMenuBar(TBarView *bar, BRect frame, const char *name,
|
|||||||
|
|
||||||
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
SetFont(be_plain_font);
|
SetFont(be_plain_font);
|
||||||
SetMaxContentWidth(kMinimumWindowWidth);
|
SetMaxContentWidth(sMinimumWindowWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -106,15 +110,19 @@ TExpandoMenuBar::AttachedToWindow()
|
|||||||
BMessenger self(this);
|
BMessenger self(this);
|
||||||
BList teamList;
|
BList teamList;
|
||||||
TBarApp::Subscribe(self, &teamList);
|
TBarApp::Subscribe(self, &teamList);
|
||||||
float width = fVertical ? Frame().Width() : kMinimumWindowWidth;
|
float width = fVertical ? Frame().Width() : sMinimumWindowWidth;
|
||||||
float height = -1.0f;
|
float height = -1.0f;
|
||||||
|
|
||||||
// top or bottom mode, add be menu and sep for menubar tracking consistency
|
// top or bottom mode, add be menu and sep for menubar tracking consistency
|
||||||
if (!fVertical) {
|
if (!fVertical) {
|
||||||
TBeMenu *beMenu = new TBeMenu(fBarView);
|
TBeMenu *beMenu = new TBeMenu(fBarView);
|
||||||
TBarWindow::SetBeMenu(beMenu);
|
TBarWindow::SetBeMenu(beMenu);
|
||||||
fBeMenuItem = new TBarMenuTitle(kBeMenuWidth, Frame().Height(),
|
const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
|
||||||
AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_BeLogoIcon), beMenu, true);
|
R_BeLogoIcon);
|
||||||
|
if (logoBitmap != NULL)
|
||||||
|
fBeMenuWidth = logoBitmap->Bounds().Width() + 16;
|
||||||
|
fBeMenuItem = new TBarMenuTitle(fBeMenuWidth, Frame().Height(),
|
||||||
|
logoBitmap, beMenu, true);
|
||||||
AddItem(fBeMenuItem);
|
AddItem(fBeMenuItem);
|
||||||
|
|
||||||
fSeparatorItem = new TTeamMenuItem(kSepItemWidth, height, fVertical);
|
fSeparatorItem = new TTeamMenuItem(kSepItemWidth, height, fVertical);
|
||||||
@@ -521,7 +529,7 @@ TExpandoMenuBar::TeamItemAtPoint(BPoint point, BMenuItem **_item)
|
|||||||
void
|
void
|
||||||
TExpandoMenuBar::AddTeam(BList *team, BBitmap *icon, char *name, char *signature)
|
TExpandoMenuBar::AddTeam(BList *team, BBitmap *icon, char *name, char *signature)
|
||||||
{
|
{
|
||||||
float itemWidth = fVertical ? fBarView->Bounds().Width() : kMinimumWindowWidth;
|
float itemWidth = fVertical ? fBarView->Bounds().Width() : sMinimumWindowWidth;
|
||||||
float itemHeight = -1.0f;
|
float itemHeight = -1.0f;
|
||||||
|
|
||||||
desk_settings *settings = ((TBarApp *)be_app)->Settings();
|
desk_settings *settings = ((TBarApp *)be_app)->Settings();
|
||||||
@@ -630,14 +638,14 @@ TExpandoMenuBar::CheckItemSizes(int32 delta)
|
|||||||
int32 count = CountItems();
|
int32 count = CountItems();
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
float newWidth = 0;
|
float newWidth = 0;
|
||||||
float fullWidth = (kMinimumWindowWidth * count);
|
float fullWidth = (sMinimumWindowWidth * count);
|
||||||
|
|
||||||
if (!fBarView->Vertical()) {
|
if (!fBarView->Vertical()) {
|
||||||
// in this case there are 2 extra items:
|
// in this case there are 2 extra items:
|
||||||
// The Be Menu
|
// The Be Menu
|
||||||
// The little separator item
|
// The little separator item
|
||||||
fullWidth = fullWidth - (kMinimumWindowWidth * 2) + (kBeMenuWidth + kSepItemWidth);
|
fullWidth = fullWidth - (sMinimumWindowWidth * 2) + (fBeMenuWidth + kSepItemWidth);
|
||||||
width -= (kBeMenuWidth + kSepItemWidth);
|
width -= (fBeMenuWidth + kSepItemWidth);
|
||||||
count -= 2;
|
count -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,14 +658,14 @@ TExpandoMenuBar::CheckItemSizes(int32 delta)
|
|||||||
if (fullWidth > width)
|
if (fullWidth > width)
|
||||||
newWidth = floorf(width/count);
|
newWidth = floorf(width/count);
|
||||||
else
|
else
|
||||||
newWidth = kMinimumWindowWidth;
|
newWidth = sMinimumWindowWidth;
|
||||||
}
|
}
|
||||||
if (newWidth > kMinimumWindowWidth)
|
if (newWidth > sMinimumWindowWidth)
|
||||||
newWidth = kMinimumWindowWidth;
|
newWidth = sMinimumWindowWidth;
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
SetMaxContentWidth(newWidth);
|
SetMaxContentWidth(newWidth);
|
||||||
if (newWidth == kMinimumWindowWidth)
|
if (newWidth == sMinimumWindowWidth)
|
||||||
fOverflow = false;
|
fOverflow = false;
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
|
|
||||||
@@ -691,25 +699,36 @@ TExpandoMenuBar::Draw(BRect update)
|
|||||||
void
|
void
|
||||||
TExpandoMenuBar::DrawBackground(BRect)
|
TExpandoMenuBar::DrawBackground(BRect)
|
||||||
{
|
{
|
||||||
|
if (fVertical)
|
||||||
|
return;
|
||||||
|
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
rgb_color menuColor = ViewColor();
|
rgb_color menuColor = ViewColor();
|
||||||
rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
|
rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
|
||||||
rgb_color dark = tint_color(menuColor, B_DARKEN_2_TINT);
|
rgb_color dark = tint_color(menuColor, B_DARKEN_2_TINT);
|
||||||
rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
||||||
|
|
||||||
int32 last = CountItems() - 1;
|
int32 last = CountItems() - 1;
|
||||||
float start;
|
|
||||||
|
|
||||||
if (last >= 0)
|
if (last >= 0)
|
||||||
start = ItemAt(last)->Frame().right + 1;
|
bounds.left = ItemAt(last)->Frame().right + 1;
|
||||||
else
|
else
|
||||||
start = 0;
|
bounds.left = 0;
|
||||||
|
|
||||||
if (!fVertical) {
|
if (be_control_look != NULL) {
|
||||||
|
SetHighColor(tint_color(menuColor, 1.22));
|
||||||
|
StrokeLine(bounds.LeftTop(), bounds.LeftBottom());
|
||||||
|
bounds.left++;
|
||||||
|
uint32 borders = BControlLook::B_TOP_BORDER
|
||||||
|
| BControlLook::B_BOTTOM_BORDER | BControlLook::B_RIGHT_BORDER;
|
||||||
|
|
||||||
|
be_control_look->DrawButtonBackground(this, bounds, bounds, menuColor,
|
||||||
|
0, borders);
|
||||||
|
} else {
|
||||||
SetHighColor(vlight);
|
SetHighColor(vlight);
|
||||||
StrokeLine(BPoint(start, bounds.top+1), bounds.RightTop() + BPoint(0,1));
|
StrokeLine(bounds.LeftTop(), bounds.RightTop());
|
||||||
StrokeLine(BPoint(start, bounds.top+1), BPoint(start, bounds.bottom));
|
StrokeLine(BPoint(bounds.left, bounds.top + 1), bounds.LeftBottom());
|
||||||
SetHighColor(hilite);
|
SetHighColor(hilite);
|
||||||
StrokeLine(BPoint(start+1, bounds.bottom), bounds.RightBottom());
|
StrokeLine(BPoint(bounds.left + 1, bounds.bottom), bounds.RightBottom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,12 +91,14 @@ class TExpandoMenuBar : public BMenuBar {
|
|||||||
|
|
||||||
void _FinishedDrag(bool invoke = false);
|
void _FinishedDrag(bool invoke = false);
|
||||||
|
|
||||||
bool fVertical;
|
bool fVertical : 1;
|
||||||
bool fOverflow;
|
bool fOverflow : 1;
|
||||||
bool fDrawLabel;
|
bool fDrawLabel : 1;
|
||||||
bool fIsScrolling;
|
bool fIsScrolling : 1;
|
||||||
bool fShowTeamExpander;
|
bool fShowTeamExpander : 1;
|
||||||
bool fExpandNewTeams;
|
bool fExpandNewTeams : 1;
|
||||||
|
|
||||||
|
float fBeMenuWidth;
|
||||||
|
|
||||||
TBarView *fBarView;
|
TBarView *fBarView;
|
||||||
int32 fFirstApp;
|
int32 fFirstApp;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ local targetSource ;
|
|||||||
if $(TARGET_PLATFORM) = haiku {
|
if $(TARGET_PLATFORM) = haiku {
|
||||||
targetLib = libshared.a ;
|
targetLib = libshared.a ;
|
||||||
targetSource = CalendarMenuWindow.cpp ;
|
targetSource = CalendarMenuWindow.cpp ;
|
||||||
SubDirC++Flags -D_SHOW_CALENDAR_MENU_WINDOW=1 ;
|
SubDirC++Flags -D_SHOW_CALENDAR_MENU_WINDOW=1 -DMOUNT_MENU_IN_DESKBAR=1 ;
|
||||||
} else {
|
} else {
|
||||||
SubDirC++Flags -D_SHOW_CALENDAR_MENU_ITEM=1 ;
|
SubDirC++Flags -D_SHOW_CALENDAR_MENU_ITEM=1 ;
|
||||||
}
|
}
|
||||||
|
|||||||
+105
-56
@@ -44,9 +44,10 @@ All rights reserved.
|
|||||||
#include <fs_index.h>
|
#include <fs_index.h>
|
||||||
#include <fs_info.h>
|
#include <fs_info.h>
|
||||||
|
|
||||||
#include <Debug.h>
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Beep.h>
|
#include <Beep.h>
|
||||||
|
#include <Bitmap.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -60,11 +61,13 @@ All rights reserved.
|
|||||||
#include <VolumeRoster.h>
|
#include <VolumeRoster.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
#include "icons_logo.h"
|
||||||
|
#include "BarApp.h"
|
||||||
#include "DeskBarUtils.h"
|
#include "DeskBarUtils.h"
|
||||||
|
#include "ResourceSet.h"
|
||||||
#include "StatusView.h"
|
#include "StatusView.h"
|
||||||
#include "StatusViewShelf.h"
|
#include "StatusViewShelf.h"
|
||||||
#include "TimeView.h"
|
#include "TimeView.h"
|
||||||
#include "BarApp.h"
|
|
||||||
|
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
@@ -83,6 +86,8 @@ const char *const kStatusPredicate = "be:deskbar_item_status";
|
|||||||
const char *const kEnabledPredicate = "be:deskbar_item_status=enabled";
|
const char *const kEnabledPredicate = "be:deskbar_item_status=enabled";
|
||||||
const char *const kDisabledPredicate = "be:deskbar_item_status=disabled";
|
const char *const kDisabledPredicate = "be:deskbar_item_status=disabled";
|
||||||
|
|
||||||
|
float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DumpItem(DeskbarItemInfo *item)
|
DumpItem(DeskbarItemInfo *item)
|
||||||
@@ -122,8 +127,17 @@ TReplicantTray::TReplicantTray(TBarView *parent, bool vertical)
|
|||||||
fBarView(parent),
|
fBarView(parent),
|
||||||
fShelf(new TReplicantShelf(this)),
|
fShelf(new TReplicantShelf(this)),
|
||||||
fMultiRowMode(vertical),
|
fMultiRowMode(vertical),
|
||||||
|
fMinimumTrayWidth(kMinimumTrayWidth),
|
||||||
fAlignmentSupport(false)
|
fAlignmentSupport(false)
|
||||||
{
|
{
|
||||||
|
// init the minimum window width according to the logo.
|
||||||
|
const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
|
||||||
|
R_BeLogoIcon);
|
||||||
|
if (logoBitmap != NULL) {
|
||||||
|
sMinimumWindowWidth = max_c(sMinimumWindowWidth,
|
||||||
|
2 * (logoBitmap->Bounds().Width() + 8));
|
||||||
|
fMinimumTrayWidth = sMinimumWindowWidth - kGutter - kDragRegionWidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,8 +152,12 @@ TReplicantTray::AttachedToWindow()
|
|||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
SetViewColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
if (be_control_look != NULL) {
|
||||||
B_DARKEN_1_TINT));
|
SetViewColor(Parent()->ViewColor());
|
||||||
|
} else {
|
||||||
|
SetViewColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
||||||
|
B_DARKEN_1_TINT));
|
||||||
|
}
|
||||||
SetDrawingMode(B_OP_COPY);
|
SetDrawingMode(B_OP_COPY);
|
||||||
|
|
||||||
Window()->SetPulseRate(1000000);
|
Window()->SetPulseRate(1000000);
|
||||||
@@ -236,7 +254,7 @@ TReplicantTray::DealWithClock(bool showClock)
|
|||||||
if (!fClock) {
|
if (!fClock) {
|
||||||
desk_settings *settings = ((TBarApp *)be_app)->Settings();
|
desk_settings *settings = ((TBarApp *)be_app)->Settings();
|
||||||
|
|
||||||
fClock = new TTimeView(kMinimumTrayWidth, kMaxReplicantHeight - 1.0,
|
fClock = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0,
|
||||||
settings->timeShowSeconds, settings->timeShowMil,
|
settings->timeShowSeconds, settings->timeShowMil,
|
||||||
settings->timeFullDate, settings->timeShowEuro, false);
|
settings->timeFullDate, settings->timeShowEuro, false);
|
||||||
AddChild(fClock);
|
AddChild(fClock);
|
||||||
@@ -278,7 +296,7 @@ TReplicantTray::GetPreferredSize(float *preferredWidth, float *preferredHeight)
|
|||||||
height = kGutter + (rowCount * kMaxReplicantHeight)
|
height = kGutter + (rowCount * kMaxReplicantHeight)
|
||||||
+ ((rowCount - 1) * kIconGap) + kGutter;
|
+ ((rowCount - 1) * kIconGap) + kGutter;
|
||||||
height = max(kMinimumTrayHeight, height);
|
height = max(kMinimumTrayHeight, height);
|
||||||
width = kMinimumTrayWidth;
|
width = fMinimumTrayWidth;
|
||||||
} else {
|
} else {
|
||||||
// if last replicant overruns clock then
|
// if last replicant overruns clock then
|
||||||
// resize to accomodate
|
// resize to accomodate
|
||||||
@@ -291,7 +309,7 @@ TReplicantTray::GetPreferredSize(float *preferredWidth, float *preferredHeight)
|
|||||||
width = fRightBottomReplicant.right + 3;
|
width = fRightBottomReplicant.right + 3;
|
||||||
}
|
}
|
||||||
// this view has a fixed minimum width
|
// this view has a fixed minimum width
|
||||||
width = max(kMinimumTrayWidth, width);
|
width = max(fMinimumTrayWidth, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
*preferredWidth = width;
|
*preferredWidth = width;
|
||||||
@@ -325,6 +343,7 @@ TReplicantTray::AdjustPlacement()
|
|||||||
void
|
void
|
||||||
TReplicantTray::Draw(BRect)
|
TReplicantTray::Draw(BRect)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
rgb_color menuColor = ViewColor();
|
rgb_color menuColor = ViewColor();
|
||||||
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
|
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
|
||||||
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
||||||
@@ -1276,7 +1295,7 @@ TReplicantTray::LocationForReplicant(int32 index, float width)
|
|||||||
// try to find free space in every row
|
// try to find free space in every row
|
||||||
for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) {
|
for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) {
|
||||||
// determine free space in this row
|
// determine free space in this row
|
||||||
BRect rect(loc.x, loc.y, loc.x + kMinimumTrayWidth - kIconGap - 2.0, loc.y + kMaxReplicantHeight);
|
BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth - kIconGap - 2.0, loc.y + kMaxReplicantHeight);
|
||||||
if (row == 0 && fBarView->ShowingClock())
|
if (row == 0 && fBarView->ShowingClock())
|
||||||
rect.right -= fClock->Frame().Width() + kIconGap;
|
rect.right -= fClock->Frame().Width() + kIconGap;
|
||||||
|
|
||||||
@@ -1407,7 +1426,10 @@ void
|
|||||||
TDragRegion::AttachedToWindow()
|
TDragRegion::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
if (be_control_look != NULL)
|
||||||
|
SetViewColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), 1.1));
|
||||||
|
else
|
||||||
|
SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
||||||
ResizeToPreferred();
|
ResizeToPreferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1443,6 +1465,8 @@ TDragRegion::Draw(BRect)
|
|||||||
{
|
{
|
||||||
rgb_color menuColor = ViewColor();
|
rgb_color menuColor = ViewColor();
|
||||||
rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
|
rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
|
||||||
|
rgb_color ldark = tint_color(menuColor, 1.02);
|
||||||
|
rgb_color dark = tint_color(menuColor, B_DARKEN_2_TINT);
|
||||||
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
|
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
|
||||||
rgb_color vvdark = tint_color(menuColor, B_DARKEN_4_TINT);
|
rgb_color vvdark = tint_color(menuColor, B_DARKEN_4_TINT);
|
||||||
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
||||||
@@ -1450,23 +1474,43 @@ TDragRegion::Draw(BRect)
|
|||||||
BRect frame(Bounds());
|
BRect frame(Bounds());
|
||||||
BeginLineArray(4);
|
BeginLineArray(4);
|
||||||
|
|
||||||
if (fBarView->Vertical()) {
|
if (be_control_look != NULL) {
|
||||||
AddLine(frame.LeftTop(), frame.RightTop(), light);
|
if (fBarView->Vertical()) {
|
||||||
AddLine(frame.LeftTop(), frame.LeftBottom(), light);
|
AddLine(frame.LeftTop(), frame.RightTop(), dark);
|
||||||
AddLine(frame.RightBottom(), frame.RightTop(), hilite);
|
AddLine(BPoint(frame.left, frame.top + 1),
|
||||||
} else if (fBarView->AcrossTop()) {
|
BPoint(frame.right, frame.top + 1), ldark);
|
||||||
AddLine(frame.LeftTop()+BPoint(0, 1), frame.RightTop()+BPoint(-1, 1),
|
AddLine(frame.LeftBottom(), frame.RightBottom(), hilite);
|
||||||
light);
|
} else if (fBarView->AcrossTop() || fBarView->AcrossBottom()) {
|
||||||
AddLine(frame.RightTop(), frame.RightBottom(), vvdark);
|
AddLine(frame.LeftTop(),
|
||||||
AddLine(frame.RightTop()+BPoint(-1, 2),frame.RightBottom()+BPoint(-1, -1),
|
BPoint(frame.left, frame.bottom), dark);
|
||||||
hilite);
|
AddLine(BPoint(frame.left + 1, frame.top + 1),
|
||||||
AddLine(frame.LeftBottom(), frame.RightBottom()+BPoint(-1, 0), hilite);
|
BPoint(frame.right - 1, frame.top + 1), light);
|
||||||
} else if (fBarView->AcrossBottom()) {
|
AddLine(BPoint(frame.right, frame.top + 2),
|
||||||
AddLine(frame.LeftTop()+BPoint(0, 1), frame.RightTop()+BPoint(-1, 1), light);
|
BPoint(frame.right, frame.bottom), hilite);
|
||||||
AddLine(frame.LeftBottom(), frame.RightBottom(), hilite);
|
AddLine(BPoint(frame.left + 1, frame.bottom),
|
||||||
AddLine(frame.RightTop(), frame.RightBottom(), vvdark);
|
BPoint(frame.right - 1, frame.bottom), hilite);
|
||||||
AddLine(frame.RightTop()+BPoint(-1, 1),frame.RightBottom()+BPoint(-1, -1),
|
}
|
||||||
hilite);
|
} else {
|
||||||
|
if (fBarView->Vertical()) {
|
||||||
|
AddLine(frame.LeftTop(), frame.RightTop(), light);
|
||||||
|
AddLine(frame.LeftTop(), frame.LeftBottom(), light);
|
||||||
|
AddLine(frame.RightBottom(), frame.RightTop(), hilite);
|
||||||
|
} else if (fBarView->AcrossTop()) {
|
||||||
|
AddLine(BPoint(frame.left, frame.top + 1),
|
||||||
|
BPoint(frame.right - 1, frame.top + 1), light);
|
||||||
|
AddLine(frame.RightTop(), frame.RightBottom(), vvdark);
|
||||||
|
AddLine(BPoint(frame.right - 1, frame.top + 2),
|
||||||
|
BPoint(frame.right - 1, frame.bottom - 1), hilite);
|
||||||
|
AddLine(frame.LeftBottom(),
|
||||||
|
BPoint(frame.right - 1, frame.bottom), hilite);
|
||||||
|
} else if (fBarView->AcrossBottom()) {
|
||||||
|
AddLine(BPoint(frame.left, frame.top + 1),
|
||||||
|
BPoint(frame.right - 1, frame.top + 1), light);
|
||||||
|
AddLine(frame.LeftBottom(), frame.RightBottom(), hilite);
|
||||||
|
AddLine(frame.RightTop(), frame.RightBottom(), vvdark);
|
||||||
|
AddLine(BPoint(frame.right - 1, frame.top + 1),
|
||||||
|
BPoint(frame.right - 1, frame.bottom - 1), hilite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EndLineArray();
|
EndLineArray();
|
||||||
@@ -1479,33 +1523,29 @@ TDragRegion::Draw(BRect)
|
|||||||
void
|
void
|
||||||
TDragRegion::DrawDragRegion()
|
TDragRegion::DrawDragRegion()
|
||||||
{
|
{
|
||||||
rgb_color menuColor = ViewColor();
|
|
||||||
rgb_color menuHilite = tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT);
|
|
||||||
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
|
|
||||||
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
|
||||||
|
|
||||||
BRect dragRegion(DragRegion());
|
BRect dragRegion(DragRegion());
|
||||||
|
|
||||||
BeginLineArray(dragRegion.IntegerHeight());
|
rgb_color menuColor = ViewColor();
|
||||||
BPoint pt = dragRegion.LeftTop() + BPoint(1,1);
|
rgb_color menuHilite = menuColor;
|
||||||
|
|
||||||
// Draw drag region highlighted if tracking mouse
|
|
||||||
if (IsTracking()) {
|
if (IsTracking()) {
|
||||||
|
// Draw drag region highlighted if tracking mouse
|
||||||
|
menuHilite = tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT);
|
||||||
SetHighColor(menuHilite);
|
SetHighColor(menuHilite);
|
||||||
FillRect(dragRegion);
|
FillRect(dragRegion);
|
||||||
while (pt.y + 1 <= dragRegion.bottom) {
|
}
|
||||||
AddLine(pt, pt, light);
|
rgb_color vdark = tint_color(menuHilite, B_DARKEN_3_TINT);
|
||||||
AddLine(pt+BPoint(1,1), pt+BPoint(1,1), vdark);
|
rgb_color light = tint_color(menuHilite, B_LIGHTEN_2_TINT);
|
||||||
|
|
||||||
pt.y += 3;
|
BeginLineArray(dragRegion.IntegerHeight());
|
||||||
}
|
BPoint pt;
|
||||||
} else {
|
pt.x = floorf((dragRegion.left + dragRegion.right) / 2 + 0.5) - 1;
|
||||||
while (pt.y + 1 <= dragRegion.bottom) {
|
pt.y = dragRegion.top + 2;
|
||||||
AddLine(pt, pt, vdark);
|
|
||||||
AddLine(pt+BPoint(1,1), pt+BPoint(1,1), light);
|
while (pt.y + 1 <= dragRegion.bottom) {
|
||||||
|
AddLine(pt, pt, vdark);
|
||||||
pt.y += 3;
|
AddLine(pt + BPoint(1, 1), pt + BPoint(1, 1), light);
|
||||||
}
|
|
||||||
|
pt.y += 3;
|
||||||
}
|
}
|
||||||
EndLineArray();
|
EndLineArray();
|
||||||
}
|
}
|
||||||
@@ -1514,9 +1554,18 @@ TDragRegion::DrawDragRegion()
|
|||||||
BRect
|
BRect
|
||||||
TDragRegion::DragRegion() const
|
TDragRegion::DragRegion() const
|
||||||
{
|
{
|
||||||
|
float kTopBottomInset = 2;
|
||||||
|
float kLeftRightInset = 1;
|
||||||
|
float kDragWidth = 3;
|
||||||
|
if (be_control_look != NULL) {
|
||||||
|
kTopBottomInset = 1;
|
||||||
|
kLeftRightInset = 0;
|
||||||
|
kDragWidth = 4;
|
||||||
|
}
|
||||||
|
|
||||||
BRect dragRegion(Bounds());
|
BRect dragRegion(Bounds());
|
||||||
dragRegion.top += 2;
|
dragRegion.top += kTopBottomInset;
|
||||||
dragRegion.bottom -= 2;
|
dragRegion.bottom -= kTopBottomInset;
|
||||||
|
|
||||||
bool placeOnLeft=false;
|
bool placeOnLeft=false;
|
||||||
if (fDragLocation == kAutoPlaceDragRegion) {
|
if (fDragLocation == kAutoPlaceDragRegion) {
|
||||||
@@ -1530,11 +1579,11 @@ TDragRegion::DragRegion() const
|
|||||||
placeOnLeft = false;
|
placeOnLeft = false;
|
||||||
|
|
||||||
if (placeOnLeft) {
|
if (placeOnLeft) {
|
||||||
dragRegion.left += 1;
|
dragRegion.left += kLeftRightInset;
|
||||||
dragRegion.right = dragRegion.left + 3;
|
dragRegion.right = dragRegion.left + kDragWidth;
|
||||||
} else {
|
} else {
|
||||||
dragRegion.right -= 1;
|
dragRegion.right -= kLeftRightInset;
|
||||||
dragRegion.left = dragRegion.right - 3;
|
dragRegion.left = dragRegion.right - kDragWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dragRegion;
|
return dragRegion;
|
||||||
@@ -1612,7 +1661,7 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage *message)
|
|||||||
BRect frame = screen.Frame();
|
BRect frame = screen.Frame();
|
||||||
|
|
||||||
float hDivider = frame.Width() / 6;
|
float hDivider = frame.Width() / 6;
|
||||||
hDivider = (hDivider < kMinimumWindowWidth + 10.0f) ? kMinimumWindowWidth + 10.0f : hDivider;
|
hDivider = (hDivider < sMinimumWindowWidth + 10.0f) ? sMinimumWindowWidth + 10.0f : hDivider;
|
||||||
float miniDivider = frame.top + kMiniHeight + 10.0f;
|
float miniDivider = frame.top + kMiniHeight + 10.0f;
|
||||||
float vDivider = frame.Height() / 2;
|
float vDivider = frame.Height() / 2;
|
||||||
#ifdef FULL_MODE
|
#ifdef FULL_MODE
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const float kMinimumTrayWidth = kIconGap
|
|||||||
+ (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
|
+ (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter;
|
||||||
const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter;
|
const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter;
|
||||||
|
|
||||||
const float kMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth;
|
extern float sMinimumWindowWidth;
|
||||||
|
|
||||||
#ifdef DB_ADDONS
|
#ifdef DB_ADDONS
|
||||||
struct DeskbarItemInfo {
|
struct DeskbarItemInfo {
|
||||||
@@ -161,6 +161,7 @@ private:
|
|||||||
int32 fLastReplicant;
|
int32 fLastReplicant;
|
||||||
|
|
||||||
bool fMultiRowMode;
|
bool fMultiRowMode;
|
||||||
|
float fMinimumTrayWidth;
|
||||||
|
|
||||||
bool fAlignmentSupport;
|
bool fAlignmentSupport;
|
||||||
#ifdef DB_ADDONS
|
#ifdef DB_ADDONS
|
||||||
|
|||||||
@@ -34,11 +34,14 @@ All rights reserved.
|
|||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
|
||||||
|
#include "TeamMenuItem.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
@@ -50,7 +53,6 @@ All rights reserved.
|
|||||||
#include "ResourceSet.h"
|
#include "ResourceSet.h"
|
||||||
#include "ShowHideMenuItem.h"
|
#include "ShowHideMenuItem.h"
|
||||||
#include "TeamMenu.h"
|
#include "TeamMenu.h"
|
||||||
#include "TeamMenuItem.h"
|
|
||||||
#include "WindowMenu.h"
|
#include "WindowMenu.h"
|
||||||
#include "WindowMenuItem.h"
|
#include "WindowMenuItem.h"
|
||||||
|
|
||||||
@@ -229,12 +231,49 @@ TTeamMenuItem::Draw()
|
|||||||
BRect frame(Frame());
|
BRect frame(Frame());
|
||||||
BMenu *menu = Menu();
|
BMenu *menu = Menu();
|
||||||
menu->PushState();
|
menu->PushState();
|
||||||
rgb_color menuColor = menu->ViewColor();
|
rgb_color menuColor = menu->LowColor();
|
||||||
|
|
||||||
|
TBarView *barview = (static_cast<TBarApp *>(be_app))->BarView();
|
||||||
|
bool canHandle = !barview->Dragging()
|
||||||
|
|| barview->AppCanHandleTypes(Signature());
|
||||||
|
|
||||||
|
if (be_control_look != NULL) {
|
||||||
|
uint32 flags = 0;
|
||||||
|
if (_IsSelected() && canHandle)
|
||||||
|
flags |= BControlLook::B_ACTIVATED;
|
||||||
|
|
||||||
|
uint32 borders = BControlLook::B_TOP_BORDER;
|
||||||
|
if (fVertical) {
|
||||||
|
menu->SetHighColor(tint_color(menuColor, B_DARKEN_1_TINT));
|
||||||
|
borders |= BControlLook::B_LEFT_BORDER
|
||||||
|
| BControlLook::B_RIGHT_BORDER;
|
||||||
|
menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
|
||||||
|
frame.bottom--;
|
||||||
|
|
||||||
|
be_control_look->DrawMenuBarBackground(menu, frame, frame,
|
||||||
|
menuColor, flags, borders);
|
||||||
|
} else {
|
||||||
|
if (flags & BControlLook::B_ACTIVATED)
|
||||||
|
menu->SetHighColor(tint_color(menuColor, B_DARKEN_3_TINT));
|
||||||
|
else
|
||||||
|
menu->SetHighColor(tint_color(menuColor, 1.22));
|
||||||
|
borders |= BControlLook::B_BOTTOM_BORDER;
|
||||||
|
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
|
||||||
|
frame.left++;
|
||||||
|
|
||||||
|
be_control_look->DrawButtonBackground(menu, frame, frame,
|
||||||
|
menuColor, flags, borders);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu->MovePenTo(ContentLocation());
|
||||||
|
DrawContent();
|
||||||
|
menu->PopState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if not selected or being tracked on, fill with gray
|
// if not selected or being tracked on, fill with gray
|
||||||
TBarView *barview = (static_cast<TBarApp *>(be_app))->BarView();
|
if (!_IsSelected() && !menu->IsRedrawAfterSticky() || !canHandle
|
||||||
bool canHandle = !barview->Dragging() || barview->AppCanHandleTypes(Signature());
|
|| !IsEnabled()) {
|
||||||
if (!_IsSelected() && !menu->IsRedrawAfterSticky() || !canHandle || !IsEnabled()) {
|
|
||||||
frame.InsetBy(1, 1);
|
frame.InsetBy(1, 1);
|
||||||
menu->SetHighColor(menuColor);
|
menu->SetHighColor(menuColor);
|
||||||
menu->FillRect(frame);
|
menu->FillRect(frame);
|
||||||
@@ -246,8 +285,6 @@ TTeamMenuItem::Draw()
|
|||||||
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
|
||||||
|
|
||||||
frame = Frame();
|
frame = Frame();
|
||||||
if (!fVertical)
|
|
||||||
frame.top += 1;
|
|
||||||
|
|
||||||
menu->SetHighColor(shadow);
|
menu->SetHighColor(shadow);
|
||||||
if (fVertical)
|
if (fVertical)
|
||||||
@@ -301,9 +338,6 @@ TTeamMenuItem::DrawContent()
|
|||||||
}
|
}
|
||||||
BRect frame(Frame());
|
BRect frame(Frame());
|
||||||
|
|
||||||
if (!fVertical)
|
|
||||||
frame.top += 1;
|
|
||||||
|
|
||||||
BRect iconBounds(fIcon->Bounds());
|
BRect iconBounds(fIcon->Bounds());
|
||||||
BRect dstRect(iconBounds);
|
BRect dstRect(iconBounds);
|
||||||
float extra = fVertical ? 0.0f : 1.0f;
|
float extra = fVertical ? 0.0f : 1.0f;
|
||||||
@@ -312,8 +346,6 @@ TTeamMenuItem::DrawContent()
|
|||||||
((frame.Height() - iconBounds.Height()) / 2) + extra));
|
((frame.Height() - iconBounds.Height()) / 2) + extra));
|
||||||
menu->DrawBitmapAsync(fIcon, dstRect);
|
menu->DrawBitmapAsync(fIcon, dstRect);
|
||||||
|
|
||||||
menu->SetDrawingMode(B_OP_COPY);
|
|
||||||
|
|
||||||
float labelHeight = fLabelAscent + fLabelDescent;
|
float labelHeight = fLabelAscent + fLabelDescent;
|
||||||
BPoint drawLoc = contLoc + BPoint(kHPad, kVPad);
|
BPoint drawLoc = contLoc + BPoint(kHPad, kVPad);
|
||||||
drawLoc.x += iconBounds.Width() + kLabelOffset;
|
drawLoc.x += iconBounds.Width() + kLabelOffset;
|
||||||
@@ -322,14 +354,16 @@ TTeamMenuItem::DrawContent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the pen to black so that either method will draw in the same color
|
// set the pen to black so that either method will draw in the same color
|
||||||
// low color is set in inherited::DrawContent, override makes sure its what we want
|
// low color is set in inherited::DrawContent, override makes sure its
|
||||||
|
// what we want
|
||||||
if (fDrawLabel) {
|
if (fDrawLabel) {
|
||||||
|
menu->SetDrawingMode(B_OP_OVER);
|
||||||
menu->SetHighColor(0, 0, 0);
|
menu->SetHighColor(0, 0, 0);
|
||||||
|
|
||||||
// override the drawing of the content when the item is disabled
|
// override the drawing of the content when the item is disabled
|
||||||
// the wrong lowcolor is used when the item is disabled since the
|
// the wrong lowcolor is used when the item is disabled since the
|
||||||
// text color does not change
|
// text color does not change
|
||||||
DrawContentLabel();
|
DrawContentLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the expandable icon.
|
// Draw the expandable icon.
|
||||||
@@ -341,46 +375,53 @@ TTeamMenuItem::DrawContent()
|
|||||||
rect.OffsetTo(BPoint(frame.right - rect.Width(),
|
rect.OffsetTo(BPoint(frame.right - rect.Width(),
|
||||||
ContentLocation().y + ((frame.Height() - rect.Height()) / 2)));
|
ContentLocation().y + ((frame.Height() - rect.Height()) / 2)));
|
||||||
|
|
||||||
rgb_color outlineColor = {80, 80, 80, 255};
|
if (be_control_look != NULL) {
|
||||||
rgb_color middleColor = {200, 200, 200, 255};
|
uint32 arrowDirection = fExpanded
|
||||||
|
? BControlLook::B_UP_ARROW : BControlLook::B_DOWN_ARROW;
|
||||||
menu->SetDrawingMode(B_OP_OVER);
|
be_control_look->DrawArrowShape(menu, rect, rect, menu->LowColor(),
|
||||||
|
arrowDirection, 0, B_DARKEN_3_TINT);
|
||||||
if (!fExpanded) {
|
|
||||||
menu->BeginLineArray(6);
|
|
||||||
|
|
||||||
menu->AddLine(BPoint(rect.left + 3, rect.top + 1),
|
|
||||||
BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
|
|
||||||
menu->AddLine(BPoint(rect.left + 3, rect.top + 1),
|
|
||||||
BPoint(rect.left + 7, rect.top + 5), outlineColor);
|
|
||||||
menu->AddLine(BPoint(rect.left + 7, rect.top + 5),
|
|
||||||
BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
|
|
||||||
|
|
||||||
menu->AddLine(BPoint(rect.left + 4, rect.top + 3),
|
|
||||||
BPoint(rect.left + 4, rect.bottom - 3), middleColor);
|
|
||||||
menu->AddLine(BPoint(rect.left + 5, rect.top + 4),
|
|
||||||
BPoint(rect.left + 5, rect.bottom - 4), middleColor);
|
|
||||||
menu->AddLine(BPoint(rect.left + 5, rect.top + 5),
|
|
||||||
BPoint(rect.left + 6, rect.top + 5), middleColor);
|
|
||||||
menu->EndLineArray();
|
|
||||||
} else {
|
} else {
|
||||||
// expanded state
|
rgb_color outlineColor = {80, 80, 80, 255};
|
||||||
|
rgb_color middleColor = {200, 200, 200, 255};
|
||||||
menu->BeginLineArray(6);
|
|
||||||
menu->AddLine(BPoint(rect.left + 1, rect.top + 3),
|
menu->SetDrawingMode(B_OP_OVER);
|
||||||
BPoint(rect.right - 3, rect.top + 3), outlineColor);
|
|
||||||
menu->AddLine(BPoint(rect.left + 1, rect.top + 3),
|
if (!fExpanded) {
|
||||||
BPoint(rect.left + 5, rect.top + 7), outlineColor);
|
menu->BeginLineArray(6);
|
||||||
menu->AddLine(BPoint(rect.left + 5, rect.top + 7),
|
|
||||||
BPoint(rect.right - 3, rect.top + 3), outlineColor);
|
menu->AddLine(BPoint(rect.left + 3, rect.top + 1),
|
||||||
|
BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
|
||||||
menu->AddLine(BPoint(rect.left + 3, rect.top + 4),
|
menu->AddLine(BPoint(rect.left + 3, rect.top + 1),
|
||||||
BPoint(rect.right - 5, rect.top + 4), middleColor);
|
BPoint(rect.left + 7, rect.top + 5), outlineColor);
|
||||||
menu->AddLine(BPoint(rect.left + 4, rect.top + 5),
|
menu->AddLine(BPoint(rect.left + 7, rect.top + 5),
|
||||||
BPoint(rect.right - 6, rect.top + 5), middleColor);
|
BPoint(rect.left + 3, rect.bottom - 1), outlineColor);
|
||||||
menu->AddLine(BPoint(rect.left + 5, rect.top + 5),
|
|
||||||
BPoint(rect.left + 5, rect.top + 6), middleColor);
|
menu->AddLine(BPoint(rect.left + 4, rect.top + 3),
|
||||||
menu->EndLineArray();
|
BPoint(rect.left + 4, rect.bottom - 3), middleColor);
|
||||||
|
menu->AddLine(BPoint(rect.left + 5, rect.top + 4),
|
||||||
|
BPoint(rect.left + 5, rect.bottom - 4), middleColor);
|
||||||
|
menu->AddLine(BPoint(rect.left + 5, rect.top + 5),
|
||||||
|
BPoint(rect.left + 6, rect.top + 5), middleColor);
|
||||||
|
menu->EndLineArray();
|
||||||
|
} else {
|
||||||
|
// expanded state
|
||||||
|
|
||||||
|
menu->BeginLineArray(6);
|
||||||
|
menu->AddLine(BPoint(rect.left + 1, rect.top + 3),
|
||||||
|
BPoint(rect.right - 3, rect.top + 3), outlineColor);
|
||||||
|
menu->AddLine(BPoint(rect.left + 1, rect.top + 3),
|
||||||
|
BPoint(rect.left + 5, rect.top + 7), outlineColor);
|
||||||
|
menu->AddLine(BPoint(rect.left + 5, rect.top + 7),
|
||||||
|
BPoint(rect.right - 3, rect.top + 3), outlineColor);
|
||||||
|
|
||||||
|
menu->AddLine(BPoint(rect.left + 3, rect.top + 4),
|
||||||
|
BPoint(rect.right - 5, rect.top + 4), middleColor);
|
||||||
|
menu->AddLine(BPoint(rect.left + 4, rect.top + 5),
|
||||||
|
BPoint(rect.right - 6, rect.top + 5), middleColor);
|
||||||
|
menu->AddLine(BPoint(rect.left + 5, rect.top + 5),
|
||||||
|
BPoint(rect.left + 5, rect.top + 6), middleColor);
|
||||||
|
menu->EndLineArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -391,7 +432,6 @@ TTeamMenuItem::DrawContentLabel()
|
|||||||
{
|
{
|
||||||
BMenu *menu = Menu();
|
BMenu *menu = Menu();
|
||||||
menu->MovePenBy(0, fLabelAscent);
|
menu->MovePenBy(0, fLabelAscent);
|
||||||
menu->SetDrawingMode(B_OP_COPY);
|
|
||||||
|
|
||||||
float cachedWidth = menu->StringWidth(Label());
|
float cachedWidth = menu->StringWidth(Label());
|
||||||
if (Submenu() && fVertical)
|
if (Submenu() && fVertical)
|
||||||
|
|||||||
Reference in New Issue
Block a user