Sophie

Sophie

distrib > * > 2010.0 > * > by-pkgid > b90d0d295bc5deaa2f765776f8c386b5 > files > 13

ecawave-debug-0.6.1-10mdv2009.0.i586.rpm

#ifndef QEBUTTONROW_H
#define QEBUTTONROW_H

#include <vector>
#include <qwidget.h>
#include <qfont.h>

class QButton;
class QAccel;
class QHBoxLayout;

/**
 * User-interface widget for representing a button-row. Supports
 * fonts and keyboard shortcuts.
 */
class QEButtonRow : public QWidget {
  Q_OBJECT

 public:

  /**
   * Sets the default font for all QEButtonRow instances
   */
  static void set_default_font(const QFont&);

 private:

  static QFont default_font;
  
 public:

  /**
   * Set default font used for all button labels. If not set, default font is used.
   */
  void set_font(const QFont& v);

  /**
   * Add a new button and associate short-cut key 'key' to it.
   */
  void add_button(QButton*, int key);

  /**
   * Add a new button. Short-cut key 'key' and 'receiver - member' pair 
   * are connected to the added button.
   *
   * @param member You must use SLOT() macro for determinating this
   */
  void add_button(QButton*, int key, const QObject * receiver, const char * member);

  /**
   * Returns the most recently added button. This should be used
   * for connecting added buttons. 
   */
  QButton* last_button(void) const { return(buttons.back()); }

  /**
   * Constructor that takes a comma-separated list of button labels as its 
   * argument.
   */
  QEButtonRow (QWidget *parent = 0, const char *name = 0);

 private:

  QFont font_rep;
  QHBoxLayout* box;
  QAccel *accel;
  std::vector<QButton*> buttons;
};

#endif