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

📄 labeledframe.itk

📁 这是一个Linux下的集成开发环境
💻 ITK
📖 第 1 页 / 共 2 页
字号:
  _positionLabel}# -----------------------------------------------------------------------------# OPTION: -labelpos## Set the position of the label within the relief of the labelFrame frame# widget.# ----------------------------------------------------------------------------configbody iwidgets::Labeledframe::labeltext {  $itk_component(label) configure -text $itk_option(-labeltext)  _positionLabel}# -----------------------------------------------------------------------------#                            PROCS# -----------------------------------------------------------------------------# -----------------------------------------------------------------------------# PRIVATE PROC: _initTable## Initializes the _LAYOUT_TABLE common variable of the Labeledframe# class.  The initialization is performed in its own proc ( as opposed# to in the class definition ) so that the initialization occurs only# once.## _LAYOUT_TABLE common array description:#   Provides a table of the configuration option values#   used to place the label widget within the grooved relief of the labelFrame#   frame for each of the 12 possible "-labelpos" values.##   Each of the 12 rows is layed out as follows:#     {"-relx" "-rely" <rowconfigure|columnconfigure> <row/column number>}# -----------------------------------------------------------------------------body iwidgets::Labeledframe::_initTable {} {  array set _LAYOUT_TABLE {    nw-relx 0.0  nw-rely 0.0  nw-wrap 0 nw-conf rowconfigure    nw-num 0    n-relx  0.5  n-rely  0.0  n-wrap  0 n-conf  rowconfigure    n-num  0    ne-relx 1.0  ne-rely 0.0  ne-wrap 0 ne-conf rowconfigure    ne-num 0    sw-relx 0.0  sw-rely 1.0  sw-wrap 0 sw-conf rowconfigure    sw-num 2    s-relx  0.5  s-rely  1.0  s-wrap  0 s-conf  rowconfigure    s-num  2    se-relx 1.0  se-rely 1.0  se-wrap 0 se-conf rowconfigure    se-num 2    en-relx 1.0  en-rely 0.0  en-wrap 1 en-conf columnconfigure en-num 2    e-relx  1.0  e-rely  0.5  e-wrap  1 e-conf  columnconfigure e-num  2    es-relx 1.0  es-rely 1.0  es-wrap 1 es-conf columnconfigure es-num 2    wn-relx 0.0  wn-rely 0.0  wn-wrap 1 wn-conf columnconfigure wn-num 0    w-relx  0.0  w-rely  0.5  w-wrap  1 w-conf  columnconfigure w-num  0    ws-relx 0.0  ws-rely 1.0  ws-wrap 1 ws-conf columnconfigure ws-num 0    }  #  # Since this is a one time only thing, we'll redefine the proc to be empty  # afterwards so it only happens once.  #  # NOTE: Be careful to use the "body" command, or the proc will get lost!  #  itcl::body ::iwidgets::Labeledframe::_initTable {} {}}# -----------------------------------------------------------------------------#                            METHODS# -----------------------------------------------------------------------------# -----------------------------------------------------------------------------# PUBLIC METHOD:: childsite## -----------------------------------------------------------------------------body iwidgets::Labeledframe::childsite {} {  return $itk_component(childsite)}# -----------------------------------------------------------------------------# PUBLIC METHOD:: clientHandlesConfigure## -----------------------------------------------------------------------------body iwidgets::Labeledframe::clientHandlesConfigure {{yes 1}} {  if {$yes} {    set dontUpdate 1    bind $itk_component(label) <Configure> { }    return [code $this _positionLabel now]  } else {     bind $itk_component(label) <Configure> [code $this _positionLabel]    set dontUpdate 0  }}# -----------------------------------------------------------------------------# PROTECTED METHOD: _positionLabel ?when?## Places the label in the relief of the labelFrame.  If "when" is "now", the# change is applied immediately.  If it is "later" or it is not# specified, then the change is applied later, when the application# is idle.# -----------------------------------------------------------------------------body iwidgets::Labeledframe::_positionLabel {{when later}} {  if {$when == "later"} {    if {$_reposition != ""} {      after cancel $_reposition    }    set _reposition [after idle [code $this _positionLabel now]]    return  }   set pos $itk_option(-labelpos)  #  # If there is not an entry for the "relx" value associated with  # the given "-labelpos" option value, then it invalid.  #  if { [catch {set relx $_LAYOUT_TABLE($pos-relx)}] } {    error "bad labelpos option\"$itk_option(-labelpos)\": should be\                  nw, n, ne, sw, s, se, en, e, es, wn, w, or ws"  }  if {!$dontUpdate} {    update idletasks    if {[string compare $_reposition DESTRUCTOR] == 0} {      # OOPS...  We are in the process of being destroyed.  Get out of here...      debug "Stuck in _postionLabel during destruction"      return    }  }  $itk_component(label) configure -wraplength $_LAYOUT_TABLE($pos-wrap)  # If there is no text in the label, do not add it to the computation.  if {$itk_option(-labeltext) == ""} {      set minsize 0      if {[place slaves $itk_component(labelFrame)] != ""} {          place forget $itk_component(label)      }    _setMarginThickness 0  } else {    set labelWidth [winfo reqwidth $itk_component(label)]    set labelHeight [winfo reqheight $itk_component(label)]      set borderwidth $itk_option(-labelborderwidth)      set margin $itk_option(-labelmargin)      switch $pos {        nw {          set labelThickness $labelHeight          set minsize [expr $labelThickness/2.0]          set xPos [expr $minsize+$borderwidth+$margin]          set yPos -$minsize        }        n {          set labelThickness $labelHeight          set minsize [expr $labelThickness/2.0]          set xPos [expr -$labelWidth/2.0]          set yPos -$minsize        }        ne  {          set labelThickness $labelHeight          set minsize [expr $labelThickness/2.0]          set xPos [expr -($minsize+$borderwidth+$margin+$labelWidth)]          set yPos -$minsize        }        sw  {          set labelThickness $labelHeight          set minsize [expr $labelThickness/2.0]          set xPos [expr $minsize+$borderwidth+$margin]          set yPos -$minsize        }        s {          set labelThickness $labelHeight          set minsize [expr $labelThickness/2.0]          set xPos [expr -$labelWidth/2.0]          set yPos [expr -$labelHeight/2.0]        }        se {          set labelThickness $labelHeight          set minsize [expr $labelThickness/2.0]          set xPos [expr -($minsize+$borderwidth+$margin+$labelWidth)]          set yPos [expr -$labelHeight/2.0]        }        wn {          set labelThickness $labelWidth          set minsize [expr $labelThickness/2.0]          set xPos -$minsize          set yPos [expr $minsize+$margin+$borderwidth]        }        w {          set labelThickness $labelWidth          set minsize [expr $labelThickness/2.0]          set xPos -$minsize          set yPos [expr -($labelHeight/2.0)]        }        ws {          set labelThickness $labelWidth          set minsize [expr $labelThickness/2.0]          set xPos -$minsize          set yPos [expr -($minsize+$borderwidth+$margin+$labelHeight)]        }        en {          set labelThickness $labelWidth          set minsize [expr $labelThickness/2.0]          set xPos -$minsize          set yPos [expr $minsize+$borderwidth+$margin]        }        e {          set labelThickness $labelWidth          set minsize [expr $labelThickness/2.0]          set xPos -$minsize          set yPos [expr -($labelHeight/2.0)]        }        es {          set labelThickness $labelWidth          set minsize [expr $labelThickness/2.0]          set xPos -$minsize          set yPos [expr -($minsize+$borderwidth+$margin+$labelHeight)]        }      }      _setMarginThickness $minsize      place $itk_component(label) \        -relx $_LAYOUT_TABLE($pos-relx) -x $xPos \        -rely $_LAYOUT_TABLE($pos-rely) -y $yPos \        -anchor nw  }  set what $_LAYOUT_TABLE($pos-conf)  set number $_LAYOUT_TABLE($pos-num)  grid $what $itk_component(labelFrame) $number -minsize $minsize  set _reposition ""}# -----------------------------------------------------------------------------# PROTECTED METHOD: _collapseMargin## Resets the "-minsize" of all rows and columns of the labelFrame's grid# used to set the label margin to 0# -----------------------------------------------------------------------------body iwidgets::Labeledframe::_collapseMargin {} {  grid columnconfigure $itk_component(labelFrame) 0 -minsize 0  grid columnconfigure $itk_component(labelFrame) 2 -minsize 0  grid rowconfigure $itk_component(labelFrame) 0 -minsize 0  grid rowconfigure $itk_component(labelFrame) 2 -minsize 0}# -----------------------------------------------------------------------------# PROTECTED METHOD: _setMarginThickness## Set the margin thickness ( i.e. the hidden "-highlightthickness"# of the labelFrame ) to the input value.## -----------------------------------------------------------------------------body iwidgets::Labeledframe::_setMarginThickness {value} {  $itk_component(labelFrame) configure -highlightthickness $value}

⌨️ 快捷键说明

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