Advanced streaming functionality for FTermBuffer and FVTerm::print()
This commit is contained in:
parent
ba17c529ff
commit
55070bfc39
|
@ -1,3 +1,8 @@
|
||||||
|
2017-08-06 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Fix GNU Screen support for vte/gnome-terminals
|
||||||
|
* Advanced streaming functionality for FTermBuffer
|
||||||
|
and FVTerm::print()
|
||||||
|
|
||||||
2017-07-31 Markus Gans <guru.mail@muenster.de>
|
2017-07-31 Markus Gans <guru.mail@muenster.de>
|
||||||
* New methods to retrieve or modify FListViewItem text or
|
* New methods to retrieve or modify FListViewItem text or
|
||||||
a FListView column text for a specific column
|
a FListView column text for a specific column
|
||||||
|
|
5
src/fc.h
5
src/fc.h
|
@ -11,6 +11,8 @@
|
||||||
#ifndef FC_H
|
#ifndef FC_H
|
||||||
#define FC_H
|
#define FC_H
|
||||||
|
|
||||||
|
#include "fstring.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class fc
|
// class fc
|
||||||
|
@ -1081,6 +1083,9 @@ class fc
|
||||||
t_keypad_local,
|
t_keypad_local,
|
||||||
t_key_mouse
|
t_key_mouse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Data Member
|
||||||
|
static const FString* empty_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -168,6 +168,8 @@ void FListBox::showInsideBrackets ( int index
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the widget geometry
|
||||||
|
|
||||||
FWidget::setGeometry(x, y, w, h, adjust);
|
FWidget::setGeometry(x, y, w, h, adjust);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
#include "fstatusbar.h"
|
#include "fstatusbar.h"
|
||||||
#include "ftermbuffer.h"
|
#include "ftermbuffer.h"
|
||||||
|
|
||||||
|
|
||||||
// static class attributes
|
|
||||||
FString FListView::empty_string = FString("");
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FListViewItem
|
// class FListViewItem
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -84,9 +80,9 @@ FListViewItem::~FListViewItem()
|
||||||
FString FListViewItem::getText (int column) const
|
FString FListViewItem::getText (int column) const
|
||||||
{
|
{
|
||||||
if (column < 0 || column_line.empty() || column >= int(column_line.size()) )
|
if (column < 0 || column_line.empty() || column >= int(column_line.size()) )
|
||||||
return FListView::empty_string;
|
return *fc::empty_string;
|
||||||
|
|
||||||
return column_line[column];
|
return column_line[uInt(column)];
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -110,7 +106,7 @@ void FListViewItem::setText (int column, const FString& text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
column_line[column] = text;
|
column_line[uInt(column)] = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -165,7 +161,7 @@ FString FListView::getColumnText (int column) const
|
||||||
// Get the text of column
|
// Get the text of column
|
||||||
|
|
||||||
if ( column < 0 || header.empty() || column >= int(header.size()) )
|
if ( column < 0 || header.empty() || column >= int(header.size()) )
|
||||||
return empty_string;
|
return *fc::empty_string;
|
||||||
|
|
||||||
return header[uInt(column)].name;
|
return header[uInt(column)].name;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +169,8 @@ FString FListView::getColumnText (int column) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the widget geometry
|
||||||
|
|
||||||
FWidget::setGeometry(x, y, w, h, adjust);
|
FWidget::setGeometry(x, y, w, h, adjust);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
|
@ -1032,34 +1030,35 @@ void FListView::drawColumnLabels()
|
||||||
|
|
||||||
if ( txt_length <= uInt(column_width) )
|
if ( txt_length <= uInt(column_width) )
|
||||||
{
|
{
|
||||||
headerline.write (txt);
|
headerline << txt;
|
||||||
|
|
||||||
if ( txt_length < uInt(column_width) )
|
if ( txt_length < uInt(column_width) )
|
||||||
headerline.write (' '); // tailing space
|
headerline << ' '; // tailing space
|
||||||
|
|
||||||
if ( txt_length + tailing_space < uInt(column_width) )
|
if ( txt_length + tailing_space < uInt(column_width) )
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
FString line ( uInt(column_width) - tailing_space - txt_length
|
FString line ( uInt(column_width) - tailing_space - txt_length
|
||||||
, wchar_t(fc::BoxDrawingsHorizontal) );
|
, wchar_t(fc::BoxDrawingsHorizontal) );
|
||||||
headerline.write (line); // horizontal line
|
headerline << line; // horizontal line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
headerline.write (' ');
|
headerline << ' ';
|
||||||
headerline.write (text.left(uInt(width - ellipsis_length)));
|
headerline << text.left(uInt(width - ellipsis_length));
|
||||||
setColor (wc.label_ellipsis_fg, wc.label_bg);
|
setColor (wc.label_ellipsis_fg, wc.label_bg);
|
||||||
headerline.write ("..");
|
headerline << "..";
|
||||||
|
|
||||||
if ( iter == header.end() - 1 ) // Last element
|
if ( iter == header.end() - 1 ) // Last element
|
||||||
headerline.write (' ');
|
headerline << ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<char_data>& h = headerline.getBuffer();
|
std::vector<char_data> h;
|
||||||
|
h << headerline;
|
||||||
first = h.begin() + xoffset;
|
first = h.begin() + xoffset;
|
||||||
|
|
||||||
if ( int(h.size()) <= getClientWidth() )
|
if ( int(h.size()) <= getClientWidth() )
|
||||||
|
@ -1067,9 +1066,8 @@ void FListView::drawColumnLabels()
|
||||||
else
|
else
|
||||||
last = h.begin() + getClientWidth() + xoffset - 1;
|
last = h.begin() + getClientWidth() + xoffset - 1;
|
||||||
|
|
||||||
const std::vector<char_data> header_part (first, last);
|
|
||||||
setPrintPos (2, 1);
|
setPrintPos (2, 1);
|
||||||
print (header_part);
|
print() << std::vector<char_data>(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -198,7 +198,6 @@ class FListView : public FWidget
|
||||||
void cb_HBarChange (FWidget*, data_ptr);
|
void cb_HBarChange (FWidget*, data_ptr);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static FString empty_string;
|
|
||||||
listViewItems data;
|
listViewItems data;
|
||||||
headerItems header;
|
headerItems header;
|
||||||
FTermBuffer headerline;
|
FTermBuffer headerline;
|
||||||
|
@ -227,7 +226,7 @@ inline const char* FListView::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListViewItem* FListView::getCurrentItem() const
|
inline FListViewItem* FListView::getCurrentItem() const
|
||||||
{ return data[current-1]; }
|
{ return data[uInt(current-1)]; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListView::listViewItems::iterator FListView::index2iterator (int index)
|
inline FListView::listViewItems::iterator FListView::index2iterator (int index)
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
#include "fobject.h"
|
#include "fobject.h"
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FObject::timer_modify_lock;
|
bool FObject::timer_modify_lock;
|
||||||
FObject::TimerList* FObject::timer_list = 0;
|
FObject::TimerList* FObject::timer_list = 0;
|
||||||
|
const FString* fc::empty_string = 0;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FObject
|
// class FObject
|
||||||
|
@ -27,8 +27,14 @@ FObject::FObject (FObject* parent)
|
||||||
|
|
||||||
if ( parent == 0 )
|
if ( parent == 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
timer_modify_lock = false;
|
timer_modify_lock = false;
|
||||||
timer_list = new TimerList();
|
|
||||||
|
if ( ! timer_list )
|
||||||
|
timer_list = new TimerList();
|
||||||
|
|
||||||
|
if ( ! fc::empty_string )
|
||||||
|
fc::empty_string = new FString("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
has_parent = true;
|
has_parent = true;
|
||||||
|
@ -49,6 +55,12 @@ FObject::~FObject() // destructor
|
||||||
timer_list = 0;
|
timer_list = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! has_parent && fc::empty_string )
|
||||||
|
{
|
||||||
|
delete fc::empty_string;
|
||||||
|
fc::empty_string = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// delete children objects
|
// delete children objects
|
||||||
FObjectList children = this->getChildren();
|
FObjectList children = this->getChildren();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fc.h"
|
||||||
#include "fevent.h"
|
#include "fevent.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ void FProgressbar::setPercentage (int percentage_value)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FProgressbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the progress bar geometry
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
bar_length = w;
|
bar_length = w;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,8 @@ void FScrollbar::setOrientation (int o)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FScrollbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the scrollbar geometry
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
|
|
||||||
int nf = 0;
|
int nf = 0;
|
||||||
|
|
|
@ -222,6 +222,8 @@ void FScrollView::setSize (int w, int h, bool adjust)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the scroll view geometry
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||||
, getTermY() + getTopPadding() - 1 );
|
, getTermY() + getTopPadding() - 1 );
|
||||||
|
|
|
@ -94,7 +94,6 @@ const FString* FTerm::xterm_font = 0;
|
||||||
const FString* FTerm::xterm_title = 0;
|
const FString* FTerm::xterm_title = 0;
|
||||||
const FString* FTerm::answer_back = 0;
|
const FString* FTerm::answer_back = 0;
|
||||||
const FString* FTerm::sec_da = 0;
|
const FString* FTerm::sec_da = 0;
|
||||||
const FString* FTerm::empty_string = 0;
|
|
||||||
FOptiMove* FTerm::opti_move = 0;
|
FOptiMove* FTerm::opti_move = 0;
|
||||||
FOptiAttr* FTerm::opti_attr = 0;
|
FOptiAttr* FTerm::opti_attr = 0;
|
||||||
FTerm::modifier_key FTerm::mod_key;
|
FTerm::modifier_key FTerm::mod_key;
|
||||||
|
@ -2597,7 +2596,8 @@ char* FTerm::init_256colorTerminal()
|
||||||
gnome_terminal = true;
|
gnome_terminal = true;
|
||||||
// Each gnome-terminal should be able to use 256 colors
|
// Each gnome-terminal should be able to use 256 colors
|
||||||
color256 = true;
|
color256 = true;
|
||||||
new_termtype = const_cast<char*>("gnome-256color");
|
if ( ! screen_terminal )
|
||||||
|
new_termtype = const_cast<char*>("gnome-256color");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -3574,7 +3574,6 @@ void FTerm::init()
|
||||||
opti_attr = new FOptiAttr();
|
opti_attr = new FOptiAttr();
|
||||||
term = new FRect(0,0,0,0);
|
term = new FRect(0,0,0,0);
|
||||||
mouse = new FPoint(0,0);
|
mouse = new FPoint(0,0);
|
||||||
empty_string = new FString("");
|
|
||||||
|
|
||||||
vt100_alt_char = new std::map<uChar,uChar>;
|
vt100_alt_char = new std::map<uChar,uChar>;
|
||||||
encoding_set = new std::map<std::string,fc::encoding>;
|
encoding_set = new std::map<std::string,fc::encoding>;
|
||||||
|
@ -4080,9 +4079,6 @@ void FTerm::finish()
|
||||||
if ( vt100_alt_char )
|
if ( vt100_alt_char )
|
||||||
delete vt100_alt_char;
|
delete vt100_alt_char;
|
||||||
|
|
||||||
if ( empty_string )
|
|
||||||
delete empty_string;
|
|
||||||
|
|
||||||
if ( sec_da )
|
if ( sec_da )
|
||||||
delete sec_da;
|
delete sec_da;
|
||||||
|
|
||||||
|
|
101
src/fterm.h
101
src/fterm.h
|
@ -421,63 +421,63 @@ class FTerm
|
||||||
static std::map <std::string,fc::encoding>* encoding_set;
|
static std::map <std::string,fc::encoding>* encoding_set;
|
||||||
static FTermcap::tcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
|
|
||||||
static bool mouse_support;
|
static bool mouse_support;
|
||||||
static bool terminal_detection;
|
static bool terminal_detection;
|
||||||
static bool raw_mode;
|
static bool raw_mode;
|
||||||
static bool input_data_pending;
|
static bool input_data_pending;
|
||||||
static bool non_blocking_stdin;
|
static bool non_blocking_stdin;
|
||||||
static bool gpm_mouse_enabled;
|
static bool gpm_mouse_enabled;
|
||||||
static bool pc_charset_console;
|
static bool pc_charset_console;
|
||||||
static bool utf8_input;
|
static bool utf8_input;
|
||||||
static bool utf8_state;
|
static bool utf8_state;
|
||||||
static bool utf8_console;
|
static bool utf8_console;
|
||||||
static bool utf8_linux_terminal;
|
static bool utf8_linux_terminal;
|
||||||
static bool force_vt100;
|
static bool force_vt100;
|
||||||
static bool vt100_console;
|
static bool vt100_console;
|
||||||
static bool ascii_console;
|
static bool ascii_console;
|
||||||
static bool color256;
|
static bool color256;
|
||||||
static bool monochron;
|
static bool monochron;
|
||||||
static bool xterm_terminal;
|
static bool xterm_terminal;
|
||||||
static bool ansi_terminal;
|
static bool ansi_terminal;
|
||||||
static bool rxvt_terminal;
|
static bool rxvt_terminal;
|
||||||
static bool urxvt_terminal;
|
static bool urxvt_terminal;
|
||||||
static bool mlterm_terminal;
|
static bool mlterm_terminal;
|
||||||
static bool putty_terminal;
|
static bool putty_terminal;
|
||||||
static bool kde_konsole;
|
static bool kde_konsole;
|
||||||
static bool gnome_terminal;
|
static bool gnome_terminal;
|
||||||
static bool kterm_terminal;
|
static bool kterm_terminal;
|
||||||
static bool tera_terminal;
|
static bool tera_terminal;
|
||||||
static bool cygwin_terminal;
|
static bool cygwin_terminal;
|
||||||
static bool mintty_terminal;
|
static bool mintty_terminal;
|
||||||
static bool linux_terminal;
|
static bool linux_terminal;
|
||||||
static bool netbsd_terminal;
|
static bool netbsd_terminal;
|
||||||
static bool openbsd_terminal;
|
static bool openbsd_terminal;
|
||||||
static bool screen_terminal;
|
static bool screen_terminal;
|
||||||
static bool tmux_terminal;
|
static bool tmux_terminal;
|
||||||
static char termtype[30];
|
static char termtype[30];
|
||||||
static char* term_name;
|
static char* term_name;
|
||||||
static char* locale_name;
|
static char* locale_name;
|
||||||
static char* locale_xterm;
|
static char* locale_xterm;
|
||||||
static FRect* term; // current terminal geometry
|
static FRect* term; // current terminal geometry
|
||||||
static FPoint* mouse; // mouse click position
|
static FPoint* mouse; // mouse click position
|
||||||
|
|
||||||
static int stdin_status_flags;
|
static int stdin_status_flags;
|
||||||
static int fd_tty;
|
static int fd_tty;
|
||||||
static uInt baudrate;
|
static uInt baudrate;
|
||||||
static bool resize_term;
|
static bool resize_term;
|
||||||
|
|
||||||
static struct termios term_init;
|
static struct termios term_init;
|
||||||
static fc::linuxConsoleCursorStyle linux_console_cursor_style;
|
static fc::linuxConsoleCursorStyle linux_console_cursor_style;
|
||||||
static fc::freebsdConsoleCursorStyle freebsd_console_cursor_style;
|
static fc::freebsdConsoleCursorStyle freebsd_console_cursor_style;
|
||||||
static struct console_font_op screen_font;
|
static struct console_font_op screen_font;
|
||||||
static struct unimapdesc screen_unicode_map;
|
static struct unimapdesc screen_unicode_map;
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
static uInt bsd_alt_keymap;
|
static uInt bsd_alt_keymap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
static kbd_t wscons_keyboard_encoding;
|
static kbd_t wscons_keyboard_encoding;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FOptiMove* opti_move;
|
static FOptiMove* opti_move;
|
||||||
|
@ -486,7 +486,6 @@ class FTerm
|
||||||
static const FString* xterm_title;
|
static const FString* xterm_title;
|
||||||
static const FString* answer_back;
|
static const FString* answer_back;
|
||||||
static const FString* sec_da;
|
static const FString* sec_da;
|
||||||
static const FString* empty_string;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -520,11 +519,11 @@ inline int FTerm::getMaxColor()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString& FTerm::getAnswerbackString()
|
inline const FString& FTerm::getAnswerbackString()
|
||||||
{ return (answer_back) ? *answer_back : *empty_string; }
|
{ return (answer_back) ? *answer_back : *fc::empty_string; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString& FTerm::getSecDAString()
|
inline const FString& FTerm::getSecDAString()
|
||||||
{ return (sec_da) ? *sec_da : *empty_string; }
|
{ return (sec_da) ? *sec_da : *fc::empty_string; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -137,5 +137,13 @@ int FTermBuffer::write (register int c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// private methods of FTermBuffer
|
// FTermBuffer non-member operators
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
std::vector< FTermBuffer::char_data>& operator << ( std::vector<FTermBuffer::char_data>& termString
|
||||||
|
, const FTermBuffer& buf )
|
||||||
|
{
|
||||||
|
if ( ! buf.data.empty() )
|
||||||
|
termString.assign(buf.data.begin(), buf.data.end());
|
||||||
|
|
||||||
|
return termString;
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ class FTermBuffer
|
||||||
|
|
||||||
// Overloaded operators
|
// Overloaded operators
|
||||||
template<class type> FTermBuffer& operator << (const type&);
|
template<class type> FTermBuffer& operator << (const type&);
|
||||||
|
// Non-member operators
|
||||||
|
friend std::vector<char_data>& operator << ( std::vector<char_data>&
|
||||||
|
, const FTermBuffer& );
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
|
@ -79,7 +82,7 @@ class FTermBuffer
|
||||||
template<class type>
|
template<class type>
|
||||||
inline FTermBuffer& FTermBuffer::operator << (const type& s)
|
inline FTermBuffer& FTermBuffer::operator << (const type& s)
|
||||||
{
|
{
|
||||||
std::ostringstream outstream;
|
std::wostringstream outstream;
|
||||||
outstream << s;
|
outstream << s;
|
||||||
write (outstream.str());
|
write (outstream.str());
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -73,6 +73,8 @@ const FString FTextView::getText() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the text view geometry
|
||||||
|
|
||||||
FWidget::setGeometry(x, y, w, h, adjust);
|
FWidget::setGeometry(x, y, w, h, adjust);
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
int height = getHeight();
|
int height = getHeight();
|
||||||
|
|
|
@ -69,6 +69,8 @@ FToggleButton::~FToggleButton() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Set the toggle button geometry
|
||||||
|
|
||||||
int min_width = button_width + int(text.getLength());
|
int min_width = button_width + int(text.getLength());
|
||||||
|
|
||||||
if ( w < min_width )
|
if ( w < min_width )
|
||||||
|
|
10
src/fvterm.h
10
src/fvterm.h
|
@ -133,6 +133,7 @@ class FVTerm : public FObject, public FTerm
|
||||||
|
|
||||||
// Overloaded operators
|
// Overloaded operators
|
||||||
template<class type> FVTerm& operator << (const type&);
|
template<class type> FVTerm& operator << (const type&);
|
||||||
|
FVTerm& operator << (const std::vector<char_data>&);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
|
@ -424,12 +425,19 @@ class FVTerm : public FObject, public FTerm
|
||||||
template<class type>
|
template<class type>
|
||||||
inline FVTerm& FVTerm::operator << (const type& s)
|
inline FVTerm& FVTerm::operator << (const type& s)
|
||||||
{
|
{
|
||||||
std::ostringstream outstream;
|
std::wostringstream outstream;
|
||||||
outstream << s;
|
outstream << s;
|
||||||
print (outstream.str());
|
print (outstream.str());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FVTerm& FVTerm::operator << (const std::vector<FVTerm::char_data>& termString)
|
||||||
|
{
|
||||||
|
print (termString);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const char* FVTerm::getClassName() const
|
inline const char* FVTerm::getClassName() const
|
||||||
{ return "FVTerm"; }
|
{ return "FVTerm"; }
|
||||||
|
|
|
@ -661,6 +661,8 @@ void FWidget::setTermSize (int w, int h)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Sets the geometry of the widget relative to its parent
|
||||||
|
|
||||||
int term_x, term_y;
|
int term_x, term_y;
|
||||||
|
|
||||||
w = std::min (w, size_hints.max_width);
|
w = std::min (w, size_hints.max_width);
|
||||||
|
|
|
@ -395,6 +395,8 @@ void FWindow::setSize (int w, int h, bool adjust)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
// Sets the geometry of the widget
|
||||||
|
|
||||||
int old_x = getX();
|
int old_x = getX();
|
||||||
int old_y = getY();
|
int old_y = getY();
|
||||||
int old_width = getWidth();
|
int old_width = getWidth();
|
||||||
|
|
|
@ -159,7 +159,7 @@ void Listview::cb_exitApp (FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Listview::cb_showInMessagebox (FWidget* widget, data_ptr)
|
void Listview::cb_showInMessagebox (FWidget* widget, data_ptr)
|
||||||
{
|
{
|
||||||
FListView* listView = static_cast<FListView*>(widget);listView=listView;
|
FListView* listView = static_cast<FListView*>(widget);
|
||||||
FListViewItem* item = listView->getCurrentItem();
|
FListViewItem* item = listView->getCurrentItem();
|
||||||
FMessageBox info ( "Weather in " + item->getText(0)
|
FMessageBox info ( "Weather in " + item->getText(0)
|
||||||
, " Condition: " + item->getText(1) + "\n"
|
, " Condition: " + item->getText(1) + "\n"
|
||||||
|
|
Loading…
Reference in New Issue