4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Terminal public header */
26 #ifndef HH_SENF_Utils_Termlib_AbstractTerminal_
27 #define HH_SENF_Utils_Termlib_AbstractTerminal_ 1
32 //#include "AbstractTerminal.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
38 /** \brief Abstract terminal interface
40 This abstract interface base class provides an abstract interface to a terminal. There are
41 two parts to this interface:
43 \li The interface which allows the terminal user to get information about the terminal
44 \li The interface which allows the terminal to send messages to the terminal user
46 The first part is implemented by providing abstract virtual members in AbstractTerminal. To
47 allow the terminal to send messages to the terminal user, the terminal user implements the
48 AbstractTerminal::Callbacks interface. The terminal user must register himself with the
49 AbstractTerminal by calling setCallbacks(). Afterwards, the AbstractTerminal implementation
50 will send calls to the terminal user via the AbstractTerminal::Callbacks API.
52 struct AbstractTerminal
54 /** \brief AbstractTerminal callbacks
56 \see AbastractTerminal
59 virtual ~Callbacks() {}
60 virtual bool cb_init() = 0; ///< Called after terminal initialization is complete
61 /**< This member may return \c false. In this case, the
62 terminal setup is considered to have failed. */
63 virtual void cb_charReceived(char ch) = 0; ///< Called whenever a char is received
64 virtual void cb_windowSizeChanged() = 0; ///< Called when the terminal window is changed
67 virtual ~AbstractTerminal() {}
69 virtual void setCallbacks(Callbacks & cb) = 0; ///< Register terminal callbacks
71 virtual std::string terminalType() = 0; ///< Get the terminal type
72 virtual unsigned width() = 0; ///< Get current terminal window width
73 virtual unsigned height() = 0; ///< Get current terminal window height
75 virtual void write(char ch) = 0; ///< Write character to terminal
80 ///////////////////////////////hh.e////////////////////////////////////////
81 //#include "AbstractTerminal.cci"
82 //#include "AbstractTerminal.ct"
83 //#include "AbstractTerminal.cti"
91 // c-file-style: "senf"
92 // indent-tabs-mode: nil
93 // ispell-local-dictionary: "american"
94 // compile-command: "scons -u test"