1# unsupported.tcl -- 2# 3# Commands provided by Tk without official support. Use them at your 4# own risk. They may change or go away without notice. 5# 6# RCS: @(#) $Id: unsupported.tcl,v 1.4 2002/07/17 16:51:53 rmax Exp $ 7# 8# See the file "license.terms" for information on usage and redistribution 9# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 10 11# ---------------------------------------------------------------------- 12# Unsupported compatibility interface for folks accessing Tk's private 13# commands and variable against recommended usage. 14# ---------------------------------------------------------------------- 15 16namespace eval ::tk::unsupported { 17 18 # Map from the old global names of Tk private commands to their 19 # new namespace-encapsulated names. 20 21 variable PrivateCommands 22 array set PrivateCommands { 23 tkButtonAutoInvoke ::tk::ButtonAutoInvoke 24 tkButtonDown ::tk::ButtonDown 25 tkButtonEnter ::tk::ButtonEnter 26 tkButtonInvoke ::tk::ButtonInvoke 27 tkButtonLeave ::tk::ButtonLeave 28 tkButtonUp ::tk::ButtonUp 29 tkCancelRepeat ::tk::CancelRepeat 30 tkCheckRadioDown ::tk::CheckRadioDown 31 tkCheckRadioEnter ::tk::CheckRadioEnter 32 tkCheckRadioInvoke ::tk::CheckRadioInvoke 33 tkColorDialog ::tk::dialog::color:: 34 tkColorDialog_BuildDialog ::tk::dialog::color::BuildDialog 35 tkColorDialog_CancelCmd ::tk::dialog::color::CancelCmd 36 tkColorDialog_Config ::tk::dialog::color::Config 37 tkColorDialog_CreateSelector ::tk::dialog::color::CreateSelector 38 tkColorDialog_DrawColorScale ::tk::dialog::color::DrawColorScale 39 tkColorDialog_EnterColorBar ::tk::dialog::color::EnterColorBar 40 tkColorDialog_InitValues ::tk::dialog::color::InitValues 41 tkColorDialog_HandleRGBEntry ::tk::dialog::color::HandleRGBEntry 42 tkColorDialog_HandleSelEntry ::tk::dialog::color::HandleSelEntry 43 tkColorDialog_LeaveColorBar ::tk::dialog::color::LeaveColorBar 44 tkColorDialog_MoveSelector ::tk::dialog::color::MoveSelector 45 tkColorDialog_OkCmd ::tk::dialog::color::OkCmd 46 tkColorDialog_RedrawColorBars ::tk::dialog::color::RedrawColorBars 47 tkColorDialog_RedrawFinalColor ::tk::dialog::color::RedrawFinalColor 48 tkColorDialog_ReleaseMouse ::tk::dialog::color::ReleaseMouse 49 tkColorDialog_ResizeColorBars ::tk::dialog::color::ResizeColorBars 50 tkColorDialog_RgbToX ::tk::dialog::color::RgbToX 51 tkColorDialog_SetRGBValue ::tk::dialog::color::SetRGBValue 52 tkColorDialog_StartMove ::tk::dialog::color::StartMove 53 tkColorDialog_XToRgb ::tk::dialog::color::XToRGB 54 tkConsoleAbout ::tk::ConsoleAbout 55 tkConsoleBind ::tk::ConsoleBind 56 tkConsoleExit ::tk::ConsoleExit 57 tkConsoleHistory ::tk::ConsoleHistory 58 tkConsoleInit ::tk::ConsoleInit 59 tkConsoleInsert ::tk::ConsoleInsert 60 tkConsoleInvoke ::tk::ConsoleInvoke 61 tkConsoleOutput ::tk::ConsoleOutput 62 tkConsolePrompt ::tk::ConsolePrompt 63 tkConsoleSource ::tk::ConsoleSource 64 tkDarken ::tk::Darken 65 tkEntryAutoScan ::tk::EntryAutoScan 66 tkEntryBackspace ::tk::EntryBackspace 67 tkEntryButton1 ::tk::EntryButton1 68 tkEntryClosestGap ::tk::EntryClosestGap 69 tkEntryGetSelection ::tk::EntryGetSelection 70 tkEntryInsert ::tk::EntryInsert 71 tkEntryKeySelect ::tk::EntryKeySelect 72 tkEntryMouseSelect ::tk::EntryMouseSelect 73 tkEntryNextWord ::tk::EntryNextWord 74 tkEntryPaste ::tk::EntryPaste 75 tkEntryPreviousWord ::tk::EntryPreviousWord 76 tkEntrySeeInsert ::tk::EntrySeeInsert 77 tkEntrySetCursor ::tk::EntrySetCursor 78 tkEntryTranspose ::tk::EntryTranspose 79 tkEventMotifBindings ::tk::EventMotifBindings 80 tkFDGetFileTypes ::tk::FDGetFileTypes 81 tkFirstMenu ::tk::FirstMenu 82 tkFocusGroup_BindIn ::tk::FocusGroup_BindIn 83 tkFocusGroup_BindOut ::tk::FocusGroup_BindOut 84 tkFocusGroup_Create ::tk::FocusGroup_Create 85 tkFocusGroup_Destroy ::tk::FocusGroup_Destroy 86 tkFocusGroup_In ::tk::FocusGroup_In 87 tkFocusGroup_Out ::tk::FocusGroup_Out 88 tkFocusOK ::tk::FocusOK 89 tkGenerateMenuSelect ::tk::GenerateMenuSelect 90 tkIconList ::tk::IconList 91 tkIconList_Add ::tk::IconList_Add 92 tkIconList_Arrange ::tk::IconList_Arrange 93 tkIconList_AutoScan ::tk::IconList_AutoScan 94 tkIconList_Btn1 ::tk::IconList_Btn1 95 tkIconList_Config ::tk::IconList_Config 96 tkIconList_Create ::tk::IconList_Create 97 tkIconList_CtrlBtn1 ::tk::IconList_CtrlBtn1 98 tkIconList_Curselection ::tk::IconList_Curselection 99 tkIconList_DeleteAll ::tk::IconList_DeleteAll 100 tkIconList_Double1 ::tk::IconList_Double1 101 tkIconList_DrawSelection ::tk::IconList_DrawSelection 102 tkIconList_FocusIn ::tk::IconList_FocusIn 103 tkIconList_FocusOut ::tk::IconList_FocusOut 104 tkIconList_Get ::tk::IconList_Get 105 tkIconList_Goto ::tk::IconList_Goto 106 tkIconList_Index ::tk::IconList_Index 107 tkIconList_Invoke ::tk::IconList_Invoke 108 tkIconList_KeyPress ::tk::IconList_KeyPress 109 tkIconList_Leave1 ::tk::IconList_Leave1 110 tkIconList_LeftRight ::tk::IconList_LeftRight 111 tkIconList_Motion1 ::tk::IconList_Motion1 112 tkIconList_Reset ::tk::IconList_Reset 113 tkIconList_ReturnKey ::tk::IconList_ReturnKey 114 tkIconList_See ::tk::IconList_See 115 tkIconList_Select ::tk::IconList_Select 116 tkIconList_Selection ::tk::IconList_Selection 117 tkIconList_ShiftBtn1 ::tk::IconList_ShiftBtn1 118 tkIconList_UpDown ::tk::IconList_UpDown 119 tkListbox ::tk::Listbox 120 tkListboxAutoScan ::tk::ListboxAutoScan 121 tkListboxBeginExtend ::tk::ListboxBeginExtend 122 tkListboxBeginSelect ::tk::ListboxBeginSelect 123 tkListboxBeginToggle ::tk::ListboxBeginToggle 124 tkListboxCancel ::tk::ListboxCancel 125 tkListboxDataExtend ::tk::ListboxDataExtend 126 tkListboxExtendUpDown ::tk::ListboxExtendUpDown 127 tkListboxKeyAccel_Goto ::tk::ListboxKeyAccel_Goto 128 tkListboxKeyAccel_Key ::tk::ListboxKeyAccel_Key 129 tkListboxKeyAccel_Reset ::tk::ListboxKeyAccel_Reset 130 tkListboxKeyAccel_Set ::tk::ListboxKeyAccel_Set 131 tkListboxKeyAccel_Unset ::tk::ListboxKeyAccel_Unxet 132 tkListboxMotion ::tk::ListboxMotion 133 tkListboxSelectAll ::tk::ListboxSelectAll 134 tkListboxUpDown ::tk::ListboxUpDown 135 tkListboxBeginToggle ::tk::ListboxBeginToggle 136 tkMbButtonUp ::tk::MbButtonUp 137 tkMbEnter ::tk::MbEnter 138 tkMbLeave ::tk::MbLeave 139 tkMbMotion ::tk::MbMotion 140 tkMbPost ::tk::MbPost 141 tkMenuButtonDown ::tk::MenuButtonDown 142 tkMenuDownArrow ::tk::MenuDownArrow 143 tkMenuDup ::tk::MenuDup 144 tkMenuEscape ::tk::MenuEscape 145 tkMenuFind ::tk::MenuFind 146 tkMenuFindName ::tk::MenuFindName 147 tkMenuFirstEntry ::tk::MenuFirstEntry 148 tkMenuInvoke ::tk::MenuInvoke 149 tkMenuLeave ::tk::MenuLeave 150 tkMenuLeftArrow ::tk::MenuLeftArrow 151 tkMenuMotion ::tk::MenuMotion 152 tkMenuNextEntry ::tk::MenuNextEntry 153 tkMenuNextMenu ::tk::MenuNextMenu 154 tkMenuRightArrow ::tk::MenuRightArrow 155 tkMenuUnpost ::tk::MenuUnpost 156 tkMenuUpArrow ::tk::MenuUpArrow 157 tkMessageBox ::tk::MessageBox 158 tkMotifFDialog ::tk::MotifFDialog 159 tkMotifFDialog_ActivateDList ::tk::MotifFDialog_ActivateDList 160 tkMotifFDialog_ActivateFList ::tk::MotifFDialog_ActivateFList 161 tkMotifFDialog_ActivateFEnt ::tk::MotifFDialog_ActivateFEnt 162 tkMotifFDialog_ActivateSEnt ::tk::MotifFDialog_ActivateSEnt 163 tkMotifFDialog ::tk::MotifFDialog 164 tkMotifFDialog_BrowseDList ::tk::MotifFDialog_BrowseDList 165 tkMotifFDialog_BrowseFList ::tk::MotifFDialog_BrowseFList 166 tkMotifFDialog_BuildUI ::tk::MotifFDialog_BuildUI 167 tkMotifFDialog_CancelCmd ::tk::MotifFDialog_CancelCmd 168 tkMotifFDialog_Config ::tk::MotifFDialog_Config 169 tkMotifFDialog_Create ::tk::MotifFDialog_Create 170 tkMotifFDialog_FileTypes ::tk::MotifFDialog_FileTypes 171 tkMotifFDialog_FilterCmd ::tk::MotifFDialog_FilterCmd 172 tkMotifFDialog_InterpFilter ::tk::MotifFDialog_InterpFilter 173 tkMotifFDialog_LoadFiles ::tk::MotifFDialog_LoadFiles 174 tkMotifFDialog_MakeSList ::tk::MotifFDialog_MakeSList 175 tkMotifFDialog_OkCmd ::tk::MotifFDialog_OkCmd 176 tkMotifFDialog_SetFilter ::tk::MotifFDialog_SetFilter 177 tkMotifFDialog_SetListMode ::tk::MotifFDialog_SetListMode 178 tkMotifFDialog_Update ::tk::MotifFDialog_Update 179 tkPostOverPoint ::tk::PostOverPoint 180 tkRecolorTree ::tk::RecolorTree 181 tkRestoreOldGrab ::tk::RestoreOldGrab 182 tkSaveGrabInfo ::tk::SaveGrabInfo 183 tkScaleActivate ::tk::ScaleActivate 184 tkScaleButtonDown ::tk::ScaleButtonDown 185 tkScaleButton2Down ::tk::ScaleButton2Down 186 tkScaleControlPress ::tk::ScaleControlPress 187 tkScaleDrag ::tk::ScaleDrag 188 tkScaleEndDrag ::tk::ScaleEndDrag 189 tkScaleIncrement ::tk::ScaleIncrement 190 tkScreenChanged ::tk::ScreenChanged 191 tkScrollButtonDown ::tk::ScrollButtonDown 192 tkScrollButton2Down ::tk::ScrollButton2Down 193 tkScrollButtonDrag ::tk::ScrollButtonDrag 194 tkScrollButtonUp ::tk::ScrollButtonUp 195 tkScrollByPages ::tk::ScrollByPages 196 tkScrollByUnits ::tk::ScrollByUnits 197 tkScrollEndDrag ::tk::ScrollEndDrag 198 tkScrollSelect ::tk::ScrollSelect 199 tkScrollStartDrag ::tk::ScrollStartDrag 200 tkScrollTopBottom ::tk::ScrollTopBottom 201 tkScrollToPos ::tk::ScrollToPos 202 tkTabToWindow ::tk::TabToWindow 203 tkTearOffMenu ::tk::TearOffMenu 204 tkTextAutoScan ::tk::TextAutoScan 205 tkTextButton1 ::tk::TextButton1 206 tkTextClosestGap ::tk::TextClosestGap 207 tkTextInsert ::tk::TextInsert 208 tkTextKeyExtend ::tk::TextKeyExtend 209 tkTextKeySelect ::tk::TextKeySelect 210 tkTextNextPara ::tk::TextNextPara 211 tkTextNextPos ::tk::TextNextPos 212 tkTextNextWord ::tk::TextNextWord 213 tkTextPaste ::tk::TextPaste 214 tkTextPrevPara ::tk::TextPrevPara 215 tkTextPrevPos ::tk::TextPrevPos 216 tkTextPrevWord ::tk::TextPrevWord 217 tkTextResetAnchor ::tk::TextResetAnchor 218 tkTextScrollPages ::tk::TextScrollPages 219 tkTextSelectTo ::tk::TextSelectTo 220 tkTextSetCursor ::tk::TextSetCursor 221 tkTextTranspose ::tk::TextTranspose 222 tkTextUpDownLine ::tk::TextUpDownLine 223 tkTraverseToMenu ::tk::TraverseToMenu 224 tkTraverseWithinMenu ::tk::TraverseWithinMenu 225 unsupported1 ::tk::unsupported::MacWindowStyle 226 } 227 228 # Map from the old global names of Tk private variable to their 229 # new namespace-encapsulated names. 230 231 variable PrivateVariables 232 array set PrivateVariables { 233 droped_to_start ::tk::mac::Droped_to_start 234 histNum ::tk::HistNum 235 stub_location ::tk::mac::Stub_location 236 tkFocusIn ::tk::FocusIn 237 tkFocusOut ::tk::FocusOut 238 tkPalette ::tk::Palette 239 tkPriv ::tk::Priv 240 tkPrivMsgBox ::tk::PrivMsgBox 241 } 242} 243 244# ::tk::unsupported::ExposePrivateCommand -- 245# 246# Expose one of Tk's private commands to be visible under its 247# old global name 248# 249# Arguments: 250# cmd Global name by which the command was once known, 251# or a glob-style pattern. 252# 253# Results: 254# None. 255# 256# Side effects: 257# The old command name in the global namespace is aliased to the 258# new private name. 259 260proc ::tk::unsupported::ExposePrivateCommand {cmd} { 261 variable PrivateCommands 262 set cmds [array get PrivateCommands $cmd] 263 if {[llength $cmds] == 0} { 264 return -code error "No compatibility support for \[$cmd]" 265 } 266 foreach {old new} $cmds { 267 namespace eval :: [list interp alias {} $old {}] $new 268 } 269} 270 271# ::tk::unsupported::ExposePrivateVariable -- 272# 273# Expose one of Tk's private variables to be visible under its 274# old global name 275# 276# Arguments: 277# var Global name by which the variable was once known, 278# or a glob-style pattern. 279# 280# Results: 281# None. 282# 283# Side effects: 284# The old variable name in the global namespace is aliased to the 285# new private name. 286 287proc ::tk::unsupported::ExposePrivateVariable {var} { 288 variable PrivateVariables 289 set vars [array get PrivateVariables $var] 290 if {[llength $vars] == 0} { 291 return -code error "No compatibility support for \$$var" 292 } 293 namespace eval ::tk::mac {} 294 foreach {old new} $vars { 295 namespace eval :: [list upvar "#0" $new $old] 296 } 297} 298