/** * Copyright Mikael Högdahl - triyana@users.sourceforge.net * * This source is distributed under the terms of the Q Public License version 1.0, * created by Trolltech (www.trolltech.com). */ #include "Fl_Table_Data.h" #include "Fl_Select.h" #include "Fl_Defines.h" #include "Fl_Choice2.h" #include #include #include #include /** * Return the border color for the cell */ Fl_Color Fl_Table_Data::border_color (int row, int col) { if (aBorder == false) return FL_WHITE; else if (row == FL_ACTIVE_ROW) return FL_BLACK; else return FL_GRAY; } /** * Return the background color for the cell */ Fl_Color Fl_Table_Data::box_color (int row, int col) { if (row == FL_ACTIVE_ROW) { if (editor_type (row, col, false) == FL_NO_EDITOR) return FL_WHITE; else return FL_YELLOW; } else if (row == FL_LABEL_ROW || row == FL_HEADER_ROW) return FL_GRAY; else { if (aStripe >= 0 && row % 2) return aStripe; else return FL_WHITE; } } /** * */ Fl_Widget* Fl_Table_Data::get_editor (FL_TABLE_EDITOR type, int row, int col) { switch (type) { case FL_TEXT_EDITOR: { Fl_Input* w = new Fl_Input (0, 0, 0, 0); w->textsize (textsize (row, col)); w->value (value (row, col)); return w; } case FL_INTEGER_EDITOR: { Fl_Int_Input* w = new Fl_Int_Input (0, 0, 0, 0); w->textsize (textsize (row, col)); w->value (value (row, col)); return w; } case FL_FLOAT_EDITOR: { Fl_Float_Input* w = new Fl_Float_Input (0, 0, 0, 0); w->textsize (textsize (row, col)); w->value (value (row, col)); return w; } case FL_SECRET_EDITOR: { Fl_Secret_Input* w = new Fl_Secret_Input (0, 0, 0, 0); w->textsize (textsize (row, col)); w->value (value (row, col)); return w; } case FL_BOOL_EDITOR: { Fl_Check_Button* w = new Fl_Check_Button (0, 0, 0, 0); w->value (value (row, col)[0]); return w; } case FL_LIST_EDITOR: { Fl_Choice2* w = new Fl_Choice2 (this, 0, 0, 0, 0); w->textsize (textsize (row, col)); if (w->populate (row, col) == false) delete w; else return w; break; } case FL_DLG_LIST_EDITOR: { int size; int sel; const char** list = choice (row, col, size, sel, aDlgLabel); Fl_Select* w = new Fl_Select (list, size, sel); w->label (aDlgLabel); return (Fl_Widget*) w; } case FL_DLG_CUSTOM_EDITOR: { Fl_Dialog* w = custom_dialog (row, col); return (Fl_Widget*) w; } default: break; } return 0; }