예제 #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;
}
예제 #2
0
void ComboButton::insertItem( const KIcon &icon, const QString &text, int index )
{
    if( index == -1 ) index = m_box->count();
    m_box->insertItem( index, icon, text );
    if( text.count() > m_box->minimumContentsLength() ) m_box->setMinimumContentsLength( text.count() );
    repaintButton();
}
예제 #3
0
void SComboBox::actionPerformed( AFocusEvent *focusEvent )
{
  char text[255];
  int selected = ((ListBox *)focusEvent->getSource())->getSelectedItem( 255, text );

  listBox->setVisible( FALSE );
  listVisible = FALSE;
  buttonUp = TRUE;
  repaintButton();

  if( selected == -1 ) return;  // Nothing selected

	if( ((ListBox *)focusEvent->getSource())->hasFocus() ) setFocus();

  entryField->setText( text );
	//setFocus();
  performSelectionEvent( selected ); // chain
  //performFocusEvent( focusEvent->getFocused() ); // chain
}
예제 #4
0
void ComboButton::boxActivated( int index )
{
    repaintButton();
    emit clicked( index );
}