added all files
[ffqwlibrary] / libffqw-n810-1.0 / sources / ffabstractbutton.cpp
diff --git a/libffqw-n810-1.0/sources/ffabstractbutton.cpp b/libffqw-n810-1.0/sources/ffabstractbutton.cpp
new file mode 100644 (file)
index 0000000..f6a4e90
--- /dev/null
@@ -0,0 +1,762 @@
+/*
+         GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+http://www.gnu.org/licenses/gpl-3.0.txt
+*/
+
+/**
+ * @file ffabstractbutton.cpp
+ * @brief Implementation of the FFAbstractButton class.
+ *
+ * @author  ComArch S.A.
+ * @date 2009.08.03
+ * @version 1.0
+ *
+ * This widget have an inside rectangle (draw area). This rectangle is bounded by four margins (top, bottom, left, right).
+ * Function setMargins(int,int,int,int) provides interface to change this parameters.
+ */
+
+#include "ffabstractbutton.h"
+
+/*Static FFViewCaches -improve performance*/
+FFViewCache* FFAbstractButton::topLeftNormal = NULL;
+FFViewCache* FFAbstractButton::topRightNormal = NULL;
+FFViewCache* FFAbstractButton::bottomLeftNormal = NULL;
+FFViewCache* FFAbstractButton::bottomRightNormal = NULL;
+FFViewCache* FFAbstractButton::topLeftClicked = NULL;
+FFViewCache* FFAbstractButton::topRightClicked = NULL;
+FFViewCache* FFAbstractButton::bottomLeftClicked = NULL;
+FFViewCache* FFAbstractButton::bottomRightClicked = NULL;
+/* static values
+ */
+bool FFAbstractButton::staticFFViewCacheUpdated = false;
+int FFAbstractButton::minimumWidth = 0;
+/**
+ * Constructs a FFAbstractButton with a parent.
+ * Set variable to initial values and set graphics used in widget.
+ */
+FFAbstractButton::FFAbstractButton(QWidget* parent) :
+       QAbstractButton(parent)
+{
+       init();
+
+}
+
+/**
+ * A virtual destructor of  FFAbstractButton.
+ */
+FFAbstractButton::~FFAbstractButton()
+{
+       ;
+}
+
+/**
+ * Returns the left margin of inside drawing rectangle.
+ */
+int FFAbstractButton::leftMargin()
+{
+       return insideRect.leftMargin_;
+}
+
+/**
+ * Returns the left margin of inside drawing rectangle.
+ */
+int FFAbstractButton::rightMargin()
+{
+       return insideRect.rightMargin_;
+}
+
+/**
+ * Returns the top margin of inside drawing rectangle.
+ */
+int FFAbstractButton::topMargin()
+{
+       return insideRect.topMargin_;
+}
+
+/**
+ * Returns the bottom margin of inside drawing rectangle.
+ */
+int FFAbstractButton::bottomMargin()
+{
+       return insideRect.bottomMargin_;
+}
+
+/**
+ * Returns the horizontal spacing between any elements in inside rectangle.
+ */
+int FFAbstractButton::hSpacing()
+{
+       return insideRect.hSpacing_;
+}
+
+/**
+ * Returns the vertical spacing between any elements in inside rectangle.
+ */
+int FFAbstractButton::vSpacing()
+{
+       return insideRect.vSpacing_;
+}
+
+/**
+ * Sets left margin of elements on a button
+ * @param leftMargin left margin of elements on a button
+ */
+void FFAbstractButton::setLeftMargin(int leftMargin)
+{
+       insideRect.leftMargin_ = leftMargin;
+       insideRect.leftMarginTemp = leftMargin;
+       updateView();
+       update();
+}
+
+/**
+ * Sets right margin of elements on a button
+ * @param rightMargin right margin of elements on a button
+ */
+void FFAbstractButton::setRightMargin(int rightMargin)
+{
+       insideRect.rightMargin_ = rightMargin;
+       insideRect.rightMarginTemp = rightMargin;
+       updateView();
+       update();
+}
+
+/**
+ * Sets top margin of elements on a button
+ * @param topMargin top margin of elements on a button
+ */
+void FFAbstractButton::setTopMargin(int topMargin)
+{
+       insideRect.topMargin_ = topMargin;
+       insideRect.topMarginTemp = topMargin;
+       updateView();
+       update();
+}
+
+/**
+ * Sets bottom margin of elements on a button
+ * @param bottomMargin bottom margin of elements on a button
+ */
+void FFAbstractButton::setBottomMargin(int bottomMargin)
+{
+       insideRect.bottomMargin_ = bottomMargin;
+       insideRect.bottomMarginTemp = bottomMargin;
+       updateView();
+       update();
+}
+
+/**
+ * Provides interface to change this parameters.
+ * @param leftMargin set margin between left edge of widget to left edge of inside rectangle
+ * @param rightMargin set margin between right edge of widget to right edge of inside rectangle
+ * @param topMargin set margin between top edge of widget to top edge of inside rectangle
+ * @param bottomMargin set margin between bottom edge of widget to bottom edge of inside rectangle
+ */
+void FFAbstractButton::setMargins(int leftMargin,
+                                  int rightMargin,
+                                  int topMargin,
+                                  int bottomMargin)
+{
+       insideRect.setMargins(leftMargin, rightMargin, topMargin, bottomMargin);
+       updateView();
+       update();
+}
+
+/**
+ * Sets horizontal spacing between any elements in inside rectangle.
+ * @param hSpacing Horizontal spacing
+ */
+void FFAbstractButton::setHSpacing(int hSpacing)
+{
+       insideRect.hSpacing_ = hSpacing;
+       insideRect.hSpacingTemp = hSpacing;
+       updateView();
+}
+
+/**
+ * Sets vertical spacing between any elements in inside rectangle.
+ * @param spacing Vertical spacing
+ */
+void FFAbstractButton::setVSpacing(int spacing)
+{
+       insideRect.vSpacing_ = spacing;
+       insideRect.vSpacingTemp = spacing;
+       updateView();
+}
+/**
+ * Returns pen
+ */
+QPen FFAbstractButton::pen()
+{
+       return pen_;
+}
+
+/**
+ * Sets pen
+ */
+void FFAbstractButton::setPen(QPen pen)
+{
+       pen_ = pen;
+}
+/**
+ * Repaints the view of this button. Overrides the virtual method from QWidget.
+ * If button is not clicked draw one type of pixmaps otherwise draw another.
+ *
+ *     Composition of pixmaps:
+ *     <table><tr><td> topLeft </td><td> topCenter </td><td> topRight </td></tr>
+ *            <tr><td> centerLeft </td><td> center </td><td> centerRight </td></tr>
+ *            <tr><td> bottomLeft </td><td> bottomCenter </td><td> bottomRight </td></tr></table>
+ * @param event Contains all informations about event.
+ */
+void FFAbstractButton::paintEvent(QPaintEvent* event)
+{
+       Q_UNUSED(event)
+
+       QPainter painter;
+
+       painter.begin(this);
+
+       if(!isClicked_)
+       {
+               painter.drawPixmap(QPoint(0, 0), topLeftNormal->pixmap());
+               painter.drawPixmap(QPoint(topLeftNormal->defaultSize().width(),
+                                         0), topCenterNormal->pixmap());
+               painter.drawPixmap(QPoint(topLeftNormal->defaultSize().width()
+                                                  + pixmapsPositionWidth_, 0),
+                                  topRightNormal->pixmap());
+               painter.drawPixmap(QPoint(0,
+                                         topLeftNormal->defaultSize().height()),
+                                  centerLeftNormal->pixmap());
+               painter.drawPixmap(QPoint(centerLeftNormal->defaultSize().width(),
+                                         topCenterNormal->defaultSize().height()),
+                                  centerNormal->pixmap());
+               painter.drawPixmap(QPoint(centerLeftNormal->defaultSize().width()
+                                                         + pixmapsPositionWidth_,
+                                         topRightNormal->defaultSize().height()),
+                                  centerRightNormal->pixmap());
+               painter.drawPixmap(QPoint(0,
+                                         topLeftNormal->defaultSize().height()
+                                                         + pixmapsPositionHeight_),
+                                  bottomLeftNormal->pixmap());
+               painter.drawPixmap(QPoint(bottomLeftNormal->defaultSize().width(),
+                                         topCenterNormal->defaultSize().height()
+                                                         + pixmapsPositionHeight_),
+                                  bottomCenterNormal->pixmap());
+               painter.drawPixmap(QPoint(bottomLeftNormal->defaultSize().width()
+                                                         + pixmapsPositionWidth_,
+                                         topRightNormal->defaultSize().height()
+                                                         + pixmapsPositionHeight_),
+                                  bottomRightNormal->pixmap());
+       }
+       else
+       {
+               painter.drawPixmap(QPoint(0, 0), topLeftClicked->pixmap());
+               painter.drawPixmap(QPoint(topLeftClicked->defaultSize().width(),
+                                         0),
+                                  topCenterClicked->pixmap());
+               painter.drawPixmap(QPoint(topLeftClicked->defaultSize().width()
+                                                  + pixmapsPositionWidth_, 0),
+                                  topRightClicked->pixmap());
+               painter.drawPixmap(QPoint(0,
+                                         topLeftClicked->defaultSize().height()),
+                                  centerLeftClicked->pixmap());
+               painter.drawPixmap(QPoint(centerLeftClicked->defaultSize().width(),
+                                         topCenterClicked->defaultSize().height()),
+                                  centerClicked->pixmap());
+               painter.drawPixmap(QPoint(centerLeftClicked->defaultSize().width()
+                                                         + pixmapsPositionWidth_,
+                                         topRightClicked->defaultSize().height()),
+                                  centerRightClicked->pixmap());
+               painter.drawPixmap(QPoint(0,
+                                         topLeftClicked->defaultSize().height()
+                                                         + pixmapsPositionHeight_),
+                                  bottomLeftClicked->pixmap());
+               painter.drawPixmap(QPoint(bottomLeftClicked->defaultSize().width(),
+                                         topCenterClicked->defaultSize().height()
+                                                         + pixmapsPositionHeight_),
+                                  bottomCenterClicked->pixmap());
+               painter.drawPixmap(QPoint(bottomLeftClicked->defaultSize().width()
+                                                         + pixmapsPositionWidth_,
+                                         topRightClicked->defaultSize().height()
+                                                         + pixmapsPositionHeight_),
+                                  bottomRightClicked->pixmap());
+       }
+
+       paintIcon(&painter);
+       painter.end();
+
+}
+
+/**
+ * Update button view after changing size of the widget.
+ * Update size of all pixmap which need it (without corners)
+ * @param event Contains all informations about event.
+ */
+void FFAbstractButton::resizeEvent(QResizeEvent* event)
+{
+       pixmapsPositionWidth_ = event->size().width()
+                       - centerLeftNormal->defaultSize().width()
+                       - centerRightNormal->defaultSize().width();
+
+       pixmapsPositionHeight_ = event->size().height()
+                       - topCenterNormal->defaultSize().height()
+                       - bottomCenterNormal->defaultSize().height();
+
+       if(event->oldSize().isValid())
+       {
+               insideRect.scaleMargins(event->oldSize(), event->size());
+       }
+       updateView();
+
+       if(!icon().isNull())
+       {
+               QRect rect(0 + leftMargin(),
+                          0 + topMargin(),
+                          geometry().width() - rightMargin() - leftMargin()
+                                          - 2 * insideRect.leftIndent_,
+                          geometry().height() - bottomMargin() - topMargin());
+
+               iconSpace = icon().pixmap(rect.size()).size().width();
+       }
+       else
+       {
+               iconSpace = 0;
+       }
+}
+
+/**
+ * Initiates an object of FFAbstractgButton. Sets all needed fields. It is called by all constructors.
+ */
+void FFAbstractButton::init()
+{
+
+       setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
+       path = BUTTON_PATH;
+
+       isClicked_ = false;
+       iconSpace = 0;
+
+       iconAlignment_ = DEFAULT_ICON_ALIGNMENT;
+
+       if(NULL == topLeftNormal)
+       {
+               topLeftNormal = new FFViewCache;
+       }
+
+       topCenterNormal = new FFViewCache;
+
+       if(NULL == topRightNormal)
+       {
+               topRightNormal = new FFViewCache;
+       }
+
+       centerLeftNormal = new FFViewCache;
+       centerNormal = new FFViewCache;
+       centerRightNormal = new FFViewCache;
+
+       if(NULL == bottomLeftNormal)
+       {
+               bottomLeftNormal = new FFViewCache;
+       }
+
+       bottomCenterNormal = new FFViewCache;
+
+       if(NULL == bottomRightNormal)
+       {
+               bottomRightNormal = new FFViewCache;
+       }
+
+       if(NULL == topLeftClicked)
+       {
+               topLeftClicked = new FFViewCache;
+       }
+
+       topCenterClicked = new FFViewCache;
+
+       if(NULL == topRightClicked)
+       {
+               topRightClicked = new FFViewCache;
+       }
+
+       centerLeftClicked = new FFViewCache;
+       centerClicked = new FFViewCache;
+       centerRightClicked = new FFViewCache;
+
+       if(NULL == bottomLeftClicked)
+       {
+               bottomLeftClicked = new FFViewCache;
+       }
+
+       bottomCenterClicked = new FFViewCache;
+
+       if(NULL == bottomRightClicked)
+       {
+               bottomRightClicked = new FFViewCache;
+       }
+
+       setSkin();
+}
+/**
+ * setSkin initiate FFViewCaches, update their size to default and set minimum width and height of widget
+ */
+void FFAbstractButton::setSkin()
+{
+
+//     QSize sizeTmp = QSize(width(), height());
+
+       if(!topLeftNormal->isValid())
+       {
+               topLeftNormal->init(path + "_topleft_normal.svg");
+       }
+
+       topCenterNormal->init(path + "_topcenter_normal.svg");
+
+       if(!topRightNormal->isValid())
+       {
+               topRightNormal->init(path + "_topright_normal.svg");
+       }
+
+       centerLeftNormal->init(path + "_centerleft_normal.svg");
+       centerNormal->init(path + "_center_normal.svg");
+       centerRightNormal->init(path + "_centerright_normal.svg");
+
+       if(!bottomLeftNormal->isValid())
+       {
+               bottomLeftNormal->init(path + "_bottomleft_normal.svg");
+       }
+
+       bottomCenterNormal->init(path + "_bottomcenter_normal.svg");
+
+       if(!bottomRightNormal->isValid())
+       {
+               bottomRightNormal->init(path + "_bottomright_normal.svg");
+       }
+
+       if(!topLeftClicked->isValid())
+       {
+               topLeftClicked->init(path + "_topleft_clicked.svg");
+       }
+
+       topCenterClicked->init(path + "_topcenter_clicked.svg");
+
+       if(!topRightClicked->isValid())
+       {
+               topRightClicked->init(path + "_topright_clicked.svg");
+       }
+
+       centerLeftClicked->init(path + "_centerleft_clicked.svg");
+       centerClicked->init(path + "_center_clicked.svg");
+       centerRightClicked->init(path + "_centerright_clicked.svg");
+
+       if(!bottomLeftClicked->isValid())
+       {
+               bottomLeftClicked->init(path + "_bottomleft_clicked.svg");
+       }
+
+       bottomCenterClicked->init(path + "_bottomcenter_clicked.svg");
+
+       if(!bottomRightClicked->isValid())
+       {
+               bottomRightClicked->init(path + "_bottomright_clicked.svg");
+       }
+
+       pixmapsPositionWidth_ = centerNormal->defaultSize().width();
+       pixmapsPositionHeight_ = centerNormal->defaultSize().height();
+
+       if(!staticFFViewCacheUpdated)
+       {
+               //Update view once after skin was set
+               topLeftNormal->updateView(topLeftNormal->defaultSize());
+               topRightNormal->updateView(topRightNormal->defaultSize());
+               bottomLeftNormal->updateView(bottomLeftNormal->defaultSize());
+               bottomRightNormal->updateView(bottomRightNormal->defaultSize());
+
+               topLeftClicked->updateView(topLeftClicked->defaultSize());
+               topRightClicked->updateView(topRightClicked->defaultSize());
+               bottomLeftClicked->updateView(bottomLeftClicked->defaultSize());
+               bottomRightClicked->updateView(bottomRightClicked->defaultSize());
+
+               minimumWidth
+                               = qMax(topLeftNormal->defaultSize().width()
+                                                      + topRightNormal->defaultSize().width(),
+                                      bottomLeftNormal->defaultSize().width()
+                                                      + bottomRightNormal->defaultSize().width());
+
+               staticFFViewCacheUpdated = true;
+       }
+
+       pixmapsPositionWidth_ = centerNormal->defaultSize().width();
+       pixmapsPositionHeight_ = centerNormal->defaultSize().height();
+
+       insideRect.leftIndent_ = topLeftNormal->defaultSize().width();
+
+       setMinimumHeight(DEFAULT_BUTTON_HEIGHT);
+       setMinimumWidth(2 * minimumWidth);
+}
+
+/**
+ * Support mouse press event.
+ * @param event Contains all informations about event.
+ */
+void FFAbstractButton::mousePressEvent(QMouseEvent* event)
+{
+       Q_UNUSED(event)
+       isClicked_ = true; // isClicked contains boolean true information of mouse button pressed
+       update();
+}
+
+/**
+ * Support mouse release event.
+ * @param event Contains all informations about event.
+ */
+void FFAbstractButton::mouseReleaseEvent(QMouseEvent *event)
+{
+       Q_UNUSED(event)
+
+       if(isClicked_)
+       {
+               if(!signalsBlocked())
+               {
+                       emit clicked();
+               }
+       }
+
+       isClicked_ = false; // isClicked contains boolean false information of mouse button unpressed
+       update();
+}
+
+/**
+ * Recalculate geometry of elements on button
+ */
+void FFAbstractButton::updateView()
+{
+       if(pixmapsPositionHeight_ <= 0)
+       {
+               pixmapsPositionHeight_ = 1;
+       }
+       //Update view all the time resize event appear:
+       topCenterNormal->updateView(QSize(pixmapsPositionWidth_,
+                                         topCenterNormal->defaultSize().height()));
+       bottomCenterNormal->updateView(QSize(pixmapsPositionWidth_,
+                                            bottomCenterNormal->defaultSize().height()));
+
+       centerLeftNormal->updateView(QSize(centerLeftNormal->defaultSize().width(),
+                                          pixmapsPositionHeight_));
+       centerRightNormal->updateView(QSize(centerRightNormal->defaultSize().width(),
+                                           pixmapsPositionHeight_));
+       centerNormal->updateView(QSize(pixmapsPositionWidth_,
+                                      pixmapsPositionHeight_));
+
+       topCenterClicked->updateView(QSize(pixmapsPositionWidth_,
+                                          topCenterClicked->defaultSize().height()));
+       bottomCenterClicked->updateView(QSize(pixmapsPositionWidth_,
+                                             bottomCenterClicked->defaultSize().height()));
+       centerLeftClicked->updateView(QSize(centerLeftClicked->defaultSize().width(),
+                                           pixmapsPositionHeight_));
+       centerRightClicked->updateView(QSize(centerRightClicked->defaultSize().width(),
+                                            pixmapsPositionHeight_));
+       centerClicked->updateView(QSize(pixmapsPositionWidth_,
+                                       pixmapsPositionHeight_));
+}
+/**
+ * Draws icon on button
+ */
+void FFAbstractButton::paintIcon(QPainter* painter)
+{
+       int move = 0;
+       if(iconAlignment_ == Qt::AlignLeft)
+       {
+               move = insideRect.leftIndent_;
+       }
+       else if(iconAlignment_ == Qt::AlignRight)
+       {
+               move = -insideRect.leftIndent_;
+       }
+       else
+       {
+               move = 0;
+       }
+       //if icon was set paint it
+       if(!icon().isNull())
+       {
+               QRect rect(0 + leftMargin() + move,
+                          0 + topMargin(),
+                          geometry().width() - rightMargin() - leftMargin(),
+                          geometry().height() - bottomMargin() - topMargin());
+
+               //paint icon in button center
+               icon().paint(painter,
+                            rect,
+                            iconAlignment_,
+                            QIcon::Normal,
+                            QIcon::Off);
+       }
+
+}
+
+/**
+ * Initiate FFAbstractButtonPrivate
+ */
+FFAbstractButtonPrivate::FFAbstractButtonPrivate()
+{
+       setMargins(0.0, 0.0, 0.0, 0.0);
+       hSpacing_ = 0;
+       hSpacingTemp = 0;
+       vSpacing_ = 0;
+       vSpacingTemp = 0;
+       leftIndent_ = 0;
+}
+
+/**
+ * Dectructor of FFAbstractButtonPrivate
+ */
+FFAbstractButtonPrivate::~FFAbstractButtonPrivate()
+{
+       ;
+}
+
+/**
+ * scaleMargins scale margins eg. when resize event appear
+ * @param oldSize before eg. resize event
+ * @param newSize actual size after eg. resize event
+ */
+void FFAbstractButtonPrivate::scaleMargins(QSize oldSize, QSize newSize)
+{
+       float widthProportion = (float)newSize.width() / (float)oldSize.width();
+       float heightProportion = (float)newSize.height()
+                       / (float)oldSize.height();
+
+       leftMarginTemp *= widthProportion;
+       rightMarginTemp *= widthProportion;
+       topMarginTemp *= heightProportion;
+       bottomMarginTemp *= heightProportion;
+       hSpacingTemp *= heightProportion;
+       vSpacingTemp *= widthProportion;
+
+       leftMargin_ = leftMarginTemp;
+       rightMargin_ = rightMarginTemp;
+       topMargin_ = topMarginTemp;
+       bottomMargin_ = bottomMarginTemp;
+       hSpacing_ = hSpacingTemp;
+       vSpacing_ = vSpacingTemp;
+}
+
+/**
+ * setMargins set left, right, top and bottom margins
+ * @param leftMargin Size of left margin
+ * @param rightMargin Size of right margin
+ * @param topMargin Size of top margin
+ * @param bottomMargin Size of bottom margin
+ */
+void FFAbstractButtonPrivate::setMargins(int leftMargin,
+                                         int rightMargin,
+                                         int topMargin,
+                                         int bottomMargin)
+{
+       leftMargin_ = leftMargin;
+       rightMargin_ = rightMargin;
+       topMargin_ = topMargin;
+       bottomMargin_ = bottomMargin;
+
+       leftMarginTemp = leftMargin;
+       rightMarginTemp = rightMargin;
+       topMarginTemp = topMargin;
+       bottomMarginTemp = bottomMargin;
+}
+/**
+ * Returns alignment of icon
+ */
+Qt::Alignment FFAbstractButton::iconAlignment()
+{
+       return iconAlignment_;
+}
+/**
+ * Sets alignment of icon
+ * @param iconAlignment new alignment of icon
+ */
+void FFAbstractButton::setIconAlignment(Qt::Alignment iconAlignment)
+{
+       this->iconAlignment_ = iconAlignment;
+}
+/**
+ * Returns default width of image used as button's corner
+ */
+int FFAbstractButton::indent()
+{
+       return insideRect.leftIndent_;
+}
+
+/**
+ \fn void FFAbstractButton::clicked()
+
+ This signal is emitted when the button will be clicked.
+ */