1 // Copyright (C) 2007 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2009-2015 Petr Pavlu <setup@dagobah.cz>
4 // This file is part of CenterIM.
6 // CenterIM is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // CenterIM is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with CenterIM. If not, see <http://www.gnu.org/licenses/>.
22 /// @ingroup cppconsui
27 #include "CppConsUI.h"
36 /// CppConsUI manager.
37 class CoreManager
: public InputProcessor
{
39 int initializeInput(Error
&error
);
40 int finalizeInput(Error
&error
);
42 int initializeOutput(Error
&error
);
43 int finalizeOutput(Error
&error
);
45 /// Reads data from the standard input. The data are first converted from the
46 /// user locale to the internal representation (UTF-8) and then processed by
48 int processStandardInput(int *wait
, Error
&error
);
49 int processStandardInputTimeout(Error
&error
);
51 int resize(Error
&error
);
52 int draw(Error
&error
);
54 void registerWindow(Window
&window
);
55 void removeWindow(Window
&window
);
56 void hideWindow(Window
&window
);
57 void topWindow(Window
&window
);
58 Window
*getTopWindow();
60 void setTopInputProcessor(InputProcessor
&top
)
62 top_input_processor_
= &top
;
64 InputProcessor
*getTopInputProcessor() { return top_input_processor_
; }
66 void logDebug(const char *message
);
67 void redraw(bool from_scratch
= false);
69 bool isRedrawPending() const;
71 void onScreenResized();
73 void onWindowMoveResize(
74 Window
&activator
, const Rect
&oldsize
, const Rect
&newsize
);
75 void onWindowWishSizeChange(
76 Window
&activator
, const Size
&oldsize
, const Size
&newsize
);
78 TermKey
*getTermKeyHandle() { return tk_
; };
80 sigc::signal
<void> signal_resize
;
81 sigc::signal
<void> signal_top_window_change
;
84 typedef std::deque
<Window
*> Windows
;
93 AppInterface interface_
;
94 InputProcessor
*top_input_processor_
;
99 PendingRedraw pending_redraw_
;
101 CoreManager(AppInterface
&set_interface
);
103 CONSUI_DISABLE_COPY(CoreManager
);
105 friend void initializeConsUI(AppInterface
&interface
);
106 friend void finalizeConsUI();
109 virtual bool processInput(const TermKeyKey
&key
) override
;
112 void updateWindowArea(Window
&window
);
114 int drawWindow(Window
&window
, Error
&error
);
116 Windows::iterator
findWindow(Window
&window
);
121 void declareBindables();
124 } // namespace CppConsUI
126 #endif // COREMANGER_H
128 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: