1/* 2 * Copyright 2009-2014 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * DarkWyrm, bpmagic@columbus.rr.com 7 * Adrien Destugues, pulkomandy@gmail.com 8 * John Scipione, jscipione@gmail.com 9 */ 10#ifndef WIN_DECORATOR_H 11#define WIN_DECORATOR_H 12 13 14#include "DecorManager.h" 15#include "SATDecorator.h" 16 17 18struct rgb_color; 19 20 21class BRect; 22 23class WinDecorAddOn : public DecorAddOn { 24public: 25 WinDecorAddOn(image_id id, const char* name); 26 27protected: 28 virtual Decorator* _AllocateDecorator(DesktopSettings& settings, 29 BRect rect, Desktop* desktop); 30}; 31 32 33class WinDecorator: public SATDecorator { 34public: 35 WinDecorator(DesktopSettings& settings, 36 BRect frame, Desktop* desktop); 37 ~WinDecorator(void); 38 39 virtual void Draw(BRect updateRect); 40 virtual void Draw(); 41 42 virtual Region RegionAt(BPoint where, int32& tab) const; 43 44 virtual bool SetRegionHighlight(Region region, 45 uint8 highlight, BRegion* dirty, 46 int32 tab = -1); 47 48protected: 49 void _DoLayout(); 50 51 virtual void _DrawFrame(BRect rect); 52 53 virtual void _DrawButtons(Decorator::Tab* tab, 54 const BRect& invalid); 55 virtual void _DrawTab(Decorator::Tab* tab, BRect rect); 56 virtual void _DrawTitle(Decorator::Tab* tab, BRect rect); 57 58 virtual void _DrawMinimize(Decorator::Tab* tab, bool direct, 59 BRect rect); 60 virtual void _DrawZoom(Decorator::Tab* tab, bool direct, 61 BRect rect); 62 virtual void _DrawClose(Decorator::Tab* tab, bool direct, 63 BRect rect); 64 65 virtual void _SetTitle(Decorator::Tab* tab, const char* string, 66 BRegion* updateRegion = NULL); 67 68 void _MoveBy(BPoint offset); 69 void _ResizeBy(BPoint offset, BRegion* dirty); 70 71 Decorator::Tab* _AllocateNewTab(); 72 73 virtual bool _AddTab(DesktopSettings& settings, 74 int32 index = -1, 75 BRegion* updateRegion = NULL); 76 virtual bool _RemoveTab(int32 index, 77 BRegion* updateRegion = NULL); 78 virtual bool _MoveTab(int32 from, int32 to, bool isMoving, 79 BRegion* updateRegion = NULL); 80 81 void _GetFootprint(BRegion *region); 82 virtual void _SetFocus(Decorator::Tab* tab); 83 84private: 85 void _UpdateFont(DesktopSettings& settings); 86 void _DrawBeveledRect(BRect r, bool down); 87 88private: 89 rgb_color fFrameHighColor; 90 rgb_color fFrameMidColor; 91 rgb_color fFrameLowColor; 92 rgb_color fFrameLowerColor; 93 94 rgb_color fFocusTabColor; 95 rgb_color fFocusTextColor; 96 rgb_color fNonFocusTabColor; 97 rgb_color fNonFocusTextColor; 98 99 rgb_color fTabColor; 100 rgb_color fTextColor; 101}; 102 103 104#endif // WIN_DECORATOR_H 105