Back to index

im-sdk  12.3.91
Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
IIIMLineEdit Class Reference

#include <IIIMLineEdit.hh>

Collaboration diagram for IIIMLineEdit:
Collaboration graph
[legend]

List of all members.

Signals

void ref_changed ()

Public Member Functions

 IIIMLineEdit (IIIMCF_handle iiimcfhandle, QWidget *parent=0, const char *name=0)
 ~IIIMLineEdit ()

Protected Member Functions

void keyPressEvent (QKeyEvent *e)

Private Member Functions

IIIMCF_language get_language (const char *id)
IIIMPreeditWidgetget_preedit ()
IIIMStatusWidgetget_status ()
IIIMLookupChoiceWidgetget_lookup_choice ()
IIIMCF_context get_context ()
void toggle_im (IIIMCF_context c, bool flag)
void commit_string ()
void deal_with_iiimcf_event ()
void update_UI ()
void resizeEvent (QResizeEvent *pre)
void moveEvent (QMoveEvent *pme)

Private Attributes

int iiimcf_flag
IIIMCF_handle handle
IIIMCF_context ctx
IIIMPreeditWidgetppw
IIIMStatusWidgetpsw
IIIMLookupChoiceWidgetplw

Detailed Description

Definition at line 9 of file IIIMLineEdit.hh.


Constructor & Destructor Documentation

IIIMLineEdit::IIIMLineEdit ( IIIMCF_handle  iiimcfhandle,
QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 232 of file IIIMLineEdit.cpp.

    : QLineEdit(parent, name)
{
    handle = h;
    QString text = QString::fromUtf8("漢字");
    setText(text);
    ppw = NULL;
    psw = NULL;
    plw = NULL;
    iiimcf_flag = 0;
}

Definition at line 248 of file IIIMLineEdit.cpp.

{
    if (ppw) delete ppw;
    if (psw) delete psw;
    if (plw) delete plw;
    if (iiimcf_flag) iiimcf_destroy_context(ctx);
}

Here is the call graph for this function:


Member Function Documentation

void IIIMLineEdit::commit_string ( ) [private]

Definition at line 132 of file IIIMLineEdit.cpp.

{
    IIIMF_status st;
    const IIIMP_card16 *pu16;
    IIIMCF_text text;
    
    st = iiimcf_get_committed_text(get_context(), &text);
    if (st != IIIMF_STATUS_SUCCESS) return;
    st = iiimcf_get_text_utf16string(text, &pu16);
    if (st != IIIMF_STATUS_SUCCESS) return;
    QString str = QString::fromUcs2(pu16);
    insert(str);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 147 of file IIIMLineEdit.cpp.

{
    IIIMF_status st;
    IIIMCF_event ev;
    IIIMCF_event_type et;

    while ((st = iiimcf_get_next_event(get_context(), &ev))
          == IIIMF_STATUS_SUCCESS) {
       if (iiimcf_get_event_type(ev, &et) == IIIMF_STATUS_SUCCESS) {
           if (et == IIIMCF_EVENT_TYPE_KEYEVENT) {
              IIIMCF_keyevent kev;
              QKeyEvent *pqe;

              if (iiimcf_get_keyevent_value(ev, &kev)
                  != IIIMF_STATUS_SUCCESS)
                  continue;
              if (convert_IIIMCF_keyevent_to_QKeyEvent(&kev, 1, &pqe)
                  != IIIMF_STATUS_SUCCESS)
                  continue;
              QLineEdit::keyPressEvent(pqe);
              delete pqe;
              if (convert_IIIMCF_keyevent_to_QKeyEvent(&kev, 0, &pqe)
                  != IIIMF_STATUS_SUCCESS)
                  continue;
              QLineEdit::keyReleaseEvent(pqe);
              delete pqe;
           }
       }
       iiimcf_ignore_event(ev);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 102 of file IIIMLineEdit.cpp.

{
    if (!iiimcf_flag) {
       IIIMF_status st;
       IIIMCF_language lang;
       IIIMCF_attr attr = IIIMCF_ATTR_NULL;

       ctx = NULL;
       lang = get_language("ja");
       if (lang) {
           if (iiimcf_create_attr(&attr) != IIIMF_STATUS_SUCCESS) return ctx;
           if (iiimcf_attr_put_ptr_value(attr, IIIMCF_ATTR_INPUT_LANGUAGE, lang)
              != IIIMF_STATUS_SUCCESS) return ctx;
           st = iiimcf_create_context(handle, attr, &ctx);
           iiimcf_destroy_attr(attr);
       } else {
           st = iiimcf_create_context(handle, IIIMCF_ATTR_NULL, &ctx);
       }

       if (st == IIIMF_STATUS_SUCCESS) {
           iiimcf_flag = 1;
           toggle_im(ctx, true);
       } else {
           ctx = NULL;
       }
    }
    return ctx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMCF_language IIIMLineEdit::get_language ( const char *  id) [private]

Definition at line 69 of file IIIMLineEdit.cpp.

{
    IIIMF_status st;
    IIIMCF_language *plangs;
    const char *id2;
    int i, n;
    st = iiimcf_get_supported_languages(handle, &n, &plangs) ;
    if (st != IIIMF_STATUS_SUCCESS) return NULL;
    for (i = 0; i < n; i++) {
       iiimcf_get_language_id(plangs[i], &id2);
       if (strcmp(id2, id) == 0) return plangs[i];
    }
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 52 of file IIIMLineEdit.cpp.

{
    if (plw) return plw;

#if 1
    plw = new IIIMLookupChoiceWidget(get_context(), NULL, NULL,
                                 Qt::WStyle_Customize
                                 | Qt::WX11BypassWM
    );
#else
    plw = new IIIMLookupChoiceWidget(get_context(), NULL, NULL);
#endif

    return plw;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 8 of file IIIMLineEdit.cpp.

{
    if (ppw) return ppw;
    ppw = new IIIMPreeditWidget(get_context(), this);
    return ppw;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 16 of file IIIMLineEdit.cpp.

{
    if (psw) return psw;

    psw = new IIIMStatusWidget(get_context(),
                            NULL, NULL,
                            Qt::WStyle_Customize
                            | Qt::WStyle_NoBorder
                            | Qt::WX11BypassWM
                            | Qt::WStyle_StaysOnTop);
    psw->place(this, IIIMStatusWidget::BOTTOM_RIGHT);
    connect(this, SIGNAL(ref_changed()), psw, SLOT(ref_change()));
    return psw;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMLineEdit::keyPressEvent ( QKeyEvent *  e) [protected]

Definition at line 210 of file IIIMLineEdit.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMLineEdit::moveEvent ( QMoveEvent *  pme) [private]

Definition at line 42 of file IIIMLineEdit.cpp.

{
    emit ref_changed();
    QLineEdit::moveEvent(pme);
    return;
}

Here is the call graph for this function:

void IIIMLineEdit::ref_changed ( ) [signal]

Here is the caller graph for this function:

void IIIMLineEdit::resizeEvent ( QResizeEvent *  pre) [private]

Definition at line 32 of file IIIMLineEdit.cpp.

{
    emit ref_changed();
    QLineEdit::resizeEvent(pre);
    return;
}

Here is the call graph for this function:

void IIIMLineEdit::toggle_im ( IIIMCF_context  c,
bool  flag 
) [private]

Definition at line 87 of file IIIMLineEdit.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMLineEdit::update_UI ( ) [private]

Definition at line 180 of file IIIMLineEdit.cpp.

{
    int flag;
    if (iiimcf_is_UIstate_changed(get_context(), &flag)
       != IIIMF_STATUS_SUCCESS)
       return;

    if (flag & IIIMCF_STATE_PREEDIT_CHANGED) {
       int w;
       QRect cr = contentsRect();
       QFontMetrics fm = fontMetrics();

       w = fm.width(displayText().left(cursorPosition()));
       cr.setWidth(w);
       get_preedit()->move(cr.topRight());
       get_preedit()->update_im();
    }
    if (flag & IIIMCF_STATE_STATUS_CHANGED) {
       get_status()->update_im();
    }
    if (flag & IIIMCF_STATE_LOOKUP_CHOICE_CHANGED) {
       get_lookup_choice()->update_im();
    }
    if (flag & IIIMCF_STATE_COMMIT_REQUIRED) {
       commit_string();
    }
    deal_with_iiimcf_event();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 15 of file IIIMLineEdit.hh.

Definition at line 14 of file IIIMLineEdit.hh.

Definition at line 11 of file IIIMLineEdit.hh.

Definition at line 18 of file IIIMLineEdit.hh.

Definition at line 16 of file IIIMLineEdit.hh.

Definition at line 17 of file IIIMLineEdit.hh.


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