[6621] | 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 | |
---|
[6145] | 8 | function openDecisionPopup( text, callbackPtr ) |
---|
[6266] | 9 | showGUI("DecisionPopup", false, true) |
---|
| 10 | DecisionPopup.setCallback(callbackPtr) |
---|
[6145] | 11 | DecisionPopup.setText(text) |
---|
[6266] | 12 | end |
---|
| 13 | |
---|
[6311] | 14 | function openInfoPopup(text, functionPtr, closeButton, arguments) |
---|
[6266] | 15 | showGUI("InfoPopup", false, true) |
---|
[6311] | 16 | InfoPopup.execute(functionPtr, arguments) |
---|
[6266] | 17 | InfoPopup.setText(text) |
---|
[6283] | 18 | InfoPopup.setCloseButton(closeButton) |
---|
[6266] | 19 | end |
---|
[6355] | 20 | |
---|
| 21 | function getMinTextSize(window) |
---|
| 22 | local size = {} |
---|
[6387] | 23 | |
---|
[6355] | 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() |
---|
[6387] | 27 | |
---|
[6355] | 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 |
---|