class_docstr: Control that displays a list of (Token, text) tuples.
  (It's mostly optimized for rather small widgets, like toolbars, menus, etc...)
  
  Mouse support:
  
      The list of tokens can also contain tuples of three items, looking like:
      (Token, text, handler). When mouse support is enabled and the user
      clicks on this token, then the given handler is called. That handler
      should accept two inputs: (CommandLineInterface, MouseEvent) and it
      should either handle the event or return `NotImplemented` in case we
      want the containing Window to handle this event.
  
  :param get_tokens: Callable that takes a `CommandLineInterface` instance
      and returns the list of (Token, text) tuples to be displayed right now.
  :param default_char: default :class:`.Char` (character and Token) to use
      for the background when there is more space available than `get_tokens`
      returns.
  :param get_default_char: Like `default_char`, but this is a callable that
      takes a :class:`prompt_toolkit.interface.CommandLineInterface` and
      returns a :class:`.Char` instance.
  :param has_focus: `bool` or `CLIFilter`, when this evaluates to `True`,
      this UI control will take the focus. The cursor will be shown in the
      upper left corner of this control, unless `get_token` returns a
      ``Token.SetCursorPosition`` token somewhere in the token list, then the
      cursor will be shown there.
class_docstr_tok: ["Control","that","displays","a","list","of","(","Token",",","text",")","tuples",".","(","It","'s","mostly","optimized","for","rather","small","widgets",",","like","toolbars",",","menus",",","etc","...",")","Mouse","support",":","The","list","of","tokens","can","also","contain","tuples","of","three","items",",","looking","like",":","(","Token",",","text",",","handler",")",".","When","mouse","support","is","enabled","and","the","user","clicks","on","this","token",",","then","the","given","handler","is","called",".","That","handler","should","accept","two","inputs",":","(","CommandLineInterface",",","MouseEvent",")","and","it","should","either","handle","the","event","or","return","`","NotImplemented","`","in","case","we","want","the","containing","Window","to","handle","this","event",".",":","param","get_tokens",":","Callable","that","takes","a","`","CommandLineInterface","`","instance","and","returns","the","list","of","(","Token",",","text",")","tuples","to","be","displayed","right","now",".",":","param","default_char",":","default",":","class",":","`",".Char","`","(","character","and","Token",")","to","use","for","the","background","when","there","is","more","space","available","than","`","get_tokens","`","returns",".",":","param","get_default_char",":","Like","`","default_char","`",",","but","this","is","a","callable","that","takes","a",":","class",":","`","prompt_toolkit.interface.CommandLineInterface","`","and","returns","a",":","class",":","`",".Char","`","instance",".",":","param","has_focus",":","`","bool","`","or","`","CLIFilter","`",",","when","this","evaluates","to","`","True","`",",","this","UI","control","will","take","the","focus",".","The","cursor","will","be","shown","in","the","upper","left","corner","of","this","control",",","unless","`","get_token","`","returns","a","``","Token.SetCursorPosition","``","token","somewhere","in","the","token","list",",","then","the","cursor","will","be","shown","there","."]
code: def create_content(self, cli, width, height):
      # Get tokens
      tokens_with_mouse_handlers = self._get_tokens_cached(cli)
  
      default_char = self.get_default_char(cli)
  
      # Wrap/align right/center parameters.
      right = self.align_right(cli)
      center = self.align_center(cli)
  
      def process_line(line):
          "Center or right align a single line."
          used_width = token_list_width(line)
          padding = width - used_width
          if center:
              padding = int(padding / 2)
          return [
              (default_char.token, default_char.char * padding)
          ] + line
  
      if right or center:
          token_lines_with_mouse_handlers = []
  
          for line in split_lines(tokens_with_mouse_handlers):
              token_lines_with_mouse_handlers.append(process_line(line))
      else:
          token_lines_with_mouse_handlers = list(
              split_lines(tokens_with_mouse_handlers)
          )
  
      # Strip mouse handlers from tokens.
      token_lines = [
          [tuple(item[:2]) for item in line]
          for line in token_lines_with_mouse_handlers
      ]
  
      # Keep track of the tokens with mouse handler, for later use in
      # `mouse_handler`.
      self._tokens = tokens_with_mouse_handlers
  
      # If there is a `Token.SetCursorPosition` in the token list, set the
      # cursor position here.
      def get_cursor_position():
          SetCursorPosition = Token.SetCursorPosition
  
          for y, line in enumerate(token_lines):
              x = 0
              for token, text in line:
                  if token == SetCursorPosition:
                      return Point(x=x, y=y)
                  x += len(text)
          return None
  
      # Create content, or take it from the cache.
      key = (
          default_char.char,
          default_char.token,
          tuple(tokens_with_mouse_handlers),
          width,
          right,
          center,
      )
  
      def get_content():
          return UIContent(
              get_line=lambda i: token_lines[i],
              line_count=len(token_lines),
              default_char=default_char,
              cursor_position=get_cursor_position(),
          )
  
      return self._content_cache.get(key, get_content)
  
imports: from __future__ import unicode_literals
  from abc import ABCMeta, abstractmethod
  from collections import namedtuple
  from six import with_metaclass
  from six.moves import range
  from prompt_toolkit.cache import SimpleCache
  from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER
  from prompt_toolkit.filters import to_cli_filter
  from prompt_toolkit.mouse_events import MouseEventType
  from prompt_toolkit.search_state import SearchState
  from prompt_toolkit.selection import SelectionType
  from prompt_toolkit.token import Token
  from prompt_toolkit.utils import get_cwidth
  from .lexers import Lexer, SimpleLexer
  from .processors import Processor
  from .screen import Char, Point
  from .utils import token_list_width, split_lines, token_list_to_text
  import six
  import time
label_desc: Use image node_id 8 for calling the TokenListControl obj's underlying member method code with example usage: obj.create_content(cli, width, height) and returns: self, unknown, None, UIContent, Point