summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-12 22:38:33 +0800
committerruki <[email protected]>2018-01-12 09:51:23 +0800
commit5d8d758fa2fb4a8e9691dae010b97725c6b736c0 (patch)
treef35203ae41c4fd6fac4ac82e7c1c142480f749a9 /xmake
parent31f736c3440041b3ac060cd4519807d82a4d0e19 (diff)
add text dialog
Diffstat (limited to 'xmake')
-rw-r--r--xmake/core/sandbox/modules/import/core/ui/textdialog.lua26
-rw-r--r--xmake/core/ui/dialog.lua11
-rw-r--r--xmake/core/ui/textdialog.lua54
3 files changed, 80 insertions, 11 deletions
diff --git a/xmake/core/sandbox/modules/import/core/ui/textdialog.lua b/xmake/core/sandbox/modules/import/core/ui/textdialog.lua
new file mode 100644
index 000000000..2fe1f94f2
--- /dev/null
+++ b/xmake/core/sandbox/modules/import/core/ui/textdialog.lua
@@ -0,0 +1,26 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file textdialog.lua
+--
+
+-- return module: textdialog
+return require("ui/textdialog")
diff --git a/xmake/core/ui/dialog.lua b/xmake/core/ui/dialog.lua
index 26de856dd..4ab34b322 100644
--- a/xmake/core/ui/dialog.lua
+++ b/xmake/core/ui/dialog.lua
@@ -40,21 +40,10 @@ function dialog:init(name, bounds, title)
-- init window
window.init(self, name, bounds, title, true)
- -- insert text
- self:panel():insert(self:text())
-
-- insert buttons
self:panel():insert(self:buttons())
end
--- get text
-function dialog:text()
- if not self._TEXT then
- self._TEXT = label:new("dialog.text", rect:new(0, 0, self:panel():width(), self:panel():height() - 1))
- end
- return self._TEXT
-end
-
-- get buttons
function dialog:buttons()
if not self._BUTTONS then
diff --git a/xmake/core/ui/textdialog.lua b/xmake/core/ui/textdialog.lua
new file mode 100644
index 000000000..84ccae63c
--- /dev/null
+++ b/xmake/core/ui/textdialog.lua
@@ -0,0 +1,54 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file textdialog.lua
+--
+
+-- load modules
+local log = require("ui/log")
+local rect = require("ui/rect")
+local label = require("ui/label")
+local dialog = require("ui/dialog")
+local curses = require("ui/curses")
+
+-- define module
+local textdialog = textdialog or dialog()
+
+-- init dialog
+function textdialog:init(name, bounds, title)
+
+ -- init window
+ dialog.init(self, name, bounds, title)
+
+ -- insert text
+ self:panel():insert(self:text())
+end
+
+-- get text
+function textdialog:text()
+ if not self._TEXT then
+ self._TEXT = label:new("textdialog.text", rect:new(0, 0, self:panel():width(), self:panel():height() - 1))
+ end
+ return self._TEXT
+end
+
+-- return module
+return textdialog