2 * Copyright 2010, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Clemens Zeidler <haiku@clemens-zeidler.de>
8 #ifndef DESKTOP_LISTENER_H
9 #define DESKTOP_LISTENER_H
12 #include <util/DoublyLinkedList.h>
16 #include <ServerLink.h>
25 class DesktopListener
: public DoublyLinkedListLinkImpl
<DesktopListener
> {
27 virtual ~DesktopListener();
29 virtual int32
Identifier() = 0;
31 virtual void ListenerRegistered(Desktop
* desktop
) = 0;
32 virtual void ListenerUnregistered() = 0;
34 virtual bool HandleMessage(Window
* sender
,
35 BPrivate::LinkReceiver
& link
,
36 BPrivate::LinkSender
& reply
) = 0;
38 virtual void WindowAdded(Window
* window
) = 0;
39 virtual void WindowRemoved(Window
* window
) = 0;
41 virtual bool KeyPressed(uint32 what
, int32 key
,
43 virtual void MouseEvent(BMessage
* message
) = 0;
44 virtual void MouseDown(Window
* window
, BMessage
* message
,
45 const BPoint
& where
) = 0;
46 virtual void MouseUp(Window
* window
, BMessage
* message
,
47 const BPoint
& where
) = 0;
48 virtual void MouseMoved(Window
* window
, BMessage
* message
,
49 const BPoint
& where
) = 0;
51 virtual void WindowMoved(Window
* window
) = 0;
52 virtual void WindowResized(Window
* window
) = 0;
53 virtual void WindowActivated(Window
* window
) = 0;
54 virtual void WindowSentBehind(Window
* window
,
55 Window
* behindOf
) = 0;
56 virtual void WindowWorkspacesChanged(Window
* window
,
57 uint32 workspaces
) = 0;
58 virtual void WindowHidden(Window
* window
,
59 bool fromMinimize
) = 0;
60 virtual void WindowMinimized(Window
* window
,
63 virtual void WindowTabLocationChanged(Window
* window
,
64 float location
, bool isShifting
) = 0;
65 virtual void SizeLimitsChanged(Window
* window
,
66 int32 minWidth
, int32 maxWidth
,
67 int32 minHeight
, int32 maxHeight
) = 0;
68 virtual void WindowLookChanged(Window
* window
,
69 window_look look
) = 0;
70 virtual void WindowFeelChanged(Window
* window
,
71 window_feel feel
) = 0;
73 virtual bool SetDecoratorSettings(Window
* window
,
74 const BMessage
& settings
) = 0;
75 virtual void GetDecoratorSettings(Window
* window
,
76 BMessage
& settings
) = 0;
80 typedef DoublyLinkedList
<DesktopListener
> DesktopListenerDLList
;
83 class DesktopObservable
{
87 void RegisterListener(DesktopListener
* listener
,
89 void UnregisterListener(DesktopListener
* listener
);
90 const DesktopListenerDLList
& GetDesktopListenerList();
92 bool MessageForListener(Window
* sender
,
93 BPrivate::LinkReceiver
& link
,
94 BPrivate::LinkSender
& reply
);
96 void NotifyWindowAdded(Window
* window
);
97 void NotifyWindowRemoved(Window
* window
);
99 bool NotifyKeyPressed(uint32 what
, int32 key
,
101 void NotifyMouseEvent(BMessage
* message
);
102 void NotifyMouseDown(Window
* window
,
103 BMessage
* message
, const BPoint
& where
);
104 void NotifyMouseUp(Window
* window
, BMessage
* message
,
105 const BPoint
& where
);
106 void NotifyMouseMoved(Window
* window
,
107 BMessage
* message
, const BPoint
& where
);
109 void NotifyWindowMoved(Window
* window
);
110 void NotifyWindowResized(Window
* window
);
111 void NotifyWindowActivated(Window
* window
);
112 void NotifyWindowSentBehind(Window
* window
,
114 void NotifyWindowWorkspacesChanged(Window
* window
,
116 void NotifyWindowHidden(Window
* window
,
118 void NotifyWindowMinimized(Window
* window
,
121 void NotifyWindowTabLocationChanged(Window
* window
,
122 float location
, bool isShifting
);
123 void NotifySizeLimitsChanged(Window
* window
,
124 int32 minWidth
, int32 maxWidth
,
125 int32 minHeight
, int32 maxHeight
);
126 void NotifyWindowLookChanged(Window
* window
,
128 void NotifyWindowFeelChanged(Window
* window
,
131 bool SetDecoratorSettings(Window
* window
,
132 const BMessage
& settings
);
133 void GetDecoratorSettings(Window
* window
,
139 InvokeGuard(bool& invoking
);
145 DesktopListenerDLList fDesktopListenerList
;
147 // prevent recursive invokes