Fixed some minor bugs

This commit is contained in:
Markus Gans 2020-08-13 23:58:32 +02:00
parent 50fc6fdb63
commit c2894b6591
32 changed files with 82 additions and 69 deletions

View File

@ -709,7 +709,7 @@ void FButton::updateButtonColor()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButton::processClick() void FButton::processClick() const
{ {
emitCallback("clicked"); emitCallback("clicked");
} }

View File

@ -69,7 +69,7 @@ void FCheckMenuItem::init()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FCheckMenuItem::processToggle() void FCheckMenuItem::processToggle() const
{ {
emitCallback("toggled"); emitCallback("toggled");
} }

View File

@ -616,13 +616,13 @@ void FComboBox::passEventToListWindow (FMouseEvent* const& ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FComboBox::processClick() void FComboBox::processClick() const
{ {
emitCallback("clicked"); emitCallback("clicked");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FComboBox::processChanged() void FComboBox::processChanged() const
{ {
emitCallback("row-changed"); emitCallback("row-changed");
} }

View File

@ -1130,7 +1130,7 @@ void FLineEdit::processActivate()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLineEdit::processChanged() void FLineEdit::processChanged() const
{ {
emitCallback("changed"); emitCallback("changed");
} }

View File

@ -1696,19 +1696,19 @@ inline bool FListBox::keyIncSearchInput (FKey key)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::processClick() void FListBox::processClick() const
{ {
emitCallback("clicked"); emitCallback("clicked");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::processSelect() void FListBox::processSelect() const
{ {
emitCallback("row-selected"); emitCallback("row-selected");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::processChanged() void FListBox::processChanged() const
{ {
emitCallback("row-changed"); emitCallback("row-changed");
} }
@ -1743,7 +1743,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::cb_vbarChange (const FWidget*, const FDataPtr) void FListBox::cb_vbarChange (const FWidget*)
{ {
FScrollbar::sType scrollType; FScrollbar::sType scrollType;
const std::size_t current_before = current; const std::size_t current_before = current;
@ -1814,7 +1814,7 @@ void FListBox::cb_vbarChange (const FWidget*, const FDataPtr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::cb_hbarChange (const FWidget*, const FDataPtr) void FListBox::cb_hbarChange (const FWidget*)
{ {
static constexpr int padding_space = 2; // 1 leading space + 1 trailing space static constexpr int padding_space = 2; // 1 leading space + 1 trailing space
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;

View File

@ -2496,7 +2496,7 @@ FObject::iterator FListView::appendItem (FListViewItem* item)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::processClick() void FListView::processClick() const
{ {
if ( itemlist.empty() ) if ( itemlist.empty() )
return; return;
@ -2505,7 +2505,7 @@ void FListView::processClick()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::processChanged() void FListView::processChanged() const
{ {
emitCallback("row-changed"); emitCallback("row-changed");
} }
@ -2855,7 +2855,7 @@ void FListView::scrollBy (int dx, int dy)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::cb_vbarChange (const FWidget*, const FDataPtr) void FListView::cb_vbarChange (const FWidget*)
{ {
FScrollbar::sType scrollType = vbar->getScrollType(); FScrollbar::sType scrollType = vbar->getScrollType();
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;
@ -2922,7 +2922,7 @@ void FListView::cb_vbarChange (const FWidget*, const FDataPtr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::cb_hbarChange (const FWidget*, const FDataPtr) void FListView::cb_hbarChange (const FWidget*)
{ {
FScrollbar::sType scrollType = hbar->getScrollType(); FScrollbar::sType scrollType = hbar->getScrollType();
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;

View File

@ -1612,7 +1612,7 @@ inline void FMenu::closeMenu()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::processActivate() void FMenu::processActivate() const
{ {
emitCallback("activate"); emitCallback("activate");
} }

View File

@ -568,25 +568,25 @@ void FMenuItem::updateSuperMenuDimensions()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::processEnable() void FMenuItem::processEnable() const
{ {
emitCallback("enable"); emitCallback("enable");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::processDisable() void FMenuItem::processDisable() const
{ {
emitCallback("disable"); emitCallback("disable");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::processActivate() void FMenuItem::processActivate() const
{ {
emitCallback("activate"); emitCallback("activate");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::processDeactivate() void FMenuItem::processDeactivate() const
{ {
emitCallback("deactivate"); emitCallback("deactivate");
} }

View File

@ -109,6 +109,7 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
else else
{ {
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
if ( button[n] )
delete button[n]; delete button[n];
if ( mbox.getParentWidget() ) if ( mbox.getParentWidget() )
@ -139,6 +140,7 @@ void FMessageBox::setHeadline (const FString& headline)
setHeight(getHeight() + 2, true); setHeight(getHeight() + 2, true);
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
if ( button[n] )
button[n]->setY (int(getHeight()) - 4, false); button[n]->setY (int(getHeight()) - 4, false);
const std::size_t column_width = getColumnWidth(headline_text); const std::size_t column_width = getColumnWidth(headline_text);
@ -269,6 +271,7 @@ inline void FMessageBox::allocation()
inline void FMessageBox::deallocation() inline void FMessageBox::deallocation()
{ {
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
if ( button[n] )
delete button[n]; delete button[n];
} }
@ -390,6 +393,9 @@ void FMessageBox::resizeButtons() const
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
{ {
if ( ! button[n] )
continue;
len[n] = button[n]->getText().getLength(); len[n] = button[n]->getText().getLength();
if ( button[n]->getText().includes('&') ) if ( button[n]->getText().includes('&') )
@ -411,6 +417,7 @@ void FMessageBox::resizeButtons() const
max_size = 7; max_size = 7;
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
if ( button[n] )
button[n]->setWidth(max_size + 3, false); button[n]->setWidth(max_size + 3, false);
} }
@ -422,6 +429,9 @@ void FMessageBox::adjustButtons()
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
{ {
if ( ! button[n] )
continue;
if ( n == num_buttons - 1 ) if ( n == num_buttons - 1 )
btn_width += button[n]->getWidth(); btn_width += button[n]->getWidth();
else else
@ -441,6 +451,9 @@ void FMessageBox::adjustButtons()
for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++) for (std::size_t n{0}; n < num_buttons && n < MAX_BUTTONS; n++)
{ {
if ( ! button[n] )
continue;
if ( n == 0 ) if ( n == 0 )
button[n]->setX(btn_x); button[n]->setX(btn_x);
else else

View File

@ -77,7 +77,7 @@ void FRadioMenuItem::init()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FRadioMenuItem::processToggle() void FRadioMenuItem::processToggle() const
{ {
emitCallback("toggled"); emitCallback("toggled");
} }

View File

@ -866,7 +866,7 @@ void FScrollView::setViewportCursor() const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollView::cb_vbarChange (const FWidget*, const FDataPtr) void FScrollView::cb_vbarChange (const FWidget*)
{ {
FScrollbar::sType scrollType = vbar->getScrollType(); FScrollbar::sType scrollType = vbar->getScrollType();
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;
@ -925,7 +925,7 @@ void FScrollView::cb_vbarChange (const FWidget*, const FDataPtr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollView::cb_hbarChange (const FWidget*, const FDataPtr) void FScrollView::cb_hbarChange (const FWidget*)
{ {
FScrollbar::sType scrollType = hbar->getScrollType(); FScrollbar::sType scrollType = hbar->getScrollType();
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;

View File

@ -399,13 +399,13 @@ inline void FSpinBox::decreaseValue()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FSpinBox::processActivate() void FSpinBox::processActivate() const
{ {
emitCallback("activate"); emitCallback("activate");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FSpinBox::processChanged() void FSpinBox::processChanged() const
{ {
emitCallback("changed"); emitCallback("changed");
} }

View File

@ -114,7 +114,7 @@ void FStatusKey::init()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FStatusKey::processActivate() void FStatusKey::processActivate() const
{ {
emitCallback("activate"); emitCallback("activate");
} }

View File

@ -736,7 +736,7 @@ inline bool FTextView::isPrintable (wchar_t ch) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTextView::processChanged() void FTextView::processChanged() const
{ {
emitCallback("changed"); emitCallback("changed");
} }
@ -763,7 +763,7 @@ void FTextView::changeOnResize() const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTextView::cb_vbarChange (const FWidget*, const FDataPtr) void FTextView::cb_vbarChange (const FWidget*)
{ {
const FScrollbar::sType scrollType = vbar->getScrollType(); const FScrollbar::sType scrollType = vbar->getScrollType();
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;
@ -818,7 +818,7 @@ void FTextView::cb_vbarChange (const FWidget*, const FDataPtr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTextView::cb_hbarChange (const FWidget*, const FDataPtr) void FTextView::cb_hbarChange (const FWidget*)
{ {
const FScrollbar::sType scrollType = hbar->getScrollType(); const FScrollbar::sType scrollType = hbar->getScrollType();
static constexpr int wheel_distance = 4; static constexpr int wheel_distance = 4;

View File

@ -414,13 +414,13 @@ void FToggleButton::drawLabel()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::processClick() void FToggleButton::processClick() const
{ {
emitCallback("clicked"); emitCallback("clicked");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::processToggle() void FToggleButton::processToggle() const
{ {
emitCallback("toggled"); emitCallback("toggled");
} }

View File

@ -1833,7 +1833,7 @@ void FWidget::KeyDownEvent (FKeyEvent* kev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::emitWheelCallback (const FWheelEvent* ev) void FWidget::emitWheelCallback (const FWheelEvent* ev) const
{ {
const int wheel = ev->getWheel(); const int wheel = ev->getWheel();

View File

@ -149,7 +149,7 @@ class FButton : public FWidget
void draw() override; void draw() override;
void updateStatusBar() const; void updateStatusBar() const;
void updateButtonColor(); void updateButtonColor();
void processClick(); void processClick() const;
// Data members // Data members
FString text{}; FString text{};

View File

@ -83,7 +83,7 @@ class FCheckMenuItem : public FMenuItem
private: private:
// Methods // Methods
void init(); void init();
void processToggle(); void processToggle() const;
void processClicked() override; void processClicked() override;
}; };

View File

@ -211,8 +211,8 @@ class FComboBox : public FWidget
void onePosUp(); void onePosUp();
void onePosDown(); void onePosDown();
void passEventToListWindow (FMouseEvent* const&); void passEventToListWindow (FMouseEvent* const&);
void processClick(); void processClick() const;
void processChanged(); void processChanged() const;
// Callback methods // Callback methods
void cb_setInputField(); void cb_setInputField();

View File

@ -201,7 +201,7 @@ class FLineEdit : public FWidget
bool keyInput (FKey); bool keyInput (FKey);
wchar_t characterFilter (const wchar_t) const; wchar_t characterFilter (const wchar_t) const;
void processActivate(); void processActivate();
void processChanged(); void processChanged() const;
// Data members // Data members
FString text{""}; FString text{""};

View File

@ -301,16 +301,16 @@ class FListBox : public FWidget
bool changeSelectionAndPosition(); bool changeSelectionAndPosition();
bool deletePreviousCharacter(); bool deletePreviousCharacter();
bool keyIncSearchInput (FKey); bool keyIncSearchInput (FKey);
void processClick(); void processClick() const;
void processSelect(); void processSelect() const;
void processChanged(); void processChanged() const;
void changeOnResize() const; void changeOnResize() const;
void lazyConvert (listBoxItems::iterator, int); void lazyConvert (listBoxItems::iterator, int);
listBoxItems::iterator index2iterator (std::size_t); listBoxItems::iterator index2iterator (std::size_t);
listBoxItems::const_iterator index2iterator (std::size_t index) const; listBoxItems::const_iterator index2iterator (std::size_t index) const;
// Callback methods // Callback methods
void cb_vbarChange (const FWidget*, const FDataPtr); void cb_vbarChange (const FWidget*);
void cb_hbarChange (const FWidget*, const FDataPtr); void cb_hbarChange (const FWidget*);
// Function Pointer // Function Pointer
lazyInsert lazy_inserter{}; lazyInsert lazy_inserter{};

View File

@ -428,8 +428,8 @@ class FListView : public FWidget
void dragDown (int); void dragDown (int);
void stopDragScroll(); void stopDragScroll();
iterator appendItem (FListViewItem*); iterator appendItem (FListViewItem*);
void processClick(); void processClick() const;
void processChanged(); void processChanged() const;
void changeOnResize() const; void changeOnResize() const;
void toggleCheckbox(); void toggleCheckbox();
void collapseAndScrollLeft(); void collapseAndScrollLeft();
@ -451,8 +451,8 @@ class FListView : public FWidget
bool hasCheckableItems() const; bool hasCheckableItems() const;
// Callback methods // Callback methods
void cb_vbarChange (const FWidget*, const FDataPtr); void cb_vbarChange (const FWidget*);
void cb_hbarChange (const FWidget*, const FDataPtr); void cb_hbarChange (const FWidget*);
// Data members // Data members
iterator root{}; iterator root{};

View File

@ -216,7 +216,7 @@ class FMenu : public FWindow, public FMenuList
void selectNextMenu (FKeyEvent*); void selectNextMenu (FKeyEvent*);
void acceptSelection(); void acceptSelection();
void closeMenu(); void closeMenu();
void processActivate(); void processActivate() const;
// Data members // Data members
FMenuItem menuitem{}; FMenuItem menuitem{};

View File

@ -156,10 +156,10 @@ class FMenuItem : public FWidget
// Methods // Methods
void init(); void init();
void updateSuperMenuDimensions(); void updateSuperMenuDimensions();
void processEnable(); void processEnable() const;
void processDisable(); void processDisable() const;
void processActivate(); void processActivate() const;
void processDeactivate(); void processDeactivate() const;
void createDialogList (FMenu*) const; void createDialogList (FMenu*) const;
template <typename T> template <typename T>
void passMouseEvent (T, const FMouseEvent*, fc::events) const; void passMouseEvent (T, const FMouseEvent*, fc::events) const;

View File

@ -83,7 +83,7 @@ class FRadioMenuItem : public FMenuItem
private: private:
// Methods // Methods
void init(); void init();
void processToggle(); void processToggle() const;
void processClicked() override; void processClicked() override;
}; };

View File

@ -196,7 +196,7 @@ void initScrollbar ( FScrollbarPtr& bar
bar->addCallback bar->addCallback
( (
"change-value", "change-value",
std::bind(cb_handler, cb_instance, bar.get(), nullptr) std::bind(cb_handler, cb_instance, bar.get())
); );
} }

View File

@ -172,8 +172,8 @@ class FScrollView : public FWidget
void setViewportCursor() const; void setViewportCursor() const;
// Callback methods // Callback methods
void cb_vbarChange (const FWidget*, const FDataPtr); void cb_vbarChange (const FWidget*);
void cb_hbarChange (const FWidget*, const FDataPtr); void cb_hbarChange (const FWidget*);
// Data members // Data members
FRect scroll_geometry{1, 1, 1, 1}; FRect scroll_geometry{1, 1, 1, 1};

View File

@ -135,8 +135,8 @@ class FSpinBox : public FWidget
void updateInputField(); void updateInputField();
void increaseValue(); void increaseValue();
void decreaseValue(); void decreaseValue();
void processActivate(); void processActivate() const;
void processChanged(); void processChanged() const;
void forceFocus(); void forceFocus();
// Callback methods // Callback methods

View File

@ -110,7 +110,7 @@ class FStatusKey : public FWidget
private: private:
// Methods // Methods
void init(); void init();
void processActivate(); void processActivate() const;
FStatusBar* getConnectedStatusbar() const; FStatusBar* getConnectedStatusbar() const;
void setConnectedStatusbar (FStatusBar*); void setConnectedStatusbar (FStatusBar*);

View File

@ -157,12 +157,12 @@ class FTextView : public FWidget
void drawText(); void drawText();
bool useFDialogBorder() const; bool useFDialogBorder() const;
bool isPrintable (wchar_t) const; bool isPrintable (wchar_t) const;
void processChanged(); void processChanged() const;
void changeOnResize() const; void changeOnResize() const;
// Callback methods // Callback methods
void cb_vbarChange (const FWidget*, const FDataPtr); void cb_vbarChange (const FWidget*);
void cb_hbarChange (const FWidget*, const FDataPtr); void cb_hbarChange (const FWidget*);
// Data members // Data members
FStringList data{}; FStringList data{};

View File

@ -133,8 +133,8 @@ class FToggleButton : public FWidget
// Methods // Methods
void draw() override; void draw() override;
void drawLabel(); void drawLabel();
void processClick(); void processClick() const;
void processToggle(); void processToggle() const;
// Event handler // Event handler
void onKeyPress (FKeyEvent*) override; void onKeyPress (FKeyEvent*) override;

View File

@ -441,10 +441,10 @@ class FWidget : public FVTerm, public FObject
void insufficientSpaceAdjust(); void insufficientSpaceAdjust();
void KeyPressEvent (FKeyEvent*); void KeyPressEvent (FKeyEvent*);
void KeyDownEvent (FKeyEvent*); void KeyDownEvent (FKeyEvent*);
void emitWheelCallback (const FWheelEvent*); void emitWheelCallback (const FWheelEvent*) const;
void setWindowFocus (bool); void setWindowFocus (bool);
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes); bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
void processDestroy(); void processDestroy() const;
virtual void draw(); virtual void draw();
void drawWindows() const; void drawWindows() const;
void drawChildren(); void drawChildren();
@ -1050,7 +1050,7 @@ inline uInt& FWidget::setModalDialogCounter()
{ return modal_dialog_counter; } { return modal_dialog_counter; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FWidget::processDestroy() inline void FWidget::processDestroy() const
{ emitCallback("destroy"); } { emitCallback("destroy"); }