Matthias wrote:
> Setting the windows to non-modal has no effect. It is plain wrong.
>
> To determine why your drawinf routine fils, I would need a complete
> source code.

Ok, this is the .h file :


class MySplitter : public Fl_Group
{
  Fl_Double_Window *container1, *container2;
  int wCtn1, border, xPos;
  bool bSplit;

  void MySplitter::draw()
  {
    Fl_Group::draw();
    fl_color(FL_BLACK);
    fl_line_style( FL_DOT, 1);

    if(bSplit && Fl::event_button1() != 0)
    {
      fl_push_clip(x(), y(), w(), h());

      xPos = Fl::event_x();

      if(Fl::event_x() > w() - (border * 2))
        xPos = w() - (border * 2);

      if(Fl::event_x() < x() + (border * 2))
        xPos = x() + (border * 2);


      fl_line(xPos - 1, y() + border, xPos - 1, y() + h() - (border * 2));
      fl_line(xPos, y() + border, xPos, y() + h() - (border * 2));
      fl_line(xPos + 1, y() + border, xPos + 1, y() + h() - (border * 2));

      fl_pop_clip();
    }
    else
    {
      fl_push_clip(x(), y(), w(), h());
      fl_pop_clip();
    }

  }


  int MySplitter::handle(int e)
  {
    int ret = Fl_Group::handle(e);

    switch(e)
    {
      case FL_MOVE:

        if(Fl::event_x() > wCtn1 - border && Fl::event_x() < wCtn1 + border)
        {
          fl_cursor(FL_CURSOR_WE);
          bSplit = true;
        }
        else
        {
          fl_cursor(FL_CURSOR_DEFAULT);
          bSplit = false;
        }

        return 1;

      case FL_PUSH:
        if(Fl::event_button() == FL_LEFT_MOUSE && bSplit)
        {
          redraw();
        }

        return 1;

      case FL_RELEASE:

        if(Fl::event_button() == FL_LEFT_MOUSE && bSplit)
        {
          container1->resize(x(), y(), xPos, h());
          wCtn1 = xPos;
          container2->resize(wCtn1, y(), w() - wCtn1, h());
          bSplit = false;
          redraw();
        }

        return 1;

      case FL_DRAG:

        if(bSplit && Fl::event_state(FL_BUTTON1) != 0)
        {
          redraw();
        }

        return 1;
    }

    return(ret);
  }


  public:

  MySplitter(int x, int y, int w, int h, const char *l = 0)
    : Fl_Group(x, y, w, h, l)
  {
    begin();
    container1 = new Fl_Double_Window(x, y, w / 2, h);
    container1->set_non_modal();
    container1->box(FL_DOWN_BOX);
    container1->color((Fl_Color) FL_RED);
    end();

    begin();
    container2 = new Fl_Double_Window(w / 2, y, w / 2, h);
    container2->set_non_modal();
    container2->box(FL_DOWN_BOX);
    container2->color((Fl_Color) FL_BLUE);
    end();

    wCtn1 = w / 2;
    bSplit = false;

    border = Fl::box_dx(FL_DOWN_BOX);
  }

};


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to