Ejemplo n.º 1
0
BOOL SComboBox::actionPerformed( AMouseEvent *e )
{
  int repaint = FALSE;
  if( (e->getEvent() == AMouseEvent::DOWN ||
       e->getEvent() == AMouseEvent::DOUBLECLICK/* ||
       e->getEvent() == AMouseEvent::CLICK*/) && !down &&
       (e->getPos()->x >= width - buttonWidth || readOnly) )
  {
    if( listVisible )
    {
      buttonUp = TRUE;
      listBox->setVisible( FALSE );
      listVisible = FALSE;
      setFocus();
    }
    else
    {
      placeListBox();
      buttonUp = FALSE;
      listBox->setVisible( TRUE );
      listBox->setOnTop();
      listBox->setFocus();
      listVisible = TRUE;
    }
    repaint = TRUE;
    down = TRUE;
  }

  if( e->getEvent() == AMouseEvent::RELEASE )
    down = FALSE;

  if( repaint ) repaintButton();
  return FALSE;
}
Ejemplo n.º 2
0
void QCompletionEdit::textDidChange( const QString &text )
{
    if ( text.isEmpty() ) {
	popup->close();
	return;
    }
    updateListBox();
    placeListBox();
}
Ejemplo n.º 3
0
void SComboBox::size( int oldWidth, int oldHeight )
{
  entryField->setPos( 2, 2 );
  entryField->setSize( width-4 - buttonWidth - 1, getEditBoxHeight()-4 );

  // Need to resize listbox, since the dialog can't handle that
//  listHeight = (orgListHeight * height) / orgHeight;
  listBox->setSize( width, listHeight );
  //listBox->setPos( x, y-listHeight );
  //listBox->setOnTop();
  placeListBox();
}
Ejemplo n.º 4
0
SComboBox::SComboBox( Window *parent, int properties, int x, int y,
          int width, int height, int listHeight ) :
  Window( parent, xlatProperties( properties|FILTERDIALOGARROWS|PASSDIALOGKEYS ), x, y, width, height + listHeight )
{
  buttonUp = TRUE;
  orgHeight = height;
  orgListHeight = this->listHeight = listHeight;
  listVisible = FALSE;
  down = FALSE;
  maxLength = 80;

  type = COMBOBOX;

  // Create the editcontrol

  entryField = new EntryField( this, (properties ^ ISTABSTOP) | PASSDIALOGKEYS, 2, 2,
                               width-4 - buttonWidth - 1, height-4 );
  entryField->setVisible( TRUE );
  entryField->setOnTop();

  setReadOnly( (properties & STATIC) == STATIC );

  addMouseListener( this  );
  entryField->addKeyListener( this  );
//  entryField->addMouseListener( this );

  // Create listbox
  listBox = new ComboListBox( this, this, Window::NOADJUSTSIZE, x, y-listHeight,
                         width, listHeight );
  listBox->addFocusListener( this );
  listBox->addSelectionListener( this );

  setSize( width, height + listHeight );

  placeListBox();

  parent->addControl( this );
}