Logo Search packages:      
Sourcecode: ecawave version File versions  Download package

qebuttonrow.cpp

// ------------------------------------------------------------------------
// qebuttonrow.cpp: User-interface widget for representing a button-row
// Copyright (C) 1999-2001 Kai Vehmanen (kai.vehmanen@wakkanet.fi)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
// ------------------------------------------------------------------------

#include <qaccel.h>
#include <qbutton.h>
#include <qlayout.h>
#include <qobject.h>

#include "qebuttonrow.h"

using std::vector;

00029 void QEButtonRow::set_default_font(const QFont& v) { default_font = v; }
QFont QEButtonRow::default_font = QFont::defaultFont();

00032 QEButtonRow::QEButtonRow (QWidget *parent, 
                    const char *name) 
  : QWidget(parent,name)
{
  font_rep = QEButtonRow::default_font;
  box = new QHBoxLayout(this);
  accel = new QAccel(this);
}

00041 void QEButtonRow::set_font(const QFont& v) { 
  font_rep = v;
  vector<QButton*>::const_iterator p = buttons.begin();
  while(p != buttons.end()) {
    (*p)->setFont(font_rep);
    ++p;
  }
}

00050 void QEButtonRow::add_button(QButton* v, int key) {
  v->setFont(font_rep);
  accel->connectItem(accel->insertItem(key), v, SLOT(animateClick()));
  box->addWidget(v, 1);
  buttons.push_back(v);
}

00057 void QEButtonRow::add_button(QButton* v, int key, const QObject *
                      receiver, const char * member) {
  v->setFont(font_rep);
  accel->connectItem(accel->insertItem(key), v, SLOT(animateClick()));
  QObject::connect(v, SIGNAL(clicked()), receiver, member);
  box->addWidget(v);
  buttons.push_back(v);
}

Generated by  Doxygen 1.6.0   Back to index