haiku/src/servers/app/WindowList.h
Axel Dörfler d689f4578d * Fixed a possible deadlock in Desktop::_ActivateApp(): since ActivateWindow()
will need to write lock the window lock, we cannot call it with the read
  lock held.
* Added a TODO comment in _ActivateApp() on how we could handle minimized
  windows.
* Added a WindowList::Count() method.
* Added a WindowList::ValidateWindow() that you can use to validate a window
  pointer in case you had to unlock the list.
* Made FirstWindow()/LastWindow() const.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26957 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-13 09:00:36 +00:00

65 lines
1.1 KiB
C++

/*
* Copyright (c) 2005-2008, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef WINDOW_LIST_H
#define WINDOW_LIST_H
#include <SupportDefs.h>
#include <Point.h>
class Window;
class WindowList {
public:
WindowList(int32 index = 0);
~WindowList();
void SetIndex(int32 index);
int32 Index() const { return fIndex; }
Window* FirstWindow() const { return fFirstWindow; }
Window* LastWindow() const { return fLastWindow; }
void AddWindow(Window* window, Window* before = NULL);
void RemoveWindow(Window* window);
bool HasWindow(Window* window) const;
bool ValidateWindow(Window* window) const;
int32 Count() const;
// O(n)
private:
int32 fIndex;
Window* fFirstWindow;
Window* fLastWindow;
};
enum window_lists {
kAllWindowList = 32,
kSubsetList,
kFocusList,
kWorkingList,
kListCount
};
struct window_anchor {
window_anchor();
Window* next;
Window* previous;
BPoint position;
};
extern const BPoint kInvalidWindowPosition;
#endif // WINDOW_LIST_H