CERT, OOP50-CPP: Avoids calling a virtual function from the constructor

This commit is contained in:
Markus Gans 2020-04-17 02:49:33 +02:00
parent fd92d7f4d8
commit defc1714e4
19 changed files with 325 additions and 258 deletions

View File

@ -39,6 +39,10 @@ using finalcut::FSize;
class SegmentView final : public finalcut::FDialog
{
public:
// Using-declaration
using FDialog::setGeometry;
// Constructor
explicit SegmentView (finalcut::FWidget* = nullptr);
private:
@ -55,11 +59,15 @@ class SegmentView final : public finalcut::FDialog
unsigned char : 1; // padding bit
} sevenSegment;
// Mutator
void setGeometry (const FRect&, bool = true) override;
// Methods
void hexEncoding();
void get7Segment (const wchar_t);
void draw() override;
// Data members
std::map<wchar_t, sevenSegment> code{};
finalcut::FString line[3];
@ -108,6 +116,14 @@ SegmentView::SegmentView (finalcut::FWidget* parent)
);
}
//----------------------------------------------------------------------
void SegmentView::setGeometry (const FRect& box, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setGeometry (box, adjust);
}
//----------------------------------------------------------------------
void SegmentView::hexEncoding()
{

View File

@ -27,6 +27,7 @@
#include <final/final.h>
using finalcut::FPoint;
using finalcut::FRect;
using finalcut::FSize;
@ -37,10 +38,13 @@ using finalcut::FSize;
class Background final : public finalcut::FDialog
{
public:
// Using-declaration
using FDialog::setGeometry;
// Typedef
typedef std::tuple<uChar,uChar,uChar> RGB;
// Constructors
// Constructor
explicit Background (finalcut::FWidget* = nullptr);
// Disable copy constructor
@ -53,6 +57,9 @@ class Background final : public finalcut::FDialog
Background& operator = (const Background&) = delete;
private:
// Mutator
void setGeometry (const FRect&, bool = true) override;
// Callback method
void cb_changed (const finalcut::FWidget*, const FDataPtr);
void cb_choice (const finalcut::FWidget*, const FDataPtr);
@ -168,6 +175,14 @@ Background::Background (finalcut::FWidget* parent)
Background::~Background() // destructor
{ }
//----------------------------------------------------------------------
void Background::setGeometry (const FRect& box, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setGeometry (box, adjust);
}
//----------------------------------------------------------------------
void Background::cb_changed (const finalcut::FWidget*, const FDataPtr)
{

View File

@ -32,6 +32,7 @@
namespace fc = finalcut::fc;
using finalcut::FPoint;
using finalcut::FRect;
using finalcut::FSize;
using finalcut::FColorPair;
@ -109,12 +110,18 @@ void Button::onKeyPress (finalcut::FKeyEvent* ev)
class Calc final : public finalcut::FDialog
{
public:
// Using-declaration
using FDialog::setGeometry;
// Constructor
explicit Calc (finalcut::FWidget* parent = nullptr);
// Destructor
~Calc() override;
// Mutator
void setGeometry (const FRect&, bool = true) override;
// Event handlers
void onKeyPress (finalcut::FKeyEvent*) override;
void onClose (finalcut::FCloseEvent*) override;
@ -299,6 +306,105 @@ Calc::Calc (FWidget* parent)
Calc::~Calc()
{ }
//----------------------------------------------------------------------
void Calc::setGeometry (const FRect& box, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setGeometry (box, adjust);
}
//----------------------------------------------------------------------
void Calc::onKeyPress (finalcut::FKeyEvent* ev)
{
const std::size_t len = input.getLength();
const FKey key = ev->key();
switch ( key )
{
case fc::Fkey_erase:
case fc::Fkey_backspace:
if ( len > 0 )
{
lDouble& x = getValue();
if ( len == 1 )
{
input = "";
x = 0.0L;
}
else
{
input = input.left(input.getLength() - 1);
x = std::strtold(input.c_str(), nullptr);
}
drawDispay();
updateTerminal();
}
ev->accept();
break;
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
{
finalcut::FAccelEvent a_ev( fc::Accelerator_Event
, getFocusWidget() );
calculator_buttons[On]->onAccel(&a_ev);
}
ev->accept();
break;
case 'q':
close();
ev->accept();
break;
default:
finalcut::FDialog::onKeyPress(ev);
break;
}
}
//----------------------------------------------------------------------
void Calc::onClose (finalcut::FCloseEvent* ev)
{
finalcut::FApplication::closeConfirmationDialog (this, ev);
}
//----------------------------------------------------------------------
void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data)
{
lDouble& x = getValue();
const Calc::button& key = *(static_cast<Calc::button*>(data));
// Call the key function
(this->*key_map[key])(x);
if ( ! input.isEmpty() )
{
if ( isDataEntryKey(key) )
x = lDouble(input.toDouble());
else
{
// Remove trailing zeros
while ( ! input.includes(L'e')
&& input.includes(L'.')
&& input.back() == L'0' )
input = input.left(input.getLength() - 1);
}
}
drawDispay();
updateTerminal();
if ( infix_operator && ! isDataEntryKey(key) )
input = "";
last_key = key;
}
//----------------------------------------------------------------------
void Calc::drawDispay()
{
@ -977,97 +1083,6 @@ void Calc::calcInfixOperator()
clearInfixOperator();
}
//----------------------------------------------------------------------
void Calc::onKeyPress (finalcut::FKeyEvent* ev)
{
const std::size_t len = input.getLength();
const FKey key = ev->key();
switch ( key )
{
case fc::Fkey_erase:
case fc::Fkey_backspace:
if ( len > 0 )
{
lDouble& x = getValue();
if ( len == 1 )
{
input = "";
x = 0.0L;
}
else
{
input = input.left(input.getLength() - 1);
x = std::strtold(input.c_str(), nullptr);
}
drawDispay();
updateTerminal();
}
ev->accept();
break;
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
{
finalcut::FAccelEvent a_ev( fc::Accelerator_Event
, getFocusWidget() );
calculator_buttons[On]->onAccel(&a_ev);
}
ev->accept();
break;
case 'q':
close();
ev->accept();
break;
default:
finalcut::FDialog::onKeyPress(ev);
break;
}
}
//----------------------------------------------------------------------
void Calc::onClose (finalcut::FCloseEvent* ev)
{
finalcut::FApplication::closeConfirmationDialog (this, ev);
}
//----------------------------------------------------------------------
void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data)
{
lDouble& x = getValue();
const Calc::button& key = *(static_cast<Calc::button*>(data));
// Call the key function
(this->*key_map[key])(x);
if ( ! input.isEmpty() )
{
if ( isDataEntryKey(key) )
x = lDouble(input.toDouble());
else
{
// Remove trailing zeros
while ( ! input.includes(L'e')
&& input.includes(L'.')
&& input.back() == L'0' )
input = input.left(input.getLength() - 1);
}
}
drawDispay();
updateTerminal();
if ( infix_operator && ! isDataEntryKey(key) )
input = "";
last_key = key;
}
//----------------------------------------------------------------------
void Calc::adjustSize()
{

View File

@ -29,6 +29,7 @@
namespace fc = finalcut::fc;
using finalcut::FPoint;
using finalcut::FRect;
using finalcut::FSize;
@ -39,6 +40,9 @@ using finalcut::FSize;
class CheckList final : public finalcut::FDialog
{
public:
// Using-declaration
using FDialog::setGeometry;
// Constructor
explicit CheckList (finalcut::FWidget* = nullptr);
@ -51,6 +55,9 @@ class CheckList final : public finalcut::FDialog
// Disable copy assignment operator (=)
CheckList& operator = (const CheckList&) = delete;
// Mutator
void setGeometry (const FRect&, bool = true) override;
private:
// Method
void populate();
@ -111,6 +118,14 @@ CheckList::CheckList (finalcut::FWidget* parent)
CheckList::~CheckList() // destructor
{ }
//----------------------------------------------------------------------
void CheckList::setGeometry (const FRect& box, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setGeometry (box, adjust);
}
//----------------------------------------------------------------------
void CheckList::populate()
{

View File

@ -53,6 +53,9 @@ class ColorChooser final : public finalcut::FWidget
FColor getBackground();
private:
// Mutator
void setSize (const FSize&, bool = true) override;
// Method
void draw() override;
void drawBorder() override;
@ -66,6 +69,7 @@ class ColorChooser final : public finalcut::FWidget
finalcut::FLabel headline{this};
};
//----------------------------------------------------------------------
ColorChooser::ColorChooser (finalcut::FWidget* parent)
: FWidget(parent)
@ -96,31 +100,23 @@ ColorChooser::~ColorChooser()
{ }
//----------------------------------------------------------------------
void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev)
inline FColor ColorChooser::getForeground()
{
const int mouse_x = ev->getX();
const int mouse_y = ev->getY();
return fg_color;
}
if ( ev->getButton() == fc::MiddleButton )
return;
//----------------------------------------------------------------------
inline FColor ColorChooser::getBackground()
{
return bg_color;
}
for (int c{0}; c < 16; c++)
{
const int xmin = 2 + (c / 8) * 3;
const int xmax = 4 + (c / 8) * 3;
const int y = 3 + c % 8;
if ( mouse_x >= xmin && mouse_x <= xmax && mouse_y == y )
{
if ( ev->getButton() == fc::LeftButton )
bg_color = FColor(c);
else if ( ev->getButton() == fc::RightButton )
fg_color = FColor(c);
redraw();
emitCallback("clicked");
}
}
//----------------------------------------------------------------------
void ColorChooser::setSize (const FSize& size, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FWidget::setSize (size, adjust);
}
//----------------------------------------------------------------------
@ -156,15 +152,31 @@ void ColorChooser::drawBorder()
}
//----------------------------------------------------------------------
inline FColor ColorChooser::getForeground()
void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev)
{
return fg_color;
}
const int mouse_x = ev->getX();
const int mouse_y = ev->getY();
//----------------------------------------------------------------------
inline FColor ColorChooser::getBackground()
{
return bg_color;
if ( ev->getButton() == fc::MiddleButton )
return;
for (int c{0}; c < 16; c++)
{
const int xmin = 2 + (c / 8) * 3;
const int xmax = 4 + (c / 8) * 3;
const int y = 3 + c % 8;
if ( mouse_x >= xmin && mouse_x <= xmax && mouse_y == y )
{
if ( ev->getButton() == fc::LeftButton )
bg_color = FColor(c);
else if ( ev->getButton() == fc::RightButton )
fg_color = FColor(c);
redraw();
emitCallback("clicked");
}
}
}
@ -195,6 +207,9 @@ class Brushes final : public finalcut::FWidget
void setBackground (FColor);
private:
// Mutator
void setSize (const FSize&, bool = true) override;
// Method
void draw() override;
void drawBorder() override;
@ -238,6 +253,14 @@ Brushes::Brushes (finalcut::FWidget* parent)
Brushes::~Brushes()
{ }
//----------------------------------------------------------------------
void Brushes::setSize (const FSize& size, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FWidget::setSize (size, adjust);
}
//----------------------------------------------------------------------
void Brushes::draw()
{

View File

@ -57,6 +57,9 @@ class Transparent final : public finalcut::FDialog
// Disable copy assignment operator (=)
Transparent& operator = (const Transparent&) = delete;
// Mutator
void setStatusbarMessage (const finalcut::FString&) override;
private:
// Method
void draw() override;
@ -82,6 +85,14 @@ Transparent::Transparent ( finalcut::FWidget* parent
Transparent::~Transparent()
{ }
//----------------------------------------------------------------------
void Transparent::setStatusbarMessage (const finalcut::FString& msg)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FWidget::setStatusbarMessage(msg);
}
//----------------------------------------------------------------------
void Transparent::draw()
{

View File

@ -31,6 +31,7 @@
namespace fc = finalcut::fc;
using finalcut::FPoint;
using finalcut::FRect;
using finalcut::FSize;
@ -41,6 +42,9 @@ using finalcut::FSize;
class ProgressDialog final : public finalcut::FDialog
{
public:
// Using-declaration
using FDialog::setGeometry;
// Constructor
explicit ProgressDialog (finalcut::FWidget* = nullptr);
@ -53,6 +57,9 @@ class ProgressDialog final : public finalcut::FDialog
// Disable copy assignment operator (=)
ProgressDialog& operator = (const ProgressDialog&) = delete;
// Mutator
void setGeometry (const FRect&, bool = true) override;
private:
// Event handlers
void onShow (finalcut::FShowEvent*) override;
@ -125,6 +132,14 @@ ProgressDialog::~ProgressDialog() // destructor
delCallback(&reset);
}
//----------------------------------------------------------------------
void ProgressDialog::setGeometry (const FRect& box, bool adjust)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setGeometry (box, adjust);
}
//----------------------------------------------------------------------
void ProgressDialog::onShow (finalcut::FShowEvent*)
{

View File

@ -67,7 +67,6 @@ libfinal_la_SOURCES = \
foptimove.cpp \
ftermbuffer.cpp \
fapplication.cpp \
fcolorpalette.cpp \
fwidgetcolors.cpp \
fwidget.cpp \
fwidget_functions.cpp \

View File

@ -139,7 +139,6 @@ OBJS = \
foptimove.o \
ftermbuffer.o \
fapplication.o \
fcolorpalette.o \
fwidgetcolors.o \
fwidget.o \
fwidget_functions.o \

View File

@ -139,7 +139,6 @@ OBJS = \
foptimove.o \
ftermbuffer.o \
fapplication.o \
fcolorpalette.o \
fwidgetcolors.o \
fwidget.o \
fwidget_functions.o \

View File

@ -1122,7 +1122,7 @@ void FApplication::performTimerAction (FObject* receiver, FEvent* event)
}
//----------------------------------------------------------------------
bool FApplication::isEventProcessable (FObject* receiver, FEvent* event )
bool FApplication::isEventProcessable (const FObject* receiver, const FEvent* event )
{
if ( ! receiver->isWidget() ) // No restrictions for non-widgets
return true;

View File

@ -1,106 +0,0 @@
/***********************************************************************
* fcolorpalette.cpp - Define RGB color value for a palette entry *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2018-2020 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 "final/fc.h"
#include "final/fcolorpalette.h"
namespace finalcut
{
//----------------------------------------------------------------------
// class FColorPalette
//----------------------------------------------------------------------
FColorPalette::~FColorPalette() // destructor
{ }
// public methods of FColorPalette
//----------------------------------------------------------------------
void FColorPalette::set8ColorPalette (func setPalette)
{
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
setPalette (fc::Green, 0x18, 0x78, 0x18);
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
setPalette (fc::Red, 0xb2, 0x18, 0x18);
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
// The same colors again...
setPalette (fc::DarkGray, 0x00, 0x00, 0x00);
setPalette (fc::LightBlue, 0x10, 0x3b, 0x9e);
setPalette (fc::LightGreen, 0x18, 0x78, 0x18);
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
setPalette (fc::LightRed, 0xb2, 0x18, 0x18);
setPalette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Yellow, 0xe8, 0x87, 0x1f);
setPalette (fc::White, 0xe0, 0xe0, 0xe0);
}
//----------------------------------------------------------------------
void FColorPalette::set16ColorPalette (func setPalette)
{
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
setPalette (fc::Green, 0x18, 0x78, 0x18);
setPalette (fc::Cyan, 0x55, 0x6a, 0xcf);
setPalette (fc::Red, 0xba, 0x1a, 0x1a);
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc);
setPalette (fc::DarkGray, 0x50, 0x50, 0x50);
setPalette (fc::LightBlue, 0x80, 0xa4, 0xec);
setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8);
setPalette (fc::LightRed, 0xee, 0x44, 0x44);
setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff);
setPalette (fc::Yellow, 0xfb, 0xe8, 0x67);
setPalette (fc::White, 0xff, 0xff, 0xff);
}
//----------------------------------------------------------------------
void FColorPalette::reset8ColorPalette (func setPalette)
{
reset16ColorPalette(setPalette);
}
//----------------------------------------------------------------------
void FColorPalette::reset16ColorPalette (func setPalette)
{
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x00, 0x00, 0xaa);
setPalette (fc::Green, 0x00, 0xaa, 0x00);
setPalette (fc::Cyan, 0x00, 0x55, 0xaa);
setPalette (fc::Red, 0xaa, 0x00, 0x00);
setPalette (fc::Magenta, 0xaa, 0x00, 0xaa);
setPalette (fc::Brown, 0xaa, 0xaa, 0x00);
setPalette (fc::LightGray, 0xaa, 0xaa, 0xaa);
setPalette (fc::DarkGray, 0x55, 0x55, 0x55);
setPalette (fc::LightBlue, 0x55, 0x55, 0xff);
setPalette (fc::LightGreen, 0x55, 0xff, 0x55);
setPalette (fc::LightCyan, 0x55, 0xff, 0xff);
setPalette (fc::LightRed, 0xff, 0x55, 0x55);
setPalette (fc::LightMagenta, 0xff, 0x55, 0xff);
setPalette (fc::Yellow, 0xff, 0xff, 0x55);
setPalette (fc::White, 0xff, 0xff, 0xff);
}
} // namespace finalcut

View File

@ -427,10 +427,6 @@ void FComboBox::onMouseDown (FMouseEvent* ev)
updateTerminal();
}
//----------------------------------------------------------------------
void FComboBox::onMouseUp (FMouseEvent*)
{ }
//----------------------------------------------------------------------
void FComboBox::onMouseMove (FMouseEvent* ev)
{

View File

@ -776,14 +776,6 @@ void FDialog::drawDialogShadow()
drawShadow(this);
}
//----------------------------------------------------------------------
void FDialog::onShow (FShowEvent*)
{ }
//----------------------------------------------------------------------
void FDialog::onHide (FHideEvent*)
{ }
//----------------------------------------------------------------------
void FDialog::onClose (FCloseEvent* ev)
{

View File

@ -287,25 +287,25 @@ void FTermcap::termcapKeysVt100()
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(fc::fkey[i].tname, "kux", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "A"); // Key up (standard mode)
fc::fkey[i].string = C_STR(CSI "A"); // Key up (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "kuX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OA"); // Key up (application mode)
if ( std::strncmp(fc::fkey[i].tname, "kdx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "B"); // Key down (standard mode)
fc::fkey[i].string = C_STR(CSI "B"); // Key down (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "kdX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OB"); // Key down (application mode)
if ( std::strncmp(fc::fkey[i].tname, "krx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "C"); // Key right (standard mode)
fc::fkey[i].string = C_STR(CSI "C"); // Key right (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "krX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OC"); // Key right (application mode)
if ( std::strncmp(fc::fkey[i].tname, "klx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "D"); // Key left (standard mode)
fc::fkey[i].string = C_STR(CSI "D"); // Key left (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "klX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OD"); // Key left (application mode)

View File

@ -179,7 +179,7 @@ class FApplication : public FWidget
void processCloseWidget();
bool processNextEvent();
void performTimerAction (FObject*, FEvent*) override;
static bool isEventProcessable (FObject*, FEvent*);
static bool isEventProcessable (const FObject*, const FEvent*);
// Data members
int app_argc{};

View File

@ -49,9 +49,6 @@ namespace finalcut
class FColorPalette final
{
public:
// Using-declaration
using func = std::function<void(FColor, int, int, int)>;
// Constructor
FColorPalette() = default;
@ -62,10 +59,14 @@ class FColorPalette final
const FString getClassName() const;
// Methods
static void set8ColorPalette (func);
static void set16ColorPalette (func);
static void reset8ColorPalette (func);
static void reset16ColorPalette (func);
template<typename funcT>
static void set8ColorPalette (funcT);
template<typename funcT>
static void set16ColorPalette (funcT);
template<typename funcT>
static void reset8ColorPalette (funcT);
template<typename funcT>
static void reset16ColorPalette (funcT);
};
// FColorPalette inline functions
@ -73,6 +74,86 @@ class FColorPalette final
inline const FString FColorPalette::getClassName() const
{ return "FColorPalette"; }
// constructors and destructor
//----------------------------------------------------------------------
inline FColorPalette::~FColorPalette() // destructor
{ }
// public methods of FColorPalette
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::set8ColorPalette (funcT set_palette)
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x10, 0x3b, 0x9e);
set_palette (fc::Green, 0x18, 0x78, 0x18);
set_palette (fc::Cyan, 0xa0, 0xb2, 0xb2);
set_palette (fc::Red, 0xb2, 0x18, 0x18);
set_palette (fc::Magenta, 0xb2, 0x18, 0xb2);
set_palette (fc::Brown, 0xe8, 0x87, 0x1f);
set_palette (fc::LightGray, 0xe0, 0xe0, 0xe0);
// The same colors again...
set_palette (fc::DarkGray, 0x00, 0x00, 0x00);
set_palette (fc::LightBlue, 0x10, 0x3b, 0x9e);
set_palette (fc::LightGreen, 0x18, 0x78, 0x18);
set_palette (fc::Cyan, 0xa0, 0xb2, 0xb2);
set_palette (fc::LightRed, 0xb2, 0x18, 0x18);
set_palette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
set_palette (fc::Yellow, 0xe8, 0x87, 0x1f);
set_palette (fc::White, 0xe0, 0xe0, 0xe0);
}
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::set16ColorPalette (funcT set_palette)
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x10, 0x3b, 0x9e);
set_palette (fc::Green, 0x18, 0x78, 0x18);
set_palette (fc::Cyan, 0x55, 0x6a, 0xcf);
set_palette (fc::Red, 0xba, 0x1a, 0x1a);
set_palette (fc::Magenta, 0xb2, 0x18, 0xb2);
set_palette (fc::Brown, 0xe8, 0x87, 0x1f);
set_palette (fc::LightGray, 0xbc, 0xbc, 0xbc);
set_palette (fc::DarkGray, 0x50, 0x50, 0x50);
set_palette (fc::LightBlue, 0x80, 0xa4, 0xec);
set_palette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
set_palette (fc::LightCyan, 0x62, 0xbf, 0xf8);
set_palette (fc::LightRed, 0xee, 0x44, 0x44);
set_palette (fc::LightMagenta, 0xe9, 0xad, 0xff);
set_palette (fc::Yellow, 0xfb, 0xe8, 0x67);
set_palette (fc::White, 0xff, 0xff, 0xff);
}
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::reset8ColorPalette (funcT set_palette)
{
reset16ColorPalette(set_palette);
}
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::reset16ColorPalette (funcT set_palette)
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x00, 0x00, 0xaa);
set_palette (fc::Green, 0x00, 0xaa, 0x00);
set_palette (fc::Cyan, 0x00, 0x55, 0xaa);
set_palette (fc::Red, 0xaa, 0x00, 0x00);
set_palette (fc::Magenta, 0xaa, 0x00, 0xaa);
set_palette (fc::Brown, 0xaa, 0xaa, 0x00);
set_palette (fc::LightGray, 0xaa, 0xaa, 0xaa);
set_palette (fc::DarkGray, 0x55, 0x55, 0x55);
set_palette (fc::LightBlue, 0x55, 0x55, 0xff);
set_palette (fc::LightGreen, 0x55, 0xff, 0x55);
set_palette (fc::LightCyan, 0x55, 0xff, 0xff);
set_palette (fc::LightRed, 0xff, 0x55, 0x55);
set_palette (fc::LightMagenta, 0xff, 0x55, 0xff);
set_palette (fc::Yellow, 0xff, 0xff, 0x55);
set_palette (fc::White, 0xff, 0xff, 0xff);
}
} // namespace finalcut
#endif // FCOLORPALETTE_H

View File

@ -196,7 +196,6 @@ class FComboBox : public FWidget
// Event handlers
void onKeyPress (FKeyEvent*) override;
void onMouseDown (FMouseEvent*) override;
void onMouseUp (FMouseEvent*) override;
void onMouseMove (FMouseEvent*) override;
void onWheel (FWheelEvent*) override;
void onFocusOut (FFocusEvent*) override;

View File

@ -151,8 +151,6 @@ class FDialog : public FWindow
void drawDialogShadow();
// Event handlers
void onShow (FShowEvent*) override;
void onHide (FHideEvent*) override;
void onClose (FCloseEvent*) override;
private: