void TSSASlider::callbackControl(void)
{
  TSS_CSASlider const *aslider_struct = (TSS_CSASlider *)getControlStruct();

  if (aslider_struct->DynamicStatus.Movement == 1)
  {
    if (_callbacks[ASLIDER_MOVEMENT] != (fASliderCallback)NULL)
    {
      _callbacks[ASLIDER_MOVEMENT](this, ASLIDER_MOVEMENT, aslider_struct->Position);
    }
    onMovement(aslider_struct->Position);
  }
  else if (aslider_struct->Events.Touch != 0u)
  {
    if (_callbacks[ASLIDER_INITIAL_TOUCH] != (fASliderCallback)NULL)
    {
      _callbacks[ASLIDER_INITIAL_TOUCH](this, ASLIDER_INITIAL_TOUCH, aslider_struct->Position);
    }
    onInitialTouch(aslider_struct->Position);
  }
  else if (aslider_struct->Events.Touch == 0u)
  {
    if (_callbacks[ASLIDER_ALL_RELEASE] != (fASliderCallback)NULL)
    {
      _callbacks[ASLIDER_ALL_RELEASE](this, ASLIDER_ALL_RELEASE, 0);
    }
    onAllRelease(aslider_struct->Position);
  }
}
Beispiel #2
0
void NetToolBox::init()
{
    m_containment = containment();
    Q_ASSERT(m_containment);

    m_icon = KIcon("plasma");
    m_closeIcon = KIcon("dialog-close");
    m_iconSize = QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
    m_animHighlightFrame = 0;
    m_hovering = false;
    m_showing = false;
    m_location = Plasma::BottomEdge;
    m_newToolsPosition = 0;

    setZValue(9000);
    resize(KIconLoader::SizeMedium, KIconLoader::SizeMedium);
    setAcceptHoverEvents(true);

    m_toolContainer = new ToolContainer(this);
    m_toolContainer->hide();
    m_toolContainer->setFlag(QGraphicsWidget::ItemStacksBehindParent);
    m_toolContainerLayout = new QGraphicsLinearLayout(m_toolContainer);
    m_toolContainerLayout->addStretch();

    m_background = new Plasma::Svg(this);
    m_background->setImagePath("widgets/toolbox");
    m_background->setContainsMultipleImages(true);
    setLocation(Plasma::BottomEdge);

    m_containment->installEventFilter(this);
    connect(m_containment, SIGNAL(geometryChanged()), this, SLOT(containmentGeometryChanged()));
    containmentGeometryChanged();

    slideAnim = Plasma::Animator::create(Plasma::Animator::SlideAnimation, this);
    slideAnim->setProperty("movementDirection", Plasma::Animation::MoveAny);
    connect(slideAnim, SIGNAL(stateChanged(QAbstractAnimation::State,
                        QAbstractAnimation::State)),
                this, SLOT(onMovement(QAbstractAnimation::State,QAbstractAnimation::State)));
    connect(slideAnim, SIGNAL(finished()), this, SLOT(movementFinished()));

    anim = new QPropertyAnimation(this, "highlight", this);
    anim->setDuration(250);
    anim->setStartValue(0);
    anim->setEndValue(1);
}