Move flags and look into the tab too. The flags are needed to determine e.g. whether or not the zoom button should be drawn.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42552 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+12
-10
@@ -1221,20 +1221,20 @@ Window::SetLook(window_look look, BRegion* updateRegion)
|
|||||||
if (fCurrentStack.Get() == NULL)
|
if (fCurrentStack.Get() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int32 stackPosition = PositionInStack();
|
||||||
|
|
||||||
::Decorator* decorator = Decorator();
|
::Decorator* decorator = Decorator();
|
||||||
if (decorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) {
|
if (decorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) {
|
||||||
// we need a new decorator
|
// we need a new decorator
|
||||||
decorator = gDecorManager.AllocateDecorator(this);
|
decorator = gDecorManager.AllocateDecorator(this);
|
||||||
fCurrentStack->SetDecorator(decorator);
|
fCurrentStack->SetDecorator(decorator);
|
||||||
if (IsFocus()) {
|
if (IsFocus())
|
||||||
int32 index = PositionInStack();
|
decorator->SetFocus(stackPosition, true);
|
||||||
decorator->SetFocus(index, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decorator != NULL) {
|
if (decorator != NULL) {
|
||||||
DesktopSettings settings(fDesktop);
|
DesktopSettings settings(fDesktop);
|
||||||
decorator->SetLook(settings, look, updateRegion);
|
decorator->SetLook(stackPosition, settings, look, updateRegion);
|
||||||
|
|
||||||
// we might need to resize the window!
|
// we might need to resize the window!
|
||||||
decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth,
|
decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth,
|
||||||
@@ -1288,7 +1288,8 @@ Window::SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
if (decorator == NULL)
|
if (decorator == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
decorator->SetFlags(flags, updateRegion);
|
int32 stackPosition = PositionInStack();
|
||||||
|
decorator->SetFlags(stackPosition, flags, updateRegion);
|
||||||
|
|
||||||
// we might need to resize the window!
|
// we might need to resize the window!
|
||||||
decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
decorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
||||||
@@ -2101,7 +2102,6 @@ Window::DetachFromWindowStack(bool ownStackNeeded)
|
|||||||
decorator->SetDrawingEngine(remainingTop->fDrawingEngine);
|
decorator->SetDrawingEngine(remainingTop->fDrawingEngine);
|
||||||
// propagate focus to the decorator
|
// propagate focus to the decorator
|
||||||
remainingTop->SetFocus(remainingTop->IsFocus());
|
remainingTop->SetFocus(remainingTop->IsFocus());
|
||||||
remainingTop->SetFeel(remainingTop->Feel());
|
|
||||||
remainingTop->SetLook(remainingTop->Look(), &dirty);
|
remainingTop->SetLook(remainingTop->Look(), &dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2145,8 +2145,11 @@ Window::AddWindowToStack(Window* window)
|
|||||||
window->DetachFromWindowStack(false);
|
window->DetachFromWindowStack(false);
|
||||||
window->fCurrentStack.SetTo(stack);
|
window->fCurrentStack.SetTo(stack);
|
||||||
|
|
||||||
if (decorator != NULL)
|
if (decorator != NULL) {
|
||||||
decorator->AddTab(window->Title(), position, &dirty);
|
DesktopSettings settings(fDesktop);
|
||||||
|
decorator->AddTab(settings, window->Title(), window->Look(),
|
||||||
|
window->Flags(), position, &dirty);
|
||||||
|
}
|
||||||
|
|
||||||
window->SetLook(window->Look(), &dirty);
|
window->SetLook(window->Look(), &dirty);
|
||||||
fDesktop->RebuildAndRedrawAfterWindowChange(TopLayerStackWindow(), dirty);
|
fDesktop->RebuildAndRedrawAfterWindowChange(TopLayerStackWindow(), dirty);
|
||||||
@@ -2196,7 +2199,6 @@ Window::MoveToTopStackLayer()
|
|||||||
if (decorator == NULL)
|
if (decorator == NULL)
|
||||||
return false;
|
return false;
|
||||||
decorator->SetDrawingEngine(fDrawingEngine);
|
decorator->SetDrawingEngine(fDrawingEngine);
|
||||||
DesktopSettings settings(fDesktop);
|
|
||||||
SetLook(Look(), NULL);
|
SetLook(Look(), NULL);
|
||||||
decorator->SetTopTap(PositionInStack());
|
decorator->SetTopTap(PositionInStack());
|
||||||
return fCurrentStack->MoveToTopLayer(this);
|
return fCurrentStack->MoveToTopLayer(this);
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ DecorAddOn::AllocateDecorator(Desktop* desktop, DrawingEngine* engine,
|
|||||||
|
|
||||||
DesktopSettings settings(desktop);
|
DesktopSettings settings(desktop);
|
||||||
Decorator* decorator;
|
Decorator* decorator;
|
||||||
decorator = _AllocateDecorator(settings, rect, look, flags);
|
decorator = _AllocateDecorator(settings, rect);
|
||||||
desktop->UnlockSingleWindow();
|
desktop->UnlockSingleWindow();
|
||||||
if (!decorator)
|
if (!decorator)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (decorator->AddTab(title) == false) {
|
if (decorator->AddTab(settings, title, look, flags) == false) {
|
||||||
delete decorator;
|
delete decorator;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -94,10 +94,9 @@ DecorAddOn::GetDesktopListeners()
|
|||||||
|
|
||||||
|
|
||||||
Decorator*
|
Decorator*
|
||||||
DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect,
|
DecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect)
|
||||||
window_look look, uint32 flags)
|
|
||||||
{
|
{
|
||||||
return new (std::nothrow)SATDecorator(settings, rect, look, flags);
|
return new (std::nothrow)SATDecorator(settings, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Decorator* _AllocateDecorator(DesktopSettings& settings,
|
virtual Decorator* _AllocateDecorator(DesktopSettings& settings,
|
||||||
BRect rect, window_look look, uint32 flags);
|
BRect rect);
|
||||||
|
|
||||||
DesktopListenerList fDesktopListeners;
|
DesktopListenerList fDesktopListeners;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ Decorator::Tab::Tab()
|
|||||||
closePressed(false),
|
closePressed(false),
|
||||||
zoomPressed(false),
|
zoomPressed(false),
|
||||||
minimizePressed(false),
|
minimizePressed(false),
|
||||||
|
|
||||||
|
look(B_TITLED_WINDOW_LOOK),
|
||||||
|
flags(0),
|
||||||
isFocused(false),
|
isFocused(false),
|
||||||
title("")
|
title("")
|
||||||
{
|
{
|
||||||
@@ -48,15 +51,11 @@ Decorator::Tab::Tab()
|
|||||||
\param wfeel style of window feel. See Window.h
|
\param wfeel style of window feel. See Window.h
|
||||||
\param wflags various window flags. See Window.h
|
\param wflags various window flags. See Window.h
|
||||||
*/
|
*/
|
||||||
Decorator::Decorator(DesktopSettings& settings, BRect rect, window_look look,
|
Decorator::Decorator(DesktopSettings& settings, BRect rect)
|
||||||
uint32 flags)
|
|
||||||
:
|
:
|
||||||
fDrawingEngine(NULL),
|
fDrawingEngine(NULL),
|
||||||
fDrawState(),
|
fDrawState(),
|
||||||
|
|
||||||
fLook(look),
|
|
||||||
fFlags(flags),
|
|
||||||
|
|
||||||
fTitleBarRect(),
|
fTitleBarRect(),
|
||||||
fFrame(rect),
|
fFrame(rect),
|
||||||
fResizeRect(),
|
fResizeRect(),
|
||||||
@@ -81,12 +80,15 @@ Decorator::~Decorator()
|
|||||||
|
|
||||||
|
|
||||||
Decorator::Tab*
|
Decorator::Tab*
|
||||||
Decorator::AddTab(const char* title, int32 index, BRegion* updateRegion)
|
Decorator::AddTab(DesktopSettings& settings, const char* title,
|
||||||
|
window_look look, uint32 flags, int32 index, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
Decorator::Tab* tab = _AllocateNewTab();
|
Decorator::Tab* tab = _AllocateNewTab();
|
||||||
if (tab == NULL)
|
if (tab == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
tab->title = title;
|
tab->title = title;
|
||||||
|
tab->look = look;
|
||||||
|
tab->flags = flags;
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@@ -100,14 +102,15 @@ Decorator::AddTab(const char* title, int32 index, BRegion* updateRegion)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_AddTab(index, updateRegion) == false) {
|
Decorator::Tab* oldTop = fTopTab;
|
||||||
|
fTopTab = tab;
|
||||||
|
if (_AddTab(settings, index, updateRegion) == false) {
|
||||||
fTabList.RemoveItem(tab);
|
fTabList.RemoveItem(tab);
|
||||||
delete tab;
|
delete tab;
|
||||||
|
fTopTab = oldTop;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fTopTab = tab;
|
|
||||||
|
|
||||||
_InvalidateFootprint();
|
_InvalidateFootprint();
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
@@ -184,7 +187,7 @@ Decorator::SetDrawingEngine(DrawingEngine* engine)
|
|||||||
\param flags New value for the flags
|
\param flags New value for the flags
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Decorator::SetFlags(uint32 flags, BRegion* updateRegion)
|
Decorator::SetFlags(int32 tab, uint32 flags, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
// we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE
|
// we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE
|
||||||
// are in sync (it's only a semantical simplification, not a necessity)
|
// are in sync (it's only a semantical simplification, not a necessity)
|
||||||
@@ -194,7 +197,10 @@ Decorator::SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
if (flags & B_NOT_RESIZABLE)
|
if (flags & B_NOT_RESIZABLE)
|
||||||
flags |= B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE;
|
flags |= B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE;
|
||||||
|
|
||||||
_SetFlags(flags, updateRegion);
|
Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
|
||||||
|
if (decoratorTab == NULL)
|
||||||
|
return;
|
||||||
|
_SetFlags(decoratorTab, flags, updateRegion);
|
||||||
_InvalidateFootprint();
|
_InvalidateFootprint();
|
||||||
// the border might have changed (smaller/larger tab)
|
// the border might have changed (smaller/larger tab)
|
||||||
}
|
}
|
||||||
@@ -214,10 +220,13 @@ Decorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
|||||||
\param look New value for the look
|
\param look New value for the look
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Decorator::SetLook(DesktopSettings& settings, window_look look,
|
Decorator::SetLook(int32 tab, DesktopSettings& settings, window_look look,
|
||||||
BRegion* updateRect)
|
BRegion* updateRect)
|
||||||
{
|
{
|
||||||
_SetLook(settings, look, updateRect);
|
Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
|
||||||
|
if (decoratorTab == NULL)
|
||||||
|
return;
|
||||||
|
_SetLook(decoratorTab, settings, look, updateRect);
|
||||||
_InvalidateFootprint();
|
_InvalidateFootprint();
|
||||||
// the border very likely changed
|
// the border very likely changed
|
||||||
}
|
}
|
||||||
@@ -227,9 +236,9 @@ Decorator::SetLook(DesktopSettings& settings, window_look look,
|
|||||||
\return the decorator's window look
|
\return the decorator's window look
|
||||||
*/
|
*/
|
||||||
window_look
|
window_look
|
||||||
Decorator::Look() const
|
Decorator::Look(int32 tab) const
|
||||||
{
|
{
|
||||||
return fLook;
|
return TabAt(tab)->look;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -237,9 +246,9 @@ Decorator::Look() const
|
|||||||
\return the decorator's window flags
|
\return the decorator's window flags
|
||||||
*/
|
*/
|
||||||
uint32
|
uint32
|
||||||
Decorator::Flags() const
|
Decorator::Flags(int32 tab) const
|
||||||
{
|
{
|
||||||
return fFlags;
|
return TabAt(tab)->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -846,17 +855,17 @@ Decorator::_FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Decorator::_SetLook(DesktopSettings& settings, window_look look,
|
Decorator::_SetLook(Decorator::Tab* tab, DesktopSettings& settings,
|
||||||
BRegion* updateRect)
|
window_look look, BRegion* updateRect)
|
||||||
{
|
{
|
||||||
fLook = look;
|
tab->look = look;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Decorator::_SetFlags(uint32 flags, BRegion* updateRegion)
|
Decorator::_SetFlags(Decorator::Tab* tab, uint32 flags, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
fFlags = flags;
|
tab->flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public:
|
|||||||
bool zoomPressed : 1;
|
bool zoomPressed : 1;
|
||||||
bool minimizePressed : 1;
|
bool minimizePressed : 1;
|
||||||
|
|
||||||
|
window_look look;
|
||||||
|
uint32 flags;
|
||||||
bool isFocused : 1;
|
bool isFocused : 1;
|
||||||
|
|
||||||
BString title;
|
BString title;
|
||||||
@@ -76,18 +78,18 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Decorator(DesktopSettings& settings, BRect rect,
|
Decorator(DesktopSettings& settings, BRect rect);
|
||||||
window_look look, uint32 flags);
|
|
||||||
virtual ~Decorator();
|
virtual ~Decorator();
|
||||||
|
|
||||||
virtual Decorator::Tab* AddTab(const char* title, int32 index = -1,
|
virtual Decorator::Tab* AddTab(DesktopSettings& settings, const char* title,
|
||||||
BRegion* updateRegion = NULL);
|
window_look look, uint32 flags,
|
||||||
|
int32 index = -1, BRegion* updateRegion = NULL);
|
||||||
virtual bool RemoveTab(int32 index,
|
virtual bool RemoveTab(int32 index,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual bool MoveTab(int32 from, int32 to, bool isMoving,
|
virtual bool MoveTab(int32 from, int32 to, bool isMoving,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual int32 TabAt(const BPoint& where) const;
|
virtual int32 TabAt(const BPoint& where) const;
|
||||||
Decorator::Tab* TabAt(int32 index)
|
Decorator::Tab* TabAt(int32 index) const
|
||||||
{ return fTabList.ItemAt(index); }
|
{ return fTabList.ItemAt(index); }
|
||||||
int32 CountTabs() const
|
int32 CountTabs() const
|
||||||
{ return fTabList.CountItems(); }
|
{ return fTabList.CountItems(); }
|
||||||
@@ -99,13 +101,13 @@ public:
|
|||||||
|
|
||||||
void FontsChanged(DesktopSettings& settings,
|
void FontsChanged(DesktopSettings& settings,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
void SetLook(DesktopSettings& settings, window_look look,
|
void SetLook(int32 tab, DesktopSettings& settings,
|
||||||
BRegion* updateRegion = NULL);
|
window_look look, BRegion* updateRegion = NULL);
|
||||||
void SetFlags(uint32 flags,
|
void SetFlags(int32 tab, uint32 flags,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
window_look Look() const;
|
window_look Look(int32 tab) const;
|
||||||
uint32 Flags() const;
|
uint32 Flags(int32 tab) const;
|
||||||
|
|
||||||
BRect BorderRect() const;
|
BRect BorderRect() const;
|
||||||
BRect TitleBarRect() const;
|
BRect TitleBarRect() const;
|
||||||
@@ -195,9 +197,10 @@ protected:
|
|||||||
|
|
||||||
virtual void _FontsChanged(DesktopSettings& settings,
|
virtual void _FontsChanged(DesktopSettings& settings,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual void _SetLook(DesktopSettings& settings,
|
virtual void _SetLook(Decorator::Tab* tab,
|
||||||
window_look look, BRegion* updateRegion = NULL);
|
DesktopSettings& settings, window_look look,
|
||||||
virtual void _SetFlags(uint32 flags,
|
BRegion* updateRegion = NULL);
|
||||||
|
virtual void _SetFlags(Decorator::Tab* tab, uint32 flags,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
virtual void _MoveBy(BPoint offset);
|
virtual void _MoveBy(BPoint offset);
|
||||||
@@ -206,7 +209,8 @@ protected:
|
|||||||
virtual bool _SetSettings(const BMessage& settings,
|
virtual bool _SetSettings(const BMessage& settings,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
virtual bool _AddTab(int32 index = -1,
|
virtual bool _AddTab(DesktopSettings& settings,
|
||||||
|
int32 index = -1,
|
||||||
BRegion* updateRegion = NULL) = 0;
|
BRegion* updateRegion = NULL) = 0;
|
||||||
virtual bool _RemoveTab(int32 index,
|
virtual bool _RemoveTab(int32 index,
|
||||||
BRegion* updateRegion = NULL) = 0;
|
BRegion* updateRegion = NULL) = 0;
|
||||||
@@ -219,9 +223,6 @@ protected:
|
|||||||
DrawingEngine* fDrawingEngine;
|
DrawingEngine* fDrawingEngine;
|
||||||
DrawState fDrawState;
|
DrawState fDrawState;
|
||||||
|
|
||||||
window_look fLook;
|
|
||||||
uint32 fFlags;
|
|
||||||
|
|
||||||
BRect fTitleBarRect;
|
BRect fTitleBarRect;
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
BRect fResizeRect;
|
BRect fResizeRect;
|
||||||
|
|||||||
@@ -101,10 +101,9 @@ const rgb_color DefaultDecorator::kNonFocusFrameColors[2] = {
|
|||||||
|
|
||||||
// TODO: get rid of DesktopSettings here, and introduce private accessor
|
// TODO: get rid of DesktopSettings here, and introduce private accessor
|
||||||
// methods to the Decorator base class
|
// methods to the Decorator base class
|
||||||
DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
|
DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect)
|
||||||
window_look look, uint32 flags)
|
|
||||||
:
|
:
|
||||||
Decorator(settings, rect, look, flags),
|
Decorator(settings, rect),
|
||||||
// focus color constants
|
// focus color constants
|
||||||
kFocusTabColor(settings.UIColor(B_WINDOW_TAB_COLOR)),
|
kFocusTabColor(settings.UIColor(B_WINDOW_TAB_COLOR)),
|
||||||
kFocusTabColorLight(tint_color(kFocusTabColor,
|
kFocusTabColorLight(tint_color(kFocusTabColor,
|
||||||
@@ -124,11 +123,6 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
|
|||||||
|
|
||||||
fOldMovingTab(0, 0, -1, -1)
|
fOldMovingTab(0, 0, -1, -1)
|
||||||
{
|
{
|
||||||
_UpdateFont(settings);
|
|
||||||
|
|
||||||
// Do initial decorator setup
|
|
||||||
_DoLayout();
|
|
||||||
|
|
||||||
// TODO: If the decorator was created with a frame too small, it should
|
// TODO: If the decorator was created with a frame too small, it should
|
||||||
// resize itself!
|
// resize itself!
|
||||||
|
|
||||||
@@ -234,7 +228,7 @@ DefaultDecorator::RegionAt(BPoint where, int32& tab) const
|
|||||||
return region;
|
return region;
|
||||||
|
|
||||||
// check the resize corner
|
// check the resize corner
|
||||||
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(where))
|
if (fTopTab->look == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(where))
|
||||||
return REGION_RIGHT_BOTTOM_CORNER;
|
return REGION_RIGHT_BOTTOM_CORNER;
|
||||||
|
|
||||||
// hit-test the borders
|
// hit-test the borders
|
||||||
@@ -253,11 +247,11 @@ DefaultDecorator::RegionAt(BPoint where, int32& tab) const
|
|||||||
return REGION_NONE;
|
return REGION_NONE;
|
||||||
|
|
||||||
// check resize area
|
// check resize area
|
||||||
if ((fFlags & B_NOT_RESIZABLE) == 0
|
if ((fTopTab->flags & B_NOT_RESIZABLE) == 0
|
||||||
&& (fLook == B_TITLED_WINDOW_LOOK
|
&& (fTopTab->look == B_TITLED_WINDOW_LOOK
|
||||||
|| fLook == B_FLOATING_WINDOW_LOOK
|
|| fTopTab->look == B_FLOATING_WINDOW_LOOK
|
||||||
|| fLook == B_MODAL_WINDOW_LOOK
|
|| fTopTab->look == B_MODAL_WINDOW_LOOK
|
||||||
|| fLook == kLeftTitledWindowLook)) {
|
|| fTopTab->look == kLeftTitledWindowLook)) {
|
||||||
BRect resizeRect(BPoint(fBottomBorder.right - kBorderResizeLength,
|
BRect resizeRect(BPoint(fBottomBorder.right - kBorderResizeLength,
|
||||||
fBottomBorder.bottom - kBorderResizeLength),
|
fBottomBorder.bottom - kBorderResizeLength),
|
||||||
fBottomBorder.RightBottom());
|
fBottomBorder.RightBottom());
|
||||||
@@ -305,13 +299,13 @@ DefaultDecorator::ExtendDirtyRegion(Region region, BRegion& dirty)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case REGION_CLOSE_BUTTON:
|
case REGION_CLOSE_BUTTON:
|
||||||
if ((fFlags & B_NOT_CLOSABLE) == 0)
|
if ((fTopTab->flags & B_NOT_CLOSABLE) == 0)
|
||||||
for (int32 i = 0; i < fTabList.CountItems(); i++)
|
for (int32 i = 0; i < fTabList.CountItems(); i++)
|
||||||
dirty.Include(fTabList.ItemAt(i)->closeRect);
|
dirty.Include(fTabList.ItemAt(i)->closeRect);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGION_ZOOM_BUTTON:
|
case REGION_ZOOM_BUTTON:
|
||||||
if ((fFlags & B_NOT_ZOOMABLE) == 0)
|
if ((fTopTab->flags & B_NOT_ZOOMABLE) == 0)
|
||||||
for (int32 i = 0; i < fTabList.CountItems(); i++)
|
for (int32 i = 0; i < fTabList.CountItems(); i++)
|
||||||
dirty.Include(fTabList.ItemAt(i)->zoomRect);
|
dirty.Include(fTabList.ItemAt(i)->zoomRect);
|
||||||
break;
|
break;
|
||||||
@@ -347,7 +341,7 @@ DefaultDecorator::ExtendDirtyRegion(Region region, BRegion& dirty)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case REGION_RIGHT_BOTTOM_CORNER:
|
case REGION_RIGHT_BOTTOM_CORNER:
|
||||||
if ((fFlags & B_NOT_RESIZABLE) == 0)
|
if ((fTopTab->flags & B_NOT_RESIZABLE) == 0)
|
||||||
dirty.Include(fResizeRect);
|
dirty.Include(fResizeRect);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -382,7 +376,7 @@ DefaultDecorator::_DoLayout()
|
|||||||
|
|
||||||
bool hasTab = false;
|
bool hasTab = false;
|
||||||
|
|
||||||
switch ((int)Look()) {
|
switch ((int)fTopTab->look) {
|
||||||
case B_MODAL_WINDOW_LOOK:
|
case B_MODAL_WINDOW_LOOK:
|
||||||
fBorderWidth = 5;
|
fBorderWidth = 5;
|
||||||
break;
|
break;
|
||||||
@@ -471,7 +465,7 @@ DefaultDecorator::_DoTabLayout()
|
|||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
fDrawState.Font().GetHeight(fontHeight);
|
fDrawState.Font().GetHeight(fontHeight);
|
||||||
|
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (tab->look != kLeftTitledWindowLook) {
|
||||||
tabRect.Set(fFrame.left - fBorderWidth,
|
tabRect.Set(fFrame.left - fBorderWidth,
|
||||||
fFrame.top - fBorderWidth
|
fFrame.top - fBorderWidth
|
||||||
- ceilf(fontHeight.ascent + fontHeight.descent + 7.0),
|
- ceilf(fontHeight.ascent + fontHeight.descent + 7.0),
|
||||||
@@ -486,7 +480,7 @@ DefaultDecorator::_DoTabLayout()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// format tab rect for a floating window - make the rect smaller
|
// format tab rect for a floating window - make the rect smaller
|
||||||
if (fLook == B_FLOATING_WINDOW_LOOK) {
|
if (tab->look == B_FLOATING_WINDOW_LOOK) {
|
||||||
tabRect.InsetBy(0, 2);
|
tabRect.InsetBy(0, 2);
|
||||||
tabRect.OffsetBy(0, 2);
|
tabRect.OffsetBy(0, 2);
|
||||||
}
|
}
|
||||||
@@ -498,9 +492,9 @@ DefaultDecorator::_DoTabLayout()
|
|||||||
|
|
||||||
// tab->minTabSize contains just the room for the buttons
|
// tab->minTabSize contains just the room for the buttons
|
||||||
tab->minTabSize = inset * 2 + tab->textOffset;
|
tab->minTabSize = inset * 2 + tab->textOffset;
|
||||||
if ((fFlags & B_NOT_CLOSABLE) == 0)
|
if ((tab->flags & B_NOT_CLOSABLE) == 0)
|
||||||
tab->minTabSize += offset + size;
|
tab->minTabSize += offset + size;
|
||||||
if ((fFlags & B_NOT_ZOOMABLE) == 0)
|
if ((tab->flags & B_NOT_ZOOMABLE) == 0)
|
||||||
tab->minTabSize += offset + size;
|
tab->minTabSize += offset + size;
|
||||||
|
|
||||||
// tab->maxTabSize contains tab->minTabSize + the width required for the
|
// tab->maxTabSize contains tab->minTabSize + the width required for the
|
||||||
@@ -512,7 +506,7 @@ DefaultDecorator::_DoTabLayout()
|
|||||||
tab->maxTabSize += tab->textOffset;
|
tab->maxTabSize += tab->textOffset;
|
||||||
tab->maxTabSize += tab->minTabSize;
|
tab->maxTabSize += tab->minTabSize;
|
||||||
|
|
||||||
float tabSize = (fLook != kLeftTitledWindowLook
|
float tabSize = (tab->look != kLeftTitledWindowLook
|
||||||
? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2;
|
? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2;
|
||||||
if (tabSize < tab->minTabSize)
|
if (tabSize < tab->minTabSize)
|
||||||
tabSize = tab->minTabSize;
|
tabSize = tab->minTabSize;
|
||||||
@@ -520,7 +514,7 @@ DefaultDecorator::_DoTabLayout()
|
|||||||
tabSize = tab->maxTabSize;
|
tabSize = tab->maxTabSize;
|
||||||
|
|
||||||
// layout buttons and truncate text
|
// layout buttons and truncate text
|
||||||
if (fLook != kLeftTitledWindowLook)
|
if (tab->look != kLeftTitledWindowLook)
|
||||||
tabRect.right = tabRect.left + tabSize;
|
tabRect.right = tabRect.left + tabSize;
|
||||||
else
|
else
|
||||||
tabRect.bottom = tabRect.top + tabSize;
|
tabRect.bottom = tabRect.top + tabSize;
|
||||||
@@ -651,7 +645,7 @@ DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
// NOTE: the DrawingEngine needs to be locked for the entire
|
// NOTE: the DrawingEngine needs to be locked for the entire
|
||||||
// time for the clipping to stay valid for this decorator
|
// time for the clipping to stay valid for this decorator
|
||||||
|
|
||||||
if (fLook == B_NO_BORDER_WINDOW_LOOK)
|
if (fTopTab->look == B_NO_BORDER_WINDOW_LOOK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fBorderWidth <= 0)
|
if (fBorderWidth <= 0)
|
||||||
@@ -659,7 +653,7 @@ DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
|
|
||||||
// Draw the border frame
|
// Draw the border frame
|
||||||
BRect r = BRect(fTopBorder.LeftTop(), fBottomBorder.RightBottom());
|
BRect r = BRect(fTopBorder.LeftTop(), fBottomBorder.RightBottom());
|
||||||
switch ((int)fLook) {
|
switch ((int)fTopTab->look) {
|
||||||
case B_TITLED_WINDOW_LOOK:
|
case B_TITLED_WINDOW_LOOK:
|
||||||
case B_DOCUMENT_WINDOW_LOOK:
|
case B_DOCUMENT_WINDOW_LOOK:
|
||||||
case B_MODAL_WINDOW_LOOK:
|
case B_MODAL_WINDOW_LOOK:
|
||||||
@@ -731,7 +725,8 @@ DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
|
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
|
||||||
BPoint(r.right - i, r.top + i), colors[i * 2]);
|
BPoint(r.right - i, r.top + i), colors[i * 2]);
|
||||||
}
|
}
|
||||||
if (fTitleBarRect.IsValid() && fLook != kLeftTitledWindowLook) {
|
if (fTitleBarRect.IsValid()
|
||||||
|
&& fTopTab->look != kLeftTitledWindowLook) {
|
||||||
// grey along the bottom of the tab
|
// grey along the bottom of the tab
|
||||||
// (overwrites "white" from frame)
|
// (overwrites "white" from frame)
|
||||||
fDrawingEngine->StrokeLine(
|
fDrawingEngine->StrokeLine(
|
||||||
@@ -750,7 +745,8 @@ DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
|
fDrawingEngine->StrokeLine(BPoint(r.left + i, r.top + i),
|
||||||
BPoint(r.left + i, r.bottom - i), colors[i * 2]);
|
BPoint(r.left + i, r.bottom - i), colors[i * 2]);
|
||||||
}
|
}
|
||||||
if (fLook == kLeftTitledWindowLook && fTitleBarRect.IsValid()) {
|
if (fTopTab->look == kLeftTitledWindowLook
|
||||||
|
&& fTitleBarRect.IsValid()) {
|
||||||
// grey along the right side of the tab
|
// grey along the right side of the tab
|
||||||
// (overwrites "white" from frame)
|
// (overwrites "white" from frame)
|
||||||
fDrawingEngine->StrokeLine(
|
fDrawingEngine->StrokeLine(
|
||||||
@@ -801,13 +797,13 @@ DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw the resize knob if we're supposed to
|
// Draw the resize knob if we're supposed to
|
||||||
if (!(fFlags & B_NOT_RESIZABLE)) {
|
if (!(fTopTab->flags & B_NOT_RESIZABLE)) {
|
||||||
r = fResizeRect;
|
r = fResizeRect;
|
||||||
|
|
||||||
ComponentColors colors;
|
ComponentColors colors;
|
||||||
_GetComponentColors(COMPONENT_RESIZE_CORNER, colors);
|
_GetComponentColors(COMPONENT_RESIZE_CORNER, colors);
|
||||||
|
|
||||||
switch ((int)fLook) {
|
switch ((int)fTopTab->look) {
|
||||||
case B_DOCUMENT_WINDOW_LOOK:
|
case B_DOCUMENT_WINDOW_LOOK:
|
||||||
{
|
{
|
||||||
if (!invalid.Intersects(r))
|
if (!invalid.Intersects(r))
|
||||||
@@ -899,7 +895,7 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid)
|
|||||||
colors[COLOR_TAB_FRAME_LIGHT]);
|
colors[COLOR_TAB_FRAME_LIGHT]);
|
||||||
fDrawingEngine->StrokeLine(tabRect.LeftTop(), tabRect.RightTop(),
|
fDrawingEngine->StrokeLine(tabRect.LeftTop(), tabRect.RightTop(),
|
||||||
colors[COLOR_TAB_FRAME_LIGHT]);
|
colors[COLOR_TAB_FRAME_LIGHT]);
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (tab->look != kLeftTitledWindowLook) {
|
||||||
fDrawingEngine->StrokeLine(tabRect.RightTop(), tabRect.RightBottom(),
|
fDrawingEngine->StrokeLine(tabRect.RightTop(), tabRect.RightBottom(),
|
||||||
colors[COLOR_TAB_FRAME_DARK]);
|
colors[COLOR_TAB_FRAME_DARK]);
|
||||||
} else {
|
} else {
|
||||||
@@ -914,14 +910,14 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid)
|
|||||||
// bevel
|
// bevel
|
||||||
fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1),
|
fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1),
|
||||||
BPoint(tabRect.left + 1,
|
BPoint(tabRect.left + 1,
|
||||||
tabBotton - (fLook == kLeftTitledWindowLook ? 1 : 0)),
|
tabBotton - (tab->look == kLeftTitledWindowLook ? 1 : 0)),
|
||||||
colors[COLOR_TAB_BEVEL]);
|
colors[COLOR_TAB_BEVEL]);
|
||||||
fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1),
|
fDrawingEngine->StrokeLine(BPoint(tabRect.left + 1, tabRect.top + 1),
|
||||||
BPoint(tabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1),
|
BPoint(tabRect.right - (tab->look == kLeftTitledWindowLook ? 0 : 1),
|
||||||
tabRect.top + 1),
|
tabRect.top + 1),
|
||||||
colors[COLOR_TAB_BEVEL]);
|
colors[COLOR_TAB_BEVEL]);
|
||||||
|
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (tab->look != kLeftTitledWindowLook) {
|
||||||
fDrawingEngine->StrokeLine(BPoint(tabRect.right - 1, tabRect.top + 2),
|
fDrawingEngine->StrokeLine(BPoint(tabRect.right - 1, tabRect.top + 2),
|
||||||
BPoint(tabRect.right - 1, tabBotton),
|
BPoint(tabRect.right - 1, tabBotton),
|
||||||
colors[COLOR_TAB_SHADOW]);
|
colors[COLOR_TAB_SHADOW]);
|
||||||
@@ -938,7 +934,7 @@ DefaultDecorator::_DrawTab(Decorator::Tab* tab, BRect invalid)
|
|||||||
gradient.AddColor(colors[COLOR_TAB_LIGHT], 0);
|
gradient.AddColor(colors[COLOR_TAB_LIGHT], 0);
|
||||||
gradient.AddColor(colors[COLOR_TAB], 255);
|
gradient.AddColor(colors[COLOR_TAB], 255);
|
||||||
|
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (tab->look != kLeftTitledWindowLook) {
|
||||||
gradient.SetEnd(tabRect.LeftBottom());
|
gradient.SetEnd(tabRect.LeftBottom());
|
||||||
fDrawingEngine->FillRect(BRect(tabRect.left + 2, tabRect.top + 2,
|
fDrawingEngine->FillRect(BRect(tabRect.left + 2, tabRect.top + 2,
|
||||||
tabRect.right - 2, tabBotton), gradient);
|
tabRect.right - 2, tabBotton), gradient);
|
||||||
@@ -997,7 +993,7 @@ DefaultDecorator::_DrawTitle(Decorator::Tab* _tab, BRect r)
|
|||||||
fDrawState.Font().GetHeight(fontHeight);
|
fDrawState.Font().GetHeight(fontHeight);
|
||||||
|
|
||||||
BPoint titlePos;
|
BPoint titlePos;
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (tab->look != kLeftTitledWindowLook) {
|
||||||
titlePos.x = closeRect.IsValid() ? closeRect.right + tab->textOffset
|
titlePos.x = closeRect.IsValid() ? closeRect.right + tab->textOffset
|
||||||
: tabRect.left + tab->textOffset;
|
: tabRect.left + tab->textOffset;
|
||||||
titlePos.y = floorf(((tabRect.top + 2.0) + tabRect.bottom
|
titlePos.y = floorf(((tabRect.top + 2.0) + tabRect.bottom
|
||||||
@@ -1080,8 +1076,8 @@ DefaultDecorator::_FontsChanged(DesktopSettings& settings,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_SetLook(DesktopSettings& settings, window_look look,
|
DefaultDecorator::_SetLook(Decorator::Tab* tab, DesktopSettings& settings,
|
||||||
BRegion* updateRegion)
|
window_look look, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
// TODO: we could be much smarter about the update region
|
// TODO: we could be much smarter about the update region
|
||||||
|
|
||||||
@@ -1089,7 +1085,7 @@ DefaultDecorator::_SetLook(DesktopSettings& settings, window_look look,
|
|||||||
if (updateRegion != NULL)
|
if (updateRegion != NULL)
|
||||||
updateRegion->Include(&GetFootprint());
|
updateRegion->Include(&GetFootprint());
|
||||||
|
|
||||||
fLook = look;
|
tab->look = look;
|
||||||
|
|
||||||
_UpdateFont(settings);
|
_UpdateFont(settings);
|
||||||
_InvalidateBitmaps();
|
_InvalidateBitmaps();
|
||||||
@@ -1102,7 +1098,8 @@ DefaultDecorator::_SetLook(DesktopSettings& settings, window_look look,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_SetFlags(uint32 flags, BRegion* updateRegion)
|
DefaultDecorator::_SetFlags(Decorator::Tab* tab, uint32 flags,
|
||||||
|
BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
// TODO: we could be much smarter about the update region
|
// TODO: we could be much smarter about the update region
|
||||||
|
|
||||||
@@ -1110,7 +1107,7 @@ DefaultDecorator::_SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
if (updateRegion != NULL)
|
if (updateRegion != NULL)
|
||||||
updateRegion->Include(&GetFootprint());
|
updateRegion->Include(&GetFootprint());
|
||||||
|
|
||||||
fFlags = flags;
|
tab->flags = flags;
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
|
|
||||||
_InvalidateFootprint();
|
_InvalidateFootprint();
|
||||||
@@ -1124,8 +1121,9 @@ DefaultDecorator::_SetFocus(Decorator::Tab* _tab)
|
|||||||
{
|
{
|
||||||
DefaultDecorator::Tab* tab = static_cast<DefaultDecorator::Tab*>(_tab);
|
DefaultDecorator::Tab* tab = static_cast<DefaultDecorator::Tab*>(_tab);
|
||||||
tab->buttonFocus = IsFocus(tab)
|
tab->buttonFocus = IsFocus(tab)
|
||||||
|| ((fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook)
|
|| ((tab->look == B_FLOATING_WINDOW_LOOK
|
||||||
&& (fFlags & B_AVOID_FOCUS) != 0);
|
|| tab->look == kLeftTitledWindowLook)
|
||||||
|
&& (tab->flags & B_AVOID_FOCUS) != 0);
|
||||||
if (CountTabs() > 1)
|
if (CountTabs() > 1)
|
||||||
_LayoutTabItems(tab, tab->tabRect);
|
_LayoutTabItems(tab, tab->tabRect);
|
||||||
}
|
}
|
||||||
@@ -1165,9 +1163,9 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty)
|
|||||||
fFrame.bottom += offset.y;
|
fFrame.bottom += offset.y;
|
||||||
|
|
||||||
// Handle invalidation of resize rect
|
// Handle invalidation of resize rect
|
||||||
if (dirty && !(fFlags & B_NOT_RESIZABLE)) {
|
if (dirty && !(fTopTab->flags & B_NOT_RESIZABLE)) {
|
||||||
BRect realResizeRect;
|
BRect realResizeRect;
|
||||||
switch ((int)fLook) {
|
switch ((int)fTopTab->look) {
|
||||||
case B_DOCUMENT_WINDOW_LOOK:
|
case B_DOCUMENT_WINDOW_LOOK:
|
||||||
realResizeRect = fResizeRect;
|
realResizeRect = fResizeRect;
|
||||||
// Resize rect at old location
|
// Resize rect at old location
|
||||||
@@ -1261,7 +1259,7 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty)
|
|||||||
|
|
||||||
float delta = tabOffset - tab->tabOffset;
|
float delta = tabOffset - tab->tabOffset;
|
||||||
tab->tabOffset = (uint32)tabOffset;
|
tab->tabOffset = (uint32)tabOffset;
|
||||||
if (fLook != kLeftTitledWindowLook)
|
if (fTopTab->look != kLeftTitledWindowLook)
|
||||||
tabRect.OffsetBy(delta, 0.0);
|
tabRect.OffsetBy(delta, 0.0);
|
||||||
else
|
else
|
||||||
tabRect.OffsetBy(0.0, delta);
|
tabRect.OffsetBy(0.0, delta);
|
||||||
@@ -1271,9 +1269,10 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty)
|
|||||||
if (tabSize > tab->maxTabSize)
|
if (tabSize > tab->maxTabSize)
|
||||||
tabSize = tab->maxTabSize;
|
tabSize = tab->maxTabSize;
|
||||||
|
|
||||||
if (fLook != kLeftTitledWindowLook && tabSize != tabRect.Width()) {
|
if (fTopTab->look != kLeftTitledWindowLook
|
||||||
|
&& tabSize != tabRect.Width()) {
|
||||||
tabRect.right = tabRect.left + tabSize;
|
tabRect.right = tabRect.left + tabSize;
|
||||||
} else if (fLook == kLeftTitledWindowLook
|
} else if (fTopTab->look == kLeftTitledWindowLook
|
||||||
&& tabSize != tabRect.Height()) {
|
&& tabSize != tabRect.Height()) {
|
||||||
tabRect.bottom = tabRect.top + tabSize;
|
tabRect.bottom = tabRect.top + tabSize;
|
||||||
}
|
}
|
||||||
@@ -1289,7 +1288,7 @@ DefaultDecorator::_ResizeBy(BPoint offset, BRegion* dirty)
|
|||||||
BRect redraw(tabRect);
|
BRect redraw(tabRect);
|
||||||
if (delta != 0.0) {
|
if (delta != 0.0) {
|
||||||
redraw = redraw | oldTabRect;
|
redraw = redraw | oldTabRect;
|
||||||
if (fLook != kLeftTitledWindowLook)
|
if (fTopTab->look != kLeftTitledWindowLook)
|
||||||
redraw.bottom++;
|
redraw.bottom++;
|
||||||
else
|
else
|
||||||
redraw.right++;
|
redraw.right++;
|
||||||
@@ -1382,8 +1381,11 @@ DefaultDecorator::_SetSettings(const BMessage& settings, BRegion* updateRegion)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DefaultDecorator::_AddTab(int32 index, BRegion* updateRegion)
|
DefaultDecorator::_AddTab(DesktopSettings& settings, int32 index,
|
||||||
|
BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
|
_UpdateFont(settings);
|
||||||
|
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
if (updateRegion != NULL)
|
if (updateRegion != NULL)
|
||||||
updateRegion->Include(fTitleBarRect);
|
updateRegion->Include(fTitleBarRect);
|
||||||
@@ -1443,7 +1445,7 @@ DefaultDecorator::_GetFootprint(BRegion *region)
|
|||||||
|
|
||||||
region->MakeEmpty();
|
region->MakeEmpty();
|
||||||
|
|
||||||
if (fLook == B_NO_BORDER_WINDOW_LOOK)
|
if (fTopTab->look == B_NO_BORDER_WINDOW_LOOK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
region->Include(fTopBorder);
|
region->Include(fTopBorder);
|
||||||
@@ -1451,12 +1453,12 @@ DefaultDecorator::_GetFootprint(BRegion *region)
|
|||||||
region->Include(fRightBorder);
|
region->Include(fRightBorder);
|
||||||
region->Include(fBottomBorder);
|
region->Include(fBottomBorder);
|
||||||
|
|
||||||
if (fLook == B_BORDERED_WINDOW_LOOK)
|
if (fTopTab->look == B_BORDERED_WINDOW_LOOK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
region->Include(&fTabsRegion);
|
region->Include(&fTabsRegion);
|
||||||
|
|
||||||
if (fLook == B_DOCUMENT_WINDOW_LOOK) {
|
if (fTopTab->look == B_DOCUMENT_WINDOW_LOOK) {
|
||||||
// include the rectangular resize knob on the bottom right
|
// include the rectangular resize knob on the bottom right
|
||||||
float knobSize = kResizeKnobSize - fBorderWidth;
|
float knobSize = kResizeKnobSize - fBorderWidth;
|
||||||
region->Include(BRect(fFrame.right - knobSize, fFrame.bottom - knobSize,
|
region->Include(BRect(fFrame.right - knobSize, fFrame.bottom - knobSize,
|
||||||
@@ -1469,9 +1471,9 @@ void
|
|||||||
DefaultDecorator::DrawButtons(Decorator::Tab* tab, const BRect& invalid)
|
DefaultDecorator::DrawButtons(Decorator::Tab* tab, const BRect& invalid)
|
||||||
{
|
{
|
||||||
// Draw the buttons if we're supposed to
|
// Draw the buttons if we're supposed to
|
||||||
if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect))
|
if (!(tab->flags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect))
|
||||||
_DrawClose(tab, false, tab->closeRect);
|
_DrawClose(tab, false, tab->closeRect);
|
||||||
if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect))
|
if (!(tab->flags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect))
|
||||||
_DrawZoom(tab, false, tab->zoomRect);
|
_DrawZoom(tab, false, tab->zoomRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1555,9 +1557,10 @@ void
|
|||||||
DefaultDecorator::_UpdateFont(DesktopSettings& settings)
|
DefaultDecorator::_UpdateFont(DesktopSettings& settings)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
if (fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) {
|
if (fTopTab->look == B_FLOATING_WINDOW_LOOK
|
||||||
|
|| fTopTab->look == kLeftTitledWindowLook) {
|
||||||
settings.GetDefaultPlainFont(font);
|
settings.GetDefaultPlainFont(font);
|
||||||
if (fLook == kLeftTitledWindowLook)
|
if (fTopTab->look == kLeftTitledWindowLook)
|
||||||
font.SetRotation(90.0f);
|
font.SetRotation(90.0f);
|
||||||
} else
|
} else
|
||||||
settings.GetDefaultBoldFont(font);
|
settings.GetDefaultBoldFont(font);
|
||||||
@@ -1623,11 +1626,11 @@ void
|
|||||||
DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
|
DefaultDecorator::_GetButtonSizeAndOffset(const BRect& tabRect, float* _offset,
|
||||||
float* _size, float* _inset) const
|
float* _size, float* _inset) const
|
||||||
{
|
{
|
||||||
float tabSize = fLook == kLeftTitledWindowLook ?
|
float tabSize = fTopTab->look == kLeftTitledWindowLook ?
|
||||||
tabRect.Width() : tabRect.Height();
|
tabRect.Width() : tabRect.Height();
|
||||||
|
|
||||||
bool smallTab = fLook == B_FLOATING_WINDOW_LOOK
|
bool smallTab = fTopTab->look == B_FLOATING_WINDOW_LOOK
|
||||||
|| fLook == kLeftTitledWindowLook;
|
|| fTopTab->look == kLeftTitledWindowLook;
|
||||||
|
|
||||||
*_offset = smallTab ? floorf(fDrawState.Font().Size() / 2.6)
|
*_offset = smallTab ? floorf(fDrawState.Font().Size() / 2.6)
|
||||||
: floorf(fDrawState.Font().Size() / 2.3);
|
: floorf(fDrawState.Font().Size() / 2.3);
|
||||||
@@ -1657,7 +1660,7 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect)
|
|||||||
BRect& zoomRect = tab->zoomRect;
|
BRect& zoomRect = tab->zoomRect;
|
||||||
|
|
||||||
// calulate close rect based on the tab rectangle
|
// calulate close rect based on the tab rectangle
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (tab->look != kLeftTitledWindowLook) {
|
||||||
closeRect.Set(tabRect.left + offset, tabRect.top + offset,
|
closeRect.Set(tabRect.left + offset, tabRect.top + offset,
|
||||||
tabRect.left + offset + size, tabRect.top + offset + size);
|
tabRect.left + offset + size, tabRect.top + offset + size);
|
||||||
|
|
||||||
@@ -1665,9 +1668,9 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect)
|
|||||||
tabRect.right - offset, tabRect.top + offset + size);
|
tabRect.right - offset, tabRect.top + offset + size);
|
||||||
|
|
||||||
// hidden buttons have no width
|
// hidden buttons have no width
|
||||||
if ((Flags() & B_NOT_CLOSABLE) != 0)
|
if ((tab->flags & B_NOT_CLOSABLE) != 0)
|
||||||
closeRect.right = closeRect.left - offset;
|
closeRect.right = closeRect.left - offset;
|
||||||
if ((Flags() & B_NOT_ZOOMABLE) != 0)
|
if ((tab->flags & B_NOT_ZOOMABLE) != 0)
|
||||||
zoomRect.left = zoomRect.right + offset;
|
zoomRect.left = zoomRect.right + offset;
|
||||||
} else {
|
} else {
|
||||||
closeRect.Set(tabRect.left + offset, tabRect.top + offset,
|
closeRect.Set(tabRect.left + offset, tabRect.top + offset,
|
||||||
@@ -1677,9 +1680,9 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect)
|
|||||||
tabRect.left + size + offset, tabRect.bottom - offset);
|
tabRect.left + size + offset, tabRect.bottom - offset);
|
||||||
|
|
||||||
// hidden buttons have no height
|
// hidden buttons have no height
|
||||||
if ((Flags() & B_NOT_CLOSABLE) != 0)
|
if ((tab->flags & B_NOT_CLOSABLE) != 0)
|
||||||
closeRect.bottom = closeRect.top - offset;
|
closeRect.bottom = closeRect.top - offset;
|
||||||
if ((Flags() & B_NOT_ZOOMABLE) != 0)
|
if ((tab->flags & B_NOT_ZOOMABLE) != 0)
|
||||||
zoomRect.top = zoomRect.bottom + offset;
|
zoomRect.top = zoomRect.bottom + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1687,7 +1690,7 @@ DefaultDecorator::_LayoutTabItems(Decorator::Tab* _tab, const BRect& tabRect)
|
|||||||
// TODO: the +2 is there because the title often appeared
|
// TODO: the +2 is there because the title often appeared
|
||||||
// truncated for no apparent reason - OTOH the title does
|
// truncated for no apparent reason - OTOH the title does
|
||||||
// also not appear perfectly in the middle
|
// also not appear perfectly in the middle
|
||||||
if (fLook != kLeftTitledWindowLook)
|
if (tab->look != kLeftTitledWindowLook)
|
||||||
size = (zoomRect.left - closeRect.right) - tab->textOffset * 2 + inset;
|
size = (zoomRect.left - closeRect.right) - tab->textOffset * 2 + inset;
|
||||||
else
|
else
|
||||||
size = (zoomRect.top - closeRect.bottom) - tab->textOffset * 2 + inset;
|
size = (zoomRect.top - closeRect.bottom) - tab->textOffset * 2 + inset;
|
||||||
@@ -1878,8 +1881,8 @@ DefaultDecorator::_GetComponentColors(Component component,
|
|||||||
float
|
float
|
||||||
DefaultDecorator::_DefaultTextOffset() const
|
DefaultDecorator::_DefaultTextOffset() const
|
||||||
{
|
{
|
||||||
return (fLook == B_FLOATING_WINDOW_LOOK
|
return (fTopTab->look == B_FLOATING_WINDOW_LOOK
|
||||||
|| fLook == kLeftTitledWindowLook) ? 10 : 18;
|
|| fTopTab->look == kLeftTitledWindowLook) ? 10 : 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1887,7 +1890,7 @@ float
|
|||||||
DefaultDecorator::_SingleTabOffsetAndSize(float& tabSize)
|
DefaultDecorator::_SingleTabOffsetAndSize(float& tabSize)
|
||||||
{
|
{
|
||||||
float maxLocation;
|
float maxLocation;
|
||||||
if (fLook != kLeftTitledWindowLook) {
|
if (fTopTab->look != kLeftTitledWindowLook) {
|
||||||
tabSize = fRightBorder.right - fLeftBorder.left;
|
tabSize = fRightBorder.right - fLeftBorder.left;
|
||||||
} else {
|
} else {
|
||||||
tabSize = fBottomBorder.bottom - fTopBorder.top;
|
tabSize = fBottomBorder.bottom - fTopBorder.top;
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
DefaultDecorator(DesktopSettings& settings,
|
DefaultDecorator(DesktopSettings& settings,
|
||||||
BRect frame, window_look look,
|
BRect frame);
|
||||||
uint32 flags);
|
|
||||||
virtual ~DefaultDecorator();
|
virtual ~DefaultDecorator();
|
||||||
|
|
||||||
virtual float TabLocation(int32 tab) const;
|
virtual float TabLocation(int32 tab) const;
|
||||||
@@ -126,10 +125,10 @@ protected:
|
|||||||
|
|
||||||
virtual void _FontsChanged(DesktopSettings& settings,
|
virtual void _FontsChanged(DesktopSettings& settings,
|
||||||
BRegion* updateRegion);
|
BRegion* updateRegion);
|
||||||
virtual void _SetLook(DesktopSettings& settings,
|
virtual void _SetLook(Decorator::Tab* tab,
|
||||||
window_look look,
|
DesktopSettings& settings, window_look look,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual void _SetFlags(uint32 flags,
|
virtual void _SetFlags(Decorator::Tab* tab, uint32 flags,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
virtual void _MoveBy(BPoint offset);
|
virtual void _MoveBy(BPoint offset);
|
||||||
@@ -142,7 +141,8 @@ protected:
|
|||||||
virtual bool _SetSettings(const BMessage& settings,
|
virtual bool _SetSettings(const BMessage& settings,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
virtual bool _AddTab(int32 index = -1,
|
virtual bool _AddTab(DesktopSettings& settings,
|
||||||
|
int32 index = -1,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual bool _RemoveTab(int32 index,
|
virtual bool _RemoveTab(int32 index,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
|||||||
@@ -49,10 +49,9 @@ static const rgb_color kHighlightTabColorShadow = tint_color(kHighlightTabColor,
|
|||||||
(B_DARKEN_1_TINT + B_NO_TINT) / 2);
|
(B_DARKEN_1_TINT + B_NO_TINT) / 2);
|
||||||
|
|
||||||
|
|
||||||
SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame,
|
SATDecorator::SATDecorator(DesktopSettings& settings, BRect frame)
|
||||||
window_look look, uint32 flags)
|
|
||||||
:
|
:
|
||||||
DefaultDecorator(settings, frame, look, flags)
|
DefaultDecorator(settings, frame)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SATDecorator(DesktopSettings& settings,
|
SATDecorator(DesktopSettings& settings,
|
||||||
BRect frame, window_look look,
|
BRect frame);
|
||||||
uint32 flags);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GetComponentColors(Component component,
|
virtual void GetComponentColors(Component component,
|
||||||
|
|||||||
@@ -379,6 +379,8 @@ SATWindow::RemovedFromGroup(SATGroup* group, bool stayBelowMouse)
|
|||||||
fWindow->Title());
|
fWindow->Title());
|
||||||
|
|
||||||
_RestoreOriginalSize(stayBelowMouse);
|
_RestoreOriginalSize(stayBelowMouse);
|
||||||
|
if (group->CountItems() == 1)
|
||||||
|
group->WindowAt(0)->_RestoreOriginalSize(false);
|
||||||
|
|
||||||
if (fShutdown) {
|
if (fShutdown) {
|
||||||
fGroupCookie->Uninit();
|
fGroupCookie->Uninit();
|
||||||
|
|||||||
Reference in New Issue
Block a user