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

📄 hierarchy.itk

📁 linux 下的源代码分析阅读器 red hat公司新版
💻 ITK
📖 第 1 页 / 共 5 页
字号:
#   where uid is a unique id and primary key for the hierarchy entry## Should the unique requirement pose a problem, the list returned# can take on another more extended form which enables the # association of text to be displayed with the uids.  The uid must# still be unique, but the text does not have to obey the unique# rule.  In addition, the format also allows the specification of# additional tags to be used on the same entry in the hierarchy# as the uid and additional icons to be displayed just before# the node.  The tags and icons are considered to be the property of# the user in that the hierarchy widget will not depend on any of # their values.##   {{uid [text [tags [icons]]]} {uid [text [tags [icons]]]} ...}##   where uid is a unique id and primary key for the hierarchy entry#         text is the text to be displayed for this uid#         tags is a list of user tags to be applied to the entry#         icons is a list of icons to be displayed in front of the text## The hierarchy widget does a look ahead from each node to determine# if the node has a children.  This can be cost some performace with# large hierarchies.  User's can avoid this by providing a hint in# the user tags.  A tag of "leaf" or "branch" tells the hierarchy# widget the information it needs to know thereby avoiding the look# ahead operation.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::querycommand {    clear    draw -eventually}# ------------------------------------------------------------------# OPTION: -selectcommand## Command executed to select an item in the list.  If this command# contains "%n", it is replaced with the name of the selected node.  # If it contains a "%s", it is replaced with a boolean indicator of # the node's current selection status, where a value of 1 denotes# that the node is currently selected and 0 that it is not.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::selectcommand {}# ------------------------------------------------------------------# OPTION: -dblclickcommand## Command executed to double click an item in the list.  If this command# contains "%n", it is replaced with the name of the selected node.  # If it contains a "%s", it is replaced with a boolean indicator of # the node's current selection status, where a value of 1 denotes# that the node is currently selected and 0 that it is not.## Douglas R. Howard, Jr.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::dblclickcommand {}# ------------------------------------------------------------------# OPTION: -iconcommand## Command executed upon selection of user icons.  If this command # contains "%n", it is replaced with the name of the node the icon# belongs to.  Should it contain "%i" then the icon name is # substituted.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::iconcommand {}# ------------------------------------------------------------------# OPTION: -icondblcommand## Command executed upon double selection of user icons.  If this command # contains "%n", it is replaced with the name of the node the icon# belongs to.  Should it contain "%i" then the icon name is # substituted.## Douglas R. Howard, Jr.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::icondblcommand {}# ------------------------------------------------------------------# OPTION: -imagecommand## Command executed upon selection of image icons.  If this command # contains "%n", it is replaced with the name of the node the icon# belongs to.  Should it contain "%i" then the icon name is # substituted.## Douglas R. Howard, Jr.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::imagecommand {}# ------------------------------------------------------------------# OPTION: -imagedblcommand## Command executed upon double selection of user icons.  If this command # contains "%n", it is replaced with the name of the node the icon# belongs to.## Douglas R. Howard, Jr.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::imagedblcommand {}# ------------------------------------------------------------------# OPTION: -alwaysquery## Boolean flag which tells the hierarchy widget weather or not# each refresh of the display should be via a new query using# the -querycommand option or use the values previous found the# last time the query was made.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::alwaysquery {}# ------------------------------------------------------------------# OPTION: -filter## When true only the branch nodes and selected items are displayed.# This gives a compact view of important items.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::filter {    switch -- $itk_option(-filter) {	1 - true - yes - on {	    set newCode {set display [info exists _selected($child)]}	}	0 - false - no - off {	    set newCode {set display 1}	}	default {	    error "bad filter option \"$itk_option(-filter)\":\                   should be boolean"	}    }    if {$newCode != $_filterCode} {	set _filterCode $newCode	draw -eventually    }}# ------------------------------------------------------------------# OPTION: -expanded## When true, the hierarchy will be completely expanded when it# is first displayed.  A fresh display can be triggered by# resetting the -querycommand option.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::expanded {    switch -- $itk_option(-expanded) {	1 - true - yes - on {	    ;# okay	}	0 - false - no - off {	    ;# okay	}	default {	    error "bad expanded option \"$itk_option(-expanded)\":\                   should be boolean"	}    }}    # ------------------------------------------------------------------# OPTION: -openicon## Specifies the open icon image to be used in the hierarchy.  Should# one not be provided, then one will be generated, pixmap if # possible, bitmap otherwise.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::openicon {    if {$itk_option(-openicon) == {}} {	if {[lsearch [image names] openFolder] == -1} {	    if {[lsearch [image types] pixmap] != -1} {		image create pixmap openFolder -data {		    /* XPM */		    static char * dir_opened [] = {			"16 16 4 1",			/* colors */			". c grey85 m white g4 grey90",			"b c black  m black g4 black",			"y c yellow m white g4 grey80",			"g c grey70 m white g4 grey70",			/* pixels */			"................",			"................",			"................",			"..bbbb..........",			".bggggb.........",			"bggggggbbbbbbb..",			"bggggggggggggb..",			"bgbbbbbbbbbbbbbb",			"bgbyyyyyyyyyyybb",			"bbyyyyyyyyyyyyb.",			"bbyyyyyyyyyyybb.",			"byyyyyyyyyyyyb..",			"bbbbbbbbbbbbbb..",			"................",			"................",			"................"};		}	    } else {		image create bitmap openFolder -data {		    #define open_width 16		    #define open_height 16		    static char open_bits[] = {			0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x42, 0x00, 			0x81, 0x3f, 0x01, 0x20, 0xf9, 0xff, 0x0d, 0xc0, 			0x07, 0x40, 0x03, 0x60, 0x01, 0x20, 0x01, 0x30,			0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};		}	    }	}	set itk_option(-openicon) openFolder    } else {	if {[lsearch [image names] $itk_option(-openicon)] == -1} {	    error "bad openicon option \"$itk_option(-openicon)\":\                   should be an existing image"	}    }}# ------------------------------------------------------------------# OPTION: -closedicon## Specifies the closed icon image to be used in the hierarchy.  # Should one not be provided, then one will be generated, pixmap if # possible, bitmap otherwise.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::closedicon {    if {$itk_option(-closedicon) == {}} {	if {[lsearch [image names] closedFolder] == -1} {	    if {[lsearch [image types] pixmap] != -1} {		image create pixmap closedFolder -data {		    /* XPM */		    static char *dir_closed[] = {			"16 16 3 1",			". c grey85 m white g4 grey90",			"b c black  m black g4 black",			"y c yellow m white g4 grey80",			"................",			"................",			"................",			"..bbbb..........",			".byyyyb.........",			"bbbbbbbbbbbbbb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"bbbbbbbbbbbbbb..",			"................",			"................",			"................"};			}	    } else {		image create bitmap closedFolder -data {		    #define closed_width 16		    #define closed_height 16		    static char closed_bits[] = {			0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x84, 0x00, 			0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 			0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,			0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};		}	    }	}	set itk_option(-closedicon) closedFolder    } else {	if {[lsearch [image names] $itk_option(-closedicon)] == -1} {	    error "bad closedicon option \"$itk_option(-closedicon)\":\                   should be an existing image"	}    }}# ------------------------------------------------------------------# OPTION: -nodeicon## Specifies the node icon image to be used in the hierarchy.  Should # one not be provided, then one will be generated, pixmap if # possible, bitmap otherwise.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::nodeicon {    if {$itk_option(-nodeicon) == {}} {	if {[lsearch [image names] nodeFolder] == -1} {	    if {[lsearch [image types] pixmap] != -1} {		image create pixmap nodeFolder -data {		    /* XPM */		    static char *dir_node[] = {			"16 16 3 1",			". c grey85 m white g4 grey90",			"b c black  m black g4 black",			"y c yellow m white g4 grey80",			"................",			"................",			"................",			"...bbbbbbbbbbb..",			"..bybyyyyyyyyb..",			".byybyyyyyyyyb..",			"byyybyyyyyyyyb..",			"bbbbbyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"byyyyyyyyyyyyb..",			"bbbbbbbbbbbbbb..",			"................",			"................",			"................"};			}	    } else {		image create bitmap nodeFolder -data {		    #define node_width 16		    #define node_height 16		    static char node_bits[] = {			0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x50, 0x40, 			0x48, 0x40, 0x44, 0x40, 0x42, 0x40, 0x7e, 0x40, 			0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,			0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};		}	    }	}	set itk_option(-nodeicon) nodeFolder    } else {	if {[lsearch [image names] $itk_option(-nodeicon)] == -1} {	    error "bad nodeicon option \"$itk_option(-nodeicon)\":\                   should be an existing image"	}    }}# ------------------------------------------------------------------# OPTION: -width## Specifies the width of the hierarchy widget as an entire unit.# The value may be specified in any of the forms acceptable to # Tk_GetPixels.  Any additional space needed to display the other# components such as labels, margins, and scrollbars force the text# to be compressed.  A value of zero along with the same value for # the height causes the value given for the visibleitems option # to be applied which administers geometry constraints in a different# manner.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::width {    if {$itk_option(-width) != 0} {	set shell [lindex [grid info $itk_component(clipper)] 1]	#	# Due to a bug in the tk4.2 grid, we have to check the 	# propagation before setting it.  Setting it to the same	# value it already is will cause it to toggle.	#	if {[grid propagate $shell]} {	    grid propagate $shell no	}		$itk_component(list) configure -width 1	$shell configure \		-width [winfo pixels $shell $itk_option(-width)]     } else {	configure -visibleitems $itk_option(-visibleitems)    }}# ------------------------------------------------------------------# OPTION: -height## Specifies the height of the hierarchy widget as an entire unit.# The value may be specified in any of the forms acceptable to # Tk_GetPixels.  Any additional space needed to display the other# components such as labels, margins, and scrollbars force the text# to be compressed.  A value of zero along with the same value for # the width causes the value given for the visibleitems option # to be applied which administers geometry constraints in a different# manner.# ------------------------------------------------------------------configbody iwidgets::Hierarchy::height {    if {$itk_option(-height) != 0} {	set shell [lindex [grid info $itk_component(clipper)] 1]	#

⌨️ 快捷键说明

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