1 // This file is part of the utui library, a terminal UI framework.
3 // Copyright (C) 2006 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
9 #ifndef ROOTWIN_H_66E7B71D025F65121A9EDB8A49C962B3
10 #define ROOTWIN_H_66E7B71D025F65121A9EDB8A49C962B3
16 /// \class CRootWindow rootwin.h utui.h
18 /// This is the one and only root window of an application. It handles
19 /// combining the output of all its child windows and rendering the result
20 /// to the terminal. It also manages the event loop, receives and routes
21 /// user input, and rations idle processing.
23 class CRootWindow
: public CWindow
{
25 static CRootWindow
& Instance (void);
26 virtual ~CRootWindow (void);
27 virtual void OnCreate (void);
28 virtual void OnDestroy (void);
29 virtual void OnResize (rcrect_t wr
);
30 void OnError (exception
& e
);
32 int RunModal (CDialog
* pw
);
33 static inline void SetIdleTimeout (long v
) { s_IdleTimeout
= v
; }
34 static inline void SetMinIdleTimeout (long v
) { s_IdleTimeout
= min (s_IdleTimeout
, v
); }
37 virtual void OnChildClose (uoff_t i
);
40 wchar_t GetKey (void) const;
42 CTerminfo m_TI
; ///< The terminfo rendering backend object.
43 CKeyboard m_Kb
; ///< The terminal keyboard driver.
44 CGC m_Screen
; ///< Currently visible screen buffer.
45 Point2d m_ScreenPos
; ///< Cursor position on the screen, if any.
46 static long s_IdleTimeout
; ///< How often to call OnIdle in absence of keystrokes.
47 static int s_ModalStack
[15]; ///< Return values of currently active modal dialogs.
48 static unsigned int s_ModalDepth
; ///< Depth of the current modal call stack.