Unnamed Fossil Project

Artifact [35ed9e8ca8]
Login

Artifact [35ed9e8ca8]

Artifact 35ed9e8ca8692a97a8c858029014b9ee0f55720d:


#---------------------------------------------------------------------------
# ntkWidget ntkTEntry.tcl --
#
# This file contains a ntk entry commands implementation
#
# this code is derived from the tile/ttk implementation written by
# Joe English
#
# Copyright (c) 2013 by Arnulf P. Wiedemann
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: ntkTEntry.tcl
#--------------------------------------------------------------------------

namespace eval ::ntk {

::itcl::extendedclass entry {
    inherit classes::tentryBase

    private variable entryEventMask [list FocusChange]
    private variable entry

    public option [list -exportselection exportSelection] -default 1
    public option [list -font font Font] -default Vera
    public option [list -invalidcommand invalidCommand InvalidCommand] -default ""
    public option [list -justify justify Justify] -default left
    public option [list -show show Show] -default 0
    public option [list -state state State] -default normal
    public option [list -textvariable textVariable Variable] -default ""
    public option [list -validate validate Validate] -default none
    public option [list -validatecommand validateCommand ValidateCommand] -default ""
    public option [list -width width Width] -default 20
    public option [list -xscrollcommand xScrollCommand ScrollCommand] -default ""

   # EntryStyleData options:

    public option [list -foreground textColor TextColor] -default black
    public option [list -background windowColor WindowColor] -default ""
    public option [list -selectbackground windowColor WindowColor] -default "#000000"
    public option [list -selectborderwidth width Width] -default 0
    public option [list -selectforeground windowColor WindowColor] -default "#ffffff"
    public option [list -insertcolor windowColor WindowColor] -default black
    public option [list -insertwidth width Width] -default 1

    constructor {args} {}

    public method EntryBBoxCommand {args}
    public method EntryDeleteCommand {args}
    public method EntryGetCommand {args}
    public method EntryICursorCommand {args}
    public method EntryIndexCommand {args}
    public method EntryInsertCommand {args}
    public method EntrySelectionsCommand {args}
    public method EntryConfigure {recordPtr mask}
    public method CreateScrollHandle {args}
    public method EntryEventProc {args}
    public method EntryInitialize {recordPtr}
    public method EntryCleanup {args}
    public method EntryPostConfigure {args}
    public method EntryDoLayout {args}
    public method EntryDisplay {args}
}

#================================ constructor ============================
#     
#=========================================================================

::itcl::body entry::constructor {args} {

    set EntryCommands [dict create]
    dict set EntryCommands bbox EntryBBoxCommand
    dict set EntryCommands cget WidgetCget
    dict set EntryCommands configure WidgetConfigure
    dict set EntryCommands delete EntryDeleteCommand
    dict set EntryCommands get EntryGetCommand
    dict set EntryCommands icursor EntryICursorCommand
    dict set EntryCommands identify WidgetIdentify
    dict set EntryCommands index EntryIndexCommand
    dict set EntryCommands insert EntryInsertCommand
    dict set EntryCommands instate WidgetInState
    dict set EntryCommands selection EntrySelectionsCommand
    dict set EntryCommands state WidgetState

    set widgetSpec [dict create]
    dict set widgetSpec className "TEntry"
    dict set widgetSpec commands $EntryCommands
    dict set widgetSpec initializeProc EntryInitialize
    dict set widgetSpec cleanupProc EntryCleanup
    dict set widgetSpec configureProc EntryConfigure
    dict set widgetSpec postConfigureProc EntryPostConfigure
    dict set widgetSpec getLayoutProc WidgetGetLayout
    dict set widgetSpec sizeProc WidgetSize
    dict set widgetSpec layoutProc EntryDoLayout
    dict set widgetSpec displayProc EntryDisplay
    dict set core widgetSpec $widgetSpec
    
    WidgetInit $args

    dict set core optionTable -exportselection [dict create];
    dict set core optionTable -exportselection type boolean
    dict set core optionTable -exportselection clientData ""
    dict set core optionTable -exportselection typeMask ""

    dict set core optionTable -font [dict create];
    dict set core optionTable -font type font
    dict set core optionTable -font clientData ""
    dict set core optionTable -font typeMask geometryChanged

    dict set core optionTable -invalidcommand [dict create];
    dict set core optionTable -invalidcommand type string
    dict set core optionTable -invalidcommand clientData ""
    dict set core optionTable -invalidcommand typeMask ""

    dict set core optionTable -justify [dict create];
    dict set core optionTable -justify type justify
    dict set core optionTable -justify clientData ""
    dict set core optionTable -justify typeMask geometryChanged

    dict set core optionTable -show [dict create];
    dict set core optionTable -show type string
    dict set core optionTable -show clientData ""
    dict set core optionTable -show typeMask ""

    dict set core optionTable -state [dict create];
    dict set core optionTable -state type string
    dict set core optionTable -state clientData ""
    dict set core optionTable -state typeMask stateChanged

    dict set core optionTable -textvariable [dict create];
    dict set core optionTable -textvariable type string
    dict set core optionTable -textvariable clientData ""
    dict set core optionTable -textvariable typeMask textvarChanged

    set validateStrings [list all key focus focusin focusout none]
    dict set core optionTable -validate [dict create];
    dict set core optionTable -validate type string_table
    dict set core optionTable -validate clientData $validateStrings
    dict set core optionTable -validate typeMask ""

    dict set core optionTable -validatecommand [dict create];
    dict set core optionTable -validatecommand type string
    dict set core optionTable -validatecommand clientData ""
    dict set core optionTable -validatecommand typeMask ""

    dict set core optionTable -width [dict create];
    dict set core optionTable -width type int
    dict set core optionTable -width clientData ""
    dict set core optionTable -width typeMask geometryChanged

    dict set core optionTable -xscrollcommand [dict create];
    dict set core optionTable -xscrollcommand type string
    dict set core optionTable -xscrollcommand clientData ""
    dict set core optionTable -xscrollcommand typeMask scrollcmdChanged

    dict set core optionTable -foreground [dict create];
    dict set core optionTable -foreground type color
    dict set core optionTable -foreground clientData ""
    dict set core optionTable -foreground typeMask ""

    dict set core optionTable -background [dict create];
    dict set core optionTable -background type color
    dict set core optionTable -background clientData ""
    dict set core optionTable -background typeMask ""

    dict set core takeFocus 1
}

#================================ EntryBBoxCommand ============================
#     
#=========================================================================

::itcl::body entry::EntryBBoxCommand {args} {
puts stderr "EntryBBoxCommand!$args!"
}

#================================ EntryDeleteCommand ============================
#     
#=========================================================================

::itcl::body entry::EntryDeleteCommand {args} {
puts stderr "EntryDeleteCommand!$args!"
}

#================================ EntryGetCommand ============================
#     
#=========================================================================

::itcl::body entry::EntryGetCommand {args} {
puts stderr "EntryGetCommand!$args!"
}

#================================ EntryICursorCommand ============================
#     
#=========================================================================

::itcl::body entry::EntryICursorCommand {args} {
puts stderr "EntryICursorCommand!$args!"
}

#================================ EntryIndexCommand ============================
#     
#=========================================================================

::itcl::body entry::EntryIndexCommand {args} {
puts stderr "EntryIndexCommand!$args!"
}

#================================ EntryInsertCommand ============================
#     
#=========================================================================

::itcl::body entry::EntryInsertCommand {args} {
puts stderr "EntryInsertCommand!$args!"
}

#================================ EntrySelectionsCommand ============================
#     
#=========================================================================

::itcl::body entry::EntrySelectionsCommand {args} {
puts stderr "EntrySelectionsCommand!$args!"
}

#================================ EntryConfigure ============================
#     
#=========================================================================

::itcl::body entry::EntryConfigure {recordPtr mask} {
puts stderr "entry::EntryConfigure called!$mask!"
    CoreConfigure $mask
    return 1
}
 
#================================ EntryEventProc ============================
#     
#=========================================================================

::itcl::body entry::EntryEventProc {args} {
puts stderr "entry::EntryEventProc called!$args!"
}

#================================ CreateScrollHandle ============================
#     
#=========================================================================

::itcl::body entry::CreateScrollHandle {args} {
puts stderr "entry::CreateScrollHandle called!$args!"
    return ""
}

#================================ EntryInitialize ============================
#     
#=========================================================================

::itcl::body entry::EntryInitialize {recordPtr} {
#puts stderr "entry::EntryInitialize called!$recordPtr!"
    ::ntk::classes::widgetInfo::CreateEventHandler [string trimleft $this :] $entryEventMask EntryEventProc $this
    # CreateSelHandler
    # BlinkCursor
    set entry [dict create]
    dict set entry string ""
    dict set entry displayString ""
    dict set entry textVariableTrace 0
    dict set entry numBytes 0
    dict set entry numChars 0
    dict set entry xscroll ""
    dict set entry xscrollHandle [CreateScrollHandle]
    dict set entry insertPos 0
    dict set entry selectFirst -1
    dict set entry selectLast -1
}

#================================ EntryCleanup ============================
#     
#=========================================================================

::itcl::body entry::EntryCleanup {args} {
puts stderr "entry::EntryCleanup called!$args!"
}

#================================ EntryPostConfigure ============================
#     
#=========================================================================

::itcl::body entry::EntryPostConfigure {args} {
puts stderr "entry::EntryPostConfigure called!$args!"
}

#================================ EntryDoLayout ============================
#     
#=========================================================================

::itcl::body entry::EntryDoLayout {args} {
puts stderr "entry::EntryDoLayout called!$args!"
}

#================================ EntryDisplay ============================
#     
#=========================================================================

::itcl::body entry::EntryDisplay {args} {
puts stderr "entry::EntryDisplay called!$args!"
}

} ; # end namspace ::ntk::classes