Thanks for the replays guys
well i now call it with a name in the fluid application
its called "Overlays" the red thingi that surrounding the components
. im going to compile your code now
Thanks
>
> Still not clear on what the OP actually wants, but here's my hack at
> it...
>
> This is actually pretty nasty code, so needs a lot of tidying.
> Seems to work OK though... For what it is.
>
> May be completely the wrong thing though, of course.
>
> --------------
> //
> // resizeable group test
> // fltk-config --compile demo.cxx
> //
> #include <stdio.h>
>
> #include <FL/Fl.H>
> #include <FL/Fl_Double_Window.H>
> #include <FL/Fl_Group.H>
> #include <FL/Fl_Box.H>
> #include <FL/Fl_Text_Editor.H>
> #include <FL/fl_draw.H>
>
> /* XPM */
> static char *grip_tile_xpm[] =3D {
> "6 6 4 1",
> " c None",
> ". c #FCFEFC",
> "+ c #D4D6D4",
> "@ c #9C9294",
> ".+++++",
> "+...@+.++",
> "+...@+",
> ".+++++",
> "+...@+.++",
> "+...@+"};
>
> Fl_Double_Window *main_win =3D NULL;
> Fl_Group *outer =3D NULL;
> Fl_Group *inner =3D NULL;
>
> #define TL -1
> #define BR 1
>
> class drag_btn : public Fl_Box {
> private:
> int x1, y1; // click posn., used for dragging checks
> int corner; // which corner...
>
> protected:
> // override box draw method to do our textured dragger look
> void draw();
> // override handle method to catch drag operations
> int handle(int event);
>
> public:
> // basic constructor
> drag_btn(int x, int y, int cr);
> };
>
> drag_btn::drag_btn(int x, int y, int cr)
> : Fl_Box(x, y, 10, 10) {
> box(FL_THIN_DOWN_BOX);
> corner =3D cr;
> }
>
> void drag_btn::draw() {
> int xo =3D x();
> int yo =3D y();
> // Draw the button box
> draw_box(box(), color());
> // set the clip region so we only "tile" the box
> fl_push_clip(xo+1, yo+1, w()-3, h()-3);
> // tile the pixmap onto the button face... there must be a better way
> for(int i =3D 2; i <=3D w(); i +=3D 6)
> for(int j =3D 2; j <=3D h(); j +=3D 6)
> fl_draw_pixmap(grip_tile_xpm, (xo + i), (yo + j));
> fl_pop_clip();
> } // draw
>
> int drag_btn::handle(int event) {
> int ret =3D Fl_Box::handle(event);
> int dx, dy, xr, yr;
> int xg, yg, wg, hg;
>
> xr =3D Fl::event_x_root();
> yr =3D Fl::event_y_root();
> switch (event) {
> case FL_PUSH: // downclick in button stores cursor offsets
> x1 =3D xr;
> y1 =3D yr;
> ret =3D 1;
> break;
>
> case FL_DRAG: // drag the button (and its parent group) around the
> screen
> dx =3D xr - x1; dy =3D yr - y1;
> x1 =3D xr; y1 =3D yr;
> // now move the enclosing group
> xg =3D outer->x();
> yg =3D outer->y();
> wg =3D outer->w();
> hg =3D outer->h();
> if(corner =3D=3D TL)
> outer->resize(xg+dx, yg+dy, wg-dx, hg-dy);
> else if (corner =3D=3D BR)
> outer->resize(xg, yg, wg+dx, hg+dy);
> main_win->redraw();
> ret =3D 1;
> break;
>
> case FL_RELEASE:
> ret =3D 1;
> break;
>
> default:
> break;
> }
>
> return ret;
> } // handle
>
> int main(int argc, char **argv) {
> main_win =3D new Fl_Double_Window(500, 500, "main");
> main_win->begin();
> outer =3D new Fl_Group(20, 20, 110, 110);
> outer->begin();
> drag_btn *b1 =3D new drag_btn(20, 20, TL);
> drag_btn *b2 =3D new drag_btn(120, 120, BR);
> inner =3D new Fl_Group(30, 30, 90, 90);
> inner->begin();
> Fl_Text_Buffer *buff =3D new Fl_Text_Buffer();
> Fl_Text_Editor *disp =3D new Fl_Text_Editor(30, 30, 90, 90);
> disp->buffer(buff);
> inner->end();
> inner->box(FL_THIN_DOWN_BOX);
> inner->resizable(disp);
> outer->end();
> outer->box(FL_ENGRAVED_FRAME);
> outer->resizable(inner);
> main_win->end();
> main_win->show(argc, argv);
>
> // fill the editor with some dummy text
> buff->text("line 0\nline 1\nline 2\n"
> "line 3\nline 4\nline 5\n"
> "line 6\nline 7\nline 8\n"
> "line 9\nline 10\nline 11\n"
> "line 12\nline 13\nline 14\n"
> "line 15\nline 16\nline 17\n"
> "line 18\nline 19\nline 20\n"
> "line 21\nline 22\nline 23\n");
>
> return Fl::run();
> } // main
> /* End of File */
> --------------
>
>
>
>
>
>
> SELEX Sensors and Airborne Systems Limited
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS=
> 14 3EL
> A company registered in England & Wales. Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk