summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-11-06 15:03:19 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2022-11-06 16:32:29 +0100
commitbb7129dae2be48affa0a19292122e5ce988c0719 (patch)
tree7a51e00f886a9258821beee96255a83a2f620fe6
parent8b92935b1e2964889d76fe64374be1ab3b040027 (diff)
Use the new Fl_Int_Vector class in Fl_Table
Replace local IntVector with Fl_Int_Vector
-rw-r--r--FL/Fl_Table.H32
-rw-r--r--src/Fl_Table.cxx21
2 files changed, 3 insertions, 50 deletions
diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H
index 62bc28be5..15e7836bb 100644
--- a/FL/Fl_Table.H
+++ b/FL/Fl_Table.H
@@ -20,6 +20,7 @@
#include <FL/Fl_Group.H>
#include <FL/Fl_Scroll.H>
+#include <FL/Fl_Int_Vector.H>
/**
A table of widgets or other content.
@@ -154,35 +155,8 @@ private:
};
unsigned int flags_;
- // An STL-ish vector without templates
- class FL_EXPORT IntVector {
- int *arr;
- unsigned int _size;
- void init() {
- arr = 0;
- _size = 0;
- }
- void copy(int *newarr, unsigned int newsize);
- public:
- IntVector() { init(); } // CTOR
- ~IntVector(); // DTOR
- IntVector(IntVector&o) { init(); copy(o.arr, o._size); } // COPY CTOR
- IntVector& operator=(IntVector&o) { // ASSIGN
- init();
- copy(o.arr, o._size);
- return(*this);
- }
- int operator[](int x) const { return(arr[x]); }
- int& operator[](int x) { return(arr[x]); }
- unsigned int size() { return(_size); }
- void size(unsigned int count);
- int pop_back() { int tmp = arr[_size-1]; _size--; return(tmp); }
- void push_back(int val) { unsigned int x = _size; size(_size+1); arr[x] = val; }
- int back() { return(arr[_size-1]); }
- };
-
- IntVector _colwidths; // column widths in pixels
- IntVector _rowheights; // row heights in pixels
+ Fl_Int_Vector _colwidths; // column widths in pixels
+ Fl_Int_Vector _rowheights; // row heights in pixels
Fl_Cursor _last_cursor; // last mouse cursor before changed to 'resize' cursor
diff --git a/src/Fl_Table.cxx b/src/Fl_Table.cxx
index 431847b61..baf06249e 100644
--- a/src/Fl_Table.cxx
+++ b/src/Fl_Table.cxx
@@ -26,27 +26,6 @@
#include <stdlib.h> // realloc/free
-// An STL-ish vector without templates (private to Fl_Table)
-
-void Fl_Table::IntVector::copy(int *newarr, unsigned int newsize) {
- size(newsize);
- memcpy(arr, newarr, newsize * sizeof(int));
-}
-
-Fl_Table::IntVector::~IntVector() { // DTOR
- if (arr)
- free(arr);
- arr = 0;
-}
-
-void Fl_Table::IntVector::size(unsigned int count) {
- if (count != _size) {
- arr = (int*)realloc(arr, count * sizeof(int));
- _size = count;
- }
-}
-
-
/** Sets the vertical scroll position so 'row' is at the top,
and causes the screen to redraw.
*/