Back to index

im-sdk  12.3.91
Public Member Functions | Private Attributes
IIIMQCFLookup Class Reference

#include <lookup.h>

List of all members.

Public Member Functions

 IIIMQCFLookup (QWidget *w, IIIMInputContext *ic)
virtual ~IIIMQCFLookup ()
void showLookupWindow (QWidget *w)
void hideLookupWindow (void)
void setLookupChoices (QStringList &lc, int size, int first_index, int last_index, int current_index)
void clearLookupChoices (void)
void setLookupTitle (QString)
void layoutWindow (int x, int y, int w, int h)
QPoint forceInside (const QRect &enclosure, const QRect &prisoner)
bool isVisible () const
void updateLabel (QString)
void adjustLookupWindowSize ()

Private Attributes

QVBox * vbox
QListBox * lw
QLabel * numLabel
int nrCandidates
int candidateIndex
int pageIndex
IIIMInputContext * iiimqc

Detailed Description

Definition at line 46 of file lookup.h.


Constructor & Destructor Documentation

IIIMQCFLookup::IIIMQCFLookup ( QWidget *  w,
IIIMInputContext *  ic 
)

Definition at line 53 of file lookup.cpp.

{
  iiimqc = ic;
  vbox = new QVBox(w, 0, candidateFlag); 

  numLabel = new QLabel(vbox, "candidateLabel");
  lw = new QListBox (vbox, "candidateListBox");
  lw->setVScrollBarMode(QScrollView::AlwaysOff);
  lw->setHScrollBarMode(QScrollView::AlwaysOff);
  lw->setFocusPolicy (QWidget::NoFocus);
  
}

Definition at line 69 of file lookup.cpp.

{
  if(vbox)
        delete vbox;
}

Member Function Documentation

Definition at line 170 of file lookup.cpp.

{
    DEBUG_DO(qDebug("**IIIMQCF: adjustCandidateWindowSize()"));

    int width  = 0;
    int height = 0;
    QListBoxItem *item =lw->item(0);
    if (item)
        height = item->height(lw) * (lw->count() + 1);

    unsigned int maxCharIndex = 0, maxCharCount = 0;
    for (int i = 0; i < lw->count(); i++) {
        if (maxCharCount < lw->item(i)->text().length()) {
            maxCharIndex = i;
           maxCharCount = lw->item(i)->text().length();
        }
    }

    QFontMetrics fm(lw->font());
    if(lw->item(maxCharIndex))
           width  = fm.width(lw->item(maxCharIndex)->text() + "   " + lw->item(maxCharIndex)->text());

    if (width < MIN_CAND_WIDTH)
        width = MIN_CAND_WIDTH;

    vbox->resize(width, height);
}

Here is the caller graph for this function:

Definition at line 121 of file lookup.cpp.

{
  lw->clear ();
}

Here is the caller graph for this function:

QPoint IIIMQCFLookup::forceInside ( const QRect &  enclosure,
const QRect &  prisoner 
)

Definition at line 150 of file lookup.cpp.

{
    int new_x, new_y;

    new_x = QMIN(enclosure.right(), prisoner.right()) - prisoner.width() + 1;
    new_x = QMAX(enclosure.left(), new_x);
    new_y = QMIN(enclosure.bottom(), prisoner.bottom()) - prisoner.height() + 1;
    new_y = QMAX(enclosure.top(), new_y);

    return QPoint(new_x, new_y);
}

Here is the caller graph for this function:

Definition at line 91 of file lookup.cpp.

{
 vbox->hide();
}
bool IIIMQCFLookup::isVisible ( ) const

Definition at line 128 of file lookup.cpp.

{
  return lw->isVisible ();
}
void IIIMQCFLookup::layoutWindow ( int  x,
int  y,
int  w,
int  h 
)

Definition at line 135 of file lookup.cpp.

{
    DEBUG_DO(qDebug("**IIIMQCF: layoutWindow: x is %d, y is %d, w is %d, h is %d\n", x, y, w, h));
    QRect focusRect  = QRect(QPoint(x, y + h), vbox->frameSize());

    QRect screenRect = QRect(0, 0,
                             QApplication::desktop()->screenGeometry().width(),
                             QApplication::desktop()->screenGeometry().height());

    QPoint p = forceInside(screenRect, focusRect);
    vbox->move(p);

}

Here is the call graph for this function:

void IIIMQCFLookup::setLookupChoices ( QStringList &  lc,
int  size,
int  first_index,
int  last_index,
int  current_index 
)

Definition at line 99 of file lookup.cpp.

{
  clearLookupChoices ();
  lw->insertStringList (lc);
  lw->setCurrentItem (current_index);
  adjustLookupWindowSize();
}

Here is the call graph for this function:

void IIIMQCFLookup::setLookupTitle ( QString  title)

Definition at line 114 of file lookup.cpp.

{
  updateLabel(title);
}

Here is the call graph for this function:

void IIIMQCFLookup::showLookupWindow ( QWidget *  w)

Definition at line 78 of file lookup.cpp.

{
  if (lw->count() > 0)
  {
     vbox->raise();
     vbox->show();
   }
  DEBUG_DO(qDebug("**IIIMQCF: showLookupWindow() after setFocus\n"));
}
void IIIMQCFLookup::updateLabel ( QString  title)

Definition at line 163 of file lookup.cpp.

{
    numLabel->setText(title);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 71 of file lookup.h.

IIIMInputContext* IIIMQCFLookup::iiimqc [private]

Definition at line 74 of file lookup.h.

QListBox* IIIMQCFLookup::lw [private]

Definition at line 68 of file lookup.h.

Definition at line 70 of file lookup.h.

QLabel* IIIMQCFLookup::numLabel [private]

Definition at line 69 of file lookup.h.

int IIIMQCFLookup::pageIndex [private]

Definition at line 72 of file lookup.h.

QVBox* IIIMQCFLookup::vbox [private]

Definition at line 67 of file lookup.h.


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