📄 stacking-box.zc
字号:
//[of]:description
//[c]Superposition of boxes, with only one visible
//[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
//[c]
import "base/types"
import "base/memory-allocator"
import "graphics/geometry"
import "graphics/graphics"
import "user/box"
import "user/container-box"
//[cf]
//[c]
//[of]:stacking box
//[of]:type
public struct stacking box : local container box
// empty
end
//[cf]
//[of]:instance creation
//[of]:new stacking box (parent box)
public func new stacking box (parent: box)
equ s = sizeof local stacking box
def b = allocate memory (s): stacking box
initialize (b, parent)
return b
end
//[cf]
//[cf]
//[of]:visibility
//[of]:show (child box)
//[c]Shows the given child box
//[c]
//[c] All other children are hidden.
//[c]
public func show (m: stacking box, c: box)
show (c)
each child (m) ? child
if c <> child
hide (child)
end
end
end
//[cf]
//[cf]
//[c]
//[of]:restricted
//[of]:initialize (parent box)
public func initialize (m: stacking box, parent: box)
initialize (super (m), parent)
class (m) = stacking box class
end
//[cf]
//[cf]
//[cf]
//[of]:stacking box class
//[of]:type
public struct stacking box class : local container box class
// empty
end
//[cf]
//[of]:stacking box class
public func stacking box class
def c = the stacking box class
if ~ initialized
initialized = true
c . copy (container box class)
c . compute min size = ^min size of union (box)
c . on size = ^adjust to parent (box)
c . on focus = ^focus to first visible (box, event)
c . adjust = ^adjust to parent (box)
end
return c
end
private def initialized = false
private def the stacking box class : local stacking box class
//[cf]
//[cf]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -