diff options
| author | ruki <[email protected]> | 2017-12-23 00:46:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-22 22:39:18 +0800 |
| commit | 8e249fefd8265911fe4fe8ef72e489cbc8e326eb (patch) | |
| tree | 39c8fa6e7b2bdb74a5bd98d77900849fab739061 /xmake/core | |
| parent | 9e2b084be73bc0b966c2c43f73403703d64b7228 (diff) | |
import some ui modules
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/ui/desktop.lua | 26 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/ui/label.lua | 26 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/ui/menubar.lua | 26 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/ui/statusbar.lua | 26 | ||||
| -rw-r--r-- | xmake/core/ui/label.lua | 75 |
5 files changed, 179 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/import/core/ui/desktop.lua b/xmake/core/sandbox/modules/import/core/ui/desktop.lua new file mode 100644 index 000000000..e9d1b3e81 --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/ui/desktop.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 - 2017, TBOOX Open Source Group. +-- +-- @author ruki +-- @file desktop.lua +-- + +-- return module: desktop +return require("ui/desktop") diff --git a/xmake/core/sandbox/modules/import/core/ui/label.lua b/xmake/core/sandbox/modules/import/core/ui/label.lua new file mode 100644 index 000000000..63631c76b --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/ui/label.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 - 2017, TBOOX Open Source Group. +-- +-- @author ruki +-- @file label.lua +-- + +-- return module: label +return require("ui/label") diff --git a/xmake/core/sandbox/modules/import/core/ui/menubar.lua b/xmake/core/sandbox/modules/import/core/ui/menubar.lua new file mode 100644 index 000000000..12134bbd0 --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/ui/menubar.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 - 2017, TBOOX Open Source Group. +-- +-- @author ruki +-- @file menubar.lua +-- + +-- return module: menubar +return require("ui/menubar") diff --git a/xmake/core/sandbox/modules/import/core/ui/statusbar.lua b/xmake/core/sandbox/modules/import/core/ui/statusbar.lua new file mode 100644 index 000000000..6e5f8d4ae --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/ui/statusbar.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 - 2017, TBOOX Open Source Group. +-- +-- @author ruki +-- @file statusbar.lua +-- + +-- return module: statusbar +return require("ui/statusbar") diff --git a/xmake/core/ui/label.lua b/xmake/core/ui/label.lua new file mode 100644 index 000000000..57a287cb5 --- /dev/null +++ b/xmake/core/ui/label.lua @@ -0,0 +1,75 @@ +--!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 - 2017, TBOOX Open Source Group. +-- +-- @author ruki +-- @file label.lua +-- + +-- load modules +local log = require("ui/log") +local view = require("ui/view") +local curses = require("ui/curses") + +-- define module +local label = label or view() + +-- init label +function label:init(name, bounds, text) + + -- init view + view.init(self, name, bounds) + + -- init text + self._TEXT = text or "" + + -- init color + self:attr_set("color", curses.color_pair("red", "white")) +end + +-- exit label +function label:exit() + view.exit(self) +end + +-- draw view +function label:draw() + + -- trace + log:print("%s: draw ..", self) + + -- draw it + local c = self:canvas() + local s = string.sub(self:text(), 1, self:width()) .. string.rep(' ', self:width() - #self:text()) + c:attr(self:attr("color")):move(0, 0):write(s, self:attr("color")) +end + +-- get text +function label:text() + return self._TEXT +end + +-- set text +function label:text_set(text) + self._TEXT = text or "" + self:invalidate() +end + +-- return module +return label |
