summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-05 22:36:07 +0800
committerruki <[email protected]>2018-01-05 09:36:47 +0800
commit7858a7121d9499a27f92caa2df8bda66c36a3f0e (patch)
treef519af523fbf50737e6b1375c394cb0ded0981ee /tests
parentacfd73c79e9c406161ed022b40fe4d0ac7b2ad42 (diff)
add dialog
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/dialog.lua56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/ui/dialog.lua b/tests/ui/dialog.lua
new file mode 100644
index 000000000..7700eae8c
--- /dev/null
+++ b/tests/ui/dialog.lua
@@ -0,0 +1,56 @@
+--!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 dialog.lua
+--
+
+-- imports
+import("core.ui.log")
+import("core.ui.rect")
+import("core.ui.view")
+import("core.ui.label")
+import("core.ui.event")
+import("core.ui.dialog")
+import("core.ui.application")
+
+-- the demo application
+local demo = application()
+
+-- init demo
+function demo:init()
+
+ -- init name
+ application.init(self, "demo")
+
+ -- init background
+ self:background_set("blue")
+
+ -- init main dialog
+-- self:insert(dialog:new("dialog.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main dialog"))
+
+ -- init hello dialog
+ self:insert(dialog:new("dialog.hello", rect {0, 0, self:width() / 2, self:height() / 4}), {centerx = true, centery = true})
+end
+
+-- main entry
+function main(...)
+ demo:run(...)
+end