Back to index

im-sdk  12.3.91
IIIMPInputContext.cpp
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 #include "IIIMPClient.hh"
00043 #include "IIIMPInputContext.hh"
00044 #include "IMProtocolStructP.hh"
00045 
00046 IIIMPInputContext::IIIMPInputContext(IIIMPClient *cl) {
00047   client = cl;
00048   ic_state = is_being_created;
00049 }
00050 
00051 IIIMPInputContext::~IIIMPInputContext() {
00052 }
00053 
00054 void
00055 IIIMPInputContext::realize() {
00056   ic_state = is_realized;
00057 }
00058 
00059 void
00060 IIIMPInputContext::unrealize() {
00061   ic_state = is_destroyed;
00062 }
00063 
00064 const CompoundString&
00065 IIIMPInputContext::getUser() const {return client->getUser();}
00066 
00067 const CompoundString&
00068 IIIMPInputContext::getApplicationName() const {
00069   return client->getApplicationName();
00070 }
00071 
00072 const CompoundString&
00073 IIIMPInputContext::getOSName() const {
00074   return client->getOSName();
00075 }
00076 
00077 const CompoundString&
00078 IIIMPInputContext::getOSArch() const {
00079   return client->getOSArch();
00080 }
00081 
00082 const CompoundString&
00083 IIIMPInputContext::getOSVersion() const {
00084   return client->getOSVersion();
00085 }
00086 
00087 const CompoundString&
00088 IIIMPInputContext::getXDisplayString() const {
00089   return client->getXDisplayString();
00090 }
00091 
00092 const CompoundString&
00093 IIIMPInputContext::getXServerVendor() const {
00094   return client->getXServerVendor();
00095 }
00096 
00097 const CompoundString&
00098 IIIMPInputContext::getLocaleName() const {return localename;}
00099 
00100 const CompoundString&
00101 IIIMPInputContext::getEngineName() const {return enginename;}
00102 
00103 void
00104 IIIMPInputContext::setLocaleName(char *name) {
00105   localename = name;
00106 }
00107 
00108 void
00109 IIIMPInputContext::setEngineName(char *name) {
00110   enginename = name;
00111 }
00112 
00113 int
00114 IIIMPInputContext::commit_string(IMText *text) {
00115   IMCommitCBStruct call_data;
00116   call_data.icid = client->getICID(this);
00117   call_data.text = text;
00118   if (!is_active()) return 1;
00119   return client->commit_string(&call_data);
00120 }
00121 
00122 int
00123 IIIMPInputContext::forward_event(IMKeyEventStruct *event) {
00124   IMForwardEventCBStruct call_data;
00125   call_data.icid = client->getICID(this);
00126   call_data.event = event;
00127   if (!is_active()) return 1;
00128   return client->forward_event(&call_data);
00129 }
00130 
00131 int
00132 IIIMPInputContext::preedit_start(IMPreeditStruct *preedit) {
00133   IMPreeditCBStruct call_data;
00134   call_data.icid = client->getICID(this);
00135   call_data.preedit = preedit;
00136   if (!is_active()) return 1;
00137   return client->preedit_start(&call_data);
00138 }
00139 int
00140 IIIMPInputContext::preedit_draw(IMPreeditStruct *preedit) {
00141   IMPreeditCBStruct call_data;
00142   call_data.icid = client->getICID(this);
00143   call_data.preedit = preedit;
00144   if (!is_active()) return 1;
00145   return client->preedit_draw(&call_data);
00146 }
00147 int
00148 IIIMPInputContext::preedit_caret(IMPreeditStruct *preedit) {
00149   IMPreeditCBStruct call_data;
00150   call_data.icid = client->getICID(this);
00151   call_data.preedit = preedit;
00152   if (!is_active()) return 1;
00153   return client->preedit_caret(&call_data);
00154 }
00155 int
00156 IIIMPInputContext::preedit_done(IMPreeditStruct *preedit) {
00157   IMPreeditCBStruct call_data;
00158   call_data.icid = client->getICID(this);
00159   call_data.preedit = preedit;
00160   if (!is_active()) return 1;
00161   return client->preedit_done(&call_data);
00162 }
00163 int
00164 IIIMPInputContext::status_start(IMStatusStruct *status) {
00165   IMStatusCBStruct call_data;
00166   call_data.icid = client->getICID(this);
00167   call_data.status = status;
00168   if (!is_active()) return 1;
00169   return client->status_start(&call_data);
00170 }
00171 int
00172 IIIMPInputContext::status_draw(IMStatusStruct *status) {
00173   IMStatusCBStruct call_data;
00174   call_data.icid = client->getICID(this);
00175   call_data.status = status;
00176   if (!is_active()) return 1;
00177   return client->status_draw(&call_data);
00178 }
00179 int
00180 IIIMPInputContext::status_done(IMStatusStruct *status) {
00181   IMStatusCBStruct call_data;
00182   call_data.icid = client->getICID(this);
00183   call_data.status = status;
00184   if (!is_active()) return 1;
00185   return client->status_done(&call_data);
00186 }
00187 int
00188 IIIMPInputContext::lookup_start(IMLookupStruct *lookup) {
00189   IMLookupCBStruct call_data;
00190   call_data.icid = client->getICID(this);
00191   call_data.lookup = lookup;
00192   if (!is_active()) return 1;
00193   return client->lookup_start(&call_data);
00194 }
00195 int
00196 IIIMPInputContext::lookup_draw(IMLookupStruct *lookup) {
00197   IMLookupCBStruct call_data;
00198   call_data.icid = client->getICID(this);
00199   call_data.lookup = lookup;
00200   if (!is_active()) return 1;
00201   return client->lookup_draw(&call_data);
00202 }
00203 int
00204 IIIMPInputContext::lookup_process(IMLookupStruct *lookup) {
00205   IMLookupCBStruct call_data;
00206   call_data.icid = client->getICID(this);
00207   call_data.lookup = lookup;
00208   if (!is_active()) return 1;
00209   return client->lookup_process(&call_data);
00210 }
00211 int
00212 IIIMPInputContext::lookup_done(IMLookupStruct *lookup) {
00213   IMLookupCBStruct call_data;
00214   call_data.icid = client->getICID(this);
00215   call_data.lookup = lookup;
00216   if (!is_active()) return 1;
00217   return client->lookup_done(&call_data);
00218 }
00219 
00220 int
00221 IIIMPInputContext::auxiliary_start(IMAuxStruct *auxiliary) {
00222   IMAuxCBStruct call_data;
00223   call_data.icid = client->getICID(this);
00224   call_data.aux = auxiliary;
00225   if (!is_active()) return 1;
00226   return client->auxiliary_start(&call_data);
00227 }
00228 int
00229 IIIMPInputContext::auxiliary_draw(IMAuxStruct *auxiliary) {
00230   IMAuxCBStruct call_data;
00231   call_data.icid = client->getICID(this);
00232   call_data.aux = auxiliary;
00233   if (!is_active()) return 1;
00234   return client->auxiliary_draw(&call_data);
00235 }
00236 int
00237 IIIMPInputContext::auxiliary_done(IMAuxStruct *auxiliary) {
00238   IMAuxCBStruct call_data;
00239   call_data.icid = client->getICID(this);
00240   call_data.aux = auxiliary;
00241   if (!is_active()) return 1;
00242   return client->auxiliary_done(&call_data);
00243 }
00244 
00245 int
00246 IIIMPInputContext::conversion_start() {
00247   IMConvStateCBStruct call_data;
00248   call_data.icid = client->getICID(this);
00249   call_data.conv_state = 0;
00250   if (!is_active()) return 1;
00251   return client->conversion_start(&call_data);
00252 }
00253 int
00254 IIIMPInputContext::conversion_end() {
00255   IMConvStateCBStruct call_data;
00256   call_data.icid = client->getICID(this);
00257   call_data.conv_state = 1;
00258   if (!is_active()) return 1;
00259   return client->conversion_end(&call_data);
00260 }