1 // Copyright 2015 The TCell Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use file except in compliance with the License. 5 // You may obtain a copy of the license at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package tcell 16 17 import ( 18 "time" 19 ) 20 21 // EventResize is sent when the window size changes. 22 type EventResize struct { 23 t time.Time 24 w int 25 h int 26 } 27 28 // NewEventResize creates an EventResize with the new updated window size, 29 // which is given in character cells. 30 func NewEventResize(width, height int) *EventResize { 31 return &EventResize{t: time.Now(), w: width, h: height} 32 } 33 34 // When returns the time when the Event was created. 35 func (ev *EventResize) When() time.Time { 36 return ev.t 37 } 38 39 // Size returns the new window size as width, height in character cells. 40 func (ev *EventResize) Size() (int, int) { 41 return ev.w, ev.h 42 } 43