Because you programmed it so... ;-)
On 12.06.2011 13:27, Dmitrij K wrote:
> #include<FL/Fl.H>
> #include<FL/Fl_Window.H>
> #include<FL/Fl_Widget.H>
> #include<FL/fl_draw.H>
>
> class wid : public Fl_Widget {
> public:
> wid(int x, int y, int w, int h, const char *l=0):Fl_Widget(x,y,w,h,l){ }
> virtual void draw(){
> static int X = x();
> static int Y = y();
> static int W = w();
> static int H = h();
>
> fl_push_clip(x(),y(),w(),h());
> // first line
> fl_color(FL_BLACK);
> for(int _x = X; _x< W; _x++){ fl_point(_x, Y); }
................. _x <= W
> // second line
> fl_xyline(X, Y+5, W);
> // third line
> fl_line(X,Y+10, X+W, Y+10);
.................. , W , ...
> fl_pop_clip();
> }
> virtual int handle(int e){
> return Fl_Widget::handle(e);
> }
> };
... or, what you might want is to use "X+W" instead of "W" to
draw a line over the full width of your widget.
Note that you should not position your window to (0,0,...), but
you'd better use (50,50,...). Also, the use of a static variable
effectively prevents correct resizing of your widget, but this was
not asked here.
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk