⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shell.zc

📁 实现树形结构
💻 ZC
字号:
//[of]:description
//[c]The most basic container
//[cf]
//[of]:license
//[c]Code Browser - a folding text editor for programmers
//[c]Copyright (C) 2003-07 Marc Kerbiquet
//[c]
//[c]This program is free software; you can redistribute it and/or modify
//[c]it under the terms of the GNU General Public License as published by
//[c]the Free Software Foundation; either version 2 of the License, or
//[c](at your option) any later version.
//[c]
//[c]This program is distributed in the hope that it will be useful,
//[c]but WITHOUT ANY WARRANTY; without even the implied warranty of
//[c]MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//[c]GNU General Public License for more details.
//[c]
//[c]You should have received a copy of the GNU General Public License
//[c]along with this program; if not, write to the Free Software
//[c]Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//[cf]
//[of]:imports
import "base/types"
import "base/memory-allocator"
//[c]
import "graphics/geometry"
import "graphics/graphics"
import "user/box"
import "user/container-box"
//[cf]
//[c]
//[of]:shell
//[of]:type
public struct shell : local container box
	// empty
end
//[cf]
//[of]:instance creation
//[of]:new shell (parent)
public func new shell (parent: box)

	equ s = sizeof local shell
	def b = allocate memory (s): shell
	initialize (b, parent)
	return b

end
//[cf]
//[cf]
//[of]:restricted
//[of]:initialize (parent box)
public func initialize (m: shell, parent: box)

	initialize (super(m), parent)
	class (m) = shell class

end
//[cf]
//[c]
//[of]:actual compute min size
func actual compute min size (m: shell)

	def child = first child (m)
	set min size(m, min width (child), min height (child))

end
//[cf]
//[c]
//[of]:handle size
//[c]The size of the box has changed
//[c]
func handle size (m: shell)
	move (first child (m), client rect (m))
end
//[cf]
//[cf]
//[cf]
//[of]:shell class
//[of]:type
public struct shell class : local container box class
end
//[cf]
//[of]:shell class
public func shell class

	def c = the shell class
	if ~ initialized
		initialized = true
		c . copy (container box class)
		c . on size = ^handle size (shell)
		c . compute min size = ^actual compute min size (shell)
	end
	return c

end

private def initialized = false
private def the shell class : local shell class
//[cf]
//[cf]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -