added all files
[ffqwlibrary] / libffqw-n810-1.0 / sources / ffabstractbutton.cpp
1 /*
2           GNU GENERAL PUBLIC LICENSE
3                        Version 3, 29 June 2007
4
5  Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
6  Everyone is permitted to copy and distribute verbatim copies
7  of this license document, but changing it is not allowed.
8
9                             Preamble
10
11   The GNU General Public License is a free, copyleft license for
12 software and other kinds of works.
13
14   The licenses for most software and other practical works are designed
15 to take away your freedom to share and change the works.  By contrast,
16 the GNU General Public License is intended to guarantee your freedom to
17 share and change all versions of a program--to make sure it remains free
18 software for all its users.  We, the Free Software Foundation, use the
19 GNU General Public License for most of our software; it applies also to
20 any other work released this way by its authors.  You can apply it to
21 your programs, too.
22
23   When we speak of free software, we are referring to freedom, not
24 price.  Our General Public Licenses are designed to make sure that you
25 have the freedom to distribute copies of free software (and charge for
26 them if you wish), that you receive source code or can get it if you
27 want it, that you can change the software or use pieces of it in new
28 free programs, and that you know you can do these things.
29
30   To protect your rights, we need to prevent others from denying you
31 these rights or asking you to surrender the rights.  Therefore, you have
32 certain responsibilities if you distribute copies of the software, or if
33 you modify it: responsibilities to respect the freedom of others.
34
35   For example, if you distribute copies of such a program, whether
36 gratis or for a fee, you must pass on to the recipients the same
37 freedoms that you received.  You must make sure that they, too, receive
38 or can get the source code.  And you must show them these terms so they
39 know their rights.
40
41   Developers that use the GNU GPL protect your rights with two steps:
42 (1) assert copyright on the software, and (2) offer you this License
43 giving you legal permission to copy, distribute and/or modify it.
44
45   For the developers' and authors' protection, the GPL clearly explains
46 that there is no warranty for this free software.  For both users' and
47 authors' sake, the GPL requires that modified versions be marked as
48 changed, so that their problems will not be attributed erroneously to
49 authors of previous versions.
50
51   Some devices are designed to deny users access to install or run
52 modified versions of the software inside them, although the manufacturer
53 can do so.  This is fundamentally incompatible with the aim of
54 protecting users' freedom to change the software.  The systematic
55 pattern of such abuse occurs in the area of products for individuals to
56 use, which is precisely where it is most unacceptable.  Therefore, we
57 have designed this version of the GPL to prohibit the practice for those
58 products.  If such problems arise substantially in other domains, we
59 stand ready to extend this provision to those domains in future versions
60 of the GPL, as needed to protect the freedom of users.
61
62   Finally, every program is threatened constantly by software patents.
63 States should not allow patents to restrict development and use of
64 software on general-purpose computers, but in those that do, we wish to
65 avoid the special danger that patents applied to a free program could
66 make it effectively proprietary.  To prevent this, the GPL assures that
67 patents cannot be used to render the program non-free.
68
69   The precise terms and conditions for copying, distribution and
70 modification follow.
71
72 http://www.gnu.org/licenses/gpl-3.0.txt
73 */
74
75 /**
76  * @file ffabstractbutton.cpp
77  * @brief Implementation of the FFAbstractButton class.
78  *
79  * @author  ComArch S.A.
80  * @date 2009.08.03
81  * @version 1.0
82  *
83  * This widget have an inside rectangle (draw area). This rectangle is bounded by four margins (top, bottom, left, right).
84  * Function setMargins(int,int,int,int) provides interface to change this parameters.
85  */
86
87 #include "ffabstractbutton.h"
88
89 /*Static FFViewCaches -improve performance*/
90 FFViewCache* FFAbstractButton::topLeftNormal = NULL;
91 FFViewCache* FFAbstractButton::topRightNormal = NULL;
92 FFViewCache* FFAbstractButton::bottomLeftNormal = NULL;
93 FFViewCache* FFAbstractButton::bottomRightNormal = NULL;
94 FFViewCache* FFAbstractButton::topLeftClicked = NULL;
95 FFViewCache* FFAbstractButton::topRightClicked = NULL;
96 FFViewCache* FFAbstractButton::bottomLeftClicked = NULL;
97 FFViewCache* FFAbstractButton::bottomRightClicked = NULL;
98 /* static values
99  */
100 bool FFAbstractButton::staticFFViewCacheUpdated = false;
101 int FFAbstractButton::minimumWidth = 0;
102 /**
103  * Constructs a FFAbstractButton with a parent.
104  * Set variable to initial values and set graphics used in widget.
105  */
106 FFAbstractButton::FFAbstractButton(QWidget* parent) :
107         QAbstractButton(parent)
108 {
109         init();
110
111 }
112
113 /**
114  * A virtual destructor of  FFAbstractButton.
115  */
116 FFAbstractButton::~FFAbstractButton()
117 {
118         ;
119 }
120
121 /**
122  * Returns the left margin of inside drawing rectangle.
123  */
124 int FFAbstractButton::leftMargin()
125 {
126         return insideRect.leftMargin_;
127 }
128
129 /**
130  * Returns the left margin of inside drawing rectangle.
131  */
132 int FFAbstractButton::rightMargin()
133 {
134         return insideRect.rightMargin_;
135 }
136
137 /**
138  * Returns the top margin of inside drawing rectangle.
139  */
140 int FFAbstractButton::topMargin()
141 {
142         return insideRect.topMargin_;
143 }
144
145 /**
146  * Returns the bottom margin of inside drawing rectangle.
147  */
148 int FFAbstractButton::bottomMargin()
149 {
150         return insideRect.bottomMargin_;
151 }
152
153 /**
154  * Returns the horizontal spacing between any elements in inside rectangle.
155  */
156 int FFAbstractButton::hSpacing()
157 {
158         return insideRect.hSpacing_;
159 }
160
161 /**
162  * Returns the vertical spacing between any elements in inside rectangle.
163  */
164 int FFAbstractButton::vSpacing()
165 {
166         return insideRect.vSpacing_;
167 }
168
169 /**
170  * Sets left margin of elements on a button
171  * @param leftMargin left margin of elements on a button
172  */
173 void FFAbstractButton::setLeftMargin(int leftMargin)
174 {
175         insideRect.leftMargin_ = leftMargin;
176         insideRect.leftMarginTemp = leftMargin;
177         updateView();
178         update();
179 }
180
181 /**
182  * Sets right margin of elements on a button
183  * @param rightMargin right margin of elements on a button
184  */
185 void FFAbstractButton::setRightMargin(int rightMargin)
186 {
187         insideRect.rightMargin_ = rightMargin;
188         insideRect.rightMarginTemp = rightMargin;
189         updateView();
190         update();
191 }
192
193 /**
194  * Sets top margin of elements on a button
195  * @param topMargin top margin of elements on a button
196  */
197 void FFAbstractButton::setTopMargin(int topMargin)
198 {
199         insideRect.topMargin_ = topMargin;
200         insideRect.topMarginTemp = topMargin;
201         updateView();
202         update();
203 }
204
205 /**
206  * Sets bottom margin of elements on a button
207  * @param bottomMargin bottom margin of elements on a button
208  */
209 void FFAbstractButton::setBottomMargin(int bottomMargin)
210 {
211         insideRect.bottomMargin_ = bottomMargin;
212         insideRect.bottomMarginTemp = bottomMargin;
213         updateView();
214         update();
215 }
216
217 /**
218  * Provides interface to change this parameters.
219  * @param leftMargin set margin between left edge of widget to left edge of inside rectangle
220  * @param rightMargin set margin between right edge of widget to right edge of inside rectangle
221  * @param topMargin set margin between top edge of widget to top edge of inside rectangle
222  * @param bottomMargin set margin between bottom edge of widget to bottom edge of inside rectangle
223  */
224 void FFAbstractButton::setMargins(int leftMargin,
225                                   int rightMargin,
226                                   int topMargin,
227                                   int bottomMargin)
228 {
229         insideRect.setMargins(leftMargin, rightMargin, topMargin, bottomMargin);
230         updateView();
231         update();
232 }
233
234 /**
235  * Sets horizontal spacing between any elements in inside rectangle.
236  * @param hSpacing Horizontal spacing
237  */
238 void FFAbstractButton::setHSpacing(int hSpacing)
239 {
240         insideRect.hSpacing_ = hSpacing;
241         insideRect.hSpacingTemp = hSpacing;
242         updateView();
243 }
244
245 /**
246  * Sets vertical spacing between any elements in inside rectangle.
247  * @param spacing Vertical spacing
248  */
249 void FFAbstractButton::setVSpacing(int spacing)
250 {
251         insideRect.vSpacing_ = spacing;
252         insideRect.vSpacingTemp = spacing;
253         updateView();
254 }
255 /**
256  * Returns pen
257  */
258 QPen FFAbstractButton::pen()
259 {
260         return pen_;
261 }
262
263 /**
264  * Sets pen
265  */
266 void FFAbstractButton::setPen(QPen pen)
267 {
268         pen_ = pen;
269 }
270 /**
271  * Repaints the view of this button. Overrides the virtual method from QWidget.
272  * If button is not clicked draw one type of pixmaps otherwise draw another.
273  *
274  *      Composition of pixmaps:
275  *      <table><tr><td> topLeft </td><td> topCenter </td><td> topRight </td></tr>
276  *             <tr><td> centerLeft </td><td> center </td><td> centerRight </td></tr>
277  *             <tr><td> bottomLeft </td><td> bottomCenter </td><td> bottomRight </td></tr></table>
278  * @param event Contains all informations about event.
279  */
280 void FFAbstractButton::paintEvent(QPaintEvent* event)
281 {
282         Q_UNUSED(event)
283
284         QPainter painter;
285
286         painter.begin(this);
287
288         if(!isClicked_)
289         {
290                 painter.drawPixmap(QPoint(0, 0), topLeftNormal->pixmap());
291                 painter.drawPixmap(QPoint(topLeftNormal->defaultSize().width(),
292                                           0), topCenterNormal->pixmap());
293                 painter.drawPixmap(QPoint(topLeftNormal->defaultSize().width()
294                                                    + pixmapsPositionWidth_, 0),
295                                    topRightNormal->pixmap());
296                 painter.drawPixmap(QPoint(0,
297                                           topLeftNormal->defaultSize().height()),
298                                    centerLeftNormal->pixmap());
299                 painter.drawPixmap(QPoint(centerLeftNormal->defaultSize().width(),
300                                           topCenterNormal->defaultSize().height()),
301                                    centerNormal->pixmap());
302                 painter.drawPixmap(QPoint(centerLeftNormal->defaultSize().width()
303                                                           + pixmapsPositionWidth_,
304                                           topRightNormal->defaultSize().height()),
305                                    centerRightNormal->pixmap());
306                 painter.drawPixmap(QPoint(0,
307                                           topLeftNormal->defaultSize().height()
308                                                           + pixmapsPositionHeight_),
309                                    bottomLeftNormal->pixmap());
310                 painter.drawPixmap(QPoint(bottomLeftNormal->defaultSize().width(),
311                                           topCenterNormal->defaultSize().height()
312                                                           + pixmapsPositionHeight_),
313                                    bottomCenterNormal->pixmap());
314                 painter.drawPixmap(QPoint(bottomLeftNormal->defaultSize().width()
315                                                           + pixmapsPositionWidth_,
316                                           topRightNormal->defaultSize().height()
317                                                           + pixmapsPositionHeight_),
318                                    bottomRightNormal->pixmap());
319         }
320         else
321         {
322                 painter.drawPixmap(QPoint(0, 0), topLeftClicked->pixmap());
323                 painter.drawPixmap(QPoint(topLeftClicked->defaultSize().width(),
324                                           0),
325                                    topCenterClicked->pixmap());
326                 painter.drawPixmap(QPoint(topLeftClicked->defaultSize().width()
327                                                    + pixmapsPositionWidth_, 0),
328                                    topRightClicked->pixmap());
329                 painter.drawPixmap(QPoint(0,
330                                           topLeftClicked->defaultSize().height()),
331                                    centerLeftClicked->pixmap());
332                 painter.drawPixmap(QPoint(centerLeftClicked->defaultSize().width(),
333                                           topCenterClicked->defaultSize().height()),
334                                    centerClicked->pixmap());
335                 painter.drawPixmap(QPoint(centerLeftClicked->defaultSize().width()
336                                                           + pixmapsPositionWidth_,
337                                           topRightClicked->defaultSize().height()),
338                                    centerRightClicked->pixmap());
339                 painter.drawPixmap(QPoint(0,
340                                           topLeftClicked->defaultSize().height()
341                                                           + pixmapsPositionHeight_),
342                                    bottomLeftClicked->pixmap());
343                 painter.drawPixmap(QPoint(bottomLeftClicked->defaultSize().width(),
344                                           topCenterClicked->defaultSize().height()
345                                                           + pixmapsPositionHeight_),
346                                    bottomCenterClicked->pixmap());
347                 painter.drawPixmap(QPoint(bottomLeftClicked->defaultSize().width()
348                                                           + pixmapsPositionWidth_,
349                                           topRightClicked->defaultSize().height()
350                                                           + pixmapsPositionHeight_),
351                                    bottomRightClicked->pixmap());
352         }
353
354         paintIcon(&painter);
355         painter.end();
356
357 }
358
359 /**
360  * Update button view after changing size of the widget.
361  * Update size of all pixmap which need it (without corners)
362  * @param event Contains all informations about event.
363  */
364 void FFAbstractButton::resizeEvent(QResizeEvent* event)
365 {
366         pixmapsPositionWidth_ = event->size().width()
367                         - centerLeftNormal->defaultSize().width()
368                         - centerRightNormal->defaultSize().width();
369
370         pixmapsPositionHeight_ = event->size().height()
371                         - topCenterNormal->defaultSize().height()
372                         - bottomCenterNormal->defaultSize().height();
373
374         if(event->oldSize().isValid())
375         {
376                 insideRect.scaleMargins(event->oldSize(), event->size());
377         }
378         updateView();
379
380         if(!icon().isNull())
381         {
382                 QRect rect(0 + leftMargin(),
383                            0 + topMargin(),
384                            geometry().width() - rightMargin() - leftMargin()
385                                            - 2 * insideRect.leftIndent_,
386                            geometry().height() - bottomMargin() - topMargin());
387
388                 iconSpace = icon().pixmap(rect.size()).size().width();
389         }
390         else
391         {
392                 iconSpace = 0;
393         }
394 }
395
396 /**
397  * Initiates an object of FFAbstractgButton. Sets all needed fields. It is called by all constructors.
398  */
399 void FFAbstractButton::init()
400 {
401
402         setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
403         path = BUTTON_PATH;
404
405         isClicked_ = false;
406         iconSpace = 0;
407
408         iconAlignment_ = DEFAULT_ICON_ALIGNMENT;
409
410         if(NULL == topLeftNormal)
411         {
412                 topLeftNormal = new FFViewCache;
413         }
414
415         topCenterNormal = new FFViewCache;
416
417         if(NULL == topRightNormal)
418         {
419                 topRightNormal = new FFViewCache;
420         }
421
422         centerLeftNormal = new FFViewCache;
423         centerNormal = new FFViewCache;
424         centerRightNormal = new FFViewCache;
425
426         if(NULL == bottomLeftNormal)
427         {
428                 bottomLeftNormal = new FFViewCache;
429         }
430
431         bottomCenterNormal = new FFViewCache;
432
433         if(NULL == bottomRightNormal)
434         {
435                 bottomRightNormal = new FFViewCache;
436         }
437
438         if(NULL == topLeftClicked)
439         {
440                 topLeftClicked = new FFViewCache;
441         }
442
443         topCenterClicked = new FFViewCache;
444
445         if(NULL == topRightClicked)
446         {
447                 topRightClicked = new FFViewCache;
448         }
449
450         centerLeftClicked = new FFViewCache;
451         centerClicked = new FFViewCache;
452         centerRightClicked = new FFViewCache;
453
454         if(NULL == bottomLeftClicked)
455         {
456                 bottomLeftClicked = new FFViewCache;
457         }
458
459         bottomCenterClicked = new FFViewCache;
460
461         if(NULL == bottomRightClicked)
462         {
463                 bottomRightClicked = new FFViewCache;
464         }
465
466         setSkin();
467 }
468 /**
469  * setSkin initiate FFViewCaches, update their size to default and set minimum width and height of widget
470  */
471 void FFAbstractButton::setSkin()
472 {
473
474 //      QSize sizeTmp = QSize(width(), height());
475
476         if(!topLeftNormal->isValid())
477         {
478                 topLeftNormal->init(path + "_topleft_normal.svg");
479         }
480
481         topCenterNormal->init(path + "_topcenter_normal.svg");
482
483         if(!topRightNormal->isValid())
484         {
485                 topRightNormal->init(path + "_topright_normal.svg");
486         }
487
488         centerLeftNormal->init(path + "_centerleft_normal.svg");
489         centerNormal->init(path + "_center_normal.svg");
490         centerRightNormal->init(path + "_centerright_normal.svg");
491
492         if(!bottomLeftNormal->isValid())
493         {
494                 bottomLeftNormal->init(path + "_bottomleft_normal.svg");
495         }
496
497         bottomCenterNormal->init(path + "_bottomcenter_normal.svg");
498
499         if(!bottomRightNormal->isValid())
500         {
501                 bottomRightNormal->init(path + "_bottomright_normal.svg");
502         }
503
504         if(!topLeftClicked->isValid())
505         {
506                 topLeftClicked->init(path + "_topleft_clicked.svg");
507         }
508
509         topCenterClicked->init(path + "_topcenter_clicked.svg");
510
511         if(!topRightClicked->isValid())
512         {
513                 topRightClicked->init(path + "_topright_clicked.svg");
514         }
515
516         centerLeftClicked->init(path + "_centerleft_clicked.svg");
517         centerClicked->init(path + "_center_clicked.svg");
518         centerRightClicked->init(path + "_centerright_clicked.svg");
519
520         if(!bottomLeftClicked->isValid())
521         {
522                 bottomLeftClicked->init(path + "_bottomleft_clicked.svg");
523         }
524
525         bottomCenterClicked->init(path + "_bottomcenter_clicked.svg");
526
527         if(!bottomRightClicked->isValid())
528         {
529                 bottomRightClicked->init(path + "_bottomright_clicked.svg");
530         }
531
532         pixmapsPositionWidth_ = centerNormal->defaultSize().width();
533         pixmapsPositionHeight_ = centerNormal->defaultSize().height();
534
535         if(!staticFFViewCacheUpdated)
536         {
537                 //Update view once after skin was set
538                 topLeftNormal->updateView(topLeftNormal->defaultSize());
539                 topRightNormal->updateView(topRightNormal->defaultSize());
540                 bottomLeftNormal->updateView(bottomLeftNormal->defaultSize());
541                 bottomRightNormal->updateView(bottomRightNormal->defaultSize());
542
543                 topLeftClicked->updateView(topLeftClicked->defaultSize());
544                 topRightClicked->updateView(topRightClicked->defaultSize());
545                 bottomLeftClicked->updateView(bottomLeftClicked->defaultSize());
546                 bottomRightClicked->updateView(bottomRightClicked->defaultSize());
547
548                 minimumWidth
549                                 = qMax(topLeftNormal->defaultSize().width()
550                                                        + topRightNormal->defaultSize().width(),
551                                        bottomLeftNormal->defaultSize().width()
552                                                        + bottomRightNormal->defaultSize().width());
553
554                 staticFFViewCacheUpdated = true;
555         }
556
557         pixmapsPositionWidth_ = centerNormal->defaultSize().width();
558         pixmapsPositionHeight_ = centerNormal->defaultSize().height();
559
560         insideRect.leftIndent_ = topLeftNormal->defaultSize().width();
561
562         setMinimumHeight(DEFAULT_BUTTON_HEIGHT);
563         setMinimumWidth(2 * minimumWidth);
564 }
565
566 /**
567  * Support mouse press event.
568  * @param event Contains all informations about event.
569  */
570 void FFAbstractButton::mousePressEvent(QMouseEvent* event)
571 {
572         Q_UNUSED(event)
573         isClicked_ = true; // isClicked contains boolean true information of mouse button pressed
574         update();
575 }
576
577 /**
578  * Support mouse release event.
579  * @param event Contains all informations about event.
580  */
581 void FFAbstractButton::mouseReleaseEvent(QMouseEvent *event)
582 {
583         Q_UNUSED(event)
584
585         if(isClicked_)
586         {
587                 if(!signalsBlocked())
588                 {
589                         emit clicked();
590                 }
591         }
592
593         isClicked_ = false; // isClicked contains boolean false information of mouse button unpressed
594         update();
595 }
596
597 /**
598  * Recalculate geometry of elements on button
599  */
600 void FFAbstractButton::updateView()
601 {
602         if(pixmapsPositionHeight_ <= 0)
603         {
604                 pixmapsPositionHeight_ = 1;
605         }
606         //Update view all the time resize event appear:
607         topCenterNormal->updateView(QSize(pixmapsPositionWidth_,
608                                           topCenterNormal->defaultSize().height()));
609         bottomCenterNormal->updateView(QSize(pixmapsPositionWidth_,
610                                              bottomCenterNormal->defaultSize().height()));
611
612         centerLeftNormal->updateView(QSize(centerLeftNormal->defaultSize().width(),
613                                            pixmapsPositionHeight_));
614         centerRightNormal->updateView(QSize(centerRightNormal->defaultSize().width(),
615                                             pixmapsPositionHeight_));
616         centerNormal->updateView(QSize(pixmapsPositionWidth_,
617                                        pixmapsPositionHeight_));
618
619         topCenterClicked->updateView(QSize(pixmapsPositionWidth_,
620                                            topCenterClicked->defaultSize().height()));
621         bottomCenterClicked->updateView(QSize(pixmapsPositionWidth_,
622                                               bottomCenterClicked->defaultSize().height()));
623         centerLeftClicked->updateView(QSize(centerLeftClicked->defaultSize().width(),
624                                             pixmapsPositionHeight_));
625         centerRightClicked->updateView(QSize(centerRightClicked->defaultSize().width(),
626                                              pixmapsPositionHeight_));
627         centerClicked->updateView(QSize(pixmapsPositionWidth_,
628                                         pixmapsPositionHeight_));
629 }
630 /**
631  * Draws icon on button
632  */
633 void FFAbstractButton::paintIcon(QPainter* painter)
634 {
635         int move = 0;
636         if(iconAlignment_ == Qt::AlignLeft)
637         {
638                 move = insideRect.leftIndent_;
639         }
640         else if(iconAlignment_ == Qt::AlignRight)
641         {
642                 move = -insideRect.leftIndent_;
643         }
644         else
645         {
646                 move = 0;
647         }
648         //if icon was set paint it
649         if(!icon().isNull())
650         {
651                 QRect rect(0 + leftMargin() + move,
652                            0 + topMargin(),
653                            geometry().width() - rightMargin() - leftMargin(),
654                            geometry().height() - bottomMargin() - topMargin());
655
656                 //paint icon in button center
657                 icon().paint(painter,
658                              rect,
659                              iconAlignment_,
660                              QIcon::Normal,
661                              QIcon::Off);
662         }
663
664 }
665
666 /**
667  * Initiate FFAbstractButtonPrivate
668  */
669 FFAbstractButtonPrivate::FFAbstractButtonPrivate()
670 {
671         setMargins(0.0, 0.0, 0.0, 0.0);
672         hSpacing_ = 0;
673         hSpacingTemp = 0;
674         vSpacing_ = 0;
675         vSpacingTemp = 0;
676         leftIndent_ = 0;
677 }
678
679 /**
680  * Dectructor of FFAbstractButtonPrivate
681  */
682 FFAbstractButtonPrivate::~FFAbstractButtonPrivate()
683 {
684         ;
685 }
686
687 /**
688  * scaleMargins scale margins eg. when resize event appear
689  * @param oldSize before eg. resize event
690  * @param newSize actual size after eg. resize event
691  */
692 void FFAbstractButtonPrivate::scaleMargins(QSize oldSize, QSize newSize)
693 {
694         float widthProportion = (float)newSize.width() / (float)oldSize.width();
695         float heightProportion = (float)newSize.height()
696                         / (float)oldSize.height();
697
698         leftMarginTemp *= widthProportion;
699         rightMarginTemp *= widthProportion;
700         topMarginTemp *= heightProportion;
701         bottomMarginTemp *= heightProportion;
702         hSpacingTemp *= heightProportion;
703         vSpacingTemp *= widthProportion;
704
705         leftMargin_ = leftMarginTemp;
706         rightMargin_ = rightMarginTemp;
707         topMargin_ = topMarginTemp;
708         bottomMargin_ = bottomMarginTemp;
709         hSpacing_ = hSpacingTemp;
710         vSpacing_ = vSpacingTemp;
711 }
712
713 /**
714  * setMargins set left, right, top and bottom margins
715  * @param leftMargin Size of left margin
716  * @param rightMargin Size of right margin
717  * @param topMargin Size of top margin
718  * @param bottomMargin Size of bottom margin
719  */
720 void FFAbstractButtonPrivate::setMargins(int leftMargin,
721                                          int rightMargin,
722                                          int topMargin,
723                                          int bottomMargin)
724 {
725         leftMargin_ = leftMargin;
726         rightMargin_ = rightMargin;
727         topMargin_ = topMargin;
728         bottomMargin_ = bottomMargin;
729
730         leftMarginTemp = leftMargin;
731         rightMarginTemp = rightMargin;
732         topMarginTemp = topMargin;
733         bottomMarginTemp = bottomMargin;
734 }
735 /**
736  * Returns alignment of icon
737  */
738 Qt::Alignment FFAbstractButton::iconAlignment()
739 {
740         return iconAlignment_;
741 }
742 /**
743  * Sets alignment of icon
744  * @param iconAlignment new alignment of icon
745  */
746 void FFAbstractButton::setIconAlignment(Qt::Alignment iconAlignment)
747 {
748         this->iconAlignment_ = iconAlignment;
749 }
750 /**
751  * Returns default width of image used as button's corner
752  */
753 int FFAbstractButton::indent()
754 {
755         return insideRect.leftIndent_;
756 }
757
758 /**
759  \fn void FFAbstractButton::clicked()
760
761  This signal is emitted when the button will be clicked.
762  */