Skip to content

Commit 389f327

Browse files
committed
Update to TGUI 1.6
1 parent 8986379 commit 389f327

File tree

7 files changed

+62
-1
lines changed

7 files changed

+62
-1
lines changed

code-generator/templates/Widgets/ChildWindow.desc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
inherits Container
22

3+
enum CloseBehavior { None, Hide, Remove }
4+
35
/// @brief Renderer containing properties that determine how the widget is displayed
46
property-widget-renderer ChildWindowRenderer
57

@@ -13,6 +15,7 @@ property string Title
1315
property uint TitleTextSize
1416
property HorizontalAlignment TitleAlignment
1517
property uint TitleButtons
18+
property CloseBehavior CloseBehavior
1619
property-bool-is Resizable
1720
property bool KeepInParent
1821
property-bool-is PositionLocked

code-generator/templates/Widgets/ComboBox.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ property-widget-renderer ComboBoxRenderer
88
property size_t ItemsToDisplay
99

1010
function size_t addItem(string item, string id)
11+
function void addMultipleItems(List<string> items)
1112
const-function string getItemById(string id)
1213

1314
const-function List<string> getItems()

code-generator/templates/Widgets/ListBox.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ inherits ScrollbarChildInterface
55
property-widget-renderer ListBoxRenderer
66

77
function size_t addItem(string item, string id)
8+
function void addMultipleItems(List<string> items)
89

910
const-function string getItemById(string id)
1011
const-function string getItemByIndex(size_t index)

code-generator/templates/Widgets/SpinControl.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ property float Minimum
1313
property float Maximum
1414
property float Step
1515
property uint DecimalPlaces
16-
property bool UseWideArrows
16+
property float SpinButtonWidth

include/CTGUI/BackendRenderTarget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ CTGUI_API void tguiBackendRenderTarget_drawFilledRect(tguiBackendRenderTarget* t
4040

4141
CTGUI_API void tguiBackendRenderTarget_drawSprite(tguiBackendRenderTarget* target, const tguiRenderStates* states, const tguiSprite* sprite);
4242
CTGUI_API void tguiBackendRenderTarget_drawText(tguiBackendRenderTarget* target, const tguiRenderStates* states, const tguiText* text);
43+
CTGUI_API void tguiBackendRenderTarget_drawTextOutline(tguiBackendRenderTarget* target, const tguiRenderStates* states, const tguiText* text);
44+
CTGUI_API void tguiBackendRenderTarget_drawTextWithoutOutline(tguiBackendRenderTarget* target, const tguiRenderStates* states, const tguiText* text);
4345
CTGUI_API void tguiBackendRenderTarget_drawTriangle(tguiBackendRenderTarget* target, const tguiRenderStates* states, tguiVertex point1, tguiVertex point2, tguiVertex point3);
4446
CTGUI_API void tguiBackendRenderTarget_drawCircle(tguiBackendRenderTarget* target, const tguiRenderStates* states, float size, tguiColor backgroundColor, float borderThickness, tguiColor borderColor);
4547
CTGUI_API void tguiBackendRenderTarget_drawRoundedRectangle(tguiBackendRenderTarget* target, const tguiRenderStates* states, tguiVector2f size, tguiColor backgroundColor, float radius, const tguiOutline* borders, tguiColor borderColor);

src/CTGUI/Backend/CSFML-Graphics.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,35 @@ namespace ctgui
149149
}
150150

151151
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
152+
#if 0
153+
static tgui::Event::KeyboardKey translateKeypadKey(tgui::Event::KeyboardKey key)
154+
{
155+
switch (key)
156+
{
157+
case tgui::Event::KeyboardKey::Numpad0:
158+
return tgui::Event::KeyboardKey::Insert;
159+
case tgui::Event::KeyboardKey::Numpad1:
160+
return tgui::Event::KeyboardKey::End;
161+
case tgui::Event::KeyboardKey::Numpad2:
162+
return tgui::Event::KeyboardKey::Down;
163+
case tgui::Event::KeyboardKey::Numpad3:
164+
return tgui::Event::KeyboardKey::PageDown;
165+
case tgui::Event::KeyboardKey::Numpad4:
166+
return tgui::Event::KeyboardKey::Left;
167+
case tgui::Event::KeyboardKey::Numpad6:
168+
return tgui::Event::KeyboardKey::Right;
169+
case tgui::Event::KeyboardKey::Numpad7:
170+
return tgui::Event::KeyboardKey::Home;
171+
case tgui::Event::KeyboardKey::Numpad8:
172+
return tgui::Event::KeyboardKey::Up;
173+
case tgui::Event::KeyboardKey::Numpad9:
174+
return tgui::Event::KeyboardKey::PageUp;
175+
default: // tgui::Event::KeyboardKey::Numpad5
176+
return tgui::Event::KeyboardKey::Unknown; // Let's ignore this key press
177+
};
178+
}
179+
#endif
180+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
152181

153182
TGUI_NODISCARD static bool convertEvent(const sfEvent& eventSFML, tgui::Event& eventTGUI)
154183
{
@@ -207,6 +236,21 @@ namespace ctgui
207236
eventTGUI.key.control = eventSFML.key.control;
208237
eventTGUI.key.shift = eventSFML.key.shift;
209238
eventTGUI.key.system = eventSFML.key.system;
239+
240+
// If the NumLock is off then we will translate keypad key events to key events for text cursor navigation.
241+
// This functionality is not yet part of SFML, but is available in PR #3238 (https://github.com/SFML/SFML/pull/3238)
242+
#if 0
243+
static_assert(static_cast<int>(tgui::Event::KeyboardKey::Numpad0) + 9 == static_cast<int>(tgui::Event::KeyboardKey::Numpad9), "Numpad0 to Numpad9 need continous ids in KeyboardKey");
244+
if (!eventSFML.key.numLock
245+
&& (static_cast<int>(eventTGUI.key.code) >= static_cast<int>(tgui::Event::KeyboardKey::Numpad0))
246+
&& (static_cast<int>(eventTGUI.key.code) <= static_cast<int>(tgui::Event::KeyboardKey::Numpad9)))
247+
{
248+
eventTGUI.key.code = translateKeypadKey(eventTGUI.key.code);
249+
if (eventTGUI.key.code == tgui::Event::KeyboardKey::Unknown) // Numpad5 was pressed which has no function
250+
return false; // We didn't handle this key press
251+
}
252+
#endif
253+
210254
return true;
211255
}
212256
case sfEvtMouseWheelScrolled:

src/CTGUI/BackendRenderTarget.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ void tguiBackendRenderTarget_drawText(tguiBackendRenderTarget* target, const tgu
7575
target->This->drawText(convertRenderStates(states), *text->This);
7676
}
7777

78+
void tguiBackendRenderTarget_drawTextOutline(tguiBackendRenderTarget* target, const tguiRenderStates* states, const tguiText* text)
79+
{
80+
target->This->drawTextOutline(convertRenderStates(states), *text->This);
81+
}
82+
83+
void tguiBackendRenderTarget_drawTextWithoutOutline(tguiBackendRenderTarget* target, const tguiRenderStates* states, const tguiText* text)
84+
{
85+
target->This->drawTextWithoutOutline(convertRenderStates(states), *text->This);
86+
}
87+
7888
void tguiBackendRenderTarget_drawTriangle(tguiBackendRenderTarget* target, const tguiRenderStates* states, tguiVertex point1, tguiVertex point2, tguiVertex point3)
7989
{
8090
target->This->drawTriangle(convertRenderStates(states), {{point1.position.x, point1.position.y}, {point1.color.r, point1.color.g, point1.color.b, point1.color.a}, {point1.texCoords.x, point1.texCoords.y}},

0 commit comments

Comments
 (0)