Window

(UI 0.9.9)

介绍

表示一个 UI 窗口

类概要

class UI\Window extends UI\Control {
/* 属性 */
protected $controls;
/* 构造函数 */
public __construct(string $title, Size $size, bool $menu = false)
/* 方法 */
public add(UI\Control $control)
public error(string $title, string $msg)
public getSize(): UI\Size
public getTitle(): string
public hasBorders(): bool
public hasMargin(): bool
public isFullScreen(): bool
public msg(string $title, string $msg)
protected onClosing(): int
public open(): string
public save(): string
public setBorders(bool $borders)
public setFullScreen(bool $full)
public setMargin(bool $margin)
public setSize(UI\Size $size)
public setTitle(string $title)
/* 继承方法 */
}

属性

controls

包含控件,不应直接操作

目录

添加注释

用户贡献注释 1 个注释

everton3x at gmail dot com
7 年前
这是一个 UI 库中向导布局的示例

<?php

/*
* 使用 PHP UI 构建的向导示例布局
*/

use UI\Window;
use
UI\Size;
use
UI\Controls\Button;
use
UI\Controls\Grid;
use
UI\Controls\Box;
use
UI\Controls\Form;
use
UI\Controls\Entry;
use
UI\Controls\Label;

/*
* 窗口
*/
$window = new Window('向导示例布局', new Size(640, 480), TRUE);
$window->setMargin(true);

/*
* 向导内容 (示例)
*/
$content = new Form();
$content->setPadded(true);
$content->append('用户:', new Entry());
$content->append('密码:', new Entry(Entry::Password));

/*
* 布局标题、内容和按钮
*/
$grid = new Grid();
$grid->setPadded(false);

/*
* 标题
*/
$grid->append(new Label('向导示例'), 0, 0, 6, 1, true, Grid::Fill, false, Grid::Fill);

/*
* 添加内容
*/
$grid->append($content, 0, 1, 6, 1, false, Grid::Fill, true, Grid::Fill);

/*
* 左侧按钮
*/
$left_box = new Box(Box::Horizontal);
$left_box->append(new Button('&关于'));
$left_box->append(new Button('&帮助'));

/*
* 右侧按钮
*/
$right_box = new Box(Box::Horizontal);
$right_box->append(new Button('&后退'));
$right_box->append(new Button('&前进'));
$right_box->append(new Button('&关闭'));

/**
* 添加按钮
*/
$grid->append($left_box, 0, 2, 1, 1, true, Grid::Start, false, Grid::Fill);
$grid->append($right_box, 5, 2, 1, 1, true, Grid::End, false, Grid::Fill);

/*
* 添加布局并显示。
*/
$window->add($grid);

$window->show();

UI\run();

?>
To Top