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 / Kolinewidthaction.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-30  |  3.6 KB  |  113 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 2004 Peter Simonsson <psn@linux.se>
  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 as published by the Free Software Foundation; either
  7.    version 2 of the License, or (at your option) any later version.
  8.  
  9.    This library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public License
  15.    along with this library; see the file COPYING.LIB.  If not, write to
  16.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.  * Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #ifndef KOLINEWIDTHACTION_H
  21. #define KOLINEWIDTHACTION_H
  22.  
  23. #include <kdialogbase.h>
  24.  
  25. #include <KoUnit.h>
  26. #include <KoSelectAction.h>
  27. #include <koffice_export.h>
  28.  
  29. /** A line width selection action */
  30. class KOFFICEUI_EXPORT KoLineWidthAction : public KoSelectAction
  31. {
  32.   Q_OBJECT
  33.   public:
  34.     /** Constructs a KoLineWidthAction with a text and an icon.
  35.      * @param text The text that will be displayed.
  36.      * @param icon The dynamically loaded icon that goes with this action.
  37.      * @param parent This action's parent.
  38.      * @param name An internal name for this action.
  39.      */
  40.     KoLineWidthAction(const QString& text, const QString& icon, QObject* parent = 0, const char* name = 0);
  41.     /** Same as above, but it also connects a slot to the selectionChanged(int) signal.
  42.      * @param text The text that will be displayed.
  43.      * @param icon The dynamically loaded icon that goes with this action.
  44.      * @param receiver The SLOT's parent.
  45.      * @param slot The SLOT to invoke when a lineWidthChanged(double) signal is emited.
  46.      * @param parent This action's parent.
  47.      * @param name An internal name for this action.
  48.      */
  49.     KoLineWidthAction(const QString& text, const QString& icon, const QObject* receiver,
  50.       const char* slot, QObject* parent, const char* name = 0);
  51.     ~KoLineWidthAction();
  52.  
  53.     /** Returns the currently selected line width */
  54.     double currentWidth() const;
  55.  
  56.   signals:
  57.     /** Emited when a new line width have been selected */
  58.     void lineWidthChanged(double);
  59.  
  60.   public slots:
  61.     /** Set the current width.
  62.      * @param width The new width.
  63.      */
  64.     void setCurrentWidth(double width);
  65.     /** Set which unit to use in the custom width dialog.
  66.      * @param unit The unit to use.
  67.      */
  68.     void setUnit(KoUnit::Unit unit);
  69.  
  70.   protected slots:
  71.     /** Reimplemented from KoSelectAction.
  72.      * Emits lineWidthChanged(double) when a new width is selected.
  73.      * @param index Index of the selected item
  74.      */
  75.     void execute(int index);
  76.  
  77.   protected:
  78.     /** Draws and adds each item of the menu. */
  79.     void createMenu();
  80.  
  81.   private:
  82.     class KoLineWidthActionPrivate;
  83.     KoLineWidthActionPrivate* d;
  84. };
  85.  
  86. /** This class provides a dialog for setting a custom line width. */
  87. class KoLineWidthChooser : public KDialogBase
  88. {
  89.   Q_OBJECT
  90.   public:
  91.     KoLineWidthChooser(QWidget* parent = 0, const char* name = 0);
  92.     ~KoLineWidthChooser();
  93.  
  94.     /** Returns the selected line width in points. */
  95.     double width() const;
  96.  
  97.   public slots:
  98.     /** Set unit to use when showing the width.
  99.      * @param unit Unit to use.
  100.      */
  101.     void setUnit(KoUnit::Unit unit);
  102.     /** Set line width.
  103.      * @param width Line width in points.
  104.      */
  105.     void setWidth(double width);
  106.  
  107.   private:
  108.     class KoLineWidthChooserPrivate;
  109.     KoLineWidthChooserPrivate* d;
  110. };
  111.  
  112. #endif
  113.