📄 blank-box.zc
字号:
//[of]:descrption
//[c]Box filled with button face color
//[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/memory-allocator"
//[c]
import "graphics/geometry"
import "graphics/graphics"
import "user/box"
import "user/container-box"
//[c]
import "glib/glib"
import "glib/glib-object"
import "gdk/gdk"
import "gtk/gtk"
//[cf]
//[c]
//[of]:constants
//[c]Special color codes
//[c]
public equ bb button face color = 0xFF000000
//[cf]
//[of]:blank box
//[of]:type
public struct blank box : local container box
private color : color
end
//[cf]
//[of]:instance creation
//[of]:new blank box (parent box)
public func new blank box (parent: box)
equ s = sizeof local blank box
def b = allocate memory (s): blank box
initialize (b, parent)
return b
end
//[cf]
//[of]:new blank box (parent box, size)
public func new blank box (parent: box, size: int)
equ s = sizeof local blank box
def b = allocate memory (s): blank box
initialize (b, parent, size)
return b
end
//[cf]
//[cf]
//[of]:color
//[of]:set color (color)
//[c]Changes the fill color
//[c]
//[c] Color is a rgb color or a special color code:
//[c] - bb button face color
//[c]
public func set color (m: blank box, color: color)
if color (m) == color
return
end
color (m) = color
can paint (m) = (color <> bb button face color)
invalidate (m)
end
//[cf]
//[cf]
//[c]
//[of]:restricted
//[of]:initialize (parent, size)
public func initialize (m: blank box, parent: box, s: int)
initialize (super(m), parent)
class (m) = blank box class
color (m) = bb button face color
can paint (m) = false
set (min size (m), s, s)
end
//[cf]
//[of]:initialize (parent)
public func initialize (m: blank box, parent: box)
initialize (m, parent, 3)
end
//[cf]
//[c]
//[of]:handle paint (canvas, clip)
public func handle paint (m: blank box, c: canvas, clip: rectangle)
fill rectangle (c, clip, color (m))
end
//[cf]
//[c]
//[cf]
//[cf]
//[of]:blank box class
//[of]:type
public struct blank box class : local container box class
// empty
end
//[cf]
//[of]:blank box class
public func blank box class
def c = the blank box class
if ~ initialized
initialized = true
c . copy (container box class)
c . on paint = ^handle paint (blank box, canvas, rectangle)
c . accept focus = ^no (box)
end
return c
end
private def initialized = false
private def the blank box class : local blank box class
//[cf]
//[cf]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -