openblt

a hobby OS from the late 90s
git clone http://frotz.net/git/openblt.git
Log | Files | Refs | LICENSE

WindowManager.h (1179B)


      1 #ifndef _WINDOW_MANAGER_H
      2 #define _WINDOW_MANAGER_H
      3 
      4 #include <blt/qsem.h>
      5 #include "Rect.h"
      6 
      7 class Renderer;
      8 class Window;
      9 
     10 const int kMaxWindows = 255;
     11 
     12 class WindowManager {
     13 public:
     14 
     15 	WindowManager(Renderer *screenRenderer);
     16 	~WindowManager();
     17 	
     18 private:
     19 
     20 	Window* CreateWindow(Window *parent, const Rect &rect, int eventPort);
     21 	void DestroyWindow(Window *window);
     22 	Window* LookupWindow(int id);
     23 	Window* WindowAtPoint(int x, int y);
     24 
     25 	int RequestorPort() const;
     26 	static int StartDispatchThread(void *windowManager);
     27 	void DispatchThread();
     28 	void ReadServicePort(void*, int);
     29 	int ReadInt32();
     30 	short ReadInt16();
     31 	char ReadInt8();
     32 	void Respond(void *, int);
     33 
     34 	void SetCursorPos(int x, int y);
     35 	static int StartMouseThread(void *_wm);
     36 	void MouseThread();
     37 	void LockCursor();
     38 	void UnlockCursor();
     39 	
     40 	void InvalidateMouseBoundries();
     41 
     42 	
     43 	Window *fWindowArray[kMaxWindows];
     44 	int fNextWindowID;
     45 
     46 	int fServicePort;
     47 	char *fReceiveBuffer;
     48 	int fReceiveBufferSize;
     49 	int fReceiveBufferPos;
     50 	int fRequestorPort;
     51 	qsem_t *fCursorLock;
     52 
     53 	Rect fMouseBoundries;
     54 	Window *fCurrentMouseFocus;
     55 	bool fMouseFocusLocked;
     56 	bool fInFocusLockedWindow;
     57 
     58 	Renderer *fScreenRenderer;
     59 };
     60 
     61 
     62 #endif