File: EventDisplayer.h

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (46 lines) | stat: -rw-r--r-- 1,208 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba
 *
 * See the LICENSE file for terms of use.
 */
#ifndef EVENTDISPLAYER_H_
#define EVENTDISPLAYER_H_

#include <Wt/WContainerWidget>
#include <Wt/WSignalMapper>

namespace Wt {
  class WText;
}

class EventDisplayer: public Wt::WContainerWidget
{
public:
  EventDisplayer(WContainerWidget *parent);

  // connects the invocation of the given signal to the display of the
  // string
  void mapConnect(Wt::SignalBase &signal, const std::string& data);
  // connects the invocation of the given signal to the display of the
  // given string, concatenated with the WText parameter of the signal.
  void mapConnectWString(Wt::Signal<Wt::WString> &signal,
			 const std::string& data);

  // Print a message on the displayer
  void setStatus(const Wt::WString &msg);

private:
  Wt::WString lastEventStr_;
  int eventCount_;
  Wt::WText *text_;

  Wt::WSignalMapper<std::string> *map_;
  Wt::WSignalMapper<std::string, Wt::WString> *mapWString_;
  void showSignal(const std::string& str);
  void showWStringSignal(const std::string& str, const Wt::WString& wstr);

  void showEvent(const Wt::WString& str);
};

#endif