1 /* 2 * Copyright 2010-2014 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * Clemens Zeidler, haiku@clemens-zeidler.de 8 */ 9 #ifndef SAT_WINDOW_H 10 #define SAT_WINDOW_H 11 12 13 #include <Region.h> 14 15 #include "SATDecorator.h" 16 #include "SATGroup.h" 17 #include "Stacking.h" 18 #include "Tiling.h" 19 20 21 class Desktop; 22 class SATGroup; 23 class StackAndTile; 24 class Window; 25 26 27 class SATWindow { 28 public: 29 SATWindow(StackAndTile* sat, Window* window); 30 ~SATWindow(); 31 32 Window* GetWindow() { return fWindow; } 33 SATDecorator* GetDecorator() const; 34 StackAndTile* GetStackAndTile() { return fStackAndTile; } 35 Desktop* GetDesktop() { return fDesktop; } 36 //! Can be NULL if memory allocation failed! 37 SATGroup* GetGroup(); 38 WindowArea* GetWindowArea() { return fWindowArea; } 39 40 bool HandleMessage(SATWindow* sender, 41 BPrivate::LinkReceiver& link, 42 BPrivate::LinkSender& reply); 43 44 bool PropagateToGroup(SATGroup* group); 45 46 // hook function called from SATGroup 47 bool AddedToGroup(SATGroup* group, WindowArea* area); 48 bool RemovedFromGroup(SATGroup* group, 49 bool stayBelowMouse); 50 void RemovedFromArea(WindowArea* area); 51 void WindowLookChanged(window_look look); 52 53 bool StackWindow(SATWindow* child); 54 55 void FindSnappingCandidates(); 56 bool JoinCandidates(); 57 void DoGroupLayout(); 58 59 void AdjustSizeLimits(BRect targetFrame); 60 void SetOriginalSizeLimits(int32 minWidth, 61 int32 maxWidth, int32 minHeight, 62 int32 maxHeight); 63 void GetSizeLimits(int32* minWidth, int32* maxWidth, 64 int32* minHeight, int32* maxHeight) const; 65 void AddDecorator(int32* minWidth, int32* maxWidth, 66 int32* minHeight, int32* maxHeight); 67 void AddDecorator(BRect& frame); 68 69 // hook called when window has been resized form the outside 70 void Resized(); 71 bool IsHResizeable() const; 72 bool IsVResizeable() const; 73 74 //! \return the complete window frame including the Decorator 75 BRect CompleteWindowFrame(); 76 77 //! \return true if window is in a group with a least another window 78 bool PositionManagedBySAT(); 79 80 bool HighlightTab(bool active); 81 bool HighlightBorders(Decorator::Region region, 82 bool active); 83 bool IsTabHighlighted(); 84 bool IsBordersHighlighted(); 85 86 uint64 Id(); 87 88 bool SetSettings(const BMessage& message); 89 void GetSettings(BMessage& message); 90 private: 91 uint64 _GenerateId(); 92 93 void _UpdateSizeLimits(); 94 void _RestoreOriginalSize( 95 bool stayBelowMouse = true); 96 97 Window* fWindow; 98 StackAndTile* fStackAndTile; 99 Desktop* fDesktop; 100 101 //! Current group. 102 WindowArea* fWindowArea; 103 104 SATSnappingBehaviour* fOngoingSnapping; 105 SATStacking fSATStacking; 106 SATTiling fSATTiling; 107 108 SATSnappingBehaviourList fSATSnappingBehaviourList; 109 110 int32 fOriginalMinWidth; 111 int32 fOriginalMaxWidth; 112 int32 fOriginalMinHeight; 113 int32 fOriginalMaxHeight; 114 115 float fOriginalWidth; 116 float fOriginalHeight; 117 118 uint64 fId; 119 120 float fOldTabLocatiom; 121 }; 122 123 124 #endif 125