viewEvents.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. export class ViewCompositionStartEvent {
  6. constructor() {
  7. this.type = 0 /* ViewEventType.ViewCompositionStart */;
  8. }
  9. }
  10. export class ViewCompositionEndEvent {
  11. constructor() {
  12. this.type = 1 /* ViewEventType.ViewCompositionEnd */;
  13. }
  14. }
  15. export class ViewConfigurationChangedEvent {
  16. constructor(source) {
  17. this.type = 2 /* ViewEventType.ViewConfigurationChanged */;
  18. this._source = source;
  19. }
  20. hasChanged(id) {
  21. return this._source.hasChanged(id);
  22. }
  23. }
  24. export class ViewCursorStateChangedEvent {
  25. constructor(selections, modelSelections) {
  26. this.type = 3 /* ViewEventType.ViewCursorStateChanged */;
  27. this.selections = selections;
  28. this.modelSelections = modelSelections;
  29. }
  30. }
  31. export class ViewDecorationsChangedEvent {
  32. constructor(source) {
  33. this.type = 4 /* ViewEventType.ViewDecorationsChanged */;
  34. if (source) {
  35. this.affectsMinimap = source.affectsMinimap;
  36. this.affectsOverviewRuler = source.affectsOverviewRuler;
  37. }
  38. else {
  39. this.affectsMinimap = true;
  40. this.affectsOverviewRuler = true;
  41. }
  42. }
  43. }
  44. export class ViewFlushedEvent {
  45. constructor() {
  46. this.type = 5 /* ViewEventType.ViewFlushed */;
  47. // Nothing to do
  48. }
  49. }
  50. export class ViewFocusChangedEvent {
  51. constructor(isFocused) {
  52. this.type = 6 /* ViewEventType.ViewFocusChanged */;
  53. this.isFocused = isFocused;
  54. }
  55. }
  56. export class ViewLanguageConfigurationEvent {
  57. constructor() {
  58. this.type = 7 /* ViewEventType.ViewLanguageConfigurationChanged */;
  59. }
  60. }
  61. export class ViewLineMappingChangedEvent {
  62. constructor() {
  63. this.type = 8 /* ViewEventType.ViewLineMappingChanged */;
  64. // Nothing to do
  65. }
  66. }
  67. export class ViewLinesChangedEvent {
  68. constructor(
  69. /**
  70. * The first line that has changed.
  71. */
  72. fromLineNumber,
  73. /**
  74. * The number of lines that have changed.
  75. */
  76. count) {
  77. this.fromLineNumber = fromLineNumber;
  78. this.count = count;
  79. this.type = 9 /* ViewEventType.ViewLinesChanged */;
  80. }
  81. }
  82. export class ViewLinesDeletedEvent {
  83. constructor(fromLineNumber, toLineNumber) {
  84. this.type = 10 /* ViewEventType.ViewLinesDeleted */;
  85. this.fromLineNumber = fromLineNumber;
  86. this.toLineNumber = toLineNumber;
  87. }
  88. }
  89. export class ViewLinesInsertedEvent {
  90. constructor(fromLineNumber, toLineNumber) {
  91. this.type = 11 /* ViewEventType.ViewLinesInserted */;
  92. this.fromLineNumber = fromLineNumber;
  93. this.toLineNumber = toLineNumber;
  94. }
  95. }
  96. export class ViewRevealRangeRequestEvent {
  97. constructor(
  98. /**
  99. * Source of the call that caused the event.
  100. */
  101. source,
  102. /**
  103. * Reduce the revealing to a minimum (e.g. avoid scrolling if the bounding box is visible and near the viewport edge).
  104. */
  105. minimalReveal,
  106. /**
  107. * Range to be reavealed.
  108. */
  109. range,
  110. /**
  111. * Selections to be revealed.
  112. */
  113. selections,
  114. /**
  115. * The vertical reveal strategy.
  116. */
  117. verticalType,
  118. /**
  119. * If true: there should be a horizontal & vertical revealing.
  120. * If false: there should be just a vertical revealing.
  121. */
  122. revealHorizontal,
  123. /**
  124. * The scroll type.
  125. */
  126. scrollType) {
  127. this.source = source;
  128. this.minimalReveal = minimalReveal;
  129. this.range = range;
  130. this.selections = selections;
  131. this.verticalType = verticalType;
  132. this.revealHorizontal = revealHorizontal;
  133. this.scrollType = scrollType;
  134. this.type = 12 /* ViewEventType.ViewRevealRangeRequest */;
  135. }
  136. }
  137. export class ViewScrollChangedEvent {
  138. constructor(source) {
  139. this.type = 13 /* ViewEventType.ViewScrollChanged */;
  140. this.scrollWidth = source.scrollWidth;
  141. this.scrollLeft = source.scrollLeft;
  142. this.scrollHeight = source.scrollHeight;
  143. this.scrollTop = source.scrollTop;
  144. this.scrollWidthChanged = source.scrollWidthChanged;
  145. this.scrollLeftChanged = source.scrollLeftChanged;
  146. this.scrollHeightChanged = source.scrollHeightChanged;
  147. this.scrollTopChanged = source.scrollTopChanged;
  148. }
  149. }
  150. export class ViewThemeChangedEvent {
  151. constructor(theme) {
  152. this.theme = theme;
  153. this.type = 14 /* ViewEventType.ViewThemeChanged */;
  154. }
  155. }
  156. export class ViewTokensChangedEvent {
  157. constructor(ranges) {
  158. this.type = 15 /* ViewEventType.ViewTokensChanged */;
  159. this.ranges = ranges;
  160. }
  161. }
  162. export class ViewTokensColorsChangedEvent {
  163. constructor() {
  164. this.type = 16 /* ViewEventType.ViewTokensColorsChanged */;
  165. // Nothing to do
  166. }
  167. }
  168. export class ViewZonesChangedEvent {
  169. constructor() {
  170. this.type = 17 /* ViewEventType.ViewZonesChanged */;
  171. // Nothing to do
  172. }
  173. }