Fixes the numerical streaming value for FLineEdit and FLabel

This commit is contained in:
Markus Gans 2019-11-16 19:10:08 +01:00
parent be1c2b2639
commit b3c367a168
11 changed files with 84 additions and 57 deletions

View File

@ -38,6 +38,15 @@ class Background : public finalcut::FDialog
public: public:
explicit Background (finalcut::FWidget* = nullptr); explicit Background (finalcut::FWidget* = nullptr);
// Disable copy constructor
Background (const Background&) = delete;
// Destructor
~Background();
// Disable assignment operator (=)
Background& operator = (const Background&) = delete;
private: private:
// Callback method // Callback method
void cb_changed (finalcut::FWidget*, FDataPtr); void cb_changed (finalcut::FWidget*, FDataPtr);
@ -79,9 +88,9 @@ Background::Background (finalcut::FWidget* parent)
// Set the initial palette values // Set the initial palette values
const auto& wc = getFWidgetColors(); const auto& wc = getFWidgetColors();
finalcut::FTerm::setPalette ( wc.term_bg finalcut::FTerm::setPalette ( wc.term_bg
, red.getValue() , int(red.getValue())
, green.getValue() , int(green.getValue())
, blue.getValue() ); , int(blue.getValue()) );
// Quit button // Quit button
quit.setGeometry(FPoint(19, 5), FSize(10, 1)); quit.setGeometry(FPoint(19, 5), FSize(10, 1));
@ -112,14 +121,18 @@ Background::Background (finalcut::FWidget* parent)
); );
} }
//----------------------------------------------------------------------
Background::~Background() // destructor
{ }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Background::cb_changed (finalcut::FWidget*, FDataPtr) void Background::cb_changed (finalcut::FWidget*, FDataPtr)
{ {
const auto& wc = getFWidgetColors(); const auto& wc = getFWidgetColors();
finalcut::FTerm::setPalette ( wc.term_bg finalcut::FTerm::setPalette ( wc.term_bg
, red.getValue() , int(red.getValue())
, green.getValue() , int(green.getValue())
, blue.getValue() ); , int(blue.getValue()) );
redraw(); redraw();
updateTerminal(); updateTerminal();
} }

View File

@ -43,12 +43,13 @@ INCLUDE_HEADERS = \
fsystemimpl.h \ fsystemimpl.h \
fscrollbar.h \ fscrollbar.h \
fscrollview.h \ fscrollview.h \
fspinbox.h \
fstatusbar.h \ fstatusbar.h \
fstring.h \ fstring.h \
fmouse.h \ fmouse.h \
fkeyboard.h \ fkeyboard.h \
ftermcap.h \
fstartoptions.h \ fstartoptions.h \
ftermcap.h \
fterm.h \ fterm.h \
ftermdata.h \ ftermdata.h \
ftermdebugdata.h \ ftermdebugdata.h \
@ -104,6 +105,7 @@ OBJS = \
fdialog.o \ fdialog.o \
fwindow.o \ fwindow.o \
fscrollview.o \ fscrollview.o \
fspinbox.o \
fmessagebox.o \ fmessagebox.o \
ftooltip.o \ ftooltip.o \
ffiledialog.o \ ffiledialog.o \

View File

@ -39,12 +39,13 @@ INCLUDE_HEADERS = \
fprogressbar.h \ fprogressbar.h \
fradiobutton.h \ fradiobutton.h \
frect.h \ frect.h \
fscrollbar.h \
fscrollview.h \
fstatusbar.h \
fstring.h \
fsystem.h \ fsystem.h \
fsystemimpl.h \ fsystemimpl.h \
fscrollbar.h \
fscrollview.h \
fspinbox.h \
fstatusbar.h \
fstring.h \
fmouse.h \ fmouse.h \
fkeyboard.h \ fkeyboard.h \
fstartoptions.h \ fstartoptions.h \
@ -104,6 +105,7 @@ OBJS = \
fdialog.o \ fdialog.o \
fwindow.o \ fwindow.o \
fscrollview.o \ fscrollview.o \
fspinbox.o \
fmessagebox.o \ fmessagebox.o \
ftooltip.o \ ftooltip.o \
ffiledialog.o \ ffiledialog.o \
@ -115,8 +117,8 @@ OBJS = \
fsystem.o \ fsystem.o \
fsystemimpl.o \ fsystemimpl.o \
fkeyboard.o \ fkeyboard.o \
ftermcap.o \
fstartoptions.o \ fstartoptions.o \
ftermcap.o \
fterm.o \ fterm.o \
fterm_functions.o \ fterm_functions.o \
ftermdebugdata.o \ ftermdebugdata.o \

View File

@ -107,7 +107,7 @@ FLabel& FLabel::operator << (const int num)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLabel& FLabel::operator << (const uLong num) FLabel& FLabel::operator << (const uInt64 num)
{ {
FString num_str; FString num_str;
num_str << num; num_str << num;
@ -116,7 +116,7 @@ FLabel& FLabel::operator << (const uLong num)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLabel& FLabel::operator << (const long num) FLabel& FLabel::operator << (const sInt64 num)
{ {
FString num_str; FString num_str;
num_str << num; num_str << num;

View File

@ -112,7 +112,7 @@ FLineEdit& FLineEdit::operator << (const int num)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLineEdit& FLineEdit::operator << (const uLong num) FLineEdit& FLineEdit::operator << (const uInt64 num)
{ {
FString num_str; FString num_str;
num_str << num; num_str << num;
@ -121,7 +121,7 @@ FLineEdit& FLineEdit::operator << (const uLong num)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLineEdit& FLineEdit::operator << (const long num) FLineEdit& FLineEdit::operator << (const sInt64 num)
{ {
FString num_str; FString num_str;
num_str << num; num_str << num;

View File

@ -149,38 +149,12 @@ void FSpinBox::setSuffix (const FString& text)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FSpinBox::draw() void FSpinBox::hide()
{ {
const auto& wc = getFWidgetColors(); input_field.hide();
FWidget::hide();
FColorPair inc_button_color = [&] () -> FColorPair FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
{ hideArea (getSize() + shadow);
if ( value == max )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
FColorPair dec_button_color = [&] () -> FColorPair
{
if ( value == min )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
print() << FPoint(getWidth() - 1, 1)
<< dec_button_color
<< fc::BlackDownPointingTriangle // ▼
<< inc_button_color
<< fc::BlackUpPointingTriangle; // ▲
if ( getFlags().shadow )
drawShadow(this);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -309,7 +283,7 @@ void FSpinBox::onTimer (FTimerEvent*)
updateInputField(); updateInputField();
break; break;
default: case FSpinBox::noSpin:
break; break;
} }
} }
@ -335,6 +309,41 @@ void FSpinBox::init()
); );
} }
//----------------------------------------------------------------------
void FSpinBox::draw()
{
const auto& wc = getFWidgetColors();
FColorPair inc_button_color = [&] () -> FColorPair
{
if ( value == max )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
FColorPair dec_button_color = [&] () -> FColorPair
{
if ( value == min )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
print() << FPoint(int(getWidth()) - 1, 1)
<< dec_button_color
<< fc::BlackDownPointingTriangle // ▼
<< inc_button_color
<< fc::BlackUpPointingTriangle; // ▲
if ( getFlags().shadow )
drawShadow(this);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FSpinBox::updateInputField() inline void FSpinBox::updateInputField()
{ {

View File

@ -277,7 +277,7 @@ FString& FString::operator << (const uInt num)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString& FString::operator << (const long num) FString& FString::operator << (const sInt64 num)
{ {
FString numstr(FString().setNumber(num)); FString numstr(FString().setNumber(num));
_insert (length, numstr.length, numstr.string); _insert (length, numstr.length, numstr.string);
@ -285,7 +285,7 @@ FString& FString::operator << (const long num)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString& FString::operator << (const uLong num) FString& FString::operator << (const uInt64 num)
{ {
FString numstr(FString().setNumber(num)); FString numstr(FString().setNumber(num));
_insert (length, numstr.length, numstr.string); _insert (length, numstr.length, numstr.string);

View File

@ -90,8 +90,8 @@ class FLabel : public FWidget
FLabel& operator << (const wchar_t); FLabel& operator << (const wchar_t);
FLabel& operator << (const uInt); FLabel& operator << (const uInt);
FLabel& operator << (const int); FLabel& operator << (const int);
FLabel& operator << (const uLong); FLabel& operator << (const uInt64);
FLabel& operator << (const long); FLabel& operator << (const sInt64);
FLabel& operator << (const float); FLabel& operator << (const float);
FLabel& operator << (const double); FLabel& operator << (const double);
FLabel& operator << (const lDouble); FLabel& operator << (const lDouble);

View File

@ -106,8 +106,8 @@ class FLineEdit : public FWidget
FLineEdit& operator << (const wchar_t); FLineEdit& operator << (const wchar_t);
FLineEdit& operator << (const uInt); FLineEdit& operator << (const uInt);
FLineEdit& operator << (const int); FLineEdit& operator << (const int);
FLineEdit& operator << (const uLong); FLineEdit& operator << (const uInt64);
FLineEdit& operator << (const long); FLineEdit& operator << (const sInt64);
FLineEdit& operator << (const float); FLineEdit& operator << (const float);
FLineEdit& operator << (const double); FLineEdit& operator << (const double);
FLineEdit& operator << (const lDouble); FLineEdit& operator << (const lDouble);

View File

@ -114,7 +114,7 @@ class FSpinBox : public FWidget
bool hasShadow(); bool hasShadow();
// Methods // Methods
void draw() override; void hide() override;
// Event handlers // Event handlers
void onKeyPress (FKeyEvent*) override; void onKeyPress (FKeyEvent*) override;
@ -134,6 +134,7 @@ class FSpinBox : public FWidget
// Methods // Methods
void init(); void init();
void draw() override;
void updateInputField(); void updateInputField();
void increaseValue(); void increaseValue();
void decreaseValue(); void decreaseValue();

View File

@ -118,8 +118,8 @@ class FString
FString& operator << (const uInt16); FString& operator << (const uInt16);
FString& operator << (const int); FString& operator << (const int);
FString& operator << (const uInt); FString& operator << (const uInt);
FString& operator << (const long); FString& operator << (const sInt64);
FString& operator << (const uLong); FString& operator << (const uInt64);
FString& operator << (const float); FString& operator << (const float);
FString& operator << (const double); FString& operator << (const double);
FString& operator << (const lDouble); FString& operator << (const lDouble);