home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / karrowbutton.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.6 KB  |  95 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2001, 2002 Frerich Raabe <raabe@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef __karrowbutton_h__
  20. #define __karrowbutton_h__
  21.  
  22. #include <qpushbutton.h>
  23.  
  24. #include <kdelibs_export.h>
  25.  
  26. class KArrowButtonPrivate;
  27. /**
  28.  * @short Draws a button with an arrow.
  29.  *
  30.  * Draws a button which shows an arrow pointing into a certain direction. The
  31.  * arrow's alignment on the button depends on the direction it's pointing to,
  32.  * e.g. a left arrow is aligned at the left border, a upwards arrow at the top
  33.  * border. This class honors the currently configured KStyle when drawing
  34.  * the arrow.
  35.  *
  36.  * @author Frerich Raabe
  37.  */
  38. class KDEUI_EXPORT KArrowButton : public QPushButton
  39. {
  40.     Q_OBJECT
  41.     Q_PROPERTY( int arrowType READ arrowTp WRITE setArrowTp )
  42.  
  43.     public:
  44.         /**
  45.          * Constructs an arrow button.
  46.          *
  47.          * @param parent This button's parent
  48.          * @param arrow The direction the arrrow should be pointing in
  49.          * @param name An internal name for this widget
  50.          */
  51.         KArrowButton(QWidget *parent = 0, Qt::ArrowType arrow = Qt::UpArrow,
  52.             const char *name = 0);
  53.  
  54.         /**
  55.          * Destructor.
  56.          */
  57.         virtual ~KArrowButton();
  58.  
  59.         /**
  60.          * Reimplemented from QPushButton.
  61.          */
  62.         virtual QSize sizeHint() const;
  63.  
  64.         /**
  65.         * Returns the arrow type
  66.         * @since 3.4
  67.         */
  68.         Qt::ArrowType arrowType() const;
  69.  
  70.         // hacks for moc braindamages with enums
  71.         int arrowTp() const { return (int) arrowType(); }
  72.         void setArrowTp( int tp ) { setArrowType( (Qt::ArrowType) tp ); }
  73.     public slots:
  74.         /**
  75.          * Defines in what direction the arrow is pointing to. Will repaint the
  76.          * button if necessary.
  77.          *
  78.          * @param a The direction this arrow should be pointing in
  79.          */
  80.         void setArrowType(Qt::ArrowType a);
  81.  
  82.     protected:
  83.         /**
  84.          * Reimplemented from QPushButton.
  85.          */
  86.         virtual void drawButton(QPainter *);
  87.  
  88.     protected:
  89.         virtual void virtual_hook( int id, void* data );
  90.     private:
  91.         KArrowButtonPrivate *d;
  92. };
  93.  
  94. #endif // __karrowbutton_h__
  95.