Fixed the drawing of FLabel widget with the default size of 1×1 character

This commit is contained in:
Markus Gans 2019-12-20 19:36:18 +01:00
parent 867dabf637
commit b7639f5301
7 changed files with 20 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2019-12-20 Markus Gans <guru.mail@muenster.de>
* Fixed the drawing of FLabel widget with the default size
of 1×1 character.
Thanks to terranpro for reporting this issue
2019-12-16 Markus Gans <guru.mail@muenster.de>
* New widget class FComboBox to provide a dropdown list
with an input field

View File

@ -106,20 +106,6 @@ void FDropDownListBox::hide()
flush();
}
//----------------------------------------------------------------------
void FDropDownListBox::onKeyPress (FKeyEvent* ev)
{
switch ( ev->key() )
{
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
hide();
break;
default:
break;
}
}
// private methods of FDropDownListBox
//----------------------------------------------------------------------
@ -368,6 +354,8 @@ void FComboBox::onKeyPress (FKeyEvent* ev)
case fc::Fmkey_up:
case fc::Fckey_up:
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
hideDropDown();
ev->accept();
break;

View File

@ -393,7 +393,7 @@ void FLabel::printLine (FString&& line)
}
else
{
to_column = width - 2;
to_column = ( width >= 2 ) ? width - 2 : 0;
to_char = getLengthFromColumnWidth(line, to_column);
}
@ -436,7 +436,8 @@ void FLabel::printLine (FString&& line)
if ( column_width > width )
{
// Print ellipsis
print() << FColorPair(ellipsis_color, getBackgroundColor()) << "..";
print() << FColorPair(ellipsis_color, getBackgroundColor())
<< FString("..").left(width);
setColor();
}
else if ( align_offset + to_column < width )

View File

@ -689,7 +689,7 @@ bool FLineEdit::hasHotkey()
//----------------------------------------------------------------------
void FLineEdit::draw()
{
if ( cursor_pos == NOT_SET && isReadOnly() )
if ( cursor_pos == NOT_SET && ! isReadOnly() )
cursorEnd();
if ( ! isShown() )

View File

@ -100,9 +100,6 @@ class FDropDownListBox : public FWindow
void show() override;
void hide() override;
// Event handlers
void onKeyPress (FKeyEvent*) override;
private:
// Methods
void init();

View File

@ -50,7 +50,9 @@
#endif
/* Define to 1 if GPM mouse is enabled */
/* #undef HAVE_LIBGPM */
#ifndef F_HAVE_LIBGPM
#define F_HAVE_LIBGPM 1
#endif
/* Define to 1 if you have the <linux/fb.h> header file. */
#ifndef F_HAVE_LINUX_FB_H

View File

@ -289,8 +289,8 @@ class FWidget : public FVTerm, public FObject
void setMinimumHeight (std::size_t);
void setMinimumSize (const FSize&);
void setMaximumWidth (std::size_t);
void setMaximumHeight (const FSize&);
void setMaximumSize (std::size_t, std::size_t);
void setMaximumHeight (std::size_t);
void setMaximumSize (const FSize&);
void setFixedSize (const FSize&);
bool setCursorPos (const FPoint&);
void unsetCursorPos();
@ -882,13 +882,12 @@ inline void FWidget::setMaximumWidth (std::size_t max_width)
{ size_hints.setMaximum (FSize(max_width, size_hints.max_height)); }
//----------------------------------------------------------------------
inline void FWidget::setMaximumHeight (const FSize& size)
{ size_hints.setMaximum (size); }
inline void FWidget::setMaximumHeight (std::size_t max_height)
{ size_hints.setMaximum (FSize(size_hints.max_width, max_height)); }
//----------------------------------------------------------------------
inline void FWidget::setMaximumSize ( std::size_t max_width
, std::size_t max_height )
{ size_hints.setMaximum (FSize(max_width, max_height)); }
inline void FWidget::setMaximumSize (const FSize& size)
{ size_hints.setMaximum (size); }
//----------------------------------------------------------------------
inline void FWidget::setFixedSize (const FSize& size)