Source Code (Use browser search to find items of interest.)

Class Index

kicker'AppletFrame (./kdebase/kicker/appletcontainer.h:150)

class AppletFrame : public AppletContainer
{
  Q_OBJECT;
  
 public:
  AppletFrame(QWidget* parent = 0);
  
  virtual QString command() const = 0;
  virtual QCString objId() const = 0;

  virtual int widthForHeight(int height) = 0;
  virtual int heightForWidth(int width) = 0;

  virtual void setPosition(Position p) = 0;
  virtual void setOrientation(Orientation o) = 0;

  bool eventFilter (QObject *, QEvent *);

  void resetLayout();

 protected:
  AppletHandle *_handle;
  QHBox  *_appletframe;
  QBoxLayout *_layout;
};

// container for external applets

kicker'AppletFrame::AppletFrame() (./kdebase/kicker/appletcontainer.cpp:96)

AppletFrame::AppletFrame( QWidget* parent )
  : AppletContainer(parent)
  , _layout(0)
{
  // setup handle
  _handle = new AppletHandle(this);
  _handle->installEventFilter(this);
  _handle->setOrientation(orientation());
  
  //setup appletframe
  _appletframe = new QHBox(this);
  _appletframe->setFrameStyle(QFrame::NoFrame);
  _appletframe->installEventFilter(this);

  if (orientation() == Horizontal)
    {
      _handle->setFixedWidth(7);
      _handle->setMaximumHeight(128);
      _layout = new QBoxLayout(this, QBoxLayout::LeftToRight, 0, 0);
    }
  else
    {
      _handle->setFixedHeight(7);
      _handle->setMaximumWidth(128);
      _layout = new QBoxLayout(this, QBoxLayout::TopToBottom, 0, 0);
    }

  _layout->setResizeMode( QLayout::FreeResize );

  _layout->addWidget(_handle);
  _layout->addWidget(_appletframe);
  _layout->activate();
}


kicker'AppletFrame::eventFilter() (./kdebase/kicker/appletcontainer.cpp:130)

bool AppletFrame::eventFilter (QObject *o, QEvent *e)
{
  switch (e->type())
    {
    case QEvent::MouseButtonPress:
      {
	    QMouseEvent* ev = (QMouseEvent*) e;
	    if ( ev->button() == RightButton )
          {
            PanelAppletOpMenu mnu(0,0, true);
            switch(mnu.exec(getPopupPosition(&mnu)))
              {
              case PanelAppletOpMenu::Move:
                _moveOffset = QPoint(_handle->width()/2, _handle->height()/2);
                emit moveme(this);
                break;
              case PanelAppletOpMenu::Remove:
                emit removeme(this);
                break;
              case PanelAppletOpMenu::Properties:
                // TODO
                break;
              default:
                break;
              }
            return false;
          }
        else if ( ev->button() == MidButton )
          {
            _moveOffset = ev->pos();
            emit moveme(this);
          }
        return false;
      }
    default:
      return QWidget::eventFilter(o, e);    // standard event processing
    }
  return false;
}


kicker'AppletFrame::resetLayout() (./kdebase/kicker/appletcontainer.cpp:170)

void AppletFrame::resetLayout()
{
  _handle->setOrientation(orientation());
  
  if (orientation() == Horizontal)
    {
      _layout->setDirection(QBoxLayout::LeftToRight);
      _handle->setFixedWidth(7);
      _handle->setMaximumHeight(128);
    }
  else
    {
      _layout->setDirection(QBoxLayout::TopToBottom);
      _handle->setFixedHeight(7);
      _handle->setMaximumWidth(128);
    }
  _layout->activate();
}