Last change
on this file since 6519 was
6459,
checked in by rgrieder, 15 years ago
|
Simplified BasicGUI construction. Just give the name of the GUI as argument. The rest will be deduced.
|
-
Property svn:eol-style set to
native
|
File size:
870 bytes
|
Rev | Line | |
---|
[5491] | 1 | -- gui.lua |
---|
| 2 | |
---|
| 3 | local P = {} |
---|
| 4 | if _REQUIREDNAME == nil then |
---|
[5661] | 5 | BasicGUI = P |
---|
[5491] | 6 | else |
---|
| 7 | _G[_REQUIREDNAME] = P |
---|
| 8 | end |
---|
| 9 | |
---|
[6459] | 10 | -- useless? |
---|
[5491] | 11 | P.overlay = nil |
---|
| 12 | |
---|
| 13 | -- constructor of the GUI |
---|
[6459] | 14 | function P:new(_filename, _visible, _gui) |
---|
| 15 | local newElement = { |
---|
| 16 | filename = _filename, |
---|
| 17 | gui = _gui, |
---|
| 18 | visible = _visible or false |
---|
| 19 | } or {} |
---|
[5491] | 20 | setmetatable(newElement, self) -- connects new element with class |
---|
| 21 | self.__index = self |
---|
| 22 | return newElement |
---|
| 23 | end |
---|
| 24 | |
---|
[5523] | 25 | function P:init() |
---|
| 26 | -- this function is empty and intended for inheriting GUIs to use |
---|
| 27 | end |
---|
| 28 | |
---|
[5491] | 29 | -- hide function for the GUI |
---|
[6459] | 30 | function P:hide() |
---|
[5491] | 31 | self.window:hide() |
---|
| 32 | self.visible = false |
---|
| 33 | end |
---|
| 34 | |
---|
| 35 | -- show function for the GUI |
---|
[6459] | 36 | function P:show() |
---|
[5491] | 37 | self.window:show() |
---|
| 38 | self.visible = true |
---|
| 39 | end |
---|
| 40 | |
---|
[6459] | 41 | function P:load() |
---|
| 42 | self.window = winMgr:loadWindowLayout(self.filename .. ".layout") |
---|
[5559] | 43 | self:init() |
---|
| 44 | return self |
---|
[5491] | 45 | end |
---|
| 46 | |
---|
[5661] | 47 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.