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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
Copyright (c) 2017 DIVIDE-Studio
Copyright (c) 2009 Ionut Cava

This file is part of DIVIDE Framework.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
and associated documentation files (the "Software"), to deal in the Software
without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#ifndef _GUI_INTERFACE_H_
#define _GUI_INTERFACE_H_

#include "GUIElement.h"

namespace Divide {

class GUIText;
class GUIFlash;
class GUIButton;
class GUIMessageBox;

class GUIInterface {
public:
    typedef hashMapImpl<U64, std::pair<GUIElement*, bool/*last state*/>> GUIMap;
    typedef DELEGATE_CBK<void, I64> ButtonCallback;

public:
    explicit GUIInterface(GUI& context);
    virtual ~GUIInterface();

    virtual void onSizeChange(const SizeChangeParams& params);

    virtual void onLanguageChange(const char* newLanguage);

    /// Get a pointer to an element by name/id
    template<typename T = GUIElement>
    inline T* getGUIElement(U64 elementName) const {
        static_assert(std::is_base_of<GUIElement, T>::value,
            "getGuiElement error: Target is not a valid GUI item");

        return static_cast<T*>(getGUIElementImpl(elementName, getTypeEnum<T>()));
    }

    template<typename T = GUIElement>
    inline T* getGUIElement(I64 elementID) const {
        static_assert(std::is_base_of<GUIElement, T>::value,
            "getGuiElement error: Target is not a valid GUI item");

        return static_cast<T*>(getGUIElementImpl(elementID, getTypeEnum<T>()));
    }

    virtual GUIText* addText(U64 guiID,
                             const vec2<I32>& position,
                             const stringImpl& font,
                             const vec4<U8>& colour,
                             const stringImpl& text,
                             U8 fontSize = 16u);

    virtual GUIText* modifyText(U64 guiID,
                                const stringImpl& text);

    virtual GUIMessageBox* addMsgBox(U64 guiID,
                                     const stringImpl& title,
                                     const stringImpl& message,
                                     const vec2<I32>& offsetFromCentre = vec2<I32>(0));

    virtual GUIButton* addButton(U64 guiID,
                                 const stringImpl& text,
                                 const vec2<I32>& position,
                                 const vec2<U32>& dimensions,
                                 ButtonCallback callback,
                                 const stringImpl& rootSheetID = "");

    virtual GUIFlash* addFlash(U64 guiID,
                               stringImpl movie,
                               const vec2<U32>& position,
                               const vec2<U32>& extent);

    // Return true if input was consumed
    virtual bool mouseMoved(const GUIEvent& event);
    // Return true if input was consumed
    virtual bool onMouseUp(const GUIEvent& event);
    // Return true if input was consumed
    virtual bool onMouseDown(const GUIEvent& event);

protected:
    void addElement(U64 id, GUIElement* element);
    virtual GUIElement* getGUIElementImpl(U64 elementName, GUIType type) const;
    virtual GUIElement* getGUIElementImpl(I64 elementID, GUIType type) const;

protected:
    GUI* _context;

    std::array<GUIMap, to_base(GUIType::COUNT)> _guiElements;
};

}; //namespace Divide
#endif //_GUI_INTERFACE_H_

Commits for Divide-Framework/trunk/Source Code/GUI/Headers/GUIInterface.h

Diff revisions: vs.
Revision Author Commited Message
978 Diff Diff IonutCava picture IonutCava Mon 20 Nov, 2017 23:42:23 +0000

[Ionut]
- More decoupling between window size and render resolution.
- Attempt to preserve render target aspect on window resize events

  • Resolution change is currently broken *
955 Diff Diff IonutCava picture IonutCava Sun 29 Oct, 2017 20:45:04 +0000

[Ionut]
- Modify the CEGUI opengl renderer to interact with the state in GLWrapper better
- Performance optimizations

902 Diff Diff IonutCava picture IonutCava Sun 25 Jun, 2017 16:56:57 +0000

[Ionut]
- Rework input system a bit for easier maintenance and readability
- Toggle AntTweakBar display using CTRL+F11

872 Diff Diff IonutCava picture IonutCava Mon 06 Mar, 2017 23:23:20 +0000

[IonutCava]
- Optimise static casts

867 Diff Diff IonutCava picture IonutCava Mon 20 Feb, 2017 17:01:12 +0000

[IonutCava]
- Rename to_XNN and to_const_XNN functions to reflect the target data type they are converting to.
- Cleanup Angle namespace and remove all “inDegrees” parameters from rotation functions. Use aliases to differentiate between Degree and Radian parameters.
- Profile guided optimizations.

842 Diff Diff IonutCava picture IonutCava Wed 01 Feb, 2017 17:25:15 +0000

[IonutCava]
- Start to implement scripting support via ChaiScript: http://chaiscript.com/
- Cleanup DELEGATE_CBK alias

841 Diff Diff IonutCava picture IonutCava Wed 01 Feb, 2017 14:47:57 +0000

[IonutCava]
- Add callbacks to Localization so that listeners can be informed of language changes
— First callback added to GUIInterface

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

818 Diff Diff IonutCava picture IonutCava Mon 16 Jan, 2017 17:23:20 +0000

[IonutCava]
- Units get their bound node setup by the SGN UnitComponent and not during creation
- Profile guided optimizations

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

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