Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/chat/ChatInputHandler.h @ 12206

Last change on this file since 12206 was 11099, checked in by muemart, 9 years ago

Fix loads of doxygen warnings and other documentation issues

  • Property svn:eol-style set to native
File size: 4.0 KB
RevLine 
[6776]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
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.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Sandro 'smerkli' Merkli
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _ChatInputHandler_H__
30#define _ChatInputHandler_H__
31
[8829]32#include "OrxonoxPrereqs.h"
[8079]33
[6776]34#include <string>
35
[9675]36#if CEGUI_VERSION >= 0x000800
37#   include <CEGUI/ForwardRefs.h>
38#   include <CEGUI/Colour.h>
39#else
40#   include <CEGUIForwardRefs.h>
41#   include <CEGUIcolour.h>
42#endif
43
[8079]44#include "util/Singleton.h"
[8829]45#include "chat/ChatListener.h"
[6791]46
[7009]47namespace orxonox // tolua_export
48{ // tolua_export
[9675]49
50#if CEGUI_VERSION >= 0x000800
51  typedef CEGUI::Colour CEGUIColour;
52#else
53  typedef CEGUI::colour CEGUIColour;
54#endif
55
[6776]56  /* class to handle chat using an InputBuffer */
[7009]57  class _OrxonoxExport ChatInputHandler  // tolua_export
58    : public Singleton<ChatInputHandler>, public ChatListener
59  { // tolua_export
[6776]60    private:
61      /** Input buffer, to be used to catch input from the
[7127]62       * keyboard
[6776]63       */
64      InputBuffer *inpbuf;
[6876]65      int disp_offset, width;
[6879]66      bool fullchat;
[6776]67
[7043]68      /* colors for nickname coloring */
69      static const int NumberOfColors = 10;
[9675]70      CEGUIColour text_colors[ NumberOfColors ];
[7043]71
[6788]72      /** input state */
73      InputState *inputState;
74
75      /** setup input buffer, the constructor calls this */
[6776]76      void configureInputBuffer();
77
[6876]78      /** adjust display offset depending on cursor position */
79      void sub_adjust_dispoffset( int maxlen, int cursorpos, int inplen );
80
[6910]81      /** singleton pointer */
[6788]82      static ChatInputHandler* singletonPtr_s;
83
[6910]84      /** cegui window handles */
[6870]85      CEGUI::Window *input, *inputonly;
[6910]86
87      /** cegui handle for the history window */
[6846]88      CEGUI::Listbox *lb_history;
89
[7043]90      /* methods to deal with colors */
91      void sub_setcolor( CEGUI::ListboxTextItem *tocolor,
92        std::string name );
93
94      void setupColors();
95
[6910]96      /* callbacks for input handler */
97      void inputChanged();
98      void addline();
99      void backspace();
100      void deleteChar();
101      void cursorRight();
102      void cursorLeft();
103      void cursorEnd();
104      void cursorHome();
105      void exit();
106
[6776]107    public:
108      /** constructor */
109      ChatInputHandler();
[8079]110      ~ChatInputHandler();
[6777]111      friend class Singleton<ChatInputHandler>;
[6776]112
[7009]113      static ChatInputHandler& getInstance(void) { return Singleton<ChatInputHandler>::getInstance(); }  // tolua_export
114
[6910]115      /** start listening */
[6791]116      static void activate_static();
[6910]117
118      /** stop listening */
[6870]119      static void activate_small_static();
[6885]120
[6910]121      /** \param message the message text
[11099]122       * \param name Name of the player who sent the message
[6910]123       *
124       * Deal with incoming chat (which means in our case: Add it to the
125       * history window of the full chat window)
126       */
[11071]127      virtual void incomingChat(const std::string& message, const std::string& name) override;
[6885]128
[6910]129      /** \param full true means show full chat window with history,
130            false means show only an input line
[7127]131       *
132       * Show the chat window and redirect the game's keyboard input
[6910]133       * into it.
134       */
[6870]135      void activate( bool full );
[6910]136
137      /** Deactivate the chat window, meaning: hide it. */
[7009]138      void deactivate();  // tolua_export
[6777]139
[7009]140  };  // tolua_export
[6776]141
142
[7009]143}  // tolua_export
[6776]144
145
146#endif /*_ChatInputHandler_H__*/
Note: See TracBrowser for help on using the repository browser.