summaryrefslogtreecommitdiffstats
path: root/doc/html/qimevent.html
blob: 779eca399a8a1923d7fc6a42d2f2695c740f0996 (plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qevent.cpp:1761 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQIMEvent Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQIMEvent Class Reference</h1>

<p>The TQIMEvent class provides parameters for input method events.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qevent-h.html">ntqevent.h</a>&gt;</tt>
<p>Inherits <a href="ntqevent.html">TQEvent</a>.
<p><a href="qimevent-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQIMEvent"><b>TQIMEvent</b></a> ( Type&nbsp;type, const&nbsp;TQString&nbsp;&amp;&nbsp;text, int&nbsp;cursorPosition )</li>
<li class=fn>const TQString &amp; <a href="#text"><b>text</b></a> () const</li>
<li class=fn>int <a href="#cursorPos"><b>cursorPos</b></a> () const</li>
<li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
<li class=fn>void <a href="#accept"><b>accept</b></a> ()</li>
<li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
<li class=fn>int <a href="#selectionLength"><b>selectionLength</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQIMEvent class provides parameters for input method events.
<p> 
<p> Input method events are sent to widgets when an input method is
used to enter text into a widget. Input methods are widely used to
enter text in Asian and other complex languages.
<p> The events are of interest to widgets that accept keyboard input
and want to be able to correctly handle complex languages. Text
input in such languages is usually a three step process.
<p> <ol type=1>
<li> <b>Starting to Compose</b><br>
When the user presses the first key on a keyboard an input context
is created. This input context will contain a string with the
typed characters.
<p> <li> <b>Composing</b><br>
With every new key pressed, the input method will try to create a
matching string for the text typed so far. While the input context
is active, the user can only move the cursor inside the string
belonging to this input context.
<p> <li> <b>Completing</b><br>
At some point, e.g. when the user presses the Spacebar, they get
to this stage, where they can choose from a number of strings that
match the text they have typed so far. The user can press Enter to
confirm their choice or Escape to cancel the input; in either case
the input context will be closed.
</ol>
<p> Note that the particular key presses used for a given input
context may differ from those we've mentioned here, i.e. they may
not be Spacebar, Enter and Escape.
<p> These three stages are represented by three different types of
events. The IMStartEvent, IMComposeEvent and IMEndEvent. When a
new input context is created, an IMStartEvent will be sent to the
widget and delivered to the <a href="tqwidget.html#imStartEvent">TQWidget::imStartEvent</a>() function.
The widget can then update internal data structures to reflect
this.
<p> After this, an IMComposeEvent will be sent to the widget for
every key the user presses. It will contain the current
composition string the widget has to show and the current cursor
position within the composition string. This string is temporary
and can change with every key the user types, so the widget will
need to store the state before the composition started (the state
it had when it received the IMStartEvent). IMComposeEvents will be
delivered to the <a href="tqwidget.html#imComposeEvent">TQWidget::imComposeEvent</a>() function.
<p> Usually, widgets try to mark the part of the text that is part of
the current composition in a way that is visible to the user. A
commonly used visual cue is to use a dotted underline.
<p> After the user has selected the final string, an IMEndEvent will
be sent to the widget. The event contains the final string the
user selected, and could be empty if they canceled the
composition. This string should be accepted as the final text the
user entered, and the intermediate composition string should be
cleared. These events are delivered to <a href="tqwidget.html#imEndEvent">TQWidget::imEndEvent</a>().
<p> If the user clicks another widget, taking the focus out of the
widget where the composition is taking place the IMEndEvent will
be sent and the string it holds will be the result of the
composition up to that point (which may be an empty string).
<p>See also <a href="events.html">Event Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQIMEvent"></a>TQIMEvent::TQIMEvent ( <a href="ntqevent.html#Type-enum">Type</a>&nbsp;type, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;text, int&nbsp;cursorPosition )
</h3>

<p> Constructs a new TQIMEvent with the accept flag set to FALSE. <em>type</em> can be one of TQEvent::IMStartEvent, TQEvent::IMComposeEvent
or TQEvent::IMEndEvent. <em>text</em> contains the current compostion
string and <em>cursorPosition</em> the current position of the cursor
inside <em>text</em>.

<h3 class=fn>void <a name="accept"></a>TQIMEvent::accept ()
</h3>

<p> Sets the accept flag of the input method event object.
<p> Setting the accept parameter indicates that the receiver of the
event processed the input method event.
<p> The accept flag is not set by default.
<p> <p>See also <a href="#ignore">ignore</a>().

<h3 class=fn>int <a name="cursorPos"></a>TQIMEvent::cursorPos () const
</h3>

<p> Returns the current cursor position inside the composition string.
Will return -1 for IMStartEvent and IMEndEvent.

<h3 class=fn>void <a name="ignore"></a>TQIMEvent::ignore ()
</h3>

<p> Clears the accept flag parameter of the input method event object.
<p> Clearing the accept parameter indicates that the event receiver
does not want the input method event.
<p> The accept flag is cleared by default.
<p> <p>See also <a href="#accept">accept</a>().

<h3 class=fn>bool <a name="isAccepted"></a>TQIMEvent::isAccepted () const
</h3>

<p> Returns TRUE if the receiver of the event processed the event;
otherwise returns FALSE.

<h3 class=fn>int <a name="selectionLength"></a>TQIMEvent::selectionLength () const
</h3>

<p> Returns the number of characters in the composition string (
starting at <a href="#cursorPos">cursorPos</a>() ) that should be marked as selected by the
input widget receiving the event.
Will return 0 for IMStartEvent and IMEndEvent.

<h3 class=fn>const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp; <a name="text"></a>TQIMEvent::text () const
</h3>

<p> Returns the composition text. This is a null string for an
IMStartEvent, and contains the final accepted string (which may be
empty) in the IMEndEvent.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>