gui.h

changeset 165
88a03c1a52d9
parent 164
8c93d8e38494
child 168
96691a009dff
equal deleted inserted replaced
164:8c93d8e38494 165:88a03c1a52d9
25 #include <QAction> 25 #include <QAction>
26 #include <QToolBar> 26 #include <QToolBar>
27 #include <QTextEdit> 27 #include <QTextEdit>
28 #include <qpushbutton.h> 28 #include <qpushbutton.h>
29 #include <qlistwidget.h> 29 #include <qlistwidget.h>
30 #include <qlabel.h>
31 #include <qboxlayout.h>
30 #include "gldraw.h" 32 #include "gldraw.h"
31 #include "config.h" 33 #include "config.h"
32 34
33 class ForgeWindow; 35 class ForgeWindow;
34 class color; 36 class color;
181 void slot_recentFile (); 183 void slot_recentFile ();
182 void slot_quickColor (); 184 void slot_quickColor ();
183 void slot_lastSecondCleanup (); 185 void slot_lastSecondCleanup ();
184 }; 186 };
185 187
188 // =============================================================================
189 // LabeledWidget
190 //
191 // Convenience class for a widget with a label beside it.
192 // =============================================================================
193 template<class R> class LabeledWidget : public QWidget {
194 public:
195 LabeledWidget (const char* labelstr, QWidget* parent) : QWidget (parent) {
196 m_widget = new R (this);
197 m_label = new QLabel (labelstr, this);
198
199 m_layout = new QHBoxLayout;
200 m_layout->addWidget (m_label);
201 m_layout->addWidget (m_widget);
202 setLayout (m_layout);
203 }
204
205 R* widget () const { return m_widget; }
206 R* w () const { return m_widget; }
207 QLabel* label () const { return m_label; }
208 QLabel* l () const { return m_label; }
209 void setWidget (R* widget) { m_widget = widget; }
210 void setLabel (QLabel* label) { m_label = label; }
211 operator R* () { return m_widget; }
212
213 private:
214 R* m_widget;
215 QLabel* m_label;
216 QHBoxLayout* m_layout;
217 };
218
186 // ----------------------------------------------------------------------------- 219 // -----------------------------------------------------------------------------
187 // Other GUI-related stuff not directly part of ForgeWindow: 220 // Other GUI-related stuff not directly part of ForgeWindow:
188 QPixmap getIcon (const char* sIconName); 221 QPixmap getIcon (const char* sIconName);
189 std::vector<quickColorMetaEntry> parseQuickColorMeta (); 222 std::vector<quickColorMetaEntry> parseQuickColorMeta ();
190 bool confirm (str title, str msg); 223 bool confirm (str title, str msg);

mercurial