viewEvents.js 5.3 KB

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