Belle II Software  release-08-01-10
MultilineWidget Class Reference

Widget which contains the dynamic amount of TGLabel objects. More...

#include <MultilineWidget.h>

Inheritance diagram for MultilineWidget:
Collaboration diagram for MultilineWidget:

Public Member Functions

 MultilineWidget (const TGWindow *p=0, const char *title=0, int line_count=0)
 Create multiline widget with parent window p.
 
int getLineCount ()
 Return number of lines in widget.
 
void setLineCount (int count)
 Add or remove lines depending on current line count. More...
 
void removeLine (int line_id)
 Remove line with specified id.
 
void removeLastLine ()
 Removes last line from multiline widget and reduces line count.
 
void setLine (int line_id, const char *text)
 Set content of the specified line to 'text'.
 
void addLine (const char *text=0)
 Append line to multiline widget.
 

Private Attributes

std::vector< TGLabel * > lines
 Content of multiline widget.
 

Detailed Description

Widget which contains the dynamic amount of TGLabel objects.

Compared to TGTextView, this class allows to update lines frequently without without redrawing the entire text. There is no internal checks for the correctness of remove operations.

Definition at line 30 of file MultilineWidget.h.

Member Function Documentation

◆ setLineCount()

void setLineCount ( int  count)

Add or remove lines depending on current line count.

If the specified count is less than previous, lines are removed from the bottom of the widget.

Definition at line 39 of file MultilineWidget.cc.

40 {
41  int prev_count = getLineCount();
42 
43  if (new_count > prev_count) {
44  for (int i = new_count - prev_count; i > 0; i--)
45  addLine();
46  } else {
47  for (int i = prev_count - new_count; i > 0; i--)
48  removeLine(new_count);
49  }
50 }
void removeLine(int line_id)
Remove line with specified id.
int getLineCount()
Return number of lines in widget.
void addLine(const char *text=0)
Append line to multiline widget.

The documentation for this class was generated from the following files: