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
90
91
92
93
94
#include "Headers/GUIMessageBox.h"

#ifndef CEGUI_STATIC
#define CEGUI_STATIC
#include <CEGUI/CEGUI.h>
#endif //CEGUI_STATIC

namespace Divide {

GUIMessageBox::GUIMessageBox(U64 guiID,
                             const stringImpl& title,
                             const stringImpl& message,
                             const vec2<I32>& offsetFromCentre,
                             CEGUI::Window* parent)
    : GUIElement(guiID, 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);
}

void GUIMessageBox::draw(GFXDevice& context) const {
    ACKNOWLEDGE_UNUSED(context);
    // Nothing. CEGUI should handle this
}

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
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 Diff Diff IonutCava picture IonutCava Thu 28 Apr, 2016 16:19:35 +0000

[IonutCava]
- Cleanup Time and Profiling code

671 Diff Diff IonutCava picture IonutCava Fri 08 Apr, 2016 16:26:49 +0000

[Ionut]
- Custom memory allocation system part 1:
— Add http://www.codeproject.com/Articles/1089905/A-Custom-STL-std-allocator-Replacement-Improves-Pe
— Add custom allocators to strings and vectors
— Add custom allocators to a few test classes
— No support for aligned memory yet, so vec4<F32> and mat4<F32> vectors use the old allocation system
- Replace more std::async call with our custom task system

466 Diff Diff IonutCava picture IonutCava Fri 05 Jun, 2015 15:07:17 +0000

[Ionut]
- Moved EASTL, SimpleINI and Threadpool libraries from Dependencies repo to engine repo
- Disabled EASTL string and vector support as they are really out of date and missing required features.
— EASTL hash map is still usable

446 Diff Diff IonutCava picture IonutCava Mon 25 May, 2015 19:37:45 +0000

[Ionut]
- SDL based windowing system:
— Support for Windowed/FullScreen windowed/Fullscreen mode

444 Diff Diff IonutCava picture IonutCava Thu 21 May, 2015 16:06:53 +0000

[Ionut]
- More platform independent code cleanup:
— Moved platform specific defines to their respective header files (e.g. THREAD_LOCAL)
— Moved most preprocessor defines from the VisualC++ projects into source code
— Removed compiler specific code (e.g. warning disables) and fixed most warning resulting from this

426 Diff Diff IonutCava picture IonutCava Fri 08 May, 2015 16:07:39 +0000

[Ionut]
- Small cleanup and performance optimizations

366 IonutCava picture IonutCava Tue 10 Mar, 2015 16:56:30 +0000

[Ionut]
- More type safe enum replacement