]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQWizardButton.cc
restart qt4 porting
[duncan/yast2-qt4.git] / src / YQWizardButton.cc
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQWizardButton.cc
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #include <qpushbutton.h>
21 #include <qsize.h>
22 #define y2log_component "qt-ui"
23 #include <ycp/y2log.h>
24
25 #include "utf8.h"
26 #include "YQUI.h"
27 #include "YQWizardButton.h"
28 #include "YQWizard.h"
29
30
31 YQWizardButton::YQWizardButton( YQWizard *      wizard,
32                                 QWidget *       buttonParent,
33                                 const string &  label,
34                                 YWidgetID *     id )
35     : YQGenericButton( wizard, label )
36     , _wizard( wizard )
37 {
38     QPushButton * button = new QPushButton( fromUTF8( label ), buttonParent );
39     CHECK_PTR( button );
40     
41     setQPushButton( button );
42     setWidgetRep( button );
43
44     if ( id )
45         setId( id );
46
47     connect( button, SIGNAL( clicked() ),
48              this,   SIGNAL( clicked() ) );
49
50     
51     // This widget itself will never be visible, only its button - which is not
52     // a child of this widget.
53     QWidget::hide();
54 }
55
56
57 YQWizardButton::~YQWizardButton()
58 {
59     // Don't delete qPushButton() here - its parent (buttonParent) will take
60     // care of that!
61 }
62
63
64 void YQWizardButton::hide()
65 {
66     if ( qPushButton() )
67         qPushButton()->hide();
68 }
69
70
71 void YQWizardButton::show()
72 {
73     if ( qPushButton() )
74         qPushButton()->show();
75 }
76
77
78 bool YQWizardButton::isShown() const
79 {
80     if ( qPushButton() )
81         return qPushButton()->isShown();
82     else
83         return false;
84 }
85
86
87 bool YQWizardButton::isHidden() const
88 {
89     return ! isShown();
90 }
91
92
93 int YQWizardButton::preferredWidth()
94 {
95     // This widget doesn't have a YWidget-based visual representation, it's
96     // only a YWidget for shortcut checking etc.
97     
98     return 0;
99 }
100
101
102 int YQWizardButton::preferredHeight()
103 {
104     // This widget doesn't have a YWidget-based visual representation, it's
105     // only a YWidget for shortcut checking etc.
106     
107     return 0;
108 }
109
110
111 void YQWizardButton::setSize( int newWidth, int newHeight )
112 {
113     // NOP
114 }
115
116
117
118 #include "YQWizardButton.moc"