TABLE OF CONTENTS


TklibAda/Ctext [ Packages ]

[ Top ] [ TklibAda ] [ Packages ]

FUNCTION

 Provides code for manipulate Tklib ctext package

SOURCE

package Tcl.Tklib.Ada.Ctext with
   SPARK_Mode
is
   pragma Elaborate_Body;

Ctext/Ctext.Tklib_Ctext [ Types ]

[ Top ] [ Ctext ] [ Types ]

FUNCTION

 This is a non-abstract type derived directly from Tk_Widget.
 Each of the derived widgets redefines the Create subprogram
 in order to create the correct type of widget.

SOURCE

   type Tklib_Ctext is new Tk_Widget with private;

Ctext/Ctext.Add_Highlight_Class [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Add highlighting class to the selected Ctext widget

SOURCE

   procedure Add_Highlight_Class
     (CtextWidget: in Tklib_Ctext; Class, Color, Keywordlist: in String) with
      Pre'Class => Class /= "" and Color /= "" and Keywordlist /= "";

PARAMETERS

 CtextWidget - Ctext widget to which a new highlighting Class will be
               added
 Class       - The name of highlighting class to add
 Color       - The name of color which will be used by the Class
 Keywordlist - List of keywords which will be included in that Class

EXAMPLE

     -- Add red highlight for some Ada keywords in class adakeywords to My_Ctext ctext
     Add_Highlight_Class(My_Ctext, "adakeywords", "red", "[list procedure function with and]");

COMMANDS

 ::ctext::addHighlightClass CtextWidget class color keywordlist

HISTORY

 8.6.7 - Added

Ctext/Ctext.Add_Highlight_Class_For_Regexp [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Add highlighting class to the selected Ctext widget.
 CtextWidget - Ctext widget to which a new highlighting Class will be
               added
 Class       - The name of highlighting class to add
 Color       - The name of color which will be used by the Class
 Pattern     - Regular expression pattern. All text parts matching it
               will be highlighted

SOURCE

   procedure Add_Highlight_Class_For_Regexp
     (CtextWidget: in Tklib_Ctext; Class, Color, Pattern: in String) with
      Pre'Class => Class /= "" and Color /= "" and Pattern /= "";

EXAMPLE

      -- -- Add yellow highlight to words which ends with my in class mycolor to My_Ctext ctext
      -- Add_Highlight_Class_For_Regexp(My_Ctext, "mycolor", "yellow", "[:alnum:]+my");

COMMANDS

 ::ctext::addHighlightClassForRegexp CtextWidget class color pattern

HISTORY

 8.6.7 - Added

Ctext/Ctext.Add_Highlight_Class_For_Special_Chars [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Add highlighting class to the selected Ctext widget.
 CtextWidget - Ctext widget to which a new highlighting Class will be
               added
 Class       - The name of highlighting class to add
 Color       - The name of color which will be used by the Class
 CharString  - Characters which will be highlighted

SOURCE

   procedure Add_Highlight_Class_For_Special_Chars
     (CtextWidget: in Tklib_Ctext; Class, Color, CharString: in String) with
      Pre'Class => Class /= "" and Color /= "" and CharString /= "";

EXAMPLE

      -- -- Add white highlight to characters p w d in class pwdcolor to My_Ctext ctext
      -- Add_Highlight_Class_For_Special_Chars(My_Ctext, "pwdcolor", "white", "pwd");

COMMANDS

 ::ctext::addHighlightClassForSpecialChars CtextWidget class color charstring

HISTORY

 8.6.7 - Added

Ctext/Ctext.Add_Highlight_Class_With_Only_Char_Start [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Add highlighting class to the selected Ctext widget.
 CtextWidget - Ctext widget to which a new highlighting Class will be
               added
 Class       - The name of highlighting class to add
 Color       - The name of color which will be used by the Class
 Char        - All words which starts with that string will be
               highlighted

SOURCE

   procedure Add_Highlight_Class_With_Only_Char_Start
     (CtextWidget: in Tklib_Ctext; Class, Color, Char: in String) with
      Pre'Class => Class /= "" and Color /= "" and Char /= "";

EXAMPLE

      -- -- Add blue highlight to words which starts with p in class pwords to My_Ctext ctext
      -- Add_Highlight_Class_With_Only_Char_Start(My_Ctext, "pwords", "blue", "p");

COMMANDS

 ::ctext::addHighlightClassWithOnlyCharStart CtextWidget class color char

HISTORY

 8.6.7 - Added

Ctext/Ctext.Append [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Append the current selection to the clipboard

SOURCE

   procedure Append(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget to which selection will be added

EXAMPLE

      -- Append current selection to My_Ctext ctext
      Append(My_Ctext);

COMMANDS

 CtextWidget append

HISTORY

 8.6.7 - Added

Ctext/Ctext.Clear_Highlight_Classes [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Remove all highlight classes from the widget

SOURCE

   procedure Clear_Highlight_Classes(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget from which highlight classes will be
               removed

EXAMPLE

   -- Remove all highlight classes from My_Ctext ctext
   Clear_Highlight_Classes(My_Ctext);

COMMANDS

 ::ctext::clearHighlightClasses CtextWidget

HISTORY

 8.6.7 - Added

Ctext/Ctext.Copy [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Call tk_textCopy for the Ctext widget

SOURCE

   procedure Copy(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget on which tk_textCopy will be called

EXAMPLE

   -- Call tk_textCopy on My_Ctext ctext
   Copy(My_Ctext);

COMMANDS

 CtextWidget copy

HISTORY

 8.6.7 - Added

Ctext/Ctext.Create_(function) [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Creates a new Tklib_Ctext in the specified interpreter.

SOURCE

   overriding function Create
     (pathName: in String; options: in String := "";
      Interp: in Tcl_Interp := Null_Interp) return Tklib_Ctext with
      Global => null;

PARAMETERS

 pathName - Tk path (starts with dot) for the widget
 options  - Options which will be passed to the widget. Default value is
            empty
 Interp   - Tcl interpreter to which the widget will be created. If null,
            the widget will be created in the "contextual" interpreter.
            Default value is null.

RESULT

 Newly created Tklib_Ctext

EXAMPLE

   -- Create a new ctext with pathname .mytext and hide line map
   My_Ctext: constant Tklib_Ctext := Create(".mytext", "-linemap 0");

SEE ALSO

 Ctext.Create_(procedure)

COMMANDS

 ctext pathName ?options?

HISTORY

 8.6.7 - Added

Ctext/Ctext.Create_(procedure) [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Creates a new Tklib_Ctext in the specified interpreter.

SOURCE

   overriding procedure Create
     (Widgt: out Tklib_Ctext; pathName: in String; options: in String := "";
      Interp: in Tcl_Interp := Null_Interp) with
      Global => null;

PARAMETERS

 Widgt    - Tklib_Ctext which will be created
 pathName - Tk path (starts with dot) for the widget
 options  - Options which will be passed to the widget. Default value is
            empty
 Interp   - Tcl interpreter to which the widget will be created. If null,
            the widget will be created in the "contextual" interpreter.
            Default value is null.

OUTPUT

 Newly created Tklib_Ctext as parameter Widgt

EXAMPLE

     -- Create ctext My_Ctext with pathname .mytext and show line map on the current Tcl interpreter
     declare
        My_Ctext: Tklib_Ctext;
     begin
        Create(My_Ctext, ".mytext", "-linemap 1");
     end;

SEE ALSO

 Ctext.Create_(function)

COMMANDS

 ctext pathName ?options?

HISTORY

 8.6.7 - Added

Ctext/Ctext.Ctext_Init [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Load package Ctext. Raise Program_Error if package can't be loaded

SOURCE

   procedure Ctext_Init(Interp: in Tcl_Interp);

PARAMETERS

 Interp: Tcl interpreter to which getstring package will be added

EXAMPLE

   -- Init ctext package on My_Interp Tcl interpreter
   Ctext_Init(My_Interp);

COMMANDS

 package require ctext

TODO

 Replace it with higher level of binding

HISTORY

 8.6.7 - Added

Ctext/Ctext.Cut [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Call tk_textCut for the Ctext widget.

SOURCE

   procedure Cut(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget on which tk_textCut will be called

EXAMPLE

   -- Call tk_textCut on My_Ctext ctext
   Cut(My_Ctext);

COMMANDS

 CtextWidget cut

HISTORY

 8.6.7 - Added

Ctext/Ctext.Delete_Highlight_Class [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Delete the selected highlight class from the widget

SOURCE

   procedure Delete_Highlight_Class
     (CtextWidget: in Tklib_Ctext; Class: in String) with
      Pre'Class => Class /= "";

PARAMETERS

 CtextWidget - Ctext widget from which the selected highlight class will
               be removed
 Class       - Name of the highlight class to remove

EXAMPLE

   -- Delete highlight class adakeywords from My_Ctext ctext
   Delete_Highlight_Class(My_Ctext, "adakeywords");

COMMANDS

 ::ctext::deleteHighlightClass CtextWidget class

HISTORY

 8.6.7 - Added

Ctext/Ctext.Disable_Comments [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Disable C comment highlighting on the selected ctext widget

SOURCE

   procedure Disable_Comments(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget on which comment highlighting will be
               disabled

EXAMPLE

      -- Disable highlight for C comments in My_Ctext ctext
      Disable_Comments(My_Ctext);

COMMANDS

 ::ctext::disableComments CtextWidget

HISTORY

 8.6.7 - Added

Ctext/Ctext.Enable_Comments [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Enable C comment highlighting on the selected ctext widget

SOURCE

   procedure Enable_Comments(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget on which comment highlighting will be
               enabled

EXAMPLE

   -- Enable highlight for C comments in My_Ctext ctext
   Enable_Comments(My_Ctext);

COMMANDS

 ::ctext::enableComments CtextWidget

HISTORY

 8.6.7 - Added

Ctext/Ctext.Fast_Delete [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Delete text range without updating the highlighting

SOURCE

   procedure Fast_Delete
     (CtextWidget: in Tklib_Ctext; Index1: in String;
      Index2: in String := "") with
      Pre'Class => Index1 /= "";

PARAMETERS

 CtextWidget - Tk_Text in which text will be deleted
 Index1      - Start index of character which will be deleted
 Index2      - End index of character before which delete will be done.
               It can be also values for another ranges of text to
               delete. If empty, delete only one character. Default
               value is empty.

EXAMPLE

   -- Delete first three characters in first row in My_Ctext ctext
   Fast_Delete(My_Ctext, "1.0", "1.2");

COMMANDS

 CtextWidget fastdelete index1 ?index2?

HISTORY

 8.6.7 - Added

Ctext/Ctext.Fast_Insert [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Insert the text to Ctext widget without updating the highlighting

SOURCE

   procedure Fast_Insert
     (CtextWidget: in Tklib_Ctext; Index, Text: in String) with
      Pre'Class => Index /= "" and Text /= "";

PARAMETERS

 CtextWidget - Tklib_Ctext to which text will be inserted
 Index       - Tklib_Ctext position on which text will be inserted.
               Lines starts from 1, characters starts from 0
 Text        - Text to insert to Tklib_Ctext widget

EXAMPLE

      -- Insert text hello world to the end of the text in My_Ctext ctext
      Fast_Insert(My_Ctext, "end", "{hello world}");

COMMANDS

 CtextWidget fastinsert index text

Ctext/Ctext.Get_Highlight_Classes [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Get the list of all highlight classes for the widget

SOURCE

   function Get_Highlight_Classes(CtextWidget: in Tklib_Ctext) return String;

PARAMETERS

 CtextWidget - Ctext widget which will be queried for classes

RESULT

 List of all highlight classes for the CtextWidget

EXAMPLE

      -- Get the highlight classes for My_Ctext ctext
      Highlight_Classes: constant String := Get_Highlight_Classes(My_Ctext);

COMMANDS

 ::ctext::getHighlightClasses CtextWidget

HISTORY

 8.6.7 - Added

Ctext/Ctext.Get_Widget [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Get the existing Tklib_Ctext widget

SOURCE

   overriding function Get_Widget
     (pathName: in String; Interp: in Tcl_Interp := Get_Context)
      return Tklib_Ctext with
      Global => null;

PARAMETERS

 pathName - Tk path (starts with dot) for the widget
 Interp   - Tcl interpreter on which the widget exists. Can be empty.
            Default value is current Tcl interpreter

RESULT

 Existing Tklib_Ctext widget

EXAMPLE

     -- Get ctext widget with name .myctext on the current Tcl interpreter
     My_Ctext: constant Tklib_Ctext := Get_Widget(".myctext");

HISTORY

 8.6.9 - Added

Ctext/Ctext.Highlight [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Highlight the text between the selected indexes

SOURCE

   procedure Highlight
     (CtextWidget: in Tklib_Ctext; StartIndex, EndIndex: in String) with
      Pre'Class => StartIndex /= "" and EndIndex /= "";

PARAMETERS

 CtextWidget - Ctext widget in which the text will be highlighted
 StartIndex  - The start index of highlighting text
 EndIndex    - The end index of highlighting text

EXAMPLE

   -- Highlight the first three characters in second line in My_Ctext ctext
   Highlight(My_Ctext, "2.0", "2.2");

COMMANDS

 CtextWidget highlight startIndex endIndex

HISTORY

 8.6.7 - Added

Ctext/Ctext.Paste [ Subprograms ]

[ Top ] [ Ctext ] [ Subprograms ]

FUNCTION

 Call tk_textPaste for the Ctext widget

SOURCE

   procedure Paste(CtextWidget: in Tklib_Ctext);

PARAMETERS

 CtextWidget - Ctext widget on which tk_textPaste will be called

EXAMPLE

      -- Call tk_textPaste on My_Ctext ctext
      Paste(My_Ctext);

COMMANDS

 CtextWidget paste

HISTORY

 8.6.7 - Added