File: Dialog.cpp

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (30 lines) | stat: -rw-r--r-- 900 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "Dialog.h"

#include <GG/ClrConstants.h>
#include <GG/DrawUtil.h>
#include <GG/Layout.h>
#include <GG/Font.h>


Dialog::Dialog(std::shared_ptr<GG::Wnd> child, const std::shared_ptr<GG::Font>& font):
    GG::Wnd(GG::X0, GG::Y0, GG::X(300), GG::Y(300), GG::DRAGABLE | GG::RESIZABLE | GG::MODAL | GG::INTERACTIVE),
    m_child(std::forward<std::shared_ptr<GG::Wnd>>(child))
{}

void Dialog::CompleteConstruction()
{
    Wnd::CompleteConstruction();

    SetLayout(GG::Wnd::Create<GG::Layout>(GG::X0, GG::Y0, GG::X1, GG::Y1, 1, 1, 2, 2));
    GetLayout()->SetColumnStretch(0, 1.0);
    //GetLayout()->SetRowStretch(0, 1.0);
    GetLayout()->Add(m_child, 0 , 0);
}

void Dialog::Render() {
    GG::Wnd::Render();
    GG::FlatRectangle(UpperLeft(), LowerRight(), GG::CLR_GRAY, GG::CLR_SHADOW, 1u);
}

GG::Pt Dialog::ClientLowerRight() const
{ return LowerRight() - GG::Pt(GG::X(10), GG::Y(10)); }