Use FL_OVERRIDE for all overridden virtual methods (#611)

FL_OVERRIDE is defined as `override` for C++11 and higher
FL_OVERRIDE is defined as `override` for VisualC 2015 and newer
Don't interfere with Fl_Widget::override()
This commit is contained in:
Matthias Melcher
2022-12-30 19:14:36 +01:00
committed by GitHub
parent f58a93a159
commit 44c874b731
197 changed files with 2236 additions and 2176 deletions

View File

@@ -49,7 +49,7 @@ public:
shaderProgram = 0;
gl_version_major = 0;
}
void draw(void) {
void draw(void) FL_OVERRIDE {
if (gl_version_major >= 3 && !shaderProgram) {
GLuint vs;
GLuint fs;
@@ -141,7 +141,7 @@ public:
}
Fl_Gl_Window::draw(); // Draw FLTK child widgets.
}
virtual int handle(int event) {
int handle(int event) FL_OVERRIDE {
static int first = 1;
if (first && event == FL_SHOW && shown()) {
first = 0;

View File

@@ -92,7 +92,7 @@ public:
All other events are handled in Fl_Group::handle().
Dragged widgets are limited inside the borders of their parent group.
*/
virtual int handle(int e) {
int handle(int e) FL_OVERRIDE {
switch (e) {

View File

@@ -38,7 +38,7 @@ public:
label("Drag\nfrom\nhere..");
}
// Sender event handler
int handle(int event) {
int handle(int event) FL_OVERRIDE {
int ret = Fl_Box::handle(event);
switch ( event ) {
case FL_PUSH: { // do 'copy/dnd' when someone clicks on box
@@ -64,7 +64,7 @@ public:
dnd_text = 0;
}
// Receiver event handler
int handle(int event) {
int handle(int event) FL_OVERRIDE {
int ret = Fl_Box::handle(event);
int len;
switch ( event ) {

View File

@@ -27,7 +27,7 @@ class DrawX : public Fl_Widget {
public:
DrawX(int X, int Y, int W, int H, const char*L=0) : Fl_Widget(X,Y,W,H,L) {
}
void draw() {
virtual void draw() FL_OVERRIDE {
// Draw background - a white filled rectangle
fl_color(FL_WHITE); fl_rectf(x(),y(),w(),h());
// Draw black 'X' over base widget's background

View File

@@ -33,7 +33,7 @@ void cb(Fl_Widget *w, void *) {
class dragbox : public Fl_Box {
public:
dragbox(int x, int y, int w, int h, const char *t=0) : Fl_Box(x,y,w,h,t) {}
int handle(int event) {
int handle(int event) FL_OVERRIDE {
static int fromx, fromy, winx, winy;
if (event == FL_PUSH) {
fromx = Fl::event_x_root();

View File

@@ -40,7 +40,7 @@ void button_cb(Fl_Widget *w, void*);
class WidgetTable : public Fl_Table {
protected:
void draw_cell(TableContext context, // table cell drawing
int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0);
int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) FL_OVERRIDE;
public:
WidgetTable(int x, int y, int w, int h, const char *l=0) : Fl_Table(x,y,w,h,l) {

View File

@@ -59,7 +59,7 @@ class MyTable : public Fl_Table {
// Fl_Table calls this function to draw each visible cell in the table.
// It's up to us to use FLTK's drawing functions to draw the cells the way we want.
//
void draw_cell(TableContext context, int ROW=0, int COL=0, int X=0, int Y=0, int W=0, int H=0) {
void draw_cell(TableContext context, int ROW=0, int COL=0, int X=0, int Y=0, int W=0, int H=0) FL_OVERRIDE {
static char s[40];
switch ( context ) {
case CONTEXT_STARTPAGE: // before page is drawn..

View File

@@ -97,8 +97,8 @@ private:
void event_callback2(); // callback for table events
protected:
void draw_cell(TableContext context, int R=0, int C=0, // table cell drawing
int X=0, int Y=0, int W=0, int H=0);
void draw_cell(TableContext context, int R=0, int C=0, // table cell drawing
int X=0, int Y=0, int W=0, int H=0) FL_OVERRIDE;
void sort_column(int col, int reverse=0); // sort table by a column
void draw_sort_arrow(int X,int Y,int W,int H);

View File

@@ -40,7 +40,7 @@ class Spreadsheet : public Fl_Table {
int s_left, s_top, s_right, s_bottom; // kb nav + mouse selection
protected:
void draw_cell(TableContext context,int=0,int=0,int=0,int=0,int=0,int=0);
void draw_cell(TableContext context,int=0,int=0,int=0,int=0,int=0,int=0) FL_OVERRIDE;
void event_callback2(); // table's event callback (instance)
static void event_callback(Fl_Widget*, void *v) { // table's event callback (static)
((Spreadsheet*)v)->event_callback2();
@@ -75,11 +75,11 @@ public:
window()->cursor(FL_CURSOR_DEFAULT); // XXX: if we don't do this, cursor can disappear!
}
// Change number of rows
void rows(int val) {
void rows(int val) FL_OVERRIDE {
Fl_Table::rows(val);
}
// Change number of columns
void cols(int val) {
void cols(int val) FL_OVERRIDE {
Fl_Table::cols(val);
}
// Get number of rows

View File

@@ -31,7 +31,7 @@ class Spreadsheet : public Fl_Table {
int row_edit, col_edit; // row/col being modified
protected:
void draw_cell(TableContext context,int=0,int=0,int=0,int=0,int=0,int=0);
void draw_cell(TableContext context,int=0,int=0,int=0,int=0,int=0,int=0) FL_OVERRIDE;
void event_callback2(); // table's event callback (instance)
static void event_callback(Fl_Widget*,void *v) { // table's event callback (static)
((Spreadsheet*)v)->event_callback2();

View File

@@ -41,7 +41,7 @@ Fl_Output *G_sum = 0; // displays sum of user's select
class MyTable : public Fl_Table_Row {
protected:
// Handle drawing all cells in table
void draw_cell(TableContext context, int R=0,int C=0, int X=0,int Y=0,int W=0,int H=0) {
void draw_cell(TableContext context, int R=0,int C=0, int X=0,int Y=0,int W=0,int H=0) FL_OVERRIDE {
static char s[30];
switch ( context ) {
case CONTEXT_COL_HEADER:
@@ -119,7 +119,7 @@ public:
{ G_sum->value(s); G_sum->redraw(); }
}
// Keyboard and mouse events
int handle(int e) {
int handle(int e) FL_OVERRIDE {
int ret = Fl_Table_Row::handle(e);
if ( e == FL_KEYBOARD && Fl::event_key() == FL_Escape ) exit(0);
switch (e) {

View File

@@ -59,7 +59,7 @@ class MyTable : public Fl_Table {
// Fl_Table calls this function to draw each visible cell in the table.
// It's up to us to use FLTK's drawing functions to draw the cells the way we want.
//
void draw_cell(TableContext context, int ROW=0, int COL=0, int X=0, int Y=0, int W=0, int H=0) {
void draw_cell(TableContext context, int ROW=0, int COL=0, int X=0, int Y=0, int W=0, int H=0) FL_OVERRIDE {
static char s[40];
switch ( context ) {
case CONTEXT_STARTPAGE: // before page is drawn..
@@ -115,7 +115,7 @@ public:
}
// Handle window resizing
void resize(int X,int Y,int W,int H) {
void resize(int X,int Y,int W,int H) FL_OVERRIDE {
Fl_Table::resize(X,Y,W,H);
FixColumnSize(); // after letting window resize, fix our right most column
}

View File

@@ -59,7 +59,7 @@ public:
// that we want the user to be able to use the horizontal scrollbar
// to reach.
//
int draw_item_content(int render) {
int draw_item_content(int render) FL_OVERRIDE {
Fl_Color fg = drawfgcolor();
Fl_Color bg = drawbgcolor();
// Show the date and time as two small strings

View File

@@ -37,7 +37,7 @@ public:
this->mode = mode;
end();
}
void resize(int X,int Y,int W,int H) {
void resize(int X,int Y,int W,int H) FL_OVERRIDE {
if ( W > 718 ) W = 718; // don't exceed 700 in width
Fl_Table::resize(X,Y,W,h()); // disallow changes in height
}
@@ -45,7 +45,7 @@ public:
// Fl_Table calls this function to draw each visible cell in the table.
// It's up to us to use FLTK's drawing functions to draw the cells the way we want.
//
void draw_cell(TableContext context, int ROW, int COL, int X, int Y, int W, int H) {
void draw_cell(TableContext context, int ROW, int COL, int X, int Y, int W, int H) FL_OVERRIDE {
static char s[40];
switch ( context ) {
case CONTEXT_STARTPAGE: // before page is drawn..