[6662] | 1 | function createSheet(sheetName) |
---|
| 2 | -- Create object of type BasicGUI and make it global |
---|
[6666] | 3 | local basicGUI = require("BasicGUI") |
---|
| 4 | if basicGUI == nil then |
---|
| 5 | error("Loading BasicGUI.lua failed") |
---|
| 6 | end |
---|
| 7 | local sheet = basicGUI:new(sheetName) |
---|
[6662] | 8 | _G[sheetName] = sheet |
---|
| 9 | return sheet |
---|
| 10 | end |
---|
| 11 | |
---|
[6145] | 12 | function openDecisionPopup( text, callbackPtr ) |
---|
[6266] | 13 | showGUI("DecisionPopup", false, true) |
---|
| 14 | DecisionPopup.setCallback(callbackPtr) |
---|
[6145] | 15 | DecisionPopup.setText(text) |
---|
[6266] | 16 | end |
---|
| 17 | |
---|
[6311] | 18 | function openInfoPopup(text, functionPtr, closeButton, arguments) |
---|
[6266] | 19 | showGUI("InfoPopup", false, true) |
---|
[6311] | 20 | InfoPopup.execute(functionPtr, arguments) |
---|
[6266] | 21 | InfoPopup.setText(text) |
---|
[6283] | 22 | InfoPopup.setCloseButton(closeButton) |
---|
[6266] | 23 | end |
---|
[6355] | 24 | |
---|
| 25 | function getMinTextSize(window) |
---|
| 26 | local size = {} |
---|
[6387] | 27 | |
---|
[6355] | 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() |
---|
[6387] | 31 | |
---|
[6355] | 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 |
---|