DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2480
Version: 1.3-feature





Link: http://www.fltk.org/str.php?L2480
Version: 1.3-feature
/*
  -----------------------------------------------------------------------------

    Demo program to test Fl_Tabs::client_area().

    Thanks to Greg Ercolano for the first version.
    This version is modified by Albrecht Schlosser.

    compile:    fltk-config --compile client_area.cxx

    run:        ./client_area [ pos ]

    Use optional argument pos to position the tabs:

        0 = Tabs on top    with default height (Fl_Tabs' labelsize + border)
       -1 = Tabs on bottom with default height (Fl_Tabs' labelsize + border)
     >  0 = Tabs on top    with given height
     < -1 = Tabs on bottom with given height
    
  -----------------------------------------------------------------------------
*/
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>

int main(int argc, char *argv[]) {
  Fl::scheme("gtk+");
  Fl_Window *win = new Fl_Window(500,200,"Tabs Example");
  {
    // Create the tab widget
    Fl_Tabs *tabs = new Fl_Tabs(10,10,500-20,200-20);
    tabs->selection_color(fl_lighter(FL_BLUE));
    {
      int X,Y,W,H,tabh;

      // set tabh to calculate the client area (see above)

      tabh = 0;
      if (argc > 1) tabh = atoi(argv[1]);

      tabs->client_area(X,Y,W,H,tabh);                  // calculate client area
      printf("init: client area = (%d,%d,%d,%d)\n",X,Y,W,H);
      // X += 5; Y += 8; W -= 10; H -= 16;                      // make a 
border (optional)

      printf("aaa1: client area = (%d,%d,%d,%d)\n",X,Y,W,H);
      Fl_Group *aaa = new Fl_Group(X,Y,W,H,"Aaa");      // no magic #'s
      tabs->client_area(X,Y,W,H,tabh);                  // calculate client area
      printf("aaa2: client area = (%d,%d,%d,%d)\n",X,Y,W,H);

      tabs->resizable(aaa);
      aaa->labelsize(20);
      aaa->color(fl_lighter(FL_GREEN));
      aaa->box(FL_NO_BOX);
      {
        Fl_Button *b1 = new Fl_Button(X+20, Y+20,90,25,"Button A1"); 
b1->color(88+1);
        Fl_Button *b2 = new Fl_Button(X+20, Y+50,90,25,"Button A2"); 
b2->color(88+2);
        Fl_Button *b3 = new Fl_Button(X+20, Y+80,90,25,"Button A3"); 
b3->color(88+3);
      }
      aaa->end();

      tabs->client_area(X,Y,W,H,tabh);                  // recalculate, must 
not change
      printf("bbb : client area = (%d,%d,%d,%d)\n",X,Y,W,H);
      Fl_Group *bbb = new Fl_Group(X,Y,W,H,"Bbb");      // no magic #'s
      bbb->labelsize(30);
      bbb->color(FL_WHITE);
      // bbb->box(FL_NO_BOX);
      {
        Fl_Button *b1 = new Fl_Button( X+20,Y+20,90,25,"Button B1"); 
b1->color(88+1);
        Fl_Button *b2 = new Fl_Button(X+120,Y+20,90,25,"Button B2"); 
b2->color(88+3);
        Fl_Button *b3 = new Fl_Button(X+220,Y+20,90,25,"Button B3"); 
b3->color(88+5);
        Fl_Button *b4 = new Fl_Button( X+20,Y+50,90,25,"Button B4"); 
b4->color(88+2);
        Fl_Button *b5 = new Fl_Button(X+120,Y+50,90,25,"Button B5"); 
b5->color(88+4);
        Fl_Button *b6 = new Fl_Button(X+220,Y+50,90,25,"Button B6"); 
b6->color(88+6);
      }
      bbb->end();

      tabs->client_area(X,Y,W,H,tabh);                  // recalculate, must 
not change
      printf("ccc : client area = (%d,%d,%d,%d)\n",X,Y,W,H);
      Fl_Group *ccc = new Fl_Group(X,Y,W,H,"Ccc");      // no magic #'s
      ccc->labelsize(35);
      ccc->color(FL_YELLOW);
      // ccc->box(FL_NO_BOX);
      {
        Fl_Button *b1 = new Fl_Button( X+20,Y+20,90,25,"Button C1"); 
b1->color(88+1);
      }
      ccc->end();
    }
    tabs->end();
    win->resizable(tabs);
  }
  win->end();
  win->show(); // argc, argv);
  return(Fl::run());
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to