Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI|Client: Added MessageDialog; relocated rest of updater sources
- Loading branch information
Showing
6 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** @file messagedialog.h Dialog for showing a message. | ||
* | ||
* @authors Copyright (c) 2013 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef DENG_CLIENT_MESSAGEDIALOG_H | ||
#define DENG_CLIENT_MESSAGEDIALOG_H | ||
|
||
#include "dialogwidget.h" | ||
|
||
/** | ||
* Dialog for showing a message. | ||
*/ | ||
class MessageDialog : public DialogWidget | ||
{ | ||
public: | ||
MessageDialog(de::String const &name = ""); | ||
|
||
LabelWidget &title(); | ||
LabelWidget &message(); | ||
|
||
protected: | ||
/** | ||
* Derived classes should call this after they add or remove widgets in the | ||
* dialog content area. | ||
*/ | ||
void updateLayout(); | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
#endif // DENG_CLIENT_MESSAGEDIALOG_H |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** @file messagedialog.cpp Dialog for showing a message. | ||
* | ||
* @authors Copyright (c) 2013 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#include "ui/widgets/messagedialog.h" | ||
#include "ui/widgets/sequentiallayout.h" | ||
|
||
using namespace de; | ||
using namespace ui; | ||
|
||
DENG2_PIMPL(MessageDialog) | ||
{ | ||
LabelWidget *title; | ||
LabelWidget *message; | ||
|
||
Instance(Public *i) : Base(i) | ||
{ | ||
ScrollAreaWidget &area = self.area(); | ||
|
||
// Create widgets. | ||
area.add(title = new LabelWidget); | ||
area.add(message = new LabelWidget); | ||
|
||
// Configure style. | ||
title->setFont("title"); | ||
title->setTextColor("accent"); | ||
title->setSizePolicy(ui::Fixed, ui::Expand); | ||
title->setAlignment(ui::AlignLeft); | ||
title->setTextLineAlignment(ui::AlignLeft); | ||
message->setSizePolicy(ui::Fixed, ui::Expand); | ||
message->setAlignment(ui::AlignLeft); | ||
message->setTextLineAlignment(ui::AlignLeft); | ||
|
||
updateLayout(); | ||
} | ||
|
||
void updateLayout() | ||
{ | ||
ScrollAreaWidget &area = self.area(); | ||
|
||
// Simple vertical layout. | ||
SequentialLayout layout(area.contentRule().left(), | ||
area.contentRule().top()); | ||
layout.setOverrideWidth(self.style().rules().rule("dialog.message.width")); | ||
|
||
// Put all the widgets into the layout. | ||
foreach(Widget *w, area.childWidgets()) | ||
{ | ||
layout << w->as<GuiWidget>(); | ||
} | ||
|
||
area.setContentSize(layout.width(), layout.height()); | ||
} | ||
}; | ||
|
||
MessageDialog::MessageDialog(String const &name) | ||
: DialogWidget(name), d(new Instance(this)) | ||
{} | ||
|
||
LabelWidget &MessageDialog::title() | ||
{ | ||
return *d->title; | ||
} | ||
|
||
LabelWidget &MessageDialog::message() | ||
{ | ||
return *d->message; | ||
} | ||
|
||
void MessageDialog::updateLayout() | ||
{ | ||
d->updateLayout(); | ||
} |