File: simpleChat_8C-source.html

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 (84 lines) | stat: -rw-r--r-- 11,454 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/simplechat/simpleChat.C Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<h1>/home/koen/project/wt/public-git/wt/examples/simplechat/simpleChat.C</h1><a href="simpleChat_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * See the LICENSE file for terms of use.</span>
<a name="l00005"></a>00005 <span class="comment"> */</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;Wt/WApplication&gt;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;Wt/WContainerWidget&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;Wt/WPushButton&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;Wt/WText&gt;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="SimpleChatServer_8h.html">SimpleChatServer.h</a>"</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="SimpleChatWidget_8h.html">SimpleChatWidget.h</a>"</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="keyword">using namespace </span>Wt;
<a name="l00016"></a>00016 
<a name="l00021"></a>00021 
<a name="l00024"></a><a class="code" href="group__chatexample.html#g7406b76fb4dd4a62fc4e9fcde0a88f94">00024</a> <a class="code" href="classSimpleChatServer.html" title="A simple chat server.">SimpleChatServer</a> <a class="code" href="group__chatexample.html#g7406b76fb4dd4a62fc4e9fcde0a88f94" title="The single chat server instance.">theServer</a>;
<a name="l00025"></a>00025 
<a name="l00028"></a><a class="code" href="classChatApplication.html">00028</a> <span class="keyword">class </span><a class="code" href="classChatApplication.html" title="A chat demo application.">ChatApplication</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 <span class="keyword">public</span>:
<a name="l00033"></a>00033   <a class="code" href="group__chatexample.html#ge1537d19ec87de98d5e4b81513dfd1c8" title="Create a new instance.">ChatApplication</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a>&amp; env);
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keyword">private</span>:
<a name="l00038"></a>00038   <span class="keywordtype">void</span> <a class="code" href="group__chatexample.html#g5dac9dfcc18f0d42adb57760b1da24d9" title="Add another chat client.">addChatWidget</a>();
<a name="l00039"></a>00039 };
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="group__chatexample.html#ge1537d19ec87de98d5e4b81513dfd1c8">00041</a> <a class="code" href="group__chatexample.html#ge1537d19ec87de98d5e4b81513dfd1c8" title="Create a new instance.">ChatApplication::ChatApplication</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a>&amp; env)
<a name="l00042"></a>00042   : <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>(env)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#71a3f7da5abb9a76df94fab69ba61670">setTitle</a>(<span class="stringliteral">"Wt Chat"</span>);
<a name="l00045"></a>00045   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#f377d541443b4bcea5fcc40be7c70173">useStyleSheet</a>(<span class="stringliteral">"simplechat.css"</span>);
<a name="l00046"></a>00046   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#5386565e35a58c94ccbbfab48f2212a4">messageResourceBundle</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WMessageResourceBundle.html#01368946b2a2aaceab3a64cddb1cb1e2">use</a>(<span class="stringliteral">"simplechat"</span>);
<a name="l00047"></a>00047 
<a name="l00048"></a>00048   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#17e118a04d962459484a12989a80bc05">root</a>()-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a>(WString::tr(<span class="stringliteral">"introduction"</span>)));
<a name="l00049"></a>00049 
<a name="l00050"></a>00050   <a class="code" href="classSimpleChatWidget.html" title="A self-contained chat widget.">SimpleChatWidget</a> *chatWidget = <span class="keyword">new</span> <a class="code" href="classSimpleChatWidget.html" title="A self-contained chat widget.">SimpleChatWidget</a>(theServer, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#17e118a04d962459484a12989a80bc05">root</a>());
<a name="l00051"></a>00051   chatWidget-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#6fd43dced1a62f7e79bc3522eeb16216">setStyleClass</a>(<span class="stringliteral">"chat"</span>);
<a name="l00052"></a>00052 
<a name="l00053"></a>00053   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#17e118a04d962459484a12989a80bc05">root</a>()-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a>(WString::tr(<span class="stringliteral">"details"</span>)));
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a> *b = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a>(<span class="stringliteral">"I'm schizophrenic ..."</span>, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#17e118a04d962459484a12989a80bc05">root</a>());
<a name="l00056"></a>00056   b-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(b, WPushButton::hide));
<a name="l00057"></a>00057   b-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(<span class="keyword">this</span>, <a class="code" href="group__chatexample.html#g5dac9dfcc18f0d42adb57760b1da24d9" title="Add another chat client.">ChatApplication::addChatWidget</a>));
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00060"></a><a class="code" href="group__chatexample.html#g5dac9dfcc18f0d42adb57760b1da24d9">00060</a> <span class="keywordtype">void</span> <a class="code" href="group__chatexample.html#g5dac9dfcc18f0d42adb57760b1da24d9" title="Add another chat client.">ChatApplication::addChatWidget</a>()
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062   <a class="code" href="classSimpleChatWidget.html" title="A self-contained chat widget.">SimpleChatWidget</a> *chatWidget2 = <span class="keyword">new</span> <a class="code" href="classSimpleChatWidget.html" title="A self-contained chat widget.">SimpleChatWidget</a>(theServer, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#17e118a04d962459484a12989a80bc05">root</a>());
<a name="l00063"></a>00063   chatWidget2-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#6fd43dced1a62f7e79bc3522eeb16216">setStyleClass</a>(<span class="stringliteral">"chat"</span>);
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="group__chatexample.html#gcb337c09cd35644b56da8b0e5bb17b9c">00066</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *<a class="code" href="ComposeExample_8C.html#cb337c09cd35644b56da8b0e5bb17b9c">createApplication</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a>&amp; env)
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="group__chatexample.html#ge1537d19ec87de98d5e4b81513dfd1c8" title="Create a new instance.">ChatApplication</a>(env);
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 
<a name="l00071"></a><a class="code" href="group__chatexample.html#g3c04138a5bfe5d72780bb7e82a18e627">00071</a> <span class="keywordtype">int</span> <a class="code" href="ComposeExample_8C.html#3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073   <span class="keywordflow">return</span> WRun(argc, argv, &amp;<a class="code" href="ComposeExample_8C.html#cb337c09cd35644b56da8b0e5bb17b9c">createApplication</a>);
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>