Author: pulkomandy Date: 2010-08-03 12:32:19 +0200 (Tue, 03 Aug 2010) New Revision: 37864 Changeset: http://dev.haiku-os.org/changeset/37864 Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.h haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.h Log: * Fix the WinDecorator and some parts of the MacDecorator * Since they all work reasonalbly well, add them to the default image. (beOs had them after all) Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2010-08-03 09:08:52 UTC (rev 37863) +++ haiku/trunk/build/jam/HaikuImage 2010-08-03 10:32:19 UTC (rev 37864) @@ -556,6 +556,10 @@ AddFilesToHaikuImage system add-ons disk_systems : <disk_system>intel <disk_system>bfs ; +# decorators +AddFilesToHaikuImage home config add-ons decorators : + MacDecorator WinDecorator ClassicBe ; + # create directories that will remain empty AddDirectoryToHaikuImage common bin ; AddDirectoryToHaikuImage common include ; Modified: haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp =================================================================== --- haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp 2010-08-03 09:08:52 UTC (rev 37863) +++ haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp 2010-08-03 10:32:19 UTC (rev 37864) @@ -550,11 +550,10 @@ void MacDecorator::_DrawZoom(BRect r) { - bool down = GetClose(); + bool down = GetZoom(); // Just like DrawZoom, but for a close button BRect rect(r); - BPoint offset(r.LeftTop()),pt2(r.RightTop()); pt2.x--; @@ -597,11 +596,10 @@ void MacDecorator::_DrawMinimize(BRect r) { - bool down = GetClose(); + bool down = GetMinimize(); - // Just like DrawZoom, but for a close button + // Just like DrawZoom, but for a Minimize button BRect rect(r); - BPoint offset(r.LeftTop()), pt2(r.RightTop()); pt2.x--; @@ -748,8 +746,8 @@ fTabRect.right += offset.x; fBorderRect.right += offset.x; fBorderRect.bottom += offset.y; - // fZoomRect.OffsetBy(offset.x,0); - // fMinimizeRect.OffsetBy(offset.x,0); + // fZoomRect.OffsetBy(offset.x, 0); + // fMinimizeRect.OffsetBy(offset.x, 0); if (dirty) { dirty->Include(fTabRect); dirty->Include(fBorderRect); @@ -777,7 +775,6 @@ if (fLook == B_NO_BORDER_WINDOW_LOOK) return; - region->Set(fBorderRect); region->Exclude(fFrame); @@ -792,9 +789,9 @@ MacDecorator::_UpdateFont(DesktopSettings& settings) { ServerFont font; - if (fLook == B_FLOATING_WINDOW_LOOK) { + if (fLook == B_FLOATING_WINDOW_LOOK) settings.GetDefaultPlainFont(font); - } else + else settings.GetDefaultBoldFont(font); font.SetFlags(B_FORCE_ANTIALIASING); Modified: haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.h =================================================================== --- haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.h 2010-08-03 09:08:52 UTC (rev 37863) +++ haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.h 2010-08-03 10:32:19 UTC (rev 37864) @@ -2,8 +2,6 @@ Copyright 2009, Haiku. Distributed under the terms of the MIT License. */ - - #ifndef _MAC_DECORATOR_H_ #define _MAC_DECORATOR_H_ @@ -31,10 +29,10 @@ uint32 flags); virtual ~MacDecorator(); - void Draw(BRect updateRect); - void Draw(); + void Draw(BRect updateRect); + void Draw(); - click_type Clicked(BPoint pt, int32 buttons, + click_type Clicked(BPoint pt, int32 buttons, int32 modifiers); protected: @@ -53,16 +51,16 @@ void _FontsChanged(DesktopSettings& settings, BRegion* updateRegion); - void _SetLook(DesktopSettings& settings, + void _SetLook(DesktopSettings& settings, window_look look, BRegion* updateRegion = NULL); - void _SetFlags(uint32 flags, + void _SetFlags(uint32 flags, BRegion* updateRegion = NULL); void _SetColors(); void _MoveBy(BPoint offset); - void _ResizeBy(BPoint offset, BRegion* dirty); + void _ResizeBy(BPoint offset, BRegion* dirty); void _GetFootprint(BRegion *region); Modified: haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp =================================================================== --- haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp 2010-08-03 09:08:52 UTC (rev 37863) +++ haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp 2010-08-03 10:32:19 UTC (rev 37864) @@ -9,6 +9,9 @@ #include "WinDecorator.h" +#include <new> +#include <stdio.h> + #include <Point.h> #include <View.h> @@ -20,20 +23,40 @@ //#define DEBUG_DECORATOR #ifdef DEBUG_DECORATOR -# include <stdio.h> -# define STRACE(x) printf x ; +# define STRACE(x) printf x #else # define STRACE(x) ; #endif +WinDecorAddOn::WinDecorAddOn(image_id id, const char* name) + : + DecorAddOn(id, name) +{ + +} + + +float +WinDecorAddOn::Version() +{ + return 1.00; +} + + +Decorator* +WinDecorAddOn::_AllocateDecorator(DesktopSettings& settings, BRect rect, + window_look look, uint32 flags) +{ + return new (std::nothrow)WinDecorator(settings, rect, look, flags); +} + + WinDecorator::WinDecorator(DesktopSettings& settings, BRect rect, window_look look, uint32 flags) : - Decorator(settings, rect, look, flags), - taboffset(0) + Decorator(settings, rect, look, flags) { - _UpdateFont(settings); // common colors to both focus and non focus state @@ -67,135 +90,10 @@ } -void -WinDecorator::SetTitle(const char* string, BRegion* updateRegion) -{ - // TODO: we could be much smarter about the update region +// TODO : Add GetSettings - BRect rect = TabRect(); - Decorator::SetTitle(string); - - if (updateRegion == NULL) - return; - - BRect updatedRect = TabRect(); - if (rect.left > updatedRect.left) - rect.left = updatedRect.left; - if (rect.right < updatedRect.right) - rect.right = updatedRect.right; - - updateRegion->Include(rect); -} - - void -WinDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion) -{ - // get previous extent - if (updateRegion != NULL) { - BRegion extent; - GetFootprint(&extent); - updateRegion->Include(&extent); - } - - _UpdateFont(settings); - _DoLayout(); - - if (updateRegion != NULL) { - BRegion extent; - GetFootprint(&extent); - updateRegion->Include(&extent); - } -} - - -void -WinDecorator::SetLook(DesktopSettings& settings, window_look look, - BRegion* updateRegion) -{ - // TODO: we could be much smarter about the update region - - // get previous extent - if (updateRegion != NULL) { - BRegion extent; - GetFootprint(&extent); - updateRegion->Include(&extent); - } - - fLook = look; - - _UpdateFont(settings); - _DoLayout(); - - if (updateRegion != NULL) { - BRegion extent; - GetFootprint(&extent); - updateRegion->Include(&extent); - } -} - - -void -WinDecorator::SetFlags(uint32 flags, BRegion* updateRegion) -{ - // TODO: we could be much smarter about the update region - - // get previous extent - if (updateRegion != NULL) { - BRegion extent; - GetFootprint(&extent); - updateRegion->Include(&extent); - } - - Decorator::SetFlags(flags, updateRegion); - _DoLayout(); - - if (updateRegion != NULL) { - BRegion extent; - GetFootprint(&extent); - updateRegion->Include(&extent); - } -} - - -void -WinDecorator::MoveBy(BPoint pt) -{ - // Move all internal rectangles the appropriate amount - fFrame.OffsetBy(pt); - fCloseRect.OffsetBy(pt); - fTabRect.OffsetBy(pt); - fBorderRect.OffsetBy(pt); - fZoomRect.OffsetBy(pt); - fMinimizeRect.OffsetBy(pt); -} - - -void -WinDecorator::ResizeBy(BPoint offset, BRegion* dirty) -{ - // Move all internal rectangles the appropriate amount - fFrame.right += offset.x; - fFrame.bottom += offset.y; - - fTabRect.right += offset.x; - fBorderRect.right += offset.x; - fBorderRect.bottom += offset.y; - // fZoomRect.OffsetBy(offset.x,0); - // fMinimizeRect.OffsetBy(offset.x,0); - if (dirty) { - dirty->Include(fTabRect); - dirty->Include(fBorderRect); - } - - - // TODO probably some other layouting stuff here - _DoLayout(); -} - - -void WinDecorator::Draw(BRect update) { STRACE(("WinDecorator::Draw(): ")); update.PrintToStream(); @@ -208,10 +106,9 @@ void -WinDecorator::Draw(void) +WinDecorator::Draw() { STRACE(("WinDecorator::Draw()\n")); - fDrawingEngine->SetDrawState(&fDrawState); _DrawFrame(fBorderRect); @@ -219,29 +116,9 @@ } -// TODO : GetSizeLimits +// TODO : add GetSizeLimits -void -WinDecorator::GetFootprint(BRegion* region) -{ - // This function calculates the decorator's footprint in coordinates - // relative to the view. This is most often used to set a Window - // object's visible region. - if (!region) - return; - - region->MakeEmpty(); - - if (fLook == B_NO_BORDER_WINDOW_LOOK) - return; - - region->Set(fBorderRect); - region->Include(fTabRect); - region->Exclude(fFrame); -} - - click_type WinDecorator::Clicked(BPoint where, int32 buttons, int32 modifiers) { @@ -337,6 +214,99 @@ void +WinDecorator::_DrawFrame(BRect rect) +{ + if (fLook == B_NO_BORDER_WINDOW_LOOK) + return; + + if (fBorderRect == fFrame) + return; + + BRect r = fBorderRect; + + fDrawingEngine->SetHighColor(frame_lowercol); + fDrawingEngine->StrokeRect(r); + + if (fLook == B_BORDERED_WINDOW_LOOK) + return; + + BPoint pt; + + pt=r.RightTop(); + pt.x--; + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol); + pt=r.LeftBottom(); + pt.y--; + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol); + + fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowercol); + fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowercol); + + r.InsetBy(1,1); + pt=r.RightTop(); + pt.x--; + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol); + pt=r.LeftBottom(); + pt.y--; + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol); + + fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowcol); + fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowcol); + + r.InsetBy(1,1); + fDrawingEngine->StrokeRect(r,frame_midcol); + r.InsetBy(1,1); + fDrawingEngine->StrokeRect(r,frame_midcol); +} + + +void +WinDecorator::_DrawTab(BRect invalid) +{ + // If a window has a tab, this will draw it and any buttons which are + // in it. + if (!fTabRect.IsValid() || !invalid.Intersects(fTabRect) || fLook==B_NO_BORDER_WINDOW_LOOK) + return; + + fDrawingEngine->FillRect(fTabRect,tab_highcol); + + _DrawTitle(fTabRect); + + // Draw the buttons if we're supposed to + // TODO : we should still draw the buttons if they are disabled, but grey them out + if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(fCloseRect)) + _DrawClose(fCloseRect); + if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(fZoomRect)) + _DrawZoom(fZoomRect); +} + + +void +WinDecorator::_DrawClose(BRect r) +{ + // Just like DrawZoom, but for a close button + _DrawBeveledRect(r,GetClose()); + + // Draw the X + + BRect rect(r); + rect.InsetBy(4,4); + rect.right--; + rect.top--; + + if (GetClose()) + rect.OffsetBy(1,1); + + fDrawingEngine->SetHighColor(RGBColor(0,0,0)); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightBottom()); + fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom()); + rect.OffsetBy(1,0); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightBottom()); + fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom()); +} + + +void WinDecorator::_DrawTitle(BRect r) { //fDrawingEngine->SetDrawingMode(B_OP_OVER); @@ -349,8 +319,8 @@ fCloseRect.IsValid() ? fCloseRect.left : fTabRect.right) - 5) - (fTabRect.left + textoffset)); fTruncatedTitleLength = fTruncatedTitle.Length(); + fDrawingEngine->SetFont(fDrawState.Font()); - //fDrawingEngine->SetFont(fDrawState.Font()); fDrawingEngine->DrawString(fTruncatedTitle,fTruncatedTitleLength, BPoint(fTabRect.left+textoffset,fCloseRect.bottom-1)); @@ -359,29 +329,9 @@ void -WinDecorator::_SetFocus(void) -{ - // SetFocus() performs necessary duties for color swapping and - // other things when a window is deactivated or activated. - - if (IsFocus()) { -// tab_highcol.SetColor(100,100,255); -// tab_lowcol.SetColor(40,0,255); - tab_highcol=fFocusTabColor; - textcol=fFocusTextColor; - } else { -// tab_highcol.SetColor(220,220,220); -// tab_lowcol.SetColor(128,128,128); - tab_highcol=fNonFocusTabColor; - textcol=fNonFocusTextColor; - } -} - - -void WinDecorator::_DrawZoom(BRect r) { - DrawBeveledRect(r,GetZoom()); + _DrawBeveledRect(r,GetZoom()); // Draw the Zoom box @@ -398,31 +348,7 @@ fDrawingEngine->StrokeRect(rect); rect.InsetBy(1,1); fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop()); - -} -void -WinDecorator::_DrawClose(BRect r) -{ - // Just like DrawZoom, but for a close button - DrawBeveledRect(r,GetClose()); - - // Draw the X - - BRect rect(r); - rect.InsetBy(4,4); - rect.right--; - rect.top--; - - if (GetClose()) - rect.OffsetBy(1,1); - - fDrawingEngine->SetHighColor(RGBColor(0,0,0)); - fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightBottom()); - fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom()); - rect.OffsetBy(1,0); - fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightBottom()); - fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom()); } @@ -430,7 +356,7 @@ WinDecorator::_DrawMinimize(BRect r) { // Just like DrawZoom, but for a Minimize button - DrawBeveledRect(r,GetMinimize()); + _DrawBeveledRect(r,GetMinimize()); fDrawingEngine->SetHighColor(textcol); BRect rect(r.left+5,r.bottom-4,r.right-5,r.bottom-3); @@ -443,29 +369,184 @@ void -WinDecorator::_DrawTab(BRect invalid) +WinDecorator::_SetTitle(const char* string, BRegion* updateRegion) { - // If a window has a tab, this will draw it and any buttons which are - // in it. - if (!fTabRect.IsValid() || !invalid.Intersects(fTabRect) || fLook==B_NO_BORDER_WINDOW_LOOK) + // TODO: we could be much smarter about the update region + + BRect rect = TabRect(); + + if (updateRegion == NULL) return; - fDrawingEngine->FillRect(fTabRect,tab_highcol); + BRect updatedRect = TabRect(); + if (rect.left > updatedRect.left) + rect.left = updatedRect.left; + if (rect.right < updatedRect.right) + rect.right = updatedRect.right; - _DrawTitle(fTabRect); + updateRegion->Include(rect); +} - // Draw the buttons if we're supposed to - // TODO : we should still draw the buttons if they are disabled, but grey them out - if (!(fFlags & B_NOT_CLOSABLE) && invalid.Intersects(fCloseRect)) - _DrawClose(fCloseRect); - if (!(fFlags & B_NOT_ZOOMABLE) && invalid.Intersects(fZoomRect)) - _DrawZoom(fZoomRect); + +void +WinDecorator::_FontsChanged(DesktopSettings& settings, + BRegion* updateRegion) +{ + // get previous extent + if (updateRegion != NULL) + updateRegion->Include(&GetFootprint()); + + _UpdateFont(settings); + _DoLayout(); + + _InvalidateFootprint(); + if (updateRegion != NULL) + updateRegion->Include(&GetFootprint()); } void -WinDecorator::DrawBeveledRect(BRect r, bool down) +WinDecorator::_SetLook(DesktopSettings& settings, window_look look, + BRegion* updateRegion) { + // TODO: we could be much smarter about the update region + + // get previous extent + if (updateRegion != NULL) + updateRegion->Include(&GetFootprint()); + + fLook = look; + + _UpdateFont(settings); + _DoLayout(); + + _InvalidateFootprint(); + if (updateRegion != NULL) + updateRegion->Include(&GetFootprint()); +} + + +void +WinDecorator::_SetFlags(uint32 flags, BRegion* updateRegion) +{ + // TODO: we could be much smarter about the update region + + // get previous extent + if (updateRegion != NULL) + updateRegion->Include(&GetFootprint()); + + _DoLayout(); + + _InvalidateFootprint(); + if (updateRegion != NULL) + updateRegion->Include(&GetFootprint()); +} + + +void +WinDecorator::_SetFocus(void) +{ + // SetFocus() performs necessary duties for color swapping and + // other things when a window is deactivated or activated. + + if (IsFocus()) { +// tab_highcol.SetColor(100,100,255); +// tab_lowcol.SetColor(40,0,255); + tab_highcol=fFocusTabColor; + textcol=fFocusTextColor; + } else { +// tab_highcol.SetColor(220,220,220); +// tab_lowcol.SetColor(128,128,128); + tab_highcol=fNonFocusTabColor; + textcol=fNonFocusTextColor; + } +} + + +void +WinDecorator::_SetColors() +{ + _SetFocus(); +} + + +void +WinDecorator::_MoveBy(BPoint pt) +{ + // Move all internal rectangles the appropriate amount + fFrame.OffsetBy(pt); + fCloseRect.OffsetBy(pt); + fTabRect.OffsetBy(pt); + fBorderRect.OffsetBy(pt); + fZoomRect.OffsetBy(pt); + fMinimizeRect.OffsetBy(pt); +} + + +void +WinDecorator::_ResizeBy(BPoint offset, BRegion* dirty) +{ + // Move all internal rectangles the appropriate amount + fFrame.right += offset.x; + fFrame.bottom += offset.y; + + fTabRect.right += offset.x; + fBorderRect.right += offset.x; + fBorderRect.bottom += offset.y; + // fZoomRect.OffsetBy(offset.x, 0); + // fMinimizeRect.OffsetBy(offset.x, 0); + if (dirty) { + dirty->Include(fTabRect); + dirty->Include(fBorderRect); + } + + + // TODO probably some other layouting stuff here + _DoLayout(); +} + + +// TODO : _SetSettings + + +void +WinDecorator::_GetFootprint(BRegion* region) +{ + // This function calculates the decorator's footprint in coordinates + // relative to the view. This is most often used to set a Window + // object's visible region. + if (!region) + return; + + region->MakeEmpty(); + + if (fLook == B_NO_BORDER_WINDOW_LOOK) + return; + + region->Set(fBorderRect); + region->Include(fTabRect); + region->Exclude(fFrame); +} + + +void +WinDecorator::_UpdateFont(DesktopSettings& settings) +{ + ServerFont font; + if (fLook == B_FLOATING_WINDOW_LOOK) + settings.GetDefaultPlainFont(font); + else + settings.GetDefaultBoldFont(font); + + font.SetFlags(B_FORCE_ANTIALIASING); + font.SetSpacing(B_STRING_SPACING); + fDrawState.SetFont(font); +} + + +void +WinDecorator::_DrawBeveledRect(BRect r, bool down) +{ RGBColor higher; RGBColor high; RGBColor mid; @@ -530,85 +611,11 @@ } -void -WinDecorator::_SetColors() -{ - _SetFocus(); -} +// #pragma mark - -void -WinDecorator::_UpdateFont(DesktopSettings& settings) +extern "C" DecorAddOn* +instantiate_decor_addon(image_id id, const char* name) { - ServerFont font; - if (fLook == B_FLOATING_WINDOW_LOOK) - settings.GetDefaultPlainFont(font); - else - settings.GetDefaultBoldFont(font); - - font.SetFlags(B_FORCE_ANTIALIASING); - font.SetSpacing(B_STRING_SPACING); - fDrawState.SetFont(font); + return new (std::nothrow)WinDecorAddOn(id, name); } - - -void -WinDecorator::_DrawFrame(BRect rect) -{ - if (fLook == B_NO_BORDER_WINDOW_LOOK) - return; - - if (fBorderRect == fFrame) - return; - - BRect r = fBorderRect; - - fDrawingEngine->SetHighColor(frame_lowercol); - fDrawingEngine->StrokeRect(r); - - if (fLook == B_BORDERED_WINDOW_LOOK) - return; - - BPoint pt; - - pt=r.RightTop(); - pt.x--; - fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol); - pt=r.LeftBottom(); - pt.y--; - fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol); - - fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowercol); - fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowercol); - - r.InsetBy(1,1); - pt=r.RightTop(); - pt.x--; - fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol); - pt=r.LeftBottom(); - pt.y--; - fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol); - - fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowcol); - fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowcol); - - r.InsetBy(1,1); - fDrawingEngine->StrokeRect(r,frame_midcol); - r.InsetBy(1,1); - fDrawingEngine->StrokeRect(r,frame_midcol); -} - - -extern "C" float -get_decorator_version(void) -{ - return 1.00; -} - - -extern "C" Decorator * -instantiate_decorator(DesktopSettings &desktopSetting, BRect rect, - window_look wlook, int32 wflags) -{ - return new WinDecorator(desktopSetting, rect, wlook, wflags); -} Modified: haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.h =================================================================== --- haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.h 2010-08-03 09:08:52 UTC (rev 37863) +++ haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.h 2010-08-03 10:32:19 UTC (rev 37864) @@ -1,45 +1,76 @@ +/* + Copyright 2009-2010, Haiku. + Distributed under the terms of the MIT License. +*/ #ifndef _BEOS_DECORATOR_H_ #define _BEOS_DECORATOR_H_ -#include "Decorator.h" +#include "DecorManager.h" +#include "RGBColor.h" + + +class WinDecorAddOn : public DecorAddOn +{ +public: + WinDecorAddOn(image_id id, const char* name); + + float Version(); +protected: + virtual Decorator* _AllocateDecorator(DesktopSettings& settings, + BRect rect, window_look look, uint32 flags); +}; + + class WinDecorator: public Decorator { public: - WinDecorator(DesktopSettings& settings, - BRect frame, window_look wlook, - uint32 wflags); - ~WinDecorator(void); + WinDecorator(DesktopSettings& settings, + BRect frame, window_look wlook, + uint32 wflags); + ~WinDecorator(void); - void SetTitle(const char* string, - BRegion* updateRegion = NULL); - void FontsChanged(DesktopSettings& settings, - BRegion* updateRegion); - virtual void SetLook(DesktopSettings& settings, - window_look look, - BRegion* updateRegion = NULL); - virtual void SetFlags(uint32 flags, - BRegion* updateRegion = NULL); + void Draw(BRect r); + void Draw(); + + click_type Clicked(BPoint pt, int32 buttons, + int32 modifiers); + +protected: + void _DoLayout(); + + void _DrawFrame(BRect r); + void _DrawTab(BRect r); + + void _DrawClose(BRect r); + void _DrawTitle(BRect r); + void _DrawZoom(BRect r); + void _DrawMinimize(BRect r); + + void _SetTitle(const char* string, + BRegion* updateRegion = NULL); + + void _FontsChanged(DesktopSettings& settings, + BRegion* updateRegion); + void _SetLook(DesktopSettings& settings, + window_look look, + BRegion* updateRegion = NULL); + void _SetFlags(uint32 flags, + BRegion* updateRegion = NULL); - void MoveBy(BPoint pt); - void ResizeBy(BPoint pt, BRegion* dirty); - void Draw(BRect r); - void Draw(void); - void GetFootprint(BRegion *region); - click_type Clicked(BPoint pt, int32 buttons, int32 modifiers); + void _SetColors(); -protected: - void _UpdateFont(DesktopSettings& settings); - void _DrawClose(BRect r); - void _DrawFrame(BRect r); - void _DrawTab(BRect r); - void _DrawTitle(BRect r); - void _DrawZoom(BRect r); - void _DrawMinimize(BRect r); - void _DoLayout(void); - void _SetFocus(void); - void _SetColors(void); - void DrawBeveledRect(BRect r, bool down); + void _MoveBy(BPoint pt); + void _ResizeBy(BPoint pt, BRegion* dirty); + + void _GetFootprint(BRegion *region); + void _SetFocus(void); + +private: + void _UpdateFont(DesktopSettings& settings); + void _DrawBeveledRect(BRect r, bool down); + + uint32 taboffset; rgb_color tab_highcol;