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