Command.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. // These classes use a keybinding system based on the design implemented in Scintilla.Net which is an
  2. // MIT licensed open source project https://github.com/jacobslusser/ScintillaNET/blob/master/src/ScintillaNET/Command.cs
  3. namespace Terminal.Gui;
  4. /// <summary>Actions which can be performed by the application or bound to keys in a <see cref="View"/> control.</summary>
  5. public enum Command
  6. {
  7. /// <summary>Invoked when the HotKey for the View has been pressed.</summary>
  8. HotKey,
  9. /// <summary>Accepts the current state (e.g. list selection, button press, toggle, etc).</summary>
  10. Accept,
  11. /// <summary>Selects an item (e.g. a list item or menu item) without necessarily accepting it.</summary>
  12. Select,
  13. /// <summary>Moves down one item (cell, line, etc...).</summary>
  14. LineDown,
  15. /// <summary>Extends the selection down one (cell, line, etc...).</summary>
  16. LineDownExtend,
  17. /// <summary>Moves down to the last child node of the branch that holds the current selection.</summary>
  18. LineDownToLastBranch,
  19. /// <summary>Scrolls down one (cell, line, etc...) (without changing the selection).</summary>
  20. ScrollDown,
  21. // --------------------------------------------------------------------
  22. /// <summary>Moves up one (cell, line, etc...).</summary>
  23. LineUp,
  24. /// <summary>Extends the selection up one item (cell, line, etc...).</summary>
  25. LineUpExtend,
  26. /// <summary>Moves up to the first child node of the branch that holds the current selection.</summary>
  27. LineUpToFirstBranch,
  28. /// <summary>Scrolls up one item (cell, line, etc...) (without changing the selection).</summary>
  29. ScrollUp,
  30. /// <summary>
  31. /// Moves the selection left one by the minimum increment supported by the <see cref="View"/> e.g. single
  32. /// character, cell, item etc.
  33. /// </summary>
  34. Left,
  35. /// <summary>Scrolls one item (cell, character, etc...) to the left</summary>
  36. ScrollLeft,
  37. /// <summary>
  38. /// Extends the selection left one by the minimum increment supported by the view e.g. single character, cell,
  39. /// item etc.
  40. /// </summary>
  41. LeftExtend,
  42. /// <summary>
  43. /// Moves the selection right one by the minimum increment supported by the view e.g. single character, cell, item
  44. /// etc.
  45. /// </summary>
  46. Right,
  47. /// <summary>Scrolls one item (cell, character, etc...) to the right.</summary>
  48. ScrollRight,
  49. /// <summary>
  50. /// Extends the selection right one by the minimum increment supported by the view e.g. single character, cell,
  51. /// item etc.
  52. /// </summary>
  53. RightExtend,
  54. /// <summary>Moves the caret to the start of the previous word.</summary>
  55. WordLeft,
  56. /// <summary>Extends the selection to the start of the previous word.</summary>
  57. WordLeftExtend,
  58. /// <summary>Moves the caret to the start of the next word.</summary>
  59. WordRight,
  60. /// <summary>Extends the selection to the start of the next word.</summary>
  61. WordRightExtend,
  62. /// <summary>Cuts to the clipboard the characters from the current position to the end of the line.</summary>
  63. CutToEndLine,
  64. /// <summary>Cuts to the clipboard the characters from the current position to the start of the line.</summary>
  65. CutToStartLine,
  66. /// <summary>Deletes the characters forwards.</summary>
  67. KillWordForwards,
  68. /// <summary>Deletes the characters backwards.</summary>
  69. KillWordBackwards,
  70. /// <summary>
  71. /// Toggles overwrite mode such that newly typed text overwrites the text that is already there (typically
  72. /// associated with the Insert key).
  73. /// </summary>
  74. ToggleOverwrite,
  75. /// <summary>
  76. /// Enables overwrite mode such that newly typed text overwrites the text that is already there (typically
  77. /// associated with the Insert key).
  78. /// </summary>
  79. EnableOverwrite,
  80. /// <summary>Disables overwrite mode (<see cref="EnableOverwrite"/>)</summary>
  81. DisableOverwrite,
  82. /// <summary>Move one page down.</summary>
  83. PageDown,
  84. /// <summary>Move one page down extending the selection to cover revealed objects/characters.</summary>
  85. PageDownExtend,
  86. /// <summary>Move one page up.</summary>
  87. PageUp,
  88. /// <summary>Move one page up extending the selection to cover revealed objects/characters.</summary>
  89. PageUpExtend,
  90. /// <summary>Moves to the top/home.</summary>
  91. TopHome,
  92. /// <summary>Extends the selection to the top/home.</summary>
  93. TopHomeExtend,
  94. /// <summary>Moves to the bottom/end.</summary>
  95. BottomEnd,
  96. /// <summary>Extends the selection to the bottom/end.</summary>
  97. BottomEndExtend,
  98. /// <summary>Open the selected item.</summary>
  99. OpenSelectedItem,
  100. /// <summary>Toggles the Expanded or collapsed state of a list or item (with subitems).</summary>
  101. ToggleExpandCollapse,
  102. /// <summary>Expands a list or item (with subitems).</summary>
  103. Expand,
  104. /// <summary>Recursively Expands all child items and their child items (if any).</summary>
  105. ExpandAll,
  106. /// <summary>Collapses a list or item (with subitems).</summary>
  107. Collapse,
  108. /// <summary>Recursively collapses a list items of their children (if any).</summary>
  109. CollapseAll,
  110. /// <summary>Cancels an action or any temporary states on the control e.g. expanding a combo list.</summary>
  111. Cancel,
  112. /// <summary>Unix emulation.</summary>
  113. UnixEmulation,
  114. /// <summary>Deletes the character on the right.</summary>
  115. DeleteCharRight,
  116. /// <summary>Deletes the character on the left.</summary>
  117. DeleteCharLeft,
  118. /// <summary>Selects all objects.</summary>
  119. SelectAll,
  120. /// <summary>Deletes all objects.</summary>
  121. DeleteAll,
  122. /// <summary>Moves the cursor to the start of line.</summary>
  123. StartOfLine,
  124. /// <summary>Extends the selection to the start of line.</summary>
  125. StartOfLineExtend,
  126. /// <summary>Moves the cursor to the end of line.</summary>
  127. EndOfLine,
  128. /// <summary>Extends the selection to the end of line.</summary>
  129. EndOfLineExtend,
  130. /// <summary>Moves the cursor to the top of page.</summary>
  131. StartOfPage,
  132. /// <summary>Moves the cursor to the bottom of page.</summary>
  133. EndOfPage,
  134. /// <summary>Moves to the left page.</summary>
  135. PageLeft,
  136. /// <summary>Moves to the right page.</summary>
  137. PageRight,
  138. /// <summary>Moves to the left begin.</summary>
  139. LeftHome,
  140. /// <summary>Extends the selection to the left begin.</summary>
  141. LeftHomeExtend,
  142. /// <summary>Moves to the right end.</summary>
  143. RightEnd,
  144. /// <summary>Extends the selection to the right end.</summary>
  145. RightEndExtend,
  146. /// <summary>Undo changes.</summary>
  147. Undo,
  148. /// <summary>Redo changes.</summary>
  149. Redo,
  150. /// <summary>Copies the current selection.</summary>
  151. Copy,
  152. /// <summary>Cuts the current selection.</summary>
  153. Cut,
  154. /// <summary>Pastes the current selection.</summary>
  155. Paste,
  156. /// <summary>Quit a <see cref="Toplevel"/>.</summary>
  157. QuitToplevel,
  158. /// <summary>Suspend an application (Only implemented in <see cref="CursesDriver"/>).</summary>
  159. Suspend,
  160. /// <summary>Moves focus to the next view.</summary>
  161. NextView,
  162. /// <summary>Moves focus to the previous view.</summary>
  163. PreviousView,
  164. /// <summary>Moves focus to the next view or Toplevel (case of Overlapped).</summary>
  165. NextViewOrTop,
  166. /// <summary>Moves focus to the next previous or Toplevel (case of Overlapped).</summary>
  167. PreviousViewOrTop,
  168. /// <summary>Refresh.</summary>
  169. Refresh,
  170. /// <summary>Toggles the selection.</summary>
  171. ToggleExtend,
  172. /// <summary>Inserts a new item.</summary>
  173. NewLine,
  174. /// <summary>Tabs to the next item.</summary>
  175. Tab,
  176. /// <summary>Tabs back to the previous item.</summary>
  177. BackTab,
  178. /// <summary>Saves the current document.</summary>
  179. Save,
  180. /// <summary>Saves the current document with a new name.</summary>
  181. SaveAs,
  182. /// <summary>Creates a new document.</summary>
  183. New,
  184. /// <summary>Shows context about the item (e.g. a context menu).</summary>
  185. ShowContextMenu
  186. }