...

Source file src/github.com/gdamore/tcell/v2/views/spacer.go

Documentation: github.com/gdamore/tcell/v2/views

     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 views
    16  
    17  import (
    18  	"github.com/gdamore/tcell/v2"
    19  )
    20  
    21  // Spacer is a Widget that occupies no visible real-estate.  It is useful to
    22  // add this to layouts when expansion space is required.  It expands as needed
    23  // with blank space.
    24  type Spacer struct {
    25  	WidgetWatchers
    26  }
    27  
    28  // Draw is called to update the displayed content.
    29  func (*Spacer) Draw() {}
    30  
    31  // Size always returns 0, 0, since no size is ever *requird* to display nothing.
    32  func (*Spacer) Size() (int, int) {
    33  	return 0, 0
    34  }
    35  
    36  // SetView sets the View object used for the text bar.
    37  func (*Spacer) SetView(View) {}
    38  
    39  // HandleEvent implements a tcell.EventHandler, but does nothing.
    40  func (*Spacer) HandleEvent(tcell.Event) bool {
    41  	return false
    42  }
    43  
    44  // Resize is called when our View changes sizes.
    45  func (s *Spacer) Resize() {
    46  	s.PostEventWidgetResize(s)
    47  }
    48  
    49  // NewSpacer creates an empty Spacer.  It's probably easier just to declare it
    50  // directly.
    51  func NewSpacer() *Spacer {
    52  	return &Spacer{}
    53  }
    54  

View as plain text