Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
nsIMEBeOS Class Reference

#include <nsWindow.h>

Collaboration diagram for nsIMEBeOS:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsIMEBeOS ()
void RunIME (uint32 *args, nsWindow *owner, BView *view)
void DispatchText (nsString &text, PRUint32 txtCount, nsTextRange *txtRuns)
void DispatchIME (PRUint32 what)
void DispatchCancelIME ()
PRBool DispatchWindowEvent (nsGUIEvent *event)

Static Public Member Functions

static nsIMEBeOSGetIME ()

Private Attributes

nsWindowimeTarget
BMessenger imeMessenger
nsString imeText
BPoint imeCaret
PRUint32 imeState
PRUint32 imeWidth
PRUint32 imeHeight

Static Private Attributes

static nsIMEBeOSbeosIME = 0

Detailed Description

Definition at line 340 of file nsWindow.h.


Constructor & Destructor Documentation

Definition at line 117 of file nsWindow.cpp.

Here is the caller graph for this function:


Member Function Documentation

Definition at line 229 of file nsWindow.cpp.

{
       if (imeText.Length() && imeState != NS_COMPOSITION_END) 
       {
              BMessage reply(B_INPUT_METHOD_EVENT);
              reply.AddInt32("be:opcode", B_INPUT_METHOD_STOPPED);
              imeMessenger.SendMessage(&reply);

              DispatchText(imeText, 0, NULL);
              DispatchIME(NS_COMPOSITION_END);

              imeText.Truncate();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 244 of file nsWindow.cpp.

{
       nsCompositionEvent compEvent(PR_TRUE, what, imeTarget);

       compEvent.refPoint.x =
       compEvent.refPoint.y = 0;
       compEvent.time        = 0;

       DispatchWindowEvent(&compEvent);
       imeState = what;

       if (what == NS_COMPOSITION_QUERY) 
       {
              imeCaret.Set(compEvent.theReply.mCursorPosition.x,
                         compEvent.theReply.mCursorPosition.y);
              imeHeight = compEvent.theReply.mCursorPosition.height+4;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMEBeOS::DispatchText ( nsString text,
PRUint32  txtCount,
nsTextRange txtRuns 
)

Definition at line 208 of file nsWindow.cpp.

{
       nsTextEvent textEvent(PR_TRUE,NS_TEXT_TEXT, imeTarget);

       textEvent.time              = 0;
       textEvent.isShift   = 
       textEvent.isControl =
       textEvent.isAlt      = 
       textEvent.isMeta     = PR_FALSE;
  
       textEvent.refPoint.x = 
       textEvent.refPoint.y = 0;

       textEvent.theText    = text.get();
       textEvent.isChar     = PR_TRUE;
       textEvent.rangeCount= txtCount;
       textEvent.rangeArray= txtRuns;

       DispatchWindowEvent(&textEvent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 263 of file nsWindow.cpp.

{
       nsEventStatus status;
       imeTarget->DispatchEvent(event, status);
       return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMEBeOS * nsIMEBeOS::GetIME ( ) [static]

Definition at line 270 of file nsWindow.cpp.

{
       if(beosIME == 0)
              beosIME = new nsIMEBeOS();
       return beosIME;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMEBeOS::RunIME ( uint32 args,
nsWindow owner,
BView *  view 
)

Definition at line 127 of file nsWindow.cpp.

{
       BMessage msg;
       msg.Unflatten((const char*)args);

       switch (msg.FindInt32("be:opcode")) 
       {
       case B_INPUT_METHOD_CHANGED:
              if (msg.HasString("be:string")) 
              {
                     const char* src = msg.FindString("be:string");
                     CopyUTF8toUTF16(src, imeText);
 
              if (msg.FindBool("be:confirmed")) 
              {      
                     if (imeState != NS_COMPOSITION_END)
                                   DispatchText(imeText, 0, NULL);
                     }
                     else 
                     {
                            nsTextRange txtRuns[2];
                            PRUint32 txtCount = 2;

                     int32 select[2];
                            select[0] = msg.FindInt32("be:selection", int32(0));
                            select[1] = msg.FindInt32("be:selection", 1);

                            txtRuns[0].mStartOffset = (select[0] == select[1]) ? 0 : utf8_str_len(src, select[1]);
                            txtRuns[0].mEndOffset       = imeText.Length();
                            txtRuns[0].mRangeType       = NS_TEXTRANGE_CONVERTEDTEXT;
                            if (select[0] == select[1])
                                   txtCount = 1;
                            else 
                            {
                                   txtRuns[1].mStartOffset = utf8_str_len(src, select[0]);
                                   txtRuns[1].mEndOffset       = utf8_str_len(src, select[1]);
                                   txtRuns[1].mRangeType       = NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
                            }
                            imeTarget = target;
                            DispatchText(imeText, txtCount, txtRuns);
                     }      
              }      
              break;

       case B_INPUT_METHOD_LOCATION_REQUEST:
              if (fView && fView->LockLooper()) 
              {
                     BPoint caret(imeCaret);
                     DispatchIME(NS_COMPOSITION_QUERY);
                     if (caret.x > imeCaret.x) 
                            caret.x = imeCaret.x - imeWidth * imeText.Length();     /* back */

                     BMessage reply(B_INPUT_METHOD_EVENT);
                     reply.AddInt32("be:opcode", B_INPUT_METHOD_LOCATION_REQUEST);
                     for (int32 s= 0; imeText[s]; s++) 
                     { 
                            reply.AddPoint("be:location_reply", fView->ConvertToScreen(caret));
                            reply.AddFloat("be:height_reply", imeHeight);
                            caret.x += imeWidth;
                     }
                     imeMessenger.SendMessage(&reply);
                     fView->UnlockLooper();
              }
              break;

       case B_INPUT_METHOD_STARTED:
              imeTarget = target;
              DispatchIME(NS_COMPOSITION_START);
              DispatchIME(NS_COMPOSITION_QUERY);

              msg.FindMessenger("be:reply_to", &imeMessenger);
              break;
       
       case B_INPUT_METHOD_STOPPED:
              if (imeState != NS_COMPOSITION_END)
                     DispatchIME(NS_COMPOSITION_END);
              imeText.Truncate();
              break;
       };
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

nsIMEBeOS * nsIMEBeOS::beosIME = 0 [static, private]

Definition at line 359 of file nsWindow.h.

BPoint nsIMEBeOS::imeCaret [private]

Definition at line 357 of file nsWindow.h.

Definition at line 358 of file nsWindow.h.

BMessenger nsIMEBeOS::imeMessenger [private]

Definition at line 355 of file nsWindow.h.

Definition at line 358 of file nsWindow.h.

Definition at line 354 of file nsWindow.h.

Definition at line 356 of file nsWindow.h.

Definition at line 358 of file nsWindow.h.


The documentation for this class was generated from the following files: