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

Class Index

ksirc'PButton (./kdenetwork/ksirc/puke/pbutton.h:17)

class PButton : public PWidget
{
  Q_OBJECT
 public:
  PButton ( PObject * parent );
  virtual ~PButton ();
  
  virtual void messageHandler(int fd, PukeMessage *pm);
  
  virtual void setWidget(QObject *_qb = 0x0);
  virtual QButton *widget();

 public slots:
  void buttonPressed();
  void buttonReleased();
  void buttonClicked();
  void buttonToggled(bool);
  
 signals:
  void outputMessage(int fd, PukeMessage *pm);

 private:
  QButton *button;

  void buttonMessage(int iCommand);
  bool checkWidget();
};

ksirc'PButton::PButton() (./kdenetwork/ksirc/puke/pbutton.cpp:20)

PButton::PButton(PObject *parent)
  : PWidget(parent)
{
  //  debug("PLineEdit PLineEdit called");
  button = 0;
  setWidget(0);
}


ksirc'PButton::~PButton() (./kdenetwork/ksirc/puke/pbutton.cpp:28)

PButton::~PButton()
{
  //  debug("PLineEdit: in destructor");
  /*
  delete widget();     // Delete the frame
  button=0;          // Set it to 0
  setWidget(button); // Now set all widget() calls to 0.
  */
}


ksirc'PButton::messageHandler() (./kdenetwork/ksirc/puke/pbutton.cpp:38)

void PButton::messageHandler(int fd, PukeMessage *pm)
{
  PukeMessage pmRet;
  switch(pm->iCommand){
    case PUKE_BUTTON_SET_TEXT:
    if(checkWidget() == FALSE)
      return;

    widget()->setText(pm->cArg);    // set the text

    pmRet.iCommand = - pm->iCommand;// Create ack
    pmRet.iWinId = pm->iWinId;
    pmRet.cArg = (char*) widget()->text().ascii(); // It's const, but we don't mess with it anyways
    pmRet.iTextSize = strlen(pmRet.cArg);
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_BUTTON_SET_PIXMAP:
    if(checkWidget() == FALSE)
      return;
    
    widget()->setPixmap(QPixmap(pm->cArg));

    pmRet.iCommand = - pm->iCommand;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = widget()->pixmap()->isNull();
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_BUTTON_SET_AUTORESIZE:
    if(checkWidget() == FALSE)
      return;

    widget()->setAutoResize(pm->iArg);

    pmRet.iCommand = - pm->iCommand;
    pmRet.iWinId = - pm->iWinId;
    pmRet.iArg = widget()->autoResize();
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  default:
    PWidget::messageHandler(fd, pm);
  }
}


ksirc'PButton::setWidget() (./kdenetwork/ksirc/puke/pbutton.cpp:83)

void PButton::setWidget(QObject *_qb)
{
  if(_qb != 0 && _qb->inherits("QButton") == FALSE)
    throw(errorInvalidSet(_qb, className()));

  button = (QButton *) _qb;
  if(button != 0){
    connect(button, SIGNAL(pressed()),
	    this, SLOT(buttonPressed()));
    connect(button, SIGNAL(released()),
	    this, SLOT(buttonReleased()));
    connect(button, SIGNAL(clicked()),
	    this, SLOT(buttonClicked()));
    connect(button, SIGNAL(toggled(bool)),
	    this, SLOT(buttonToggled(bool)));
    
  }
  PWidget::setWidget(_qb);

}



ksirc'PButton::widget() (./kdenetwork/ksirc/puke/pbutton.cpp:105)

QButton *PButton::widget()
{
  return button;
}


ksirc'PButton::buttonMessage() (./kdenetwork/ksirc/puke/pbutton.cpp:110)

void PButton::buttonMessage(int iCommand)
{
  PukeMessage pmRet;

  pmRet.iCommand = iCommand;
  pmRet.iArg = 0;
  pmRet.iWinId = widgetIden().iWinId;
  pmRet.cArg = 0;

  emit outputMessage(widgetIden().fd, &pmRet);
}


ksirc'PButton::buttonPressed() (./kdenetwork/ksirc/puke/pbutton.cpp:122)

void PButton::buttonPressed()
{
  buttonMessage(PUKE_BUTTON_PRESSED_ACK);
}


ksirc'PButton::buttonReleased() (./kdenetwork/ksirc/puke/pbutton.cpp:127)

void PButton::buttonReleased()
{
  buttonMessage(PUKE_BUTTON_RELEASED_ACK);
}


ksirc'PButton::buttonClicked() (./kdenetwork/ksirc/puke/pbutton.cpp:132)

void PButton::buttonClicked()
{
  buttonMessage(PUKE_BUTTON_CLICKED_ACK);
}


ksirc'PButton::buttonToggled() (./kdenetwork/ksirc/puke/pbutton.cpp:137)

void PButton::buttonToggled(bool)
{
  buttonMessage(PUKE_BUTTON_TOGGLED_ACK);
}


ksirc'PButton::checkWidget() (./kdenetwork/ksirc/puke/pbutton.cpp:142)

bool PButton::checkWidget()
{
  if(widget() == 0){
    debug("PButton: No Widget set");
    return FALSE;
  }
  return TRUE;
}