Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "stdafx.h"

#include "Headers/GUIMessageBox.h"

#include <CEGUI/CEGUI.h>
namespace Divide {

GUIMessageBox::GUIMessageBox(U64 guiID,
                             const stringImpl& name,
                             const stringImpl& title,
                             const stringImpl& message,
                             const vec2<I32>& offsetFromCentre,
                             CEGUI::Window* parent)
    : GUIElement(guiID, name, parent, GUIType::GUI_MESSAGE_BOX)
{
    // Get a local pointer to the CEGUI Window Manager, Purely for convenience
    // to reduce typing
    CEGUI::WindowManager* pWindowManager =
        CEGUI::WindowManager::getSingletonPtr();
    // load the messageBox Window from the layout file
    _msgBoxWindow = pWindowManager->loadLayoutFromFile("messageBox.layout");
    _msgBoxWindow->setName((title + "_MesageBox").c_str());
    _parent->addChild(_msgBoxWindow);
    CEGUI::PushButton* confirmBtn =
        dynamic_cast<CEGUI::PushButton*>(_msgBoxWindow->getChild("ConfirmBtn"));
    confirmBtn->subscribeEvent(
        CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIMessageBox::onConfirm, this));

    setTitle(title);
    setMessage(message);
    setOffset(offsetFromCentre);
    setActive(true);
    setVisible(false);
}

GUIMessageBox::~GUIMessageBox()
{
    _parent->removeChild(_msgBoxWindow);
    CEGUI::WindowManager::getSingletonPtr()->destroyWindow(_msgBoxWindow);
}

bool GUIMessageBox::onConfirm(const CEGUI::EventArgs& /*e*/) {
    setActive(false);
    setVisible(false);
    return true;
}

void GUIMessageBox::setVisible(const bool visible) {
    _msgBoxWindow->setVisible(visible);
    _msgBoxWindow->setModalState(visible);
    GUIElement::setVisible(visible);
}

void GUIMessageBox::setActive(const bool active) {
    _msgBoxWindow->setEnabled(active);
    GUIElement::setActive(active);
}

void GUIMessageBox::setTitle(const stringImpl& titleText) {
    _msgBoxWindow->setText(titleText.c_str());
}

void GUIMessageBox::setMessage(const stringImpl& message) {
    _msgBoxWindow->getChild("MessageText")->setText(message.c_str());
}

void GUIMessageBox::setOffset(const vec2<I32>& offsetFromCentre) {
    CEGUI::UVector2 crtPosition(_msgBoxWindow->getPosition());
    crtPosition.d_x.d_offset += offsetFromCentre.x;
    crtPosition.d_y.d_offset += offsetFromCentre.y;
    _msgBoxWindow->setPosition(crtPosition);
}

void GUIMessageBox::setMessageType(MessageType type) {
    switch (type) {
        default:
        case MessageType::MESSAGE_INFO: {
            _msgBoxWindow->setProperty("CaptionColour", "FFFFFFFF");
        } break;
        case MessageType::MESSAGE_WARNING: {
            _msgBoxWindow->setProperty("CaptionColour", "00FFFFFF");
        } break;
        case MessageType::MESSAGE_ERROR: {
            _msgBoxWindow->setProperty("CaptionColour", "FF0000FF");
        } break;
    }
}
};

Commits for Divide-Framework/trunk/Source Code/GUI/GUIMessageBox.cpp

Diff revisions: vs.
Revision Author Commited Message
1003 Diff Diff IonutCava picture IonutCava Tue 19 Dec, 2017 17:08:06 +0000

[Ionut]
- GUI cleanup

1002 Diff Diff IonutCava picture IonutCava Mon 18 Dec, 2017 17:31:54 +0000

[Ionut]
- Cleanup GUI a bit
- Disable some nVidia GL warnings

987 Diff Diff IonutCava picture IonutCava Thu 30 Nov, 2017 17:19:21 +0000

[Ionut]
- glBlendFuncSeparate changes the blend mode for ALL buffers, so adjust code to handle this. This also fixes CEGUI rendering
- Fix CEGUI crashing on shutdown

966 Diff Diff IonutCava picture IonutCava Mon 06 Nov, 2017 17:10:01 +0000

[Ionut]
- Remove old “add2DRenderFunction” and use command buffers instead
- Allow frame to blit to the screen or a render target of choice

941 Diff Diff IonutCava picture IonutCava Mon 04 Sep, 2017 20:55:02 +0000

[Ionut]
- Update CEGUI from static to dynamic config (some dlls might still be missing)
- Attempt to work around a weird string issue with the newest VS2017 update

890 Diff Diff IonutCava picture IonutCava Sun 14 May, 2017 20:54:59 +0000

[Ionut]
- Add pre-compiled header support
- Initial code for per-stage tessellation computation

802 Diff Diff IonutCava picture IonutCava Tue 29 Nov, 2016 17:15:38 +0000

[IonutCava]
- GUI class is no longer a Singleton
- Reduced usage of GFXDevice::instance()

795 Diff Diff IonutCava picture IonutCava Wed 23 Nov, 2016 17:14:33 +0000

[IonutCava]
- Remove ULL. Use U64 instead
- Various small bug fixes and typos.

745 Diff Diff IonutCava picture IonutCava Wed 29 Jun, 2016 20:14:50 +0000

[IonutCava]
- Added on click sounds for buttons
- Added music playlist options for scenes (configurable via XML)
- Cache sound chunks and music files in SDLWrapper.cpp

693 IonutCava picture IonutCava Thu 28 Apr, 2016 16:19:35 +0000

[IonutCava]
- Cleanup Time and Profiling code