Author: pulkomandy Date: 2009-12-24 12:25:28 +0100 (Thu, 24 Dec 2009) New Revision: 34762 Changeset: http://dev.haiku-os.org/changeset/34762/haiku Modified: haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp haiku/trunk/src/add-ons/decorators/WinDecorator/Jamfile haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.h Log: MacDecorator: only formatting changes WinDecorator: * Now compilable * Windows are drawing properly * The window title is still missing for some reason Modified: haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp =================================================================== --- haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp 2009-12-23 21:25:42 UTC (rev 34761) +++ haiku/trunk/src/add-ons/decorators/MacDecorator/MacDecorator.cpp 2009-12-24 11:25:28 UTC (rev 34762) @@ -247,7 +247,7 @@ } if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point)) { - STRACE("MacDecorator():Clicked() - Zoom\n"); + STRACE(("MacDecorator():Clicked() - Zoom\n")); return DEC_ZOOM; } @@ -278,7 +278,7 @@ void -MacDecorator::_DoLayout(void) +MacDecorator::_DoLayout() { int32 kDefaultBorderWidth = 6; STRACE(("MacDecorator: Do Layout\n")); @@ -607,7 +607,7 @@ } - void +void MacDecorator::_DrawClose(BRect r) { bool down=GetClose(); @@ -650,7 +650,7 @@ } - void +void MacDecorator::_DrawTitle(BRect rect) { if(IsFocus()) @@ -716,7 +716,8 @@ } -void MacDecorator::_DrawMinimize(BRect r) +void +MacDecorator::_DrawMinimize(BRect r) { bool down=GetClose(); @@ -761,14 +762,14 @@ } - void +void MacDecorator::_SetColors() { _SetFocus(); } - void +void MacDecorator::_UpdateFont(DesktopSettings& settings) { ServerFont font; @@ -785,8 +786,8 @@ /*! \brief Draws a rectangle with a gradient. \param down The rectangle should be drawn recessed or not - */ - void +*/ +void MacDecorator::_DrawBlendedRect(DrawingEngine* engine, BRect rect, bool down/*, bool focus*/) { @@ -820,5 +821,5 @@ extern "C" Decorator *(instantiate_decorator)(DesktopSettings &desktopSetting, BRect rec, window_look loo, uint32 flag) { - return (new MacDecorator(desktopSetting, rec, loo, flag)); + return new MacDecorator(desktopSetting, rec, loo, flag); } Modified: haiku/trunk/src/add-ons/decorators/WinDecorator/Jamfile =================================================================== --- haiku/trunk/src/add-ons/decorators/WinDecorator/Jamfile 2009-12-23 21:25:42 UTC (rev 34761) +++ haiku/trunk/src/add-ons/decorators/WinDecorator/Jamfile 2009-12-24 11:25:28 UTC (rev 34762) @@ -2,9 +2,12 @@ UseFreeTypeHeaders ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; -UsePrivateHeaders [ FDirName servers app ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; +UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; +UsePrivateHeaders app shared interface graphics ; +UseLibraryHeaders agg ; Addon WinDecorator : WinDecorator.cpp - : be libappserver.so + : be <nogrist>app_server $(TARGET_LIBSTDC++) ; Modified: haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp =================================================================== --- haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp 2009-12-23 21:25:42 UTC (rev 34761) +++ haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.cpp 2009-12-24 11:25:28 UTC (rev 34762) @@ -1,219 +1,322 @@ +/* + Copyright 2009, Haiku. + Distributed under the terms of the MIT License. +*/ + +/*! Decorator looking like Windows 95 */ + + +#include "WinDecorator.h" + #include <Point.h> -#include "DisplayDriver.h" #include <View.h> -#include "LayerData.h" -#include "ColorUtils.h" -#include "WinDecorator.h" + +#include "DesktopSettings.h" +#include "DrawingEngine.h" +#include "PatternHandler.h" #include "RGBColor.h" -#include "PatternHandler.h" -//#define DEBUG_DECOR -#ifdef DEBUG_DECOR -#include <stdio.h> +//#define DEBUG_DECORATOR +#ifdef DEBUG_DECORATOR +# include <stdio.h> +# define STRACE(x) printf x ; +#else +# define STRACE(x) ; #endif -WinDecorator::WinDecorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags) - : Decorator(rect,wlook,wfeel,wflags) + +WinDecorator::WinDecorator(DesktopSettings& settings, BRect rect, + window_look look, uint32 flags) + : Decorator(settings, rect, look, flags) { -#ifdef DEBUG_DECOR -printf("WinDecorator()\n"); -#endif taboffset=0; - frame_highcol.SetColor(255,255,255); - frame_midcol.SetColor(216,216,216); - frame_lowcol.SetColor(110,110,110); - frame_lowercol.SetColor(0,0,0); + frame_highcol = (rgb_color){ 255, 255, 255, 255 }; + frame_midcol = (rgb_color){ 216, 216, 216, 255 }; + frame_lowcol = (rgb_color){ 110, 110, 110, 255 }; + frame_lowercol = (rgb_color){ 0, 0, 0, 255 }; + fFocusTabColor = settings.UIColor(B_WINDOW_TAB_COLOR); + fFocusTextColor = settings.UIColor(B_WINDOW_TEXT_COLOR); + fNonFocusTabColor = settings.UIColor(B_WINDOW_INACTIVE_TAB_COLOR); + fNonFocusTextColor = settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR); + + _UpdateFont(settings); _DoLayout(); textoffset=5; + + STRACE(("WinDecorator()\n")); } -WinDecorator::~WinDecorator(void) + +WinDecorator::~WinDecorator() { -#ifdef DEBUG_DECOR -printf("~WinDecorator()\n"); -#endif + STRACE(("~WinDecorator()\n")); } -click_type WinDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers) + +void +WinDecorator::SetTitle(const char* string, BRegion* updateRegion) { - if(_closerect.Contains(pt)) - { + // TODO: we could be much smarter about the update region -#ifdef DEBUG_DECOR -printf("WinDecorator():Clicked() - Close\n"); -#endif + BRect rect = TabRect(); - return DEC_CLOSE; + 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); } - if(_zoomrect.Contains(pt)) - { + _UpdateFont(settings); + _DoLayout(); -#ifdef DEBUG_DECOR -printf("WinDecorator():Clicked() - Zoom\n"); -#endif + if (updateRegion != NULL) { + BRegion extent; + GetFootprint(&extent); + updateRegion->Include(&extent); + } +} + +// SetLook + + +// SetFlags + + + + + +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::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 pt, int32 buttons, int32 modifiers) +{ + if (fCloseRect.Contains(pt)) { + STRACE(("WinDecorator():Clicked() - Close\n")); + return DEC_CLOSE; + } + + if (fZoomRect.Contains(pt)) { + STRACE(("WinDecorator():Clicked() - Zoom\n")); return DEC_ZOOM; } // Clicking in the tab? - if(_tabrect.Contains(pt)) - { + if (fTabRect.Contains(pt)) { // Here's part of our window management stuff - if(buttons==B_PRIMARY_MOUSE_BUTTON && !GetFocus()) + /* TODO This is missing DEC_MOVETOFRONT + if(buttons==B_PRIMARY_MOUSE_BUTTON && !IsFocus()) return DEC_MOVETOFRONT; + */ return DEC_DRAG; } // We got this far, so user is clicking on the border? - BRect srect(_frame); - srect.top+=19; - BRect clientrect(srect.InsetByCopy(3,3)); - if(srect.Contains(pt) && !clientrect.Contains(pt)) + if(fBorderRect.Contains(pt) && !fFrame.Contains(pt)) { -#ifdef DEBUG_DECOR -printf("WinDecorator():Clicked() - Resize\n"); -#endif + STRACE(("WinDecorator():Clicked() - Resize\n")); return DEC_RESIZE; } // Guess user didn't click anything -#ifdef DEBUG_DECOR -printf("WinDecorator():Clicked()\n"); -#endif + STRACE(("WinDecorator():Clicked()\n")); return DEC_NONE; } -void WinDecorator::_DoLayout(void) + +void +WinDecorator::_DoLayout() { -#ifdef DEBUG_DECOR -printf("WinDecorator()::_DoLayout()\n"); -#endif - _borderrect=_frame; - _tabrect=_frame; + STRACE(("WinDecorator()::_DoLayout()\n")); - _tabrect.InsetBy(4,4); - _tabrect.bottom=_tabrect.top+19; - - _zoomrect=_tabrect; - _zoomrect.top+=3; - _zoomrect.right-=3; - _zoomrect.bottom-=3; - _zoomrect.left=_zoomrect.right-15; + bool hasTab = false; - _closerect=_zoomrect; - _zoomrect.OffsetBy(0-_zoomrect.Width()-3,0); - - _minimizerect=_zoomrect; - _minimizerect.OffsetBy(0-_zoomrect.Width()-1,0); -} + fBorderRect=fFrame; + fTabRect=fFrame; -void WinDecorator::MoveBy(float x, float y) -{ - MoveBy(BPoint(x,y)); -} + switch (Look()) { + case B_MODAL_WINDOW_LOOK: + fBorderRect.InsetBy(-4, -4); + break; -void WinDecorator::MoveBy(BPoint pt) -{ - // Move all internal rectangles the appropriate amount - _frame.OffsetBy(pt); - _closerect.OffsetBy(pt); - _tabrect.OffsetBy(pt); - _borderrect.OffsetBy(pt); - _zoomrect.OffsetBy(pt); - _minimizerect.OffsetBy(pt); -} + case B_TITLED_WINDOW_LOOK: + case B_DOCUMENT_WINDOW_LOOK: + hasTab = true; + fBorderRect.InsetBy(-4, -4); + break; + case B_FLOATING_WINDOW_LOOK: + hasTab = true; + break; -void WinDecorator::GetFootprint(BRegion *region) -{ - // This function calculates the decorator's footprint in coordinates - // relative to the layer. This is most often used to set a WinBorder - // object's visible region. - if(!region) - return; - - region->Set(_borderrect); - region->Include(_tabrect); + case B_BORDERED_WINDOW_LOOK: + fBorderRect.InsetBy(-1, -1); + break; + + default: + break; + } + + if (hasTab) { + fBorderRect.top -= 19; + + fTabRect.top -= 19; + fTabRect.bottom=fTabRect.top+19; + + fZoomRect=fTabRect; + fZoomRect.top+=3; + fZoomRect.right-=3; + fZoomRect.bottom-=3; + fZoomRect.left=fZoomRect.right-15; + + fCloseRect=fZoomRect; + fZoomRect.OffsetBy(0-fZoomRect.Width()-3,0); + + fMinimizeRect=fZoomRect; + fMinimizeRect.OffsetBy(0-fZoomRect.Width()-1,0); + } } -void WinDecorator::_DrawTitle(BRect r) + +void +WinDecorator::_DrawTitle(BRect r) { - _drawdata.SetHighColor(_colors->window_tab_text); - _drawdata.SetLowColor(GetFocus()?_colors->window_tab:_colors->inactive_window_tab); + fDrawingEngine->SetHighColor(textcol); + fDrawingEngine->SetLowColor(IsFocus()?fFocusTabColor:fNonFocusTabColor); - int32 titlecount=_ClipTitle((_minimizerect.left-5)-(_tabrect.left+5)); - BString titlestr=GetTitle(); - if(titlecount<titlestr.CountChars()) - { - titlestr.Truncate(titlecount-1); - titlestr+="..."; - titlecount+=2; - } - _driver->DrawString(titlestr.String(),titlecount, - BPoint(_tabrect.left+5,_closerect.bottom-1),&_drawdata); + fTruncatedTitle = Title(); + fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_END, + (fTabRect.left + textoffset) - (fZoomRect.left - 5)); + fTruncatedTitleLength = fTruncatedTitle.Length(); + fDrawingEngine->SetFont(fDrawState.Font()); + + fDrawingEngine->DrawString(fTruncatedTitle,fTruncatedTitleLength, + BPoint(fTabRect.left+textoffset,fCloseRect.bottom-1)); } -void WinDecorator::_SetFocus(void) + +void +WinDecorator::_SetFocus(void) { // SetFocus() performs necessary duties for color swapping and // other things when a window is deactivated or activated. - - if(GetFocus()) - { + + if (IsFocus()) { // tab_highcol.SetColor(100,100,255); // tab_lowcol.SetColor(40,0,255); - tab_highcol=_colors->window_tab; - textcol=_colors->window_tab_text; - } - else - { + tab_highcol=fFocusTabColor; + textcol=fFocusTextColor; + } else { // tab_highcol.SetColor(220,220,220); // tab_lowcol.SetColor(128,128,128); - tab_highcol=_colors->inactive_window_tab; - textcol=_colors->inactive_window_tab_text; + tab_highcol=fNonFocusTabColor; + textcol=fNonFocusTextColor; } } -void WinDecorator::Draw(BRect update) + +void +WinDecorator::Draw(BRect update) { -#ifdef DEBUG_DECOR -printf("WinDecorator::Draw(): "); update.PrintToStream(); -#endif - // Draw the top view's client area - just a hack :) -// RGBColor blue(100,100,255); -// _drawdata.SetHighColor(blue); + STRACE(("WinDecorator::Draw(): ")); update.PrintToStream(); - _driver->FillRect(_borderrect,_colors->document_background); + fDrawingEngine->SetDrawState(&fDrawState); - if(_borderrect.Intersects(update)) - _driver->FillRect(_borderrect,_colors->document_background); - _DrawFrame(update); _DrawTab(update); } -void WinDecorator::Draw(void) + +void +WinDecorator::Draw(void) { -#ifdef DEBUG_DECOR -printf("WinDecorator::Draw()\n"); -#endif + STRACE(("WinDecorator::Draw()\n")); - // Draw the top view's client area - just a hack :) -// RGBColor blue(100,100,255); -// _drawdata.SetHighColor(blue); + fDrawingEngine->SetDrawState(&fDrawState); - _driver->FillRect(_borderrect,_colors->document_background); - _driver->FillRect(_borderrect,_colors->document_background); - DrawFrame(); - - DrawTab(); + _DrawFrame(fBorderRect); + _DrawTab(fTabRect); } -void WinDecorator::_DrawZoom(BRect r) + +void +WinDecorator::_DrawZoom(BRect r) { DrawBeveledRect(r,GetZoom()); @@ -228,14 +331,15 @@ if(GetZoom()) rect.OffsetBy(1,1); - _drawdata.SetHighColor(RGBColor(0,0,0)); - _driver->StrokeRect(rect,_drawdata.HighColor()); + fDrawingEngine->SetHighColor(RGBColor(0,0,0)); + fDrawingEngine->StrokeRect(rect); rect.InsetBy(1,1); - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),_drawdata.HighColor()); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop()); } -void WinDecorator::_DrawClose(BRect r) +void +WinDecorator::_DrawClose(BRect r) { // Just like DrawZoom, but for a close button DrawBeveledRect(r,GetClose()); @@ -250,12 +354,12 @@ if(GetClose()) rect.OffsetBy(1,1); - _drawdata.SetHighColor(RGBColor(0,0,0)); - _driver->StrokeLine(rect.LeftTop(),rect.RightBottom(),_drawdata.HighColor()); - _driver->StrokeLine(rect.RightTop(),rect.LeftBottom(),_drawdata.HighColor()); + fDrawingEngine->SetHighColor(RGBColor(0,0,0)); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightBottom()); + fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom()); rect.OffsetBy(1,0); - _driver->StrokeLine(rect.LeftTop(),rect.RightBottom(),_drawdata.HighColor()); - _driver->StrokeLine(rect.RightTop(),rect.LeftBottom(),_drawdata.HighColor()); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightBottom()); + fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom()); } void WinDecorator::_DrawMinimize(BRect r) @@ -263,36 +367,39 @@ // Just like DrawZoom, but for a Minimize button DrawBeveledRect(r,GetMinimize()); - _drawdata.SetHighColor(textcol); + fDrawingEngine->SetHighColor(textcol); BRect rect(r.left+5,r.bottom-4,r.right-5,r.bottom-3); if(GetMinimize()) rect.OffsetBy(1,1); - _drawdata.SetHighColor(RGBColor(0,0,0)); - _driver->StrokeRect(rect,_drawdata.HighColor()); + fDrawingEngine->SetHighColor(RGBColor(0,0,0)); + fDrawingEngine->StrokeRect(rect); } -void WinDecorator::_DrawTab(BRect r) + +void +WinDecorator::_DrawTab(BRect r) { // If a window has a tab, this will draw it and any buttons which are // in it. - if(_look==B_NO_BORDER_WINDOW_LOOK) + if(fLook==B_NO_BORDER_WINDOW_LOOK) return; - -// _driver->StrokeRect(_tabrect,frame_lowcol); -// UpdateTitle(layer->name->String()); - _driver->FillRect(_tabrect,tab_highcol); + fDrawingEngine->FillRect(fTabRect,tab_highcol); + _DrawTitle(r); + // Draw the buttons if we're supposed to - if(!(_flags & B_NOT_CLOSABLE)) - _DrawClose(_closerect); - if(!(_flags & B_NOT_ZOOMABLE)) - _DrawZoom(_zoomrect); + if(!(fFlags & B_NOT_CLOSABLE)) + _DrawClose(fCloseRect); + if(!(fFlags & B_NOT_ZOOMABLE)) + _DrawZoom(fZoomRect); } -void WinDecorator::DrawBeveledRect(BRect r, bool down) + +void +WinDecorator::DrawBeveledRect(BRect r, bool down) { RGBColor higher,high,mid,low,lower; @@ -317,95 +424,123 @@ BPoint pt; // Top highlight - _drawdata.SetHighColor(higher); - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),higher); + fDrawingEngine->SetHighColor(higher); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop()); // Left highlight - _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),higher); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.LeftBottom()); // Right shading pt=rect.RightTop(); pt.y++; - _driver->StrokeLine(pt,rect.RightBottom(),lower); + fDrawingEngine->StrokeLine(pt,rect.RightBottom(),lower); // Bottom shading pt=rect.LeftBottom(); pt.x++; - _driver->StrokeLine(pt,rect.RightBottom(),lower); + fDrawingEngine->StrokeLine(pt,rect.RightBottom(),lower); rect.InsetBy(1,1); // Top inside highlight - _driver->StrokeLine(rect.LeftTop(),rect.RightTop(),higher); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop()); // Left inside highlight - _driver->StrokeLine(rect.LeftTop(),rect.LeftBottom(),higher); + fDrawingEngine->StrokeLine(rect.LeftTop(),rect.LeftBottom()); // Right inside shading pt=rect.RightTop(); pt.y++; - _driver->StrokeLine(pt,rect.RightBottom(),lower); + fDrawingEngine->StrokeLine(pt,rect.RightBottom(),lower); // Bottom inside shading pt=rect.LeftBottom(); pt.x++; - _driver->StrokeLine(pt,rect.RightBottom(),lower); + fDrawingEngine->StrokeLine(pt,rect.RightBottom(),lower); rect.InsetBy(1,1); - _driver->FillRect(rect,mid); + fDrawingEngine->FillRect(rect,mid); } -void WinDecorator::_SetColors(void) + +void +WinDecorator::_SetColors() { _SetFocus(); } -void WinDecorator::_DrawFrame(BRect rect) + +void +WinDecorator::_UpdateFont(DesktopSettings& settings) { - if(_look==B_NO_BORDER_WINDOW_LOOK) + 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::_DrawFrame(BRect rect) +{ + if(fLook==B_NO_BORDER_WINDOW_LOOK) return; - BRect r=_borderrect; + if (fBorderRect == fFrame) + return; + + BRect r=fBorderRect; - _drawdata.SetHighColor(RGBColor(255,0,0)); - _driver->StrokeRect(r,_drawdata.HighColor()); + fDrawingEngine->SetHighColor(frame_lowercol); + fDrawingEngine->StrokeRect(r); + + if ( fLook == B_BORDERED_WINDOW_LOOK) + return; BPoint pt; pt=r.RightTop(); pt.x--; - _driver->StrokeLine(r.LeftTop(),pt,frame_midcol); + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol); pt=r.LeftBottom(); pt.y--; - _driver->StrokeLine(r.LeftTop(),pt,frame_midcol); + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol); - _driver->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowercol); - _driver->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowercol); + 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--; - _driver->StrokeLine(r.LeftTop(),pt,frame_highcol); + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol); pt=r.LeftBottom(); pt.y--; - _driver->StrokeLine(r.LeftTop(),pt,frame_highcol); + fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol); - _driver->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowcol); - _driver->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowcol); + fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowcol); + fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowcol); r.InsetBy(1,1); - _driver->StrokeRect(r,frame_midcol); + fDrawingEngine->StrokeRect(r,frame_midcol); r.InsetBy(1,1); - _driver->StrokeRect(r,frame_midcol); + fDrawingEngine->StrokeRect(r,frame_midcol); } + extern "C" float get_decorator_version(void) { return 1.00; } -extern "C" Decorator *instantiate_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags) + +extern "C" Decorator *instantiate_decorator(DesktopSettings &desktopSetting, BRect rect, + window_look wlook, int32 wflags) { - return new WinDecorator(rect,wlook,wfeel,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 2009-12-23 21:25:42 UTC (rev 34761) +++ haiku/trunk/src/add-ons/decorators/WinDecorator/WinDecorator.h 2009-12-24 11:25:28 UTC (rev 34762) @@ -6,19 +6,25 @@ class WinDecorator: public Decorator { public: - WinDecorator(BRect frame, int32 wlook, int32 wfeel, int32 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); - void MoveBy(float x, float y); void MoveBy(BPoint pt); -// void ResizeBy(float x, float y); -// void ResizeBy(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); protected: + void _UpdateFont(DesktopSettings& settings); void _DrawClose(BRect r); void _DrawFrame(BRect r); void _DrawTab(BRect r); @@ -31,11 +37,22 @@ void DrawBeveledRect(BRect r, bool down); uint32 taboffset; - RGBColor tab_highcol, tab_lowcol; - RGBColor frame_highcol, frame_midcol, frame_lowcol, frame_lowercol; - RGBColor textcol; + rgb_color tab_highcol; + rgb_color tab_lowcol; + rgb_color frame_highcol; + rgb_color frame_midcol; + rgb_color frame_lowcol; + rgb_color frame_lowercol; + rgb_color textcol; + rgb_color fFocusTabColor; + rgb_color fNonFocusTabColor; + rgb_color fFocusTextColor; + rgb_color fNonFocusTextColor; uint64 solidhigh, solidlow; + BString fTruncatedTitle; + int32 fTruncatedTitleLength; + bool slidetab; int textoffset; };