Update list of wide characters
[centerim5.git] / cppconsui / CoreManager.h
blobc7f106891a3561f617a914b989c4508537fbbbf0
1 // Copyright (C) 2007 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2009-2015 Petr Pavlu <setup@dagobah.cz>
3 //
4 // This file is part of CenterIM.
5 //
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/>.
19 /// @file
20 /// CoreManager class
21 ///
22 /// @ingroup cppconsui
24 #ifndef COREMANAGER_H
25 #define COREMANAGER_H
27 #include "CppConsUI.h"
28 #include "Window.h"
30 #include <deque>
31 #include <iconv.h>
32 #include <termkey.h>
34 namespace CppConsUI {
36 /// CppConsUI manager.
37 class CoreManager : public InputProcessor {
38 public:
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
47 /// InputProcessor.
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;
83 private:
84 typedef std::deque<Window *> Windows;
86 enum PendingRedraw {
87 REDRAW_NONE,
88 REDRAW_NORMAL,
89 REDRAW_FROM_SCRATCH,
92 Windows windows_;
93 AppInterface interface_;
94 InputProcessor *top_input_processor_;
96 TermKey *tk_;
97 iconv_t iconv_desc_;
99 PendingRedraw pending_redraw_;
101 CoreManager(AppInterface &set_interface);
102 ~CoreManager() {}
103 CONSUI_DISABLE_COPY(CoreManager);
105 friend void initializeConsUI(AppInterface &interface);
106 friend void finalizeConsUI();
108 // InputProcessor
109 virtual bool processInput(const TermKeyKey &key) override;
111 void updateArea();
112 void updateWindowArea(Window &window);
114 int drawWindow(Window &window, Error &error);
116 Windows::iterator findWindow(Window &window);
117 void focusWindow();
119 void redrawScreen();
121 void declareBindables();
124 } // namespace CppConsUI
126 #endif // COREMANGER_H
128 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: