1 | function createSheet(sheetName) |
---|
2 | -- Create object of type BasicGUI and make it global |
---|
3 | local sheet = require("BasicGUI"):new(sheetName) |
---|
4 | _G[sheetName] = sheet |
---|
5 | return sheet |
---|
6 | end |
---|
7 | |
---|
8 | function openDecisionPopup( text, callbackPtr ) |
---|
9 | showGUI("DecisionPopup", false, true) |
---|
10 | DecisionPopup.setCallback(callbackPtr) |
---|
11 | DecisionPopup.setText(text) |
---|
12 | end |
---|
13 | |
---|
14 | function openInfoPopup(text, functionPtr, closeButton, arguments) |
---|
15 | showGUI("InfoPopup", false, true) |
---|
16 | InfoPopup.execute(functionPtr, arguments) |
---|
17 | InfoPopup.setText(text) |
---|
18 | InfoPopup.setCloseButton(closeButton) |
---|
19 | end |
---|
20 | |
---|
21 | function getMinTextSize(window) |
---|
22 | local size = {} |
---|
23 | |
---|
24 | local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel()) |
---|
25 | local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight() |
---|
26 | local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth() |
---|
27 | |
---|
28 | table.insert(size, height) |
---|
29 | table.insert(size, width) |
---|
30 | return size |
---|
31 | end |
---|
32 | |
---|
33 | function getScrollingStepSize(window) |
---|
34 | local height = window:getUnclippedPixelRect():getHeight() |
---|
35 | local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight() |
---|
36 | local ratio = height/maxHeight |
---|
37 | return 0.008*ratio/0.3204 |
---|
38 | end |
---|