Use of smart pointers
This commit is contained in:
parent
f3bdc3b410
commit
f6c21db7e7
|
@ -92,8 +92,6 @@ FListBox::FListBox (FWidget* parent)
|
|||
FListBox::~FListBox() // destructor
|
||||
{
|
||||
delOwnTimer();
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
|
||||
|
||||
|
@ -817,12 +815,12 @@ void FListBox::init()
|
|||
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
|
|
@ -581,8 +581,6 @@ FListView::FListView (FWidget* parent)
|
|||
FListView::~FListView() // destructor
|
||||
{
|
||||
delOwnTimer();
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
|
||||
// public methods of FListView
|
||||
|
@ -1390,12 +1388,12 @@ void FListView::init()
|
|||
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
|
|
@ -42,8 +42,6 @@ FScrollView::FScrollView (FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
FScrollView::~FScrollView() // destructor
|
||||
{
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
removeArea (viewport);
|
||||
child_print_area = viewport = nullptr;
|
||||
}
|
||||
|
@ -764,12 +762,12 @@ void FScrollView::init_scrollbar()
|
|||
{
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
|
|
@ -41,10 +41,7 @@ FTextView::FTextView(FWidget* parent)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
FTextView::~FTextView() // destructor
|
||||
{
|
||||
delete vbar;
|
||||
delete hbar;
|
||||
}
|
||||
{ }
|
||||
|
||||
|
||||
// public methods of FTextView
|
||||
|
@ -624,12 +621,12 @@ void FTextView::init()
|
|||
|
||||
try
|
||||
{
|
||||
vbar = new FScrollbar(fc::vertical, this);
|
||||
vbar = std::make_shared<FScrollbar>(fc::vertical, this);
|
||||
vbar->setMinimum(0);
|
||||
vbar->setValue(0);
|
||||
vbar->hide();
|
||||
|
||||
hbar = new FScrollbar(fc::horizontal, this);
|
||||
hbar = std::make_shared<FScrollbar>(fc::horizontal, this);
|
||||
hbar->setMinimum(0);
|
||||
hbar->setValue(0);
|
||||
hbar->hide();
|
||||
|
|
|
@ -229,6 +229,9 @@ class FListBox : public FWidget
|
|||
virtual void adjustSize();
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Enumeration
|
||||
enum convert_type
|
||||
{
|
||||
|
@ -303,8 +306,8 @@ class FListBox : public FWidget
|
|||
listBoxItems itemlist{};
|
||||
FWidget::data_ptr source_container{nullptr};
|
||||
convert_type conv_type{FListBox::no_convert};
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
FString text{};
|
||||
FString inc_search{};
|
||||
bool multi_select{false};
|
||||
|
|
|
@ -356,6 +356,7 @@ class FListView : public FWidget
|
|||
struct Header; // forward declaration
|
||||
typedef std::vector<Header> headerItems;
|
||||
typedef std::vector<fc::sorting_type> sortTypes;
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Constants
|
||||
static const int USE_MAX_SIZE = -1;
|
||||
|
@ -428,8 +429,8 @@ class FListView : public FWidget
|
|||
FListViewIterator last_visible_line{};
|
||||
headerItems header{};
|
||||
FTermBuffer headerline{};
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
fc::dragScroll drag_scroll{fc::noScroll};
|
||||
int scroll_repeat{100};
|
||||
int scroll_distance{1};
|
||||
|
|
|
@ -150,6 +150,9 @@ class FScrollView : public FWidget
|
|||
void copy2area();
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Constants
|
||||
static const int vertical_border_spacing = 2;
|
||||
static const int horizontal_border_spacing = 2;
|
||||
|
@ -177,8 +180,8 @@ class FScrollView : public FWidget
|
|||
FRect scroll_geometry{1, 1, 1, 1};
|
||||
FRect viewport_geometry{};
|
||||
term_area* viewport{nullptr}; // virtual scroll content
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
uInt8 nf_offset{0};
|
||||
bool border{true};
|
||||
bool use_own_print_area{false};
|
||||
|
|
|
@ -127,6 +127,9 @@ class FTextView : public FWidget
|
|||
virtual void adjustSize();
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::shared_ptr<FScrollbar> FScrollbarPtr;
|
||||
|
||||
// Accessors
|
||||
std::size_t getTextHeight();
|
||||
std::size_t getTextWidth();
|
||||
|
@ -145,8 +148,8 @@ class FTextView : public FWidget
|
|||
|
||||
// Data Members
|
||||
FStringList data{};
|
||||
FScrollbar* vbar{nullptr};
|
||||
FScrollbar* hbar{nullptr};
|
||||
FScrollbarPtr vbar{nullptr};
|
||||
FScrollbarPtr hbar{nullptr};
|
||||
bool update_scrollbar{true};
|
||||
int xoffset{0};
|
||||
int yoffset{0};
|
||||
|
|
Loading…
Reference in New Issue