Last change
on this file since 6518 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
|
Line | |
---|
1 | -- gui.lua |
---|
2 | |
---|
3 | local P = {} |
---|
4 | if _REQUIREDNAME == nil then |
---|
5 | BasicGUI = P |
---|
6 | else |
---|
7 | _G[_REQUIREDNAME] = P |
---|
8 | end |
---|
9 | |
---|
10 | -- useless? |
---|
11 | P.overlay = nil |
---|
12 | |
---|
13 | -- constructor of the GUI |
---|
14 | function P:new(_filename, _visible, _gui) |
---|
15 | local newElement = { |
---|
16 | filename = _filename, |
---|
17 | gui = _gui, |
---|
18 | visible = _visible or false |
---|
19 | } or {} |
---|
20 | setmetatable(newElement, self) -- connects new element with class |
---|
21 | self.__index = self |
---|
22 | return newElement |
---|
23 | end |
---|
24 | |
---|
25 | function P:init() |
---|
26 | -- this function is empty and intended for inheriting GUIs to use |
---|
27 | end |
---|
28 | |
---|
29 | -- hide function for the GUI |
---|
30 | function P:hide() |
---|
31 | self.window:hide() |
---|
32 | self.visible = false |
---|
33 | end |
---|
34 | |
---|
35 | -- show function for the GUI |
---|
36 | function P:show() |
---|
37 | self.window:show() |
---|
38 | self.visible = true |
---|
39 | end |
---|
40 | |
---|
41 | function P:load() |
---|
42 | self.window = winMgr:loadWindowLayout(self.filename .. ".layout") |
---|
43 | self:init() |
---|
44 | return self |
---|
45 | end |
---|
46 | |
---|
47 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.