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