Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FL/Fl.H>
- #include <FL/Fl_Window.H>
- #include <FL/Fl_Scroll.H>
- #include <FL/Fl_Box.H>
- #define BW 200 //box width
- #define BH 50 //box height
- #define SEP 10 //separator
- int main(){
- Fl_Window win(500, 300);
- Fl_Scroll *scr=new Fl_Scroll(10,10,win.w()-20,win.h()-20);
- scr->color(FL_GREEN);
- int col=scr->w()/BW;
- int c=0,line=SEP;
- for(int i=1;i<=20;i++){
- Fl_Box *b = new Fl_Box(scr->x()+SEP+(c*(BW+SEP)),scr->y()+line,BW,BH);
- b->box(FL_FLAT_BOX);
- b->color(FL_RED);
- c += 1;
- if(c == col){
- c = 0;
- line += (BH + SEP);
- }
- }
- new Fl_Box(SEP,scr->y()+line-SEP,SEP,SEP);
- win.show();
- return Fl::run();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement