12 * GNU General Public License for more details. |
12 * GNU General Public License for more details. |
13 * |
13 * |
14 * You should have received a copy of the GNU General Public License |
14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software |
15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 */ |
|
18 |
|
19 /** |
|
20 * @file |
|
21 * @brief AbstractPage class definition |
17 */ |
22 */ |
18 |
23 |
19 #ifndef ABSTRACTPAGE_H |
24 #ifndef ABSTRACTPAGE_H |
20 #define ABSTRACTPAGE_H |
25 #define ABSTRACTPAGE_H |
21 |
26 |
50 class AbstractPage : public QWidget |
55 class AbstractPage : public QWidget |
51 { |
56 { |
52 Q_OBJECT |
57 Q_OBJECT |
53 |
58 |
54 signals: |
59 signals: |
|
60 /** |
|
61 * @brief This signal is emitted when going back to the previous is |
|
62 * requested - e.g. when the back-button is clicked. |
|
63 */ |
55 void goBack(); |
64 void goBack(); |
56 |
65 |
57 protected: |
66 protected: |
58 // constructor and virtual destructor |
67 /** |
|
68 * @brief Class constructor |
|
69 * |
|
70 * @param parent parent widget. |
|
71 */ |
59 AbstractPage(QWidget * parent = 0); |
72 AbstractPage(QWidget * parent = 0); |
60 |
73 |
61 // call this in the constructor of your subclass |
74 /// Class Destructor |
|
75 virtual ~AbstractPage() {}; |
|
76 |
|
77 /// Call this in the constructor of your subclass. |
62 void initPage(); |
78 void initPage(); |
63 |
79 |
64 // the following methods are used during page construction |
80 /** |
|
81 * @brief Used during page construction. |
|
82 * You MUST implement this method in your subclass. |
|
83 * |
|
84 * Use it to define the main layout (no behavior) of the page. |
|
85 */ |
|
86 virtual QLayout * bodyLayoutDefinition() = 0; |
65 |
87 |
66 // you MUST implement this method in your subclass |
88 /** |
67 // only define layout, not behavior in here |
89 * @brief Used during page construction. |
68 virtual QLayout * bodyLayoutDefinition() = 0; |
90 * You can implement this method in your subclass. |
|
91 * |
|
92 * Use it to define layout (not behavior) of the page's footer. |
|
93 */ |
|
94 virtual QLayout * footerLayoutDefinition() { return NULL; }; |
69 |
95 |
70 // you CAN implement this method in your subclass |
96 /** |
71 virtual QLayout * footerLayoutDefinition() { return NULL; }; |
97 * @brief Used during page construction. |
|
98 * You can implement this method in your subclass. |
|
99 * |
|
100 * This is a good place to connect signals within your page in order |
|
101 * to get the desired page behavior.<br /> |
|
102 * Keep in mind not to expose twidgets as public! |
|
103 * instead define a signal with a meaningful name and connect the widget |
|
104 * signals to your page signals |
|
105 */ |
|
106 virtual void connectSignals() {}; |
72 |
107 |
73 // you CAN but most likely want to implement this method in your subclass |
108 /** |
74 // keep in mind not to expose twidgets as public! |
109 * @brief Creates a default formatted button for this page. |
75 // instead define a signal with a meaningful name and connect the widget |
110 * |
76 // signals to your page signals |
111 * @param name name of the button - used as its text if not hasIcon. |
77 virtual void connectSignals() {}; |
112 * @param hasIcon set to true if this is a picture button. |
|
113 * |
|
114 * @return the button. |
|
115 */ |
|
116 QPushButton * formattedButton(const QString & name, bool hasIcon = false); |
78 |
117 |
79 virtual ~AbstractPage() {}; |
118 /** |
|
119 * @brief Creates a default formatted button and adds it to a |
|
120 * grid layout at the location specified. |
|
121 * |
|
122 * @param name label or path to icon of the button (depends on hasIcon) |
|
123 * @param grid pointer of the grid layout in which to insert the button. |
|
124 * @param row layout row index in which to insert the button. |
|
125 * @param column layout column index in which to insert the button. |
|
126 * @param rowSpan how many layout rows the button will span. |
|
127 * @param columnSpan how many layout columns the button will span. |
|
128 * @param hasIcon set to true if this is a picture button. |
|
129 * |
|
130 * @return the button. |
|
131 */ |
|
132 QPushButton * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false); |
80 |
133 |
81 QPushButton * formattedButton(const QString & btname, bool hasIcon = false); |
134 /** |
82 QPushButton * addButton(const QString & btname, QGridLayout * grid, int wy, int wx, bool hasIcon = false); |
135 * @brief Creates a default formatted button and adds it to a |
83 QPushButton * addButton(const QString & btname, QGridLayout * grid, int wy, int wx, int rowSpan, int columnSpan, bool hasIcon = false); |
136 * grid layout at the location specified. |
84 QPushButton * addButton(const QString & btname, QBoxLayout * box, int where, bool hasIcon = false); |
137 * |
|
138 * @param name label or path to icon of the button (depends on hasIcon) |
|
139 * @param box pointer of the box layout in which to insert the button. |
|
140 * @param where layout ndex in which to insert the button. |
|
141 * @param hasIcon set to true if this is a picture button. |
|
142 * |
|
143 * @return the button. |
|
144 */ |
|
145 QPushButton * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false); |
85 |
146 |
|
147 /** |
|
148 * @brief Changes visibility of the back-button. |
|
149 * |
|
150 * @param visible set to true if the button should be visible. |
|
151 */ |
86 void setBackButtonVisible(bool visible = true); |
152 void setBackButtonVisible(bool visible = true); |
87 |
153 |
88 QFont * font14; |
154 QFont * font14; ///< used font |
89 |
155 |
90 private: |
156 private: |
91 |
157 |
92 QPushButton * btnBack; |
158 QPushButton * btnBack; ///< back button |
93 }; |
159 }; |
94 |
160 |
95 #endif |
161 #endif |
96 |
162 |