New Widget class FSpinBox to provide spin boxes
This commit is contained in:
parent
5852c8129b
commit
dedc1f3410
|
@ -39,6 +39,7 @@ examples/.libs/
|
|||
examples/calculator
|
||||
examples/dialog
|
||||
examples/string-operations
|
||||
examples/background-color
|
||||
examples/opti-move
|
||||
examples/termcap
|
||||
examples/hello
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2019-11-16 Markus Gans <guru.mail@muenster.de>
|
||||
* New Widget class FSpinBox to provide spin boxes
|
||||
|
||||
2019-11-06 Markus Gans <guru.mail@muenster.de>
|
||||
* Improved display of the NewFont midline
|
||||
|
||||
|
|
51
README.md
51
README.md
|
@ -178,36 +178,39 @@ Class digramm
|
|||
: ┌--------┤ FString │ │ ┌──────────────┐
|
||||
: : └─────────┘ │ ┌────┤ FApplication │
|
||||
: : *┌────────┐ │ │ └──────────────┘
|
||||
: ┌--------┤ FPoint │ │ │ ┌─────────┐
|
||||
: : └────────┘ │ ├────┤ FButton │
|
||||
: : *┌───────┐ │ │ └─────────┘
|
||||
: ┌--------┤ FRect │ │ │ ┌────────┐
|
||||
: : └───────┘ │ ├────┤ FLabel │
|
||||
: ┌--------┤ FPoint │ │ │ ┌────────┐
|
||||
: : └────────┘ │ ├────┤ FLabel │
|
||||
: : *┌───────┐ │ │ └────────┘
|
||||
: ┌--------┤ FSize │ │ │ ┌───────────┐
|
||||
: ┌--------┤ FRect │ │ │ ┌───────────┐
|
||||
: : └───────┘ │ ├────┤ FLineEdit │
|
||||
:1 :1 │ │ └───────────┘
|
||||
┌─┴──┴──┐ │ │ ┌──────────────┐ ┌──────────────┐
|
||||
│ FTerm │ │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
|
||||
└───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘
|
||||
:1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐
|
||||
┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
|
||||
│ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘
|
||||
└────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐
|
||||
├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │
|
||||
┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘
|
||||
│ FObject │◄──┘ │ ┌────────────┐
|
||||
└─────────┘ ├────┤ FScrollbar │
|
||||
: : *┌───────┐ │ │ └───────────┘
|
||||
: ┌--------┤ FSize │ │ │ ┌──────────┐
|
||||
: : └───────┘ │ ├────┤ FSpinBox │
|
||||
:1 :1 │ │ └──────────┘
|
||||
┌─┴──┴──┐ │ │ ┌─────────┐
|
||||
│ FTerm │ │ ├────┤ FButton │
|
||||
└───┬───┘ ┌────────┐ │ │ └─────────┘
|
||||
:1 │ FEvent │◄─────┘ │ ┌──────────────┐ ┌──────────────┐
|
||||
┌───┴────┐ └────┬───┘ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
|
||||
│ FVTerm │◄──┐ :1 │ └──────────────┘ │ └──────────────┘
|
||||
└────────┘ │ ┌────┴────┐ │ ┌───────────────┐ │ ┌───────────┐
|
||||
├────┤ FWidget │◄───────┼────┤ FToggleButton │◄─┼──┤ FCheckBox │
|
||||
┌─────────┐ │ └─────────┘ │ └───────────────┘ │ └───────────┘
|
||||
│ FObject │◄──┘ │ ┌──────────────┐ │ ┌─────────┐
|
||||
└─────────┘ ├────┤ FProgressbar │ └──┤ FSwitch │
|
||||
│ └──────────────┘ └─────────┘
|
||||
│ ┌────────────┐
|
||||
├────┤ FScrollbar │
|
||||
│ └────────────┘
|
||||
│ ┌───────────┐
|
||||
├────┤ FTextView │
|
||||
│ └───────────┘
|
||||
│ ┌──────────┐1 *┌──────────────┐
|
||||
├────┤ FListBox ├-------┤ FListBoxItem │
|
||||
│ └──────────┘ └──────────────┘
|
||||
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
|
||||
│ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │
|
||||
└─────────────┘ │ └───────────┘ └───────────────┘
|
||||
┌─────────────┐1 │ ┌──────────┐1 *┌──────────────┐
|
||||
│ FTermBuffer ├----------------------├────┤ FListBox ├-------┤ FListBoxItem │
|
||||
└─────────────┘ │ └──────────┘ └──────────────┘
|
||||
│ 1┌───────────┐1 *┌───────────────┐
|
||||
├────┤ FListView ├------┤ FListViewItem │
|
||||
│ └───────────┘ └───────────────┘
|
||||
│ ┌─────────────┐
|
||||
├────┤ FScrollView │
|
||||
│ └─────────────┘
|
||||
|
|
|
@ -44,36 +44,39 @@
|
|||
: ┌--------┤ FString │ │ ┌──────────────┐
|
||||
: : └─────────┘ │ ┌────┤ FApplication │
|
||||
: : *┌────────┐ │ │ └──────────────┘
|
||||
: ┌--------┤ FPoint │ │ │ ┌─────────┐
|
||||
: : └────────┘ │ ├────┤ FButton │
|
||||
: : *┌───────┐ │ │ └─────────┘
|
||||
: ┌--------┤ FRect │ │ │ ┌────────┐
|
||||
: : └───────┘ │ ├────┤ FLabel │
|
||||
: ┌--------┤ FPoint │ │ │ ┌────────┐
|
||||
: : └────────┘ │ ├────┤ FLabel │
|
||||
: : *┌───────┐ │ │ └────────┘
|
||||
: ┌--------┤ FSize │ │ │ ┌───────────┐
|
||||
: ┌--------┤ FRect │ │ │ ┌───────────┐
|
||||
: : └───────┘ │ ├────┤ FLineEdit │
|
||||
:1 :1 │ │ └───────────┘
|
||||
┌─┴──┴──┐ │ │ ┌──────────────┐ ┌──────────────┐
|
||||
│ FTerm │ │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
|
||||
└───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘
|
||||
:1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐
|
||||
┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
|
||||
│ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘
|
||||
└────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐
|
||||
├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │
|
||||
┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘
|
||||
│ FObject │◄──┘ │ ┌────────────┐
|
||||
└─────────┘ ├────┤ FScrollbar │
|
||||
: : *┌───────┐ │ │ └───────────┘
|
||||
: ┌--------┤ FSize │ │ │ ┌──────────┐
|
||||
: : └───────┘ │ ├────┤ FSpinBox │
|
||||
:1 :1 │ │ └──────────┘
|
||||
┌─┴──┴──┐ │ │ ┌─────────┐
|
||||
│ FTerm │ │ ├────┤ FButton │
|
||||
└───┬───┘ ┌────────┐ │ │ └─────────┘
|
||||
:1 │ FEvent │◄─────┘ │ ┌──────────────┐ ┌──────────────┐
|
||||
┌───┴────┐ └────┬───┘ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
|
||||
│ FVTerm │◄──┐ :1 │ └──────────────┘ │ └──────────────┘
|
||||
└────────┘ │ ┌────┴────┐ │ ┌───────────────┐ │ ┌───────────┐
|
||||
├────┤ FWidget │◄───────┼────┤ FToggleButton │◄─┼──┤ FCheckBox │
|
||||
┌─────────┐ │ └─────────┘ │ └───────────────┘ │ └───────────┘
|
||||
│ FObject │◄──┘ │ ┌──────────────┐ │ ┌─────────┐
|
||||
└─────────┘ ├────┤ FProgressbar │ └──┤ FSwitch │
|
||||
│ └──────────────┘ └─────────┘
|
||||
│ ┌────────────┐
|
||||
├────┤ FScrollbar │
|
||||
│ └────────────┘
|
||||
│ ┌───────────┐
|
||||
├────┤ FTextView │
|
||||
│ └───────────┘
|
||||
│ ┌──────────┐1 *┌──────────────┐
|
||||
├────┤ FListBox ├-------┤ FListBoxItem │
|
||||
│ └──────────┘ └──────────────┘
|
||||
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
|
||||
│ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │
|
||||
└─────────────┘ │ └───────────┘ └───────────────┘
|
||||
┌─────────────┐1 │ ┌──────────┐1 *┌──────────────┐
|
||||
│ FTermBuffer ├----------------------├────┤ FListBox ├-------┤ FListBoxItem │
|
||||
└─────────────┘ │ └──────────┘ └──────────────┘
|
||||
│ 1┌───────────┐1 *┌───────────────┐
|
||||
├────┤ FListView ├------┤ FListViewItem │
|
||||
│ └───────────┘ └───────────────┘
|
||||
│ ┌─────────────┐
|
||||
├────┤ FScrollView │
|
||||
│ └─────────────┘
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
First steps with the Final Cut widget toolkit
|
||||
First steps with the FINAL CUT widget toolkit
|
||||
=============================================
|
||||
|
||||
Table of Contents
|
||||
|
|
|
@ -33,7 +33,7 @@ using finalcut::FSize;
|
|||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class TextWindow
|
||||
// class SegmentView
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class SegmentView : public finalcut::FDialog
|
||||
|
|
|
@ -25,6 +25,7 @@ noinst_PROGRAMS = \
|
|||
calculator \
|
||||
watch \
|
||||
term-attributes \
|
||||
background-color \
|
||||
transparent \
|
||||
keyboard \
|
||||
mouse \
|
||||
|
@ -50,6 +51,7 @@ mandelbrot_SOURCES = mandelbrot.cpp
|
|||
calculator_SOURCES = calculator.cpp
|
||||
watch_SOURCES = watch.cpp
|
||||
term_attributes_SOURCES = term-attributes.cpp
|
||||
background_color_SOURCES = background-color.cpp
|
||||
termcap_SOURCES = termcap.cpp
|
||||
transparent_SOURCES = transparent.cpp
|
||||
keyboard_SOURCES = keyboard.cpp
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
/***********************************************************************
|
||||
* background-color.cpp - Sets the background color palette *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* as published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* The Final Cut is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this program. If not, see *
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <final/final.h>
|
||||
|
||||
using finalcut::FPoint;
|
||||
using finalcut::FSize;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Background
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class Background : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
explicit Background (finalcut::FWidget* = nullptr);
|
||||
|
||||
private:
|
||||
// Callback method
|
||||
void cb_changed (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data members
|
||||
finalcut::FSpinBox red{this};
|
||||
finalcut::FSpinBox green{this};
|
||||
finalcut::FSpinBox blue{this};
|
||||
finalcut::FButton quit{"&Quit", this};
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
Background::Background (finalcut::FWidget* parent)
|
||||
: FDialog(parent)
|
||||
{
|
||||
// Dialog settings
|
||||
setText ("Background color palette");
|
||||
setGeometry (FPoint(25, 5), FSize(32, 9));
|
||||
|
||||
// Spin boxes
|
||||
red.setGeometry (FPoint(2, 2), FSize(7, 1));
|
||||
red.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||
red.setLabelText ("Red");
|
||||
red.setRange (0, 255);
|
||||
red.setValue (0x80);
|
||||
|
||||
green.setGeometry (FPoint(12, 2), FSize(7, 1));
|
||||
green.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||
green.setLabelText ("Green");
|
||||
green.setRange (0, 255);
|
||||
green.setValue (0xa4);
|
||||
|
||||
blue.setGeometry (FPoint(22, 2), FSize(7, 1));
|
||||
blue.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||
blue.setLabelText ("Blue");
|
||||
blue.setRange (0, 255);
|
||||
blue.setValue (0xec);
|
||||
|
||||
// Set the initial palette values
|
||||
const auto& wc = getFWidgetColors();
|
||||
finalcut::FTerm::setPalette ( wc.term_bg
|
||||
, red.getValue()
|
||||
, green.getValue()
|
||||
, blue.getValue() );
|
||||
|
||||
// Quit button
|
||||
quit.setGeometry(FPoint(19, 5), FSize(10, 1));
|
||||
|
||||
// Add some function callbacks
|
||||
quit.addCallback
|
||||
(
|
||||
"clicked",
|
||||
F_METHOD_CALLBACK (this, &finalcut::FApplication::cb_exitApp)
|
||||
);
|
||||
|
||||
red.addCallback
|
||||
(
|
||||
"changed",
|
||||
F_METHOD_CALLBACK (this, &Background::cb_changed)
|
||||
);
|
||||
|
||||
green.addCallback
|
||||
(
|
||||
"changed",
|
||||
F_METHOD_CALLBACK (this, &Background::cb_changed)
|
||||
);
|
||||
|
||||
blue.addCallback
|
||||
(
|
||||
"changed",
|
||||
F_METHOD_CALLBACK (this, &Background::cb_changed)
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Background::cb_changed (finalcut::FWidget*, FDataPtr)
|
||||
{
|
||||
const auto& wc = getFWidgetColors();
|
||||
finalcut::FTerm::setPalette ( wc.term_bg
|
||||
, red.getValue()
|
||||
, green.getValue()
|
||||
, blue.getValue() );
|
||||
redraw();
|
||||
updateTerminal();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// main part
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
finalcut::FApplication app(argc, argv);
|
||||
Background dialog(&app);
|
||||
app.setMainWidget(&dialog);
|
||||
dialog.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ void AttribDemo::printColorLine()
|
|||
{
|
||||
auto parent = static_cast<AttribDlg*>(getParent());
|
||||
|
||||
for (FColor color{0}; color < colors; color++)
|
||||
for (FColor color{0}; color < uInt(colors); color++)
|
||||
{
|
||||
print() << FColorPair(color, parent->bgcolor) << " # ";
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
|
||||
Quit.setText (L"&Quit");
|
||||
|
||||
// Add some function callbacks
|
||||
// Callback function
|
||||
Quit.addCallback
|
||||
(
|
||||
"clicked",
|
||||
|
|
|
@ -44,7 +44,7 @@ libfinal_la_SOURCES = \
|
|||
ffiledialog.cpp \
|
||||
fkey_map.cpp \
|
||||
fcharmap.cpp \
|
||||
ftextview.cpp \
|
||||
fspinbox.cpp \
|
||||
fstartoptions.cpp \
|
||||
fstatusbar.cpp \
|
||||
ftermcap.cpp \
|
||||
|
@ -58,6 +58,7 @@ libfinal_la_SOURCES = \
|
|||
ftermios.cpp \
|
||||
fterm.cpp \
|
||||
fterm_functions.cpp \
|
||||
ftextview.cpp \
|
||||
fvterm.cpp \
|
||||
fevent.cpp \
|
||||
foptiattr.cpp \
|
||||
|
@ -117,6 +118,7 @@ finalcutinclude_HEADERS = \
|
|||
include/final/frect.h \
|
||||
include/final/fscrollbar.h \
|
||||
include/final/fscrollview.h \
|
||||
include/final/fspinbox.h \
|
||||
include/final/fstartoptions.h \
|
||||
include/final/fstatusbar.h \
|
||||
include/final/fstring.h \
|
||||
|
@ -133,8 +135,8 @@ finalcutinclude_HEADERS = \
|
|||
include/final/ftermios.h \
|
||||
include/final/fterm.h \
|
||||
include/final/ftermdata.h \
|
||||
include/final/fvterm.h \
|
||||
include/final/ftextview.h \
|
||||
include/final/fvterm.h \
|
||||
include/final/ftogglebutton.h \
|
||||
include/final/fcolorpalette.h \
|
||||
include/final/fwidgetcolors.h \
|
||||
|
|
|
@ -151,27 +151,6 @@ bool FButton::setEnable (bool enable)
|
|||
bool FButton::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( enable )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isEnabled() && getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
||||
updateButtonColor();
|
||||
return enable;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace finalcut
|
|||
|
||||
// constructor and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FLineEdit::FLineEdit(FWidget* parent)
|
||||
FLineEdit::FLineEdit (FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, label{new FLabel("", parent)}
|
||||
{
|
||||
|
@ -196,35 +196,21 @@ bool FLineEdit::setEnable (bool enable)
|
|||
//----------------------------------------------------------------------
|
||||
bool FLineEdit::setFocus (bool enable)
|
||||
{
|
||||
const auto& wc = getFWidgetColors();
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( enable )
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
const auto& wc = getFWidgetColors();
|
||||
|
||||
if ( enable )
|
||||
{
|
||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
||||
setBackgroundColor (wc.inputfield_active_focus_bg);
|
||||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isEnabled() )
|
||||
else
|
||||
{
|
||||
setForegroundColor (wc.inputfield_active_fg);
|
||||
setBackgroundColor (wc.inputfield_active_bg);
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -534,6 +520,19 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FLineEdit::onWheel (FWheelEvent* ev)
|
||||
{
|
||||
// Sends the wheel event to the parent widget
|
||||
|
||||
auto widget = getParentWidget();
|
||||
|
||||
if ( widget )
|
||||
{
|
||||
FApplication::sendEvent(widget, ev);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FLineEdit::onTimer (FTimerEvent*)
|
||||
{
|
||||
|
@ -652,6 +651,10 @@ void FLineEdit::onFocusOut (FFocusEvent*)
|
|||
void FLineEdit::adjustLabel()
|
||||
{
|
||||
auto label_width = getColumnWidth(label_text);
|
||||
auto w = label_associated_widget;
|
||||
|
||||
if ( ! w )
|
||||
return;
|
||||
|
||||
if ( hasHotkey() )
|
||||
label_width--;
|
||||
|
@ -662,12 +665,12 @@ void FLineEdit::adjustLabel()
|
|||
switch ( label_orientation )
|
||||
{
|
||||
case label_above:
|
||||
label->setGeometry ( FPoint(getX(), getY() - 1)
|
||||
label->setGeometry ( FPoint(w->getX(), w->getY() - 1)
|
||||
, FSize(label_width, 1) );
|
||||
break;
|
||||
|
||||
case label_left:
|
||||
label->setGeometry ( FPoint(getX() - int(label_width) - 1, getY())
|
||||
label->setGeometry ( FPoint(w->getX() - int(label_width) - 1, w->getY())
|
||||
, FSize(label_width, 1) );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -180,31 +180,6 @@ void FListBox::setGeometry ( const FPoint& pos, const FSize& size
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FListBox::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( enable )
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::setText (const FString& txt)
|
||||
{
|
||||
|
|
|
@ -112,56 +112,36 @@ bool FMenuItem::setFocus (bool enable)
|
|||
{
|
||||
FWidget::setFocus(enable);
|
||||
|
||||
if ( enable )
|
||||
if ( ! enable || ! isEnabled() || selected )
|
||||
return enable;
|
||||
|
||||
auto menu_list = getFMenuList(*getSuperMenu());
|
||||
setSelected();
|
||||
|
||||
if ( menu_list )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( ! selected )
|
||||
{
|
||||
auto menu_list = getFMenuList(*getSuperMenu());
|
||||
setSelected();
|
||||
|
||||
if ( menu_list )
|
||||
{
|
||||
menu_list->unselectItem();
|
||||
menu_list->setSelectedItem(this);
|
||||
}
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
|
||||
auto parent = getSuperMenu();
|
||||
|
||||
if ( isMenuBar(parent) )
|
||||
{
|
||||
auto menubar_ptr = static_cast<FMenuBar*>(parent);
|
||||
|
||||
if ( menubar_ptr )
|
||||
menubar_ptr->redraw();
|
||||
}
|
||||
else if ( isMenu(parent) )
|
||||
{
|
||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->redraw();
|
||||
}
|
||||
}
|
||||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
}
|
||||
}
|
||||
menu_list->unselectItem();
|
||||
menu_list->setSelectedItem(this);
|
||||
}
|
||||
else
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
|
||||
auto parent = getSuperMenu();
|
||||
|
||||
if ( isMenuBar(parent) )
|
||||
{
|
||||
if ( isEnabled() && getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
auto menubar_ptr = static_cast<FMenuBar*>(parent);
|
||||
|
||||
if ( menubar_ptr )
|
||||
menubar_ptr->redraw();
|
||||
}
|
||||
else if ( isMenu(parent) )
|
||||
{
|
||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
||||
|
||||
if ( menu_ptr )
|
||||
menu_ptr->redraw();
|
||||
}
|
||||
|
||||
return enable;
|
||||
|
|
|
@ -174,6 +174,21 @@ void FObject::delChild (FObject* obj)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FObject::setParent (FObject* parent)
|
||||
{
|
||||
// Sets a new parent object
|
||||
|
||||
if ( ! parent )
|
||||
return;
|
||||
|
||||
removeParent();
|
||||
|
||||
parent_obj = parent;
|
||||
has_parent = true;
|
||||
parent->children_list.push_back(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FObject::event (FEvent* ev)
|
||||
{
|
||||
|
|
|
@ -273,7 +273,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
|||
return;
|
||||
}
|
||||
|
||||
// Process left button
|
||||
// Process left mouse button
|
||||
scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
||||
|
||||
if ( scroll_type == FScrollbar::noScroll )
|
||||
|
@ -341,7 +341,7 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
|||
return;
|
||||
}
|
||||
|
||||
// Process left button
|
||||
// Process left mouse button
|
||||
int new_scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
||||
|
||||
if ( scroll_type == FScrollbar::scrollJump )
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "final/fpoint.h"
|
||||
#include "final/fsize.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -100,6 +102,26 @@ bool FSize::isEmpty() const
|
|||
return width == 0 && height == 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSize::scaleBy (int dx, int dy)
|
||||
{
|
||||
if ( dx < 0 )
|
||||
width -= std::size_t(-dx);
|
||||
else
|
||||
width += std::size_t(dx);
|
||||
|
||||
if ( dx < 0 )
|
||||
height -= std::size_t(-dy);
|
||||
else
|
||||
height += std::size_t(dy);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSize::scaleBy (const FPoint& d)
|
||||
{
|
||||
scaleBy (d.getX(), d.getY());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
std::ostream& operator << (std::ostream& outstr, const FSize& s)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,428 @@
|
|||
/***********************************************************************
|
||||
* fspinbox.cpp - Widget FSpinBox *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* as published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* The Final Cut is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this program. If not, see *
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include "final/fcolorpair.h"
|
||||
#include "final/fevent.h"
|
||||
#include "final/flabel.h"
|
||||
#include "final/flineedit.h"
|
||||
#include "final/fpoint.h"
|
||||
#include "final/fsize.h"
|
||||
#include "final/fspinbox.h"
|
||||
#include "final/fstatusbar.h"
|
||||
#include "final/fwidgetcolors.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FSpinBox
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FSpinBox::FSpinBox (FWidget* parent)
|
||||
: FWidget(parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FSpinBox::~FSpinBox() // destructor
|
||||
{ }
|
||||
|
||||
|
||||
// public methods of FSpinBox
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setGeometry ( const FPoint& pos, const FSize& size
|
||||
, bool adjust )
|
||||
{
|
||||
FWidget::setGeometry (pos, size, adjust);
|
||||
FSize input_field_size(size);
|
||||
input_field_size.scaleBy(-2, 0);
|
||||
input_field.setGeometry (FPoint(1, 1), input_field_size, adjust);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FSpinBox::setEnable (bool enable)
|
||||
{
|
||||
FWidget::setEnable(enable);
|
||||
input_field.setEnable(enable);
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FSpinBox::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(enable);
|
||||
input_field.setFocus(enable);
|
||||
return enable;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FSpinBox::setShadow (bool enable)
|
||||
{
|
||||
if ( enable
|
||||
&& getEncoding() != fc::VT100
|
||||
&& getEncoding() != fc::ASCII )
|
||||
{
|
||||
setFlags().shadow = true;
|
||||
setShadowSize(FSize(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
setFlags().shadow = false;
|
||||
setShadowSize(FSize(0, 0));
|
||||
}
|
||||
|
||||
return getFlags().shadow;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setValue (sInt64 n)
|
||||
{
|
||||
if ( n > max )
|
||||
value = max;
|
||||
else if ( n < min )
|
||||
value = min;
|
||||
else
|
||||
value = n;
|
||||
|
||||
updateInputField();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setMinValue (sInt64 n)
|
||||
{
|
||||
if ( n <= max )
|
||||
value = min = n;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setMaxValue (sInt64 n)
|
||||
{
|
||||
if ( n >= min )
|
||||
max = n;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setRange (sInt64 m, sInt64 n)
|
||||
{
|
||||
if ( m <= n )
|
||||
{
|
||||
value = min = m;
|
||||
max = n;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setPrefix (const FString& text)
|
||||
{
|
||||
pfix = text;
|
||||
updateInputField();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::setSuffix (const FString& text)
|
||||
{
|
||||
sfix = text;
|
||||
updateInputField();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
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(getWidth() - 1, 1)
|
||||
<< dec_button_color
|
||||
<< fc::BlackDownPointingTriangle // ▼
|
||||
<< inc_button_color
|
||||
<< fc::BlackUpPointingTriangle; // ▲
|
||||
|
||||
if ( getFlags().shadow )
|
||||
drawShadow(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::onKeyPress (FKeyEvent* ev)
|
||||
{
|
||||
if ( ! isEnabled() )
|
||||
return;
|
||||
|
||||
FKey key = ev->key();
|
||||
|
||||
switch ( key )
|
||||
{
|
||||
case fc::Fkey_tab:
|
||||
focusNextChild();
|
||||
break;
|
||||
|
||||
case fc::Fkey_btab:
|
||||
focusPrevChild();
|
||||
break;
|
||||
|
||||
case fc::Fkey_up:
|
||||
increaseValue();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_down:
|
||||
decreaseValue();
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ev->isAccepted() )
|
||||
updateInputField();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
if ( ev->getButton() != fc::LeftButton
|
||||
&& ev->getButton() != fc::MiddleButton )
|
||||
return;
|
||||
|
||||
forceFocus();
|
||||
|
||||
if ( min == max )
|
||||
return;
|
||||
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x == int(getWidth()) - 1 && mouse_y == 1 )
|
||||
{
|
||||
spining_state = FSpinBox::spinDown;
|
||||
decreaseValue();
|
||||
updateInputField();
|
||||
threshold_reached = false;
|
||||
addTimer(threshold_time);
|
||||
}
|
||||
else if ( mouse_x == int(getWidth()) && mouse_y == 1 )
|
||||
{
|
||||
spining_state = FSpinBox::spinUp;
|
||||
increaseValue();
|
||||
updateInputField();
|
||||
threshold_reached = false;
|
||||
addTimer(threshold_time);
|
||||
}
|
||||
else
|
||||
delOwnTimer();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::onMouseUp (FMouseEvent*)
|
||||
{
|
||||
delOwnTimer();
|
||||
spining_state = FSpinBox::noSpin;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::onWheel (FWheelEvent* ev)
|
||||
{
|
||||
int wheel = ev->getWheel();
|
||||
|
||||
delOwnTimer();
|
||||
forceFocus();
|
||||
spining_state = FSpinBox::noSpin;
|
||||
|
||||
switch ( wheel )
|
||||
{
|
||||
case fc::WheelUp:
|
||||
increaseValue();
|
||||
updateInputField();
|
||||
break;
|
||||
|
||||
case fc::WheelDown:
|
||||
decreaseValue();
|
||||
updateInputField();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::onTimer (FTimerEvent*)
|
||||
{
|
||||
if ( ! threshold_reached )
|
||||
{
|
||||
threshold_reached = true;
|
||||
delOwnTimer();
|
||||
addTimer(repeat_time);
|
||||
}
|
||||
|
||||
switch ( spining_state )
|
||||
{
|
||||
case FSpinBox::spinUp:
|
||||
increaseValue();
|
||||
updateInputField();
|
||||
break;
|
||||
|
||||
case FSpinBox::spinDown:
|
||||
decreaseValue();
|
||||
updateInputField();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// private methods of FSpinBox
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::init()
|
||||
{
|
||||
setShadow();
|
||||
auto parent_widget = getParentWidget();
|
||||
FLabel* label = input_field.getLabelObject();
|
||||
label->setParent(getParent());
|
||||
label->setForegroundColor (parent_widget->getForegroundColor());
|
||||
label->setBackgroundColor (parent_widget->getBackgroundColor());
|
||||
input_field.setLabelAssociatedWidget(this);
|
||||
input_field.setInputFilter("[-[:digit:]]"); // Only numbers
|
||||
input_field.unsetShadow();
|
||||
input_field << value;
|
||||
input_field.addCallback
|
||||
(
|
||||
"changed",
|
||||
F_METHOD_CALLBACK (this, &FSpinBox::cb_inputFieldChange)
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FSpinBox::updateInputField()
|
||||
{
|
||||
input_field.clear();
|
||||
input_field << pfix << value << sfix;
|
||||
input_field.redraw();
|
||||
redraw();
|
||||
updateTerminal();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FSpinBox::increaseValue()
|
||||
{
|
||||
if ( value < max )
|
||||
{
|
||||
value++;
|
||||
processChanged();
|
||||
}
|
||||
else
|
||||
delOwnTimer();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FSpinBox::decreaseValue()
|
||||
{
|
||||
if ( value > min )
|
||||
{
|
||||
value--;
|
||||
processChanged();
|
||||
}
|
||||
else
|
||||
delOwnTimer();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::processChanged()
|
||||
{
|
||||
emitCallback("changed");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::forceFocus()
|
||||
{
|
||||
if ( hasFocus() )
|
||||
return;
|
||||
|
||||
auto focused_widget = getFocusWidget();
|
||||
setFocus();
|
||||
|
||||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
|
||||
redraw();
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->drawMessage();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSpinBox::cb_inputFieldChange (finalcut::FWidget* w, FDataPtr)
|
||||
{
|
||||
auto lineedit = static_cast<FLineEdit*>(w);
|
||||
|
||||
if ( lineedit->getText().isEmpty() )
|
||||
value = 0;
|
||||
else
|
||||
{
|
||||
std::wregex regex(L"[-]?[[:xdigit:]]+");
|
||||
std::wsmatch match;
|
||||
std::wstring text = lineedit->getText().wc_str();
|
||||
|
||||
if ( std::regex_search(text, match, regex) )
|
||||
{
|
||||
FString tmp(match[0]);
|
||||
value = tmp.toLong();
|
||||
}
|
||||
else
|
||||
value = 0;
|
||||
}
|
||||
|
||||
if ( value > max )
|
||||
value = max;
|
||||
else if ( value < min )
|
||||
value = min;
|
||||
|
||||
updateInputField();
|
||||
processChanged();
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
@ -150,6 +150,30 @@ const wchar_t ambiguous_width_list[] =
|
|||
#endif
|
||||
};
|
||||
|
||||
const wchar_t reverse_newfont_list[] =
|
||||
{
|
||||
fc::NF_rev_left_arrow2,
|
||||
fc::NF_rev_right_arrow2,
|
||||
fc::NF_rev_border_corner_upper_right,
|
||||
fc::NF_rev_border_line_right,
|
||||
fc::NF_rev_border_line_vertical_left,
|
||||
fc::NF_rev_border_corner_lower_right,
|
||||
fc::NF_rev_up_arrow2,
|
||||
fc::NF_rev_down_arrow2,
|
||||
fc::NF_rev_up_arrow1,
|
||||
fc::NF_rev_down_arrow1,
|
||||
fc::NF_rev_left_arrow1,
|
||||
fc::NF_rev_right_arrow1,
|
||||
fc::NF_rev_menu_button1,
|
||||
fc::NF_rev_menu_button2,
|
||||
fc::NF_rev_up_pointing_triangle1,
|
||||
fc::NF_rev_down_pointing_triangle1,
|
||||
fc::NF_rev_up_pointing_triangle2,
|
||||
fc::NF_rev_down_pointing_triangle2,
|
||||
fc::NF_rev_menu_button3,
|
||||
fc::NF_rev_border_line_right_and_left
|
||||
};
|
||||
|
||||
|
||||
// FTerm non-member functions
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -182,6 +206,18 @@ inline bool hasAmbiguousWidth (wchar_t wchar)
|
|||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool isReverseNewFontchar (wchar_t wchar)
|
||||
{
|
||||
const auto& begin = std::begin(reverse_newfont_list);
|
||||
const auto& end = std::end(reverse_newfont_list);
|
||||
|
||||
if ( std::find(begin, end, wchar) != end ) // found
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
wchar_t cp437_to_unicode (uChar c)
|
||||
{
|
||||
|
|
|
@ -143,37 +143,23 @@ bool FToggleButton::setEnable (bool enable)
|
|||
bool FToggleButton::setFocus (bool enable)
|
||||
{
|
||||
FWidget::setFocus(enable);
|
||||
const auto& wc = getFWidgetColors();
|
||||
|
||||
if ( enable )
|
||||
if ( isEnabled() )
|
||||
{
|
||||
if ( isEnabled() )
|
||||
const auto& wc = getFWidgetColors();
|
||||
|
||||
if ( enable )
|
||||
{
|
||||
if ( isRadioButton() )
|
||||
focus_inside_group = false;
|
||||
|
||||
setForegroundColor (wc.toggle_button_active_focus_fg);
|
||||
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
||||
|
||||
if ( getStatusBar() )
|
||||
{
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isEnabled() )
|
||||
else
|
||||
{
|
||||
setForegroundColor (wc.toggle_button_active_fg);
|
||||
setBackgroundColor (wc.toggle_button_active_bg);
|
||||
|
||||
if ( getStatusBar() )
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2864,41 +2864,16 @@ inline void FVTerm::markAsPrinted (uInt from, uInt to, uInt line)
|
|||
inline void FVTerm::newFontChanges (FChar*& next_char)
|
||||
{
|
||||
// NewFont special cases
|
||||
if ( isNewFont() )
|
||||
{
|
||||
switch ( next_char->ch )
|
||||
{
|
||||
case fc::LowerHalfBlock:
|
||||
next_char->ch = fc::UpperHalfBlock;
|
||||
// fall through
|
||||
case fc::NF_rev_left_arrow2:
|
||||
case fc::NF_rev_right_arrow2:
|
||||
case fc::NF_rev_border_corner_upper_right:
|
||||
case fc::NF_rev_border_line_right:
|
||||
case fc::NF_rev_border_line_vertical_left:
|
||||
case fc::NF_rev_border_corner_lower_right:
|
||||
case fc::NF_rev_up_arrow2:
|
||||
case fc::NF_rev_down_arrow2:
|
||||
case fc::NF_rev_up_arrow1:
|
||||
case fc::NF_rev_down_arrow1:
|
||||
case fc::NF_rev_left_arrow1:
|
||||
case fc::NF_rev_right_arrow1:
|
||||
case fc::NF_rev_menu_button1:
|
||||
case fc::NF_rev_menu_button2:
|
||||
case fc::NF_rev_up_pointing_triangle1:
|
||||
case fc::NF_rev_down_pointing_triangle1:
|
||||
case fc::NF_rev_up_pointing_triangle2:
|
||||
case fc::NF_rev_down_pointing_triangle2:
|
||||
case fc::NF_rev_menu_button3:
|
||||
case fc::NF_rev_border_line_right_and_left:
|
||||
// Show in reverse video
|
||||
next_char->attr.bit.reverse = true;
|
||||
break;
|
||||
if ( ! isNewFont() )
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ( next_char->ch == fc::LowerHalfBlock )
|
||||
{
|
||||
next_char->ch = fc::UpperHalfBlock;
|
||||
next_char->attr.bit.reverse = true;
|
||||
}
|
||||
else if ( isReverseNewFontchar(next_char->ch) )
|
||||
next_char->attr.bit.reverse = true; // Show in reverse video
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -284,23 +284,11 @@ bool FWidget::setFocus (bool enable)
|
|||
FWidget::setFocusWidget(this);
|
||||
}
|
||||
|
||||
auto window = FWindow::getWindowWidget(this);
|
||||
|
||||
// set window focus
|
||||
if ( enable && window )
|
||||
{
|
||||
if ( ! window->isWindowActive() )
|
||||
{
|
||||
bool has_raised = window->raiseWindow();
|
||||
FWindow::setActiveWindow(window);
|
||||
|
||||
if ( has_raised && window->isVisible() && window->isShown() )
|
||||
window->redraw();
|
||||
}
|
||||
|
||||
window->setWindowFocusWidget(this);
|
||||
}
|
||||
// Activates the window with the focused widget
|
||||
setWindowFocus (enable);
|
||||
|
||||
// Set status bar text for widget focus
|
||||
setStatusbarText (enable);
|
||||
return (flags.focus = enable);
|
||||
}
|
||||
|
||||
|
@ -1794,17 +1782,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::KeyPressEvent (FKeyEvent* kev)
|
||||
{
|
||||
bool accpt_focus{false};
|
||||
|
||||
if ( kev->key() == fc::Fkey_tab )
|
||||
accpt_focus = focusNextChild();
|
||||
else if ( kev->key() == fc::Fkey_btab )
|
||||
accpt_focus = focusPrevChild();
|
||||
|
||||
if ( accpt_focus )
|
||||
return;
|
||||
|
||||
FWidget* widget(this);
|
||||
FWidget* widget(this);
|
||||
|
||||
while ( widget )
|
||||
{
|
||||
|
@ -1812,15 +1790,20 @@ void FWidget::KeyPressEvent (FKeyEvent* kev)
|
|||
|
||||
if ( ! kev->isAccepted() )
|
||||
{
|
||||
if ( kev->key() == fc::Fkey_right
|
||||
|| kev->key() == fc::Fkey_down )
|
||||
accpt_focus = focusNextChild();
|
||||
else if ( kev->key() == fc::Fkey_left
|
||||
|| kev->key() == fc::Fkey_up )
|
||||
accpt_focus = focusPrevChild();
|
||||
FKey key = kev->key();
|
||||
|
||||
if ( accpt_focus )
|
||||
if ( [&] () -> bool
|
||||
{
|
||||
if ( isFocusNextKey(key) )
|
||||
return focusNextChild();
|
||||
else if ( isFocusPrevKey(key) )
|
||||
return focusPrevChild();
|
||||
|
||||
return false;
|
||||
}() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( kev->isAccepted() || widget->isRootWidget() )
|
||||
|
@ -1846,6 +1829,31 @@ void FWidget::KeyDownEvent (FKeyEvent* kev)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setWindowFocus (bool enable)
|
||||
{
|
||||
// set the window focus
|
||||
|
||||
if ( ! enable )
|
||||
return;
|
||||
|
||||
auto window = FWindow::getWindowWidget(this);
|
||||
|
||||
if ( ! window )
|
||||
return;
|
||||
|
||||
if ( ! window->isWindowActive() )
|
||||
{
|
||||
bool has_raised = window->raiseWindow();
|
||||
FWindow::setActiveWindow(window);
|
||||
|
||||
if ( has_raised && window->isVisible() && window->isShown() )
|
||||
window->redraw();
|
||||
}
|
||||
|
||||
window->setWindowFocusWidget(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWidget::FCallbackPtr FWidget::getCallbackPtr (FCallback cb_function)
|
||||
{
|
||||
|
@ -1954,6 +1962,26 @@ void FWidget::setColorTheme()
|
|||
wcolors.set16ColorTheme();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setStatusbarText (bool enable)
|
||||
{
|
||||
if ( ! isEnabled() || ! getStatusBar() )
|
||||
return;
|
||||
|
||||
if ( enable )
|
||||
{
|
||||
const auto& msg = getStatusbarMessage();
|
||||
const auto& curMsg = getStatusBar()->getMessage();
|
||||
|
||||
if ( curMsg != msg )
|
||||
getStatusBar()->setMessage(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
getStatusBar()->clearMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// non-member functions
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -27,6 +27,28 @@ namespace finalcut
|
|||
{
|
||||
|
||||
// FWidget non-member functions
|
||||
//----------------------------------------------------------------------
|
||||
bool isFocusNextKey (FKey key)
|
||||
{
|
||||
if ( key == fc::Fkey_tab
|
||||
|| key == fc::Fkey_right
|
||||
|| key == fc::Fkey_down )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool isFocusPrevKey (FKey key)
|
||||
{
|
||||
if ( key == fc::Fkey_btab
|
||||
|| key == fc::Fkey_left
|
||||
|| key == fc::Fkey_up )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FKey getHotkey (const FString& text)
|
||||
{
|
||||
|
|
|
@ -117,6 +117,8 @@ void FWidgetColors::set8ColorTheme()
|
|||
scrollbar_bg = fc::LightGray;
|
||||
scrollbar_button_fg = fc::Black;
|
||||
scrollbar_button_bg = fc::LightGray;
|
||||
scrollbar_button_inactive_fg = fc::Cyan;
|
||||
scrollbar_button_inactive_bg = fc::LightGray;
|
||||
progressbar_fg = fc::Blue;
|
||||
progressbar_bg = fc::LightGray;
|
||||
}
|
||||
|
@ -206,6 +208,8 @@ void FWidgetColors::set16ColorTheme()
|
|||
scrollbar_bg = fc::LightBlue;
|
||||
scrollbar_button_fg = fc::Black;
|
||||
scrollbar_button_bg = fc::LightGray;
|
||||
scrollbar_button_inactive_fg = fc::DarkGray;
|
||||
scrollbar_button_inactive_bg = fc::LightGray;
|
||||
progressbar_fg = fc::DarkGray;
|
||||
progressbar_bg = fc::LightBlue;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class FToolTip;
|
|||
class FDialog : public FWindow
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
// Using-declaration
|
||||
using FWindow::setResizeable;
|
||||
|
||||
// Enumeration
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include <final/fscrollbar.h>
|
||||
#include <final/fscrollview.h>
|
||||
#include <final/fsize.h>
|
||||
#include <final/fspinbox.h>
|
||||
#include <final/fstartoptions.h>
|
||||
#include <final/fstatusbar.h>
|
||||
#include <final/fstring.h>
|
||||
|
|
|
@ -70,6 +70,9 @@ class FLabel;
|
|||
class FLineEdit : public FWidget
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
using FWidget::setGeometry;
|
||||
|
||||
// Enumerations
|
||||
enum label_o
|
||||
{
|
||||
|
@ -83,9 +86,6 @@ class FLineEdit : public FWidget
|
|||
password = 1
|
||||
};
|
||||
|
||||
// Using-declaration
|
||||
using FWidget::setGeometry;
|
||||
|
||||
// Constructor
|
||||
explicit FLineEdit (FWidget* = nullptr);
|
||||
explicit FLineEdit (const FString&, FWidget* = nullptr);
|
||||
|
@ -118,7 +118,8 @@ class FLineEdit : public FWidget
|
|||
FString getText() const;
|
||||
std::size_t getMaxLength() const;
|
||||
std::size_t getCursorPosition() const;
|
||||
int getLabelOrientation();
|
||||
FLabel* getLabelObject() const;
|
||||
label_o getLabelOrientation();
|
||||
|
||||
// Mutators
|
||||
void setText (const FString&);
|
||||
|
@ -129,6 +130,7 @@ class FLineEdit : public FWidget
|
|||
void setLabelText (const FString&);
|
||||
void setInputType (const inputType);
|
||||
void setLabelOrientation (const label_o);
|
||||
void setLabelAssociatedWidget (FWidget*);
|
||||
void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
bool setEnable(bool) override;
|
||||
|
@ -154,6 +156,7 @@ class FLineEdit : public FWidget
|
|||
void onMouseDown (FMouseEvent*) override;
|
||||
void onMouseUp (FMouseEvent*) override;
|
||||
void onMouseMove (FMouseEvent*) override;
|
||||
void onWheel (FWheelEvent*) override;
|
||||
void onTimer (FTimerEvent*) override;
|
||||
void onAccel (FAccelEvent*) override;
|
||||
void onHide (FHideEvent*) override;
|
||||
|
@ -206,22 +209,26 @@ class FLineEdit : public FWidget
|
|||
void processChanged();
|
||||
|
||||
// Data members
|
||||
FString text{""};
|
||||
FString print_text{""};
|
||||
FString label_text{""};
|
||||
FLabel* label{};
|
||||
std::wstring input_filter{};
|
||||
dragScroll drag_scroll{FLineEdit::noScroll};
|
||||
label_o label_orientation{FLineEdit::label_left};
|
||||
inputType input_type{FLineEdit::textfield};
|
||||
int scroll_repeat{100};
|
||||
bool scroll_timer{false};
|
||||
bool insert_mode{true};
|
||||
std::size_t cursor_pos{NOT_SET};
|
||||
std::size_t text_offset{0};
|
||||
std::size_t char_width_offset{0};
|
||||
std::size_t x_pos{0};
|
||||
std::size_t max_length{std::numeric_limits<std::size_t>::max()};
|
||||
FString text{""};
|
||||
FString print_text{""};
|
||||
FString label_text{""};
|
||||
FLabel* label{};
|
||||
FWidget* label_associated_widget{this};
|
||||
std::wstring input_filter{};
|
||||
dragScroll drag_scroll{FLineEdit::noScroll};
|
||||
label_o label_orientation{FLineEdit::label_left};
|
||||
inputType input_type{FLineEdit::textfield};
|
||||
int scroll_repeat{100};
|
||||
bool scroll_timer{false};
|
||||
bool insert_mode{true};
|
||||
std::size_t cursor_pos{NOT_SET};
|
||||
std::size_t text_offset{0};
|
||||
std::size_t char_width_offset{0};
|
||||
std::size_t x_pos{0};
|
||||
std::size_t max_length{std::numeric_limits<std::size_t>::max()};
|
||||
|
||||
// Friend class
|
||||
friend class FSpinBox;
|
||||
};
|
||||
|
||||
|
||||
|
@ -243,8 +250,12 @@ inline std::size_t FLineEdit::getCursorPosition() const
|
|||
{ return cursor_pos; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FLineEdit::getLabelOrientation()
|
||||
{ return int(label_orientation); }
|
||||
inline FLabel* FLineEdit::getLabelObject() const
|
||||
{ return label; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FLineEdit::label_o FLineEdit::getLabelOrientation()
|
||||
{ return label_orientation; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FLineEdit::setInputFilter (const FString& regex_string)
|
||||
|
@ -258,6 +269,10 @@ inline void FLineEdit::clearInputFilter()
|
|||
inline void FLineEdit::setInputType (const inputType type)
|
||||
{ input_type = type; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FLineEdit::setLabelAssociatedWidget (FWidget* w)
|
||||
{ label_associated_widget = w; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FLineEdit::setEnable()
|
||||
{ return setEnable(true); }
|
||||
|
|
|
@ -142,12 +142,12 @@ inline void FListBoxItem::clear()
|
|||
class FListBox : public FWidget
|
||||
{
|
||||
public:
|
||||
// Typedef
|
||||
typedef std::vector<FListBoxItem> listBoxItems;
|
||||
|
||||
// Using-declaration
|
||||
using FWidget::setGeometry;
|
||||
|
||||
// Typedef
|
||||
typedef std::vector<FListBoxItem> listBoxItems;
|
||||
|
||||
// Constructor
|
||||
explicit FListBox (FWidget* = nullptr);
|
||||
template <typename Iterator, typename InsertConverter>
|
||||
|
@ -188,9 +188,6 @@ class FListBox : public FWidget
|
|||
void setMultiSelection ();
|
||||
void unsetMultiSelection ();
|
||||
bool setDisable() override;
|
||||
bool setFocus (bool) override;
|
||||
bool setFocus() override;
|
||||
bool unsetFocus() override;
|
||||
void setText (const FString&);
|
||||
|
||||
// Inquiries
|
||||
|
@ -442,14 +439,6 @@ inline void FListBox::unsetMultiSelection()
|
|||
inline bool FListBox::setDisable()
|
||||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::setFocus()
|
||||
{ return setFocus(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::unsetFocus()
|
||||
{ return setFocus(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::isSelected (std::size_t index)
|
||||
{ return index2iterator(index - 1)->selected; }
|
||||
|
|
|
@ -113,6 +113,7 @@ class FObject
|
|||
void removeParent();
|
||||
void addChild (FObject*);
|
||||
void delChild (FObject*);
|
||||
void setParent (FObject*);
|
||||
|
||||
// Event handler
|
||||
virtual bool event (FEvent*);
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FPoint;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FSize
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -95,6 +98,10 @@ class FSize
|
|||
std::size_t& width_ref();
|
||||
std::size_t& height_ref();
|
||||
|
||||
// Methods
|
||||
void scaleBy (int, int);
|
||||
void scaleBy (const FPoint&);
|
||||
|
||||
private:
|
||||
// Data members
|
||||
std::size_t width{0};
|
||||
|
|
|
@ -0,0 +1,219 @@
|
|||
/***********************************************************************
|
||||
* fspinbox.h - Widget FSpinBox *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2019 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* as published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* The Final Cut is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this program. If not, see *
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
/* Inheritance diagram
|
||||
* ═══════════════════
|
||||
*
|
||||
* ▕▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FTerm ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FVTerm ▏ ▕ FObject ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲ ▲
|
||||
* │ │
|
||||
* └─────┬─────┘
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FWidget ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▏
|
||||
* ▲
|
||||
* │
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FSpinBox ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▏
|
||||
*/
|
||||
|
||||
#ifndef FSPINBOX_H
|
||||
#define FSPINBOX_H
|
||||
|
||||
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "final/fwidget.h"
|
||||
|
||||
namespace finalcut
|
||||
{
|
||||
|
||||
// class forward declaration
|
||||
class FLineEdit;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FSpinBox
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class FSpinBox : public FWidget
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
using FWidget::setGeometry;
|
||||
|
||||
// Constructors
|
||||
explicit FSpinBox (FWidget* = nullptr);
|
||||
|
||||
// Disable copy constructor
|
||||
FSpinBox (const FSpinBox&) = delete;
|
||||
|
||||
// Destructor
|
||||
~FSpinBox();
|
||||
|
||||
// Disable assignment operator (=)
|
||||
FSpinBox& operator = (const FSpinBox&) = delete;
|
||||
|
||||
// Accessors
|
||||
sInt64 getValue();
|
||||
FString getPrefix() const;
|
||||
FString getSuffix() const;
|
||||
FLineEdit::label_o getLabelOrientation();
|
||||
|
||||
// Mutators
|
||||
void setGeometry ( const FPoint&, const FSize&
|
||||
, bool = true ) override;
|
||||
bool setEnable (bool) override;
|
||||
bool setEnable() override;
|
||||
bool unsetEnable() override;
|
||||
bool setDisable() override;
|
||||
bool setFocus (bool) override;
|
||||
bool setFocus() override;
|
||||
bool unsetFocus() override;
|
||||
bool setShadow (bool);
|
||||
bool setShadow();
|
||||
bool unsetShadow();
|
||||
void setValue (sInt64);
|
||||
void setMinValue (sInt64);
|
||||
void setMaxValue (sInt64);
|
||||
void setRange (sInt64, sInt64);
|
||||
void setPrefix (const FString&);
|
||||
void setSuffix (const FString&);
|
||||
void setLabelText (const FString&);
|
||||
void setLabelOrientation (const FLineEdit::label_o);
|
||||
|
||||
// Inquiries
|
||||
bool hasShadow();
|
||||
|
||||
// Methods
|
||||
void draw() override;
|
||||
|
||||
// Event handlers
|
||||
void onKeyPress (FKeyEvent*) override;
|
||||
void onMouseDown (FMouseEvent*) override;
|
||||
void onMouseUp (FMouseEvent*) override;
|
||||
void onWheel (FWheelEvent*) override;
|
||||
void onTimer (FTimerEvent*) override;
|
||||
|
||||
private:
|
||||
// Enumeration
|
||||
enum spiningState
|
||||
{
|
||||
noSpin = 0,
|
||||
spinUp = 1,
|
||||
spinDown = 2
|
||||
};
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
void updateInputField();
|
||||
void increaseValue();
|
||||
void decreaseValue();
|
||||
void processChanged();
|
||||
void forceFocus();
|
||||
|
||||
// Callback methods
|
||||
void cb_inputFieldChange (finalcut::FWidget*, FDataPtr);
|
||||
|
||||
// Data members
|
||||
FLineEdit input_field{this};
|
||||
sInt64 value{0};
|
||||
sInt64 min{std::numeric_limits<sInt64>::min()};
|
||||
sInt64 max{std::numeric_limits<sInt64>::max()};
|
||||
FString pfix{};
|
||||
FString sfix{};
|
||||
spiningState spining_state{FSpinBox::noSpin};
|
||||
bool threshold_reached{false};
|
||||
int threshold_time{500};
|
||||
int repeat_time{10};
|
||||
};
|
||||
|
||||
|
||||
// FSpinBox inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline sInt64 FSpinBox::getValue()
|
||||
{ return value; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FSpinBox::getPrefix() const
|
||||
{ return pfix; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FSpinBox::getSuffix() const
|
||||
{ return sfix; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FLineEdit::label_o FSpinBox::getLabelOrientation()
|
||||
{ return input_field.getLabelOrientation(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::setEnable()
|
||||
{ return setEnable(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::unsetEnable()
|
||||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::setDisable()
|
||||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::setFocus()
|
||||
{ return setFocus(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::unsetFocus()
|
||||
{ return setFocus(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::setShadow()
|
||||
{ return setShadow(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::unsetShadow()
|
||||
{ return setShadow(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FSpinBox::hasShadow()
|
||||
{ return getFlags().shadow; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FSpinBox::setLabelText (const FString& s)
|
||||
{ input_field.setLabelText(s); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FSpinBox::setLabelOrientation (const FLineEdit::label_o o)
|
||||
{ input_field.setLabelOrientation(o); }
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FSPINBOX_H
|
|
@ -388,6 +388,7 @@ class FTerm final
|
|||
// implemented in fterm_functions.cpp
|
||||
//----------------------------------------------------------------------
|
||||
uInt env2uint (const char*);
|
||||
bool isReverseNewFontchar (wchar_t);
|
||||
wchar_t cp437_to_unicode (uChar);
|
||||
uChar unicode_to_cp437 (wchar_t);
|
||||
FString getFullWidth (const FString&);
|
||||
|
|
|
@ -410,6 +410,7 @@ class FWidget : public FVTerm, public FObject
|
|||
void insufficientSpaceAdjust();
|
||||
void KeyPressEvent (FKeyEvent*);
|
||||
void KeyDownEvent (FKeyEvent*);
|
||||
void setWindowFocus (bool);
|
||||
FCallbackPtr getCallbackPtr (FCallback);
|
||||
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
|
||||
void processDestroy();
|
||||
|
@ -417,6 +418,7 @@ class FWidget : public FVTerm, public FObject
|
|||
void drawWindows();
|
||||
void drawChildren();
|
||||
static void setColorTheme();
|
||||
void setStatusbarText (bool);
|
||||
|
||||
// Data members
|
||||
FPoint widget_cursor_position{-1, -1};
|
||||
|
@ -527,6 +529,8 @@ class FWidget : public FVTerm, public FObject
|
|||
// implemented in fwidget_functions.cpp
|
||||
//----------------------------------------------------------------------
|
||||
void detectTermSize();
|
||||
bool isFocusNextKey (FKey);
|
||||
bool isFocusPrevKey (FKey);
|
||||
FKey getHotkey (const FString&);
|
||||
std::size_t getHotkeyPos (const FString& src, FString& dest);
|
||||
void setHotkeyViaString (FWidget*, const FString&);
|
||||
|
|
|
@ -134,6 +134,8 @@ class FWidgetColors final
|
|||
FColor scrollbar_bg{fc::Default};
|
||||
FColor scrollbar_button_fg{fc::Default};
|
||||
FColor scrollbar_button_bg{fc::Default};
|
||||
FColor scrollbar_button_inactive_fg{fc::Default};
|
||||
FColor scrollbar_button_inactive_bg{fc::Default};
|
||||
FColor progressbar_fg{fc::Default};
|
||||
FColor progressbar_bg{fc::Default};
|
||||
};
|
||||
|
|
|
@ -59,6 +59,7 @@ class FSizeTest : public CPPUNIT_NS::TestFixture
|
|||
void subtractionTest();
|
||||
void areaTest();
|
||||
void referenceTest();
|
||||
void scaleTest();
|
||||
void streamInsertionTest();
|
||||
void streamExtractionTest();
|
||||
|
||||
|
@ -82,6 +83,7 @@ class FSizeTest : public CPPUNIT_NS::TestFixture
|
|||
CPPUNIT_TEST (subtractionTest);
|
||||
CPPUNIT_TEST (areaTest);
|
||||
CPPUNIT_TEST (referenceTest);
|
||||
CPPUNIT_TEST (scaleTest);
|
||||
CPPUNIT_TEST (streamInsertionTest);
|
||||
CPPUNIT_TEST (streamExtractionTest);
|
||||
|
||||
|
@ -369,6 +371,37 @@ void FSizeTest::referenceTest()
|
|||
CPPUNIT_ASSERT ( s1.getHeight() == 4 );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::scaleTest()
|
||||
{
|
||||
finalcut::FSize s1 (15, 15);
|
||||
CPPUNIT_ASSERT ( s1.getWidth() == 15 );
|
||||
CPPUNIT_ASSERT ( s1.getHeight() == 15 );
|
||||
CPPUNIT_ASSERT ( s1 == finalcut::FSize(15, 15) );
|
||||
|
||||
const finalcut::FPoint p1 (-2, -3);
|
||||
s1.scaleBy(p1);
|
||||
CPPUNIT_ASSERT ( s1.getWidth() == 13 );
|
||||
CPPUNIT_ASSERT ( s1.getHeight() == 12 );
|
||||
CPPUNIT_ASSERT ( s1 == finalcut::FSize(13, 12) );
|
||||
|
||||
const finalcut::FPoint p2 (3, 2);
|
||||
s1.scaleBy(p2);
|
||||
CPPUNIT_ASSERT ( s1.getWidth() == 16 );
|
||||
CPPUNIT_ASSERT ( s1.getHeight() == 14 );
|
||||
CPPUNIT_ASSERT ( s1 == finalcut::FSize(16, 14) );
|
||||
|
||||
s1.scaleBy(1, -1);
|
||||
CPPUNIT_ASSERT ( s1.getWidth() == 17 );
|
||||
CPPUNIT_ASSERT ( s1.getHeight() == 13 );
|
||||
CPPUNIT_ASSERT ( s1 == finalcut::FSize(17, 13) );
|
||||
|
||||
s1.scaleBy(-2, 2);
|
||||
CPPUNIT_ASSERT ( s1.getWidth() == 15 );
|
||||
CPPUNIT_ASSERT ( s1.getHeight() == 15 );
|
||||
CPPUNIT_ASSERT ( s1 == finalcut::FSize(15, 15) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FSizeTest::streamInsertionTest()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue