Fix compiler warning, add inactive (deactivated) box test mode.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10780 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2015-07-08 23:41:19 +00:00
parent 634ede015d
commit 349f326933
1 changed files with 7 additions and 2 deletions

View File

@ -49,13 +49,14 @@ int N = 0;
static const int outline = 0; // draw 1-px red frame around all boxes
static const int box_bg = 0; // draw white background inside all boxes
static const int inactive = 0; // deactivate boxes and use green background
class BoxGroup : public Fl_Group {
public:
BoxGroup(int x, int y, int w, int h) : Fl_Group(x,y,w,h) {};
void draw() {
draw_box();
if (outline||box_bg) {
if (outline + box_bg) { // outline or box_bg or both
Fl_Widget*const* a = array();
for (int i=children(); i--;) {
Fl_Widget& o = **a++;
@ -69,7 +70,7 @@ class BoxGroup : public Fl_Group {
}
fl_color(FL_BLACK);
}
} // outline || box_bg
} // outline or box_bg or both
Fl_Group::draw_children();
} // draw()
}; // class BoxGroup
@ -84,6 +85,10 @@ void bt(const char *name, Fl_Boxtype type, int square=0) {
y = y*H+10;
Fl_Box *b = new Fl_Box(type,x,y,square ? H-20 : W-20,H-20,name);
b->labelsize(11);
if (inactive) {
b->color(FL_GREEN);
b->deactivate();
}
if (square) b->align(FL_ALIGN_RIGHT);
}