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");
}

View File

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

View File

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

View File

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

View File

@ -1696,19 +1696,19 @@ inline bool FListBox::keyIncSearchInput (FKey key)
}
//----------------------------------------------------------------------
void FListBox::processClick()
void FListBox::processClick() const
{
emitCallback("clicked");
}
//----------------------------------------------------------------------
void FListBox::processSelect()
void FListBox::processSelect() const
{
emitCallback("row-selected");
}
//----------------------------------------------------------------------
void FListBox::processChanged()
void FListBox::processChanged() const
{
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;
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 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() )
return;
@ -2505,7 +2505,7 @@ void FListView::processClick()
}
//----------------------------------------------------------------------
void FListView::processChanged()
void FListView::processChanged() const
{
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();
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();
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");
}

View File

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

View File

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

View File

@ -77,7 +77,7 @@ void FRadioMenuItem::init()
}
//----------------------------------------------------------------------
void FRadioMenuItem::processToggle()
void FRadioMenuItem::processToggle() const
{
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();
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();
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");
}
//----------------------------------------------------------------------
void FSpinBox::processChanged()
void FSpinBox::processChanged() const
{
emitCallback("changed");
}

View File

@ -114,7 +114,7 @@ void FStatusKey::init()
}
//----------------------------------------------------------------------
void FStatusKey::processActivate()
void FStatusKey::processActivate() const
{
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");
}
@ -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();
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();
static constexpr int wheel_distance = 4;

View File

@ -414,13 +414,13 @@ void FToggleButton::drawLabel()
}
//----------------------------------------------------------------------
void FToggleButton::processClick()
void FToggleButton::processClick() const
{
emitCallback("clicked");
}
//----------------------------------------------------------------------
void FToggleButton::processToggle()
void FToggleButton::processToggle() const
{
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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -196,7 +196,7 @@ void initScrollbar ( FScrollbarPtr& bar
bar->addCallback
(
"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;
// Callback methods
void cb_vbarChange (const FWidget*, const FDataPtr);
void cb_hbarChange (const FWidget*, const FDataPtr);
void cb_vbarChange (const FWidget*);
void cb_hbarChange (const FWidget*);
// Data members
FRect scroll_geometry{1, 1, 1, 1};

View File

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

View File

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

View File

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

View File

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

View File

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